From 1ae4ea2ea3174d042860f08446d0d9e16d2e46bc Mon Sep 17 00:00:00 2001 From: Paul Beckingham Date: Thu, 19 Feb 2015 08:51:36 -0800 Subject: [PATCH] I18N - Removed unnecessary string termination and exceptions. - Removed associated localized errors. --- src/l10n/deu-DEU.h | 4 ---- src/l10n/eng-USA.h | 4 ---- src/l10n/epo-RUS.h | 4 ---- src/l10n/esp-ESP.h | 4 ---- src/l10n/fra-FRA.h | 4 ---- src/l10n/ita-ITA.h | 4 ---- src/l10n/pol-POL.h | 4 ---- src/l10n/por-PRT.h | 4 ---- src/utf8.cpp | 13 +------------ 9 files changed, 1 insertion(+), 44 deletions(-) diff --git a/src/l10n/deu-DEU.h b/src/l10n/deu-DEU.h index f65d6a238..8847ab9c9 100644 --- a/src/l10n/deu-DEU.h +++ b/src/l10n/deu-DEU.h @@ -881,10 +881,6 @@ #define STRING_TDB2_UNDO_SYNCED "Kann Änderung nicht rückgängig machen, weil die Aufgabe bereits abgeglichen wurde. Aufgabe stattdessen löschen." #define STRING_TDB2_DIRTY_EXIT "Beende mit ungeschriebenen Änderungen auf {1}" -// utf8 -#define STRING_UTF8_INVALID_CP_REP "Ungültige Codepoint-Darstellung." -#define STRING_UTF8_INVALID_CP "Ungültiger Unicode-Codepoint." - // View #define STRING_VIEW_TOO_SMALL "Dieser Report hat eine Mindestbreite von {1} und passt nicht in die Bildschirmbreite von {2}." diff --git a/src/l10n/eng-USA.h b/src/l10n/eng-USA.h index d14e8a6a8..a7aee545a 100644 --- a/src/l10n/eng-USA.h +++ b/src/l10n/eng-USA.h @@ -881,10 +881,6 @@ #define STRING_TDB2_UNDO_SYNCED "Cannot undo change because the task was already synced. Modify the task instead." #define STRING_TDB2_DIRTY_EXIT "Exiting with unwritten changes to {1}" -// utf8 -#define STRING_UTF8_INVALID_CP_REP "Invalid codepoint representation." -#define STRING_UTF8_INVALID_CP "Invalid Unicode codepoint." - // View #define STRING_VIEW_TOO_SMALL "The report has a minimum width of {1} and does not fit in the available width of {2}." diff --git a/src/l10n/epo-RUS.h b/src/l10n/epo-RUS.h index e9c7fb5a5..f78c42162 100644 --- a/src/l10n/epo-RUS.h +++ b/src/l10n/epo-RUS.h @@ -881,10 +881,6 @@ #define STRING_TDB2_UNDO_SYNCED "Ne povos malfari ŝanĝon ĉar la tasko estis jam sinkronigita. Modifu anstataŭe la taskon." #define STRING_TDB2_DIRTY_EXIT "Eliranta kun neskribitajn ŝanĝojn al {1}" -// utf8 -#define STRING_UTF8_INVALID_CP_REP "Nevalida kodpunkta nombro." -#define STRING_UTF8_INVALID_CP "Nevalida unikoda kodpunkto." - // View #define STRING_VIEW_TOO_SMALL "La raporto havas larĝecminimumon {1}, al kio ne konformas la disponebla larĝeco {2}." diff --git a/src/l10n/esp-ESP.h b/src/l10n/esp-ESP.h index c1752f88c..fc1404724 100644 --- a/src/l10n/esp-ESP.h +++ b/src/l10n/esp-ESP.h @@ -891,10 +891,6 @@ #define STRING_TDB2_UNDO_SYNCED "No se puede deshacer el cambio porque la tarea ya ha sido sincronizada. Como alternativa, modifique la tarea." #define STRING_TDB2_DIRTY_EXIT "Exiting with unwritten changes to {1}" -// utf8 -#define STRING_UTF8_INVALID_CP_REP "Representación de codepoint no válida." -#define STRING_UTF8_INVALID_CP "Codepoint Unicode no válido." - // View #define STRING_VIEW_TOO_SMALL "El informe tiene una anchura mínima de {1} y no cabe en la disponible, que es {2}." diff --git a/src/l10n/fra-FRA.h b/src/l10n/fra-FRA.h index 24ab905d2..7137d09ec 100644 --- a/src/l10n/fra-FRA.h +++ b/src/l10n/fra-FRA.h @@ -881,10 +881,6 @@ #define STRING_TDB2_UNDO_SYNCED "Impossible d'annuler les changements car la tâche a déjà été synchronysée. Modifiez plutôt la tâche." #define STRING_TDB2_DIRTY_EXIT "Exiting with unwritten changes to {1}" -// utf8 -#define STRING_UTF8_INVALID_CP_REP "Invalid codepoint representation." -#define STRING_UTF8_INVALID_CP "Invalid Unicode codepoint." - // View #define STRING_VIEW_TOO_SMALL "The report has a minimum width of {1} and does not fit in the available width of {2}." diff --git a/src/l10n/ita-ITA.h b/src/l10n/ita-ITA.h index c005921e9..a7fda70e6 100644 --- a/src/l10n/ita-ITA.h +++ b/src/l10n/ita-ITA.h @@ -880,10 +880,6 @@ #define STRING_TDB2_UNDO_SYNCED "Cannot undo change because the task was already synced. Modify the task instead." #define STRING_TDB2_DIRTY_EXIT "Exiting with unwritten changes to {1}" -// utf8 -#define STRING_UTF8_INVALID_CP_REP "Rappresentazione non valida del codepoint." -#define STRING_UTF8_INVALID_CP "Codepoint Unicode non valido." - // View #define STRING_VIEW_TOO_SMALL "Il report ha larghezza minima di {1} e non entra nella larghezza disponibile di {2}." diff --git a/src/l10n/pol-POL.h b/src/l10n/pol-POL.h index 9283aba01..8394d2f93 100644 --- a/src/l10n/pol-POL.h +++ b/src/l10n/pol-POL.h @@ -881,10 +881,6 @@ #define STRING_TDB2_UNDO_SYNCED "Nie można cofnąć zmian ponieważ zadanie zostało zsynchronizowane. Zmodyfikuj zadanie." #define STRING_TDB2_DIRTY_EXIT "Zamykanie z niezapisanymi zmianami w {1}" -// utf8 -#define STRING_UTF8_INVALID_CP_REP "Niepoprawna reprezentacja znaku." -#define STRING_UTF8_INVALID_CP "Niepoprawny znak Unicode." - // View #define STRING_VIEW_TOO_SMALL "Raport ma minimalną szerokość {1} i nie mieści się w dostępnej przestrzeni {2}." diff --git a/src/l10n/por-PRT.h b/src/l10n/por-PRT.h index 0ac1463da..281fe63f7 100644 --- a/src/l10n/por-PRT.h +++ b/src/l10n/por-PRT.h @@ -881,10 +881,6 @@ #define STRING_TDB2_UNDO_SYNCED "Não é possível reverter a alteração porque a tarefa já foi syncronizada. Em vez disso modifique a tarefa." #define STRING_TDB2_DIRTY_EXIT "Saindo com modificações por gravar de {1}" -// utf8 -#define STRING_UTF8_INVALID_CP_REP "Representação de 'codepoint' inválida." -#define STRING_UTF8_INVALID_CP "'Codepoint' Unicode inválido." - // View #define STRING_VIEW_TOO_SMALL "O relatório tem uma largura mínima de {1} e não cabe na largura disponível {2}." diff --git a/src/utf8.cpp b/src/utf8.cpp index 3b837d7cb..129232e50 100644 --- a/src/utf8.cpp +++ b/src/utf8.cpp @@ -26,9 +26,7 @@ #include #include -#include #include -#include //////////////////////////////////////////////////////////////////////////////// // Converts '0' -> 0 @@ -66,8 +64,6 @@ unsigned int utf8_codepoint (const std::string& input) XDIGIT (input[2]) << 4 | XDIGIT (input[3]); } - else - throw std::string (STRING_UTF8_INVALID_CP_REP); return codepoint; } @@ -117,13 +113,12 @@ unsigned int utf8_next_char (const std::string& input, std::string::size_type& i // http://en.wikipedia.org/wiki/UTF-8 std::string utf8_character (unsigned int codepoint) { - char sequence[5]; + char sequence[5] = {0}; // 0xxxxxxx -> 0xxxxxxx if (codepoint < 0x80) { sequence[0] = codepoint; - sequence[1] = 0; } // 00000yyy yyxxxxxx -> 110yyyyy 10xxxxxx @@ -131,7 +126,6 @@ std::string utf8_character (unsigned int codepoint) { sequence[0] = 0xC0 | (codepoint & 0x7C0) >> 6; sequence[1] = 0x80 | (codepoint & 0x3F); - sequence[2] = 0; } // zzzzyyyy yyxxxxxx -> 1110zzzz 10yyyyyy 10xxxxxx @@ -140,7 +134,6 @@ std::string utf8_character (unsigned int codepoint) sequence[0] = 0xE0 | (codepoint & 0xF000) >> 12; sequence[1] = 0x80 | (codepoint & 0xFC0) >> 6; sequence[2] = 0x80 | (codepoint & 0x3F); - sequence[3] = 0; } // 000wwwzz zzzzyyyy yyxxxxxx -> 11110www 10zzzzzz 10yyyyyy 10xxxxxx @@ -150,12 +143,8 @@ std::string utf8_character (unsigned int codepoint) sequence[1] = 0x80 | (codepoint & 0x03F000) >> 12; sequence[2] = 0x80 | (codepoint & 0x0FC0) >> 6; sequence[3] = 0x80 | (codepoint & 0x3F); - sequence[4] = 0; } - else - throw std::string (STRING_UTF8_INVALID_CP); - sequence[4] = '\0'; return std::string (sequence); }