Browse Source

Mark re-used "source" array as undefined

And fix the prefetches after \0.
master
Samuel Thibault 3 years ago
parent
commit
5087b05c52
1 changed files with 8 additions and 3 deletions
  1. 8
    3
      src/libespeak-ng/translate.c

+ 8
- 3
src/libespeak-ng/translate.c View File

#include "synthesize.h" // for PHONEME_LIST2, N_PHONEME_LIST, PHON... #include "synthesize.h" // for PHONEME_LIST2, N_PHONEME_LIST, PHON...
#include "ucd/ucd.h" // for ucd_toupper #include "ucd/ucd.h" // for ucd_toupper
#include "voice.h" // for voice, voice_t #include "voice.h" // for voice, voice_t
#include "speech.h" // for MAKE_MEM_UNDEFINED


Translator *translator = NULL; // the main translator Translator *translator = NULL; // the main translator
Translator *translator2 = NULL; // secondary translator for certain words Translator *translator2 = NULL; // secondary translator for certain words
case L('n', 'l'): case L('n', 'l'):
// look for 'n and replace by a special character (unicode: schwa) // look for 'n and replace by a special character (unicode: schwa)


if (!iswalpha(prev_in)) {
if ((c == '\'') && !iswalpha(prev_in)) {
utf8_in(&next2, &ptr[1]); utf8_in(&next2, &ptr[1]);


if ((c == '\'') && IsSpace(next2)) {
if (IsSpace(next2)) {
if ((next_in == 'n') && (tr->translator_name == L('a', 'f'))) { if ((next_in == 'n') && (tr->translator_name == L('a', 'f'))) {
// n preceded by either apostrophe or U2019 "right single quotation mark" // n preceded by either apostrophe or U2019 "right single quotation mark"
ptr[0] = ' '; // delete the n ptr[0] = ' '; // delete the n


for (ix = 0; ix < N_TR_SOURCE; ix++) for (ix = 0; ix < N_TR_SOURCE; ix++)
charix[ix] = 0; charix[ix] = 0;
MAKE_MEM_UNDEFINED(&source, sizeof(source));
terminator = ReadClause(tr, source, charix, &charix_top, N_TR_SOURCE, &tone, voice_change_name); terminator = ReadClause(tr, source, charix, &charix_top, N_TR_SOURCE, &tone, voice_change_name);


if (tone_out != NULL) { if (tone_out != NULL) {
source_index += utf8_in(&cc, &source[source_index]); source_index += utf8_in(&cc, &source[source_index]);
c = cc; c = cc;
} }
next_in_nbytes = utf8_in(&next_in, &source[source_index]);


if (c == 0) { if (c == 0) {
finished = true; finished = true;
c = ' '; c = ' ';
next_in = ' ';
next_in_nbytes = 0;
} }
else
next_in_nbytes = utf8_in(&next_in, &source[source_index]);


if (c == CTRL_EMBEDDED) { if (c == CTRL_EMBEDDED) {
// start of embedded command in the text // start of embedded command in the text

Loading…
Cancel
Save