mirror of
https://github.com/rhasspy/espeak-ng.git
synced 2026-11-09 16:01:12 +00:00
Use snprintf on all platforms (it is C99 conformant in Visual Studio 2015 and can be supported in the compatibility layer for older versions as needed).
This commit is contained in:
@@ -128,13 +128,8 @@ ESPEAK_NG_API void espeak_ng_GetStatusCodeMessage(espeak_ng_STATUS status, char
|
||||
#else
|
||||
strerror_r(status, buffer, length);
|
||||
#endif
|
||||
} else {
|
||||
#ifdef PLATFORM_WINDOWS
|
||||
sprintf(buffer, "Unspecified error 0x%x", status);
|
||||
#else
|
||||
} else
|
||||
snprintf(buffer, length, "Unspecified error 0x%x", status);
|
||||
#endif
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -80,11 +80,7 @@ int pre_pause;
|
||||
ALPHABET *current_alphabet;
|
||||
|
||||
// these were previously in translator class
|
||||
#ifdef PLATFORM_WINDOWS
|
||||
char word_phonemes[N_WORD_PHONEMES*2]; // longer, because snprint() is not available
|
||||
#else
|
||||
char word_phonemes[N_WORD_PHONEMES]; // a word translated into phoneme codes
|
||||
#endif
|
||||
int n_ph_list2;
|
||||
PHONEME_LIST2 ph_list2[N_PHONEME_LIST]; // first stage of text->phonemes
|
||||
|
||||
@@ -1303,30 +1299,18 @@ int TranslateWord(Translator *tr, char *word_start, WORD_TAB *wtab, char *word_o
|
||||
*p = phonSTRESS_3;
|
||||
}
|
||||
}
|
||||
#ifdef PLATFORM_WINDOWS
|
||||
sprintf(word_phonemes, "%s%s%s", unpron_phonemes, prefix_phonemes, phonemes);
|
||||
#else
|
||||
snprintf(word_phonemes, sizeof(word_phonemes), "%s%s%s", unpron_phonemes, prefix_phonemes, phonemes);
|
||||
#endif
|
||||
word_phonemes[N_WORD_PHONEMES-1] = 0;
|
||||
SetWordStress(tr, word_phonemes, dictionary_flags, -1, 0);
|
||||
} else {
|
||||
// stress position affects the whole word, including prefix
|
||||
#ifdef PLATFORM_WINDOWS
|
||||
sprintf(word_phonemes, "%s%s%s", unpron_phonemes, prefix_phonemes, phonemes);
|
||||
#else
|
||||
snprintf(word_phonemes, sizeof(word_phonemes), "%s%s%s", unpron_phonemes, prefix_phonemes, phonemes);
|
||||
#endif
|
||||
word_phonemes[N_WORD_PHONEMES-1] = 0;
|
||||
SetWordStress(tr, word_phonemes, dictionary_flags, -1, 0);
|
||||
}
|
||||
} else {
|
||||
SetWordStress(tr, phonemes, dictionary_flags, -1, add_suffix_phonemes);
|
||||
#ifdef PLATFORM_WINDOWS
|
||||
sprintf(word_phonemes, "%s%s%s", unpron_phonemes, prefix_phonemes, phonemes);
|
||||
#else
|
||||
snprintf(word_phonemes, sizeof(word_phonemes), "%s%s%s", unpron_phonemes, prefix_phonemes, phonemes);
|
||||
#endif
|
||||
word_phonemes[N_WORD_PHONEMES-1] = 0;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user