diff --git a/src/libespeak-ng/common.c b/src/libespeak-ng/common.c index 5acbc49c..f44cf5e3 100644 --- a/src/libespeak-ng/common.c +++ b/src/libespeak-ng/common.c @@ -298,6 +298,25 @@ int Read4Bytes(FILE *f) return acc; } +unsigned int StringToWord(const char *string) +{ + // Pack 4 characters into a word + int ix; + unsigned char c; + unsigned int word; + + if (string == NULL) + return 0; + + word = 0; + for (ix = 0; ix < 4; ix++) { + if (string[ix] == 0) break; + c = string[ix]; + word |= (c << (ix*8)); + } + return word; +} + int towlower2(unsigned int c, Translator *translator) { // check for non-standard upper to lower case conversions diff --git a/src/libespeak-ng/common.h b/src/libespeak-ng/common.h index 0ee270a0..76fff8bf 100644 --- a/src/libespeak-ng/common.h +++ b/src/libespeak-ng/common.h @@ -34,6 +34,7 @@ int IsSpace(unsigned int c); int isspace2(unsigned int c); int is_str_totally_null(const char* str, int size); // Tests if all bytes of str up to size are null int Read4Bytes(FILE *f); +unsigned int StringToWord(const char *string); int towlower2(unsigned int c, Translator *translator); // Supports Turkish I ESPEAK_NG_API int utf8_in(int *c, const char *buf); diff --git a/src/libespeak-ng/compiledata.c b/src/libespeak-ng/compiledata.c index 020c1ab1..7aad556a 100644 --- a/src/libespeak-ng/compiledata.c +++ b/src/libespeak-ng/compiledata.c @@ -35,7 +35,7 @@ #include #include -#include "common.h" // for GetFileLength, strncpy0, ... +#include "common.h" // for GetFileLength, strncpy0, ...c #include "error.h" // for create_file_error_context #include "mnemonics.h" // for LookupMnemName, MNEM_TAB #include "phoneme.h" // for PHONEME_TAB, PHONEME_TAB_LIST @@ -502,25 +502,6 @@ static void error_from_status(espeak_ng_STATUS status, const char *context) error("%s.", message); } -static unsigned int StringToWord(const char *string) -{ - // Pack 4 characters into a word - int ix; - unsigned char c; - unsigned int word; - - if (string == NULL) - return 0; - - word = 0; - for (ix = 0; ix < 4; ix++) { - if (string[ix] == 0) break; - c = string[ix]; - word |= (c << (ix*8)); - } - return word; -} - static const MNEM_TAB reserved_phonemes[] = { { "_\001", phonCONTROL }, // NOT USED { "%", phonSTRESS_U }, diff --git a/src/libespeak-ng/compilembrola.c b/src/libespeak-ng/compilembrola.c index 09f74b09..ee3a8386 100644 --- a/src/libespeak-ng/compilembrola.c +++ b/src/libespeak-ng/compilembrola.c @@ -31,6 +31,7 @@ #include "mbrola.h" #include "error.h" // for create_file_error_context +#include "common.h" // for StringToWord #include "mbrola.h" // for MBROLA_TAB #include "phoneme.h" // for N_PHONEME_TAB #include "speech.h" // for path_home @@ -44,25 +45,6 @@ static const char *basename(const char *filename) return current == filename ? current : current + 1; } -static unsigned int StringToWord(const char *string) -{ - // Pack 4 characters into a word - int ix; - unsigned char c; - unsigned int word; - - if (string == NULL) - return 0; - - word = 0; - for (ix = 0; ix < 4; ix++) { - if (string[ix] == 0) break; - c = string[ix]; - word |= (c << (ix*8)); - } - return word; -} - #pragma GCC visibility push(default) espeak_ng_STATUS espeak_ng_CompileMbrolaVoice(const char *filepath, FILE *log, espeak_ng_ERROR_CONTEXT *context) {