From f4ea533d83c74b509fe3d5696f656a32c49cc927 Mon Sep 17 00:00:00 2001 From: jonsd Date: Fri, 27 Jun 2008 09:00:10 +0000 Subject: [PATCH] Fix: Word events had a bad text index if the word starts with a non-ascii character. git-svn-id: https://espeak.svn.sourceforge.net/svnroot/espeak/trunk@177 d46cf337-b52f-0410-862d-fd96e6ae7743 --- src/readclause.cpp | 6 +++--- src/translate.cpp | 8 ++++---- src/translate.h | 2 +- 3 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/readclause.cpp b/src/readclause.cpp index d77c07eb..b8c8d87f 100644 --- a/src/readclause.cpp +++ b/src/readclause.cpp @@ -1818,8 +1818,8 @@ MNEM_TAB xml_char_mnemonics[] = { {NULL,-1}}; -int Translator::ReadClause(FILE *f_in, char *buf, unsigned short *charix, int n_buf) -{//================================================================================= +int Translator::ReadClause(FILE *f_in, char *buf, short *charix, int n_buf) +{//======================================================================== /* Find the end of the current clause. Write the clause into buf @@ -2274,7 +2274,7 @@ if(option_ssml) parag=1; { charix[ix] = count_characters - clause_start_char; while(j < ix) - charix[j++] = 0xffff; // subsequent bytes of a multibyte character + charix[j++] = -1; // subsequent bytes of a multibyte character } if(((ix > (n_buf-20)) && !IsAlpha(c1) && !iswdigit(c1)) || (ix >= (n_buf-2))) diff --git a/src/translate.cpp b/src/translate.cpp index d38dd58c..85b25b28 100755 --- a/src/translate.cpp +++ b/src/translate.cpp @@ -2010,7 +2010,7 @@ void *Translator::TranslateClause(FILE *f_text, const void *vp_input, int *tone_ int j, k; int n_digits; - unsigned short charix[N_TR_SOURCE+1]; + short charix[N_TR_SOURCE+1]; WORD_TAB words[N_CLAUSE_WORDS]; int word_count=0; // index into words @@ -2106,7 +2106,7 @@ void *Translator::TranslateClause(FILE *f_text, const void *vp_input, int *tone_ while(charix[j] != 0) { // count the number of characters (excluding multibyte continuation bytes) - if(charix[j++] != 0xffff) + if(charix[j++] != -1) k++; } words[0].length = k; @@ -2511,13 +2511,13 @@ if((c == '/') && (langopts.testing & 2) && IsDigit09(next_in) && IsAlpha(prev_ou words[word_count].start = ix; words[word_count].flags = 0; - for(j=source_index; charix[j] == 0; j++); // skip blanks + for(j=source_index; charix[j] <= 0; j++); // skip blanks words[word_count].sourceix = charix[j]; k = 0; while(charix[j] != 0) { // count the number of characters (excluding multibyte continuation bytes) - if(charix[j++] != 0xffff) + if(charix[j++] != -1) k++; } words[word_count].length = k; diff --git a/src/translate.h b/src/translate.h index b489d5ad..c46a262e 100755 --- a/src/translate.h +++ b/src/translate.h @@ -435,7 +435,7 @@ private: void MakePhonemeList(int post_pause, int new_sentence); int SubstitutePhonemes(PHONEME_LIST2 *plist_out); - int ReadClause(FILE *f_in, char *buf, unsigned short *charix, int n_buf); + int ReadClause(FILE *f_in, char *buf, short *charix, int n_buf); int AnnouncePunctuation(int c1, int c2, char *buf, int ix); const char *LookupDict2(const char *word, const char *word2, char *phonetic, unsigned int *flags, int end_flags, WORD_TAB *wtab);