code cleanup: remove static from WordToString

This commit is contained in:
Yury Popov
2022-11-19 17:29:16 +03:00
parent 5a37bc301b
commit 89b2a55ea4
5 changed files with 10 additions and 10 deletions
+2 -1
View File
@@ -2197,6 +2197,7 @@ static void WritePhonemeTables(CompileContext *ctx)
static void EndPhonemeTable(CompileContext *ctx)
{
int ix;
char buf[5];
if (ctx->n_phoneme_tabs == 0)
return;
@@ -2205,7 +2206,7 @@ static void EndPhonemeTable(CompileContext *ctx)
for (ix = 0; ix < ctx->n_phcodes; ix++) {
if (ctx->phoneme_tab2[ix].type == phINVALID) {
error(ctx, "Phoneme [%s] not declared, referenced at line %d",
WordToString(ctx->phoneme_tab2[ix].mnemonic), (int)(ctx->phoneme_tab2[ix].program));
WordToString(buf, ctx->phoneme_tab2[ix].mnemonic), (int)(ctx->phoneme_tab2[ix].program));
ctx->error_count++;
ctx->phoneme_tab2[ix].type = 0; // prevent the error message repeating
}
+4 -3
View File
@@ -350,6 +350,7 @@ int MbrolaTranslate(PHONEME_LIST *plist, int n_phonemes, bool resume, FILE *f_mb
const char *final_pitch;
char *ptr;
char mbr_buf[120];
char phbuf[5];
static int phix;
static int embedded_ix;
@@ -405,7 +406,7 @@ int MbrolaTranslate(PHONEME_LIST *plist, int n_phonemes, bool resume, FILE *f_mb
DoPhonemeMarker(espeakEVENT_PHONEME, (p->sourceix & 0x7ff) + clause_start_char, 0, phoneme_name);
}
ptr += sprintf(ptr, "%s\t", WordToString(name));
ptr += sprintf(ptr, "%s\t", WordToString(phbuf, name));
if (name2 == '_') {
// add a pause after this phoneme
@@ -438,7 +439,7 @@ int MbrolaTranslate(PHONEME_LIST *plist, int n_phonemes, bool resume, FILE *f_mb
ptr += sprintf(ptr, "%d\t%s", len1, pitch);
pitch = WritePitch(p->env, p->pitch1, p->pitch2, -len_percent, 0);
ptr += sprintf(ptr, "%s\t%d\t%s", WordToString(name2), len-len1, pitch);
ptr += sprintf(ptr, "%s\t%d\t%s", WordToString(phbuf, name2), len-len1, pitch);
}
done = true;
break;
@@ -490,7 +491,7 @@ int MbrolaTranslate(PHONEME_LIST *plist, int n_phonemes, bool resume, FILE *f_mb
if (!done) {
if (name2 != 0) {
len1 = (len * len_percent)/100;
ptr += sprintf(ptr, "%d\n%s\t", len1, WordToString(name2));
ptr += sprintf(ptr, "%d\n%s\t", len1, WordToString(phbuf, name2));
len -= len1;
}
ptr += sprintf(ptr, "%d%s\n", len, final_pitch);
+2 -1
View File
@@ -391,7 +391,8 @@ int SelectPhonemeTableName(const char *name)
static void InvalidInstn(PHONEME_TAB *ph, int instn)
{
fprintf(stderr, "Invalid instruction %.4x for phoneme '%s'\n", instn, WordToString(ph->mnemonic));
char buf[5];
fprintf(stderr, "Invalid instruction %.4x for phoneme '%s'\n", instn, WordToString(buf, ph->mnemonic));
}
static bool StressCondition(Translator *tr, PHONEME_LIST *plist, int condition, int control)
+1 -4
View File
@@ -72,13 +72,10 @@ static voice_t *new_voice = NULL;
#define RMS_START 28 // 28
#define VOWEL_FRONT_LENGTH 50
const char *WordToString(unsigned int word)
const char *WordToString(char buf[5], unsigned int word)
{
// Convert a phoneme mnemonic word into a string
int ix;
static char buf[5];
MAKE_MEM_UNDEFINED(&buf, sizeof(buf));
for (ix = 0; ix < 4; ix++)
buf[ix] = word >> (ix*8);
+1 -1
View File
@@ -463,7 +463,7 @@ void DoPhonemeMarker(int type, int char_posn, int length, char *name);
int DoSample3(PHONEME_DATA *phdata, int length_mod, int amp);
int DoSpect2(PHONEME_TAB *this_ph, int which, FMT_PARAMS *fmt_params, PHONEME_LIST *plist, int modulation);
int PauseLength(int pause, int control);
const char *WordToString(unsigned int word);
const char *WordToString(char buf[5], unsigned int word);
#ifdef __cplusplus
}