diff --git a/src/espeak-ng.c b/src/espeak-ng.c index 132ce381..57c9f5b5 100644 --- a/src/espeak-ng.c +++ b/src/espeak-ng.c @@ -36,7 +36,7 @@ extern ESPEAK_NG_API void strncpy0(char *to, const char *from, int size); extern ESPEAK_NG_API int utf8_in(int *c, const char *buf); -extern ESPEAK_NG_API size_t GetFileLength(const char *filename); +extern ESPEAK_NG_API int GetFileLength(const char *filename); // This version of the command-line speak program uses the // libespeak.so.1 library @@ -112,9 +112,9 @@ static const char *help_text = int samplerate; int quiet = 0; -int samples_total = 0; -int samples_split = 0; -int samples_split_seconds = 0; +unsigned int samples_total = 0; +unsigned int samples_split = 0; +unsigned int samples_split_seconds = 0; unsigned int wavefile_count = 0; FILE *f_wavfile = NULL; @@ -227,7 +227,7 @@ int OpenWavFile(char *path, int rate) static void CloseWavFile() { - int pos; + unsigned int pos; if ((f_wavfile == NULL) || (f_wavfile == stdout)) return; @@ -282,7 +282,7 @@ static int SynthCallback(short *wav, int numsamples, espeak_EVENT *events) if (numsamples > 0) { samples_total += numsamples; - fwrite(wav, (size_t)(numsamples*2), 1, f_wavfile); + fwrite(wav, numsamples*2, 1, f_wavfile); } return 0; } @@ -343,13 +343,13 @@ int main(int argc, char **argv) int option_index = 0; int c; - size_t ix; + int ix; char *optarg2; - unsigned int value; + int value; int flag_stdin = 0; int flag_compile = 0; - size_t filesize = 0; - unsigned int synth_flags = espeakCHARS_AUTO | espeakPHONEMES | espeakENDPAUSE; + int filesize = 0; + int synth_flags = espeakCHARS_AUTO | espeakPHONEMES | espeakENDPAUSE; int volume = -1; int speed = -1; @@ -488,7 +488,7 @@ int main(int argc, char **argv) strncpy0(wavefile, optarg2, sizeof(filename)); break; case 'z': // remove pause from the end of a sentence - synth_flags &= (unsigned int)~espeakENDPAUSE; + synth_flags &= ~espeakENDPAUSE; break; case 0x100: // --stdin flag_stdin = 1; @@ -716,10 +716,11 @@ int main(int argc, char **argv) } if (p_text != NULL) { - size_t size = strlen(p_text); + int size; + size = strlen(p_text); espeak_Synth(p_text, size+1, 0, POS_CHARACTER, 0, synth_flags, NULL, NULL); } else if (flag_stdin) { - size_t max = 1000; + int max = 1000; p_text = (char *)malloc(max); if (flag_stdin == 2) { diff --git a/src/libespeak-ng/compilembrola.c b/src/libespeak-ng/compilembrola.c index 531ba860..0ced134c 100644 --- a/src/libespeak-ng/compilembrola.c +++ b/src/libespeak-ng/compilembrola.c @@ -45,6 +45,7 @@ static unsigned int StringToWord(const char *string) { // Pack 4 characters into a word int ix; + unsigned char c; unsigned int word; if (string == NULL) @@ -53,7 +54,8 @@ static unsigned int StringToWord(const char *string) word = 0; for (ix = 0; ix < 4; ix++) { if (string[ix] == 0) break; - word |= ((unsigned int)string[ix] << (ix*8)); + c = string[ix]; + word |= (c << (ix*8)); } return word; } diff --git a/src/libespeak-ng/event.c b/src/libespeak-ng/event.c index 7695ff8a..18d30dd8 100644 --- a/src/libespeak-ng/event.c +++ b/src/libespeak-ng/event.c @@ -493,12 +493,12 @@ void clock_gettime2(struct timespec *ts) ts->tv_nsec = tv.tv_usec*1000; } -void add_time_in_ms(struct timespec *ts, uint64_t time_in_ms) +void add_time_in_ms(struct timespec *ts, int time_in_ms) { if (!ts) return; - uint64_t t_ns = (uint64_t)ts->tv_nsec + 1000000 * time_in_ms; + uint64_t t_ns = (uint64_t)ts->tv_nsec + 1000000 * (uint64_t)time_in_ms; while (t_ns >= ONE_BILLION) { ts->tv_sec += 1; t_ns -= ONE_BILLION; diff --git a/src/libespeak-ng/klatt.c b/src/libespeak-ng/klatt.c index 78fa079e..2d305cdc 100644 --- a/src/libespeak-ng/klatt.c +++ b/src/libespeak-ng/klatt.c @@ -380,7 +380,7 @@ static int parwave(klatt_frame_ptr frame) temp = (int)(out * wdata.amplitude * kt_globals.amp_gain0); // Convert back to integer // mix with a recorded WAV if required for this phoneme - unsigned char c; + signed char c; int sample; if (wdata.mix_wavefile_ix < wdata.n_mix_wavefile) { diff --git a/src/libespeak-ng/spect.c b/src/libespeak-ng/spect.c index c71a0151..47e5bde2 100644 --- a/src/libespeak-ng/spect.c +++ b/src/libespeak-ng/spect.c @@ -139,7 +139,7 @@ static void SpectFrameDestroy(SpectFrame *frame) int LoadFrame(SpectFrame *frame, FILE *stream, int file_format_type) { short ix; - unsigned short x; + short x; unsigned short *spect_data; frame->time = read_double(stream); @@ -275,8 +275,7 @@ static float GetFrameLength(SpectSeq *spect, int frame) espeak_ng_STATUS LoadSpectSeq(SpectSeq *spect, const char *filename) { - unsigned short n; - short temp; + short n, temp; int ix; uint32_t id1, id2, name_len; int set_max_y = 0; @@ -310,7 +309,7 @@ espeak_ng_STATUS LoadSpectSeq(SpectSeq *spect, const char *filename) } else spect->name = NULL; - fread(&n, sizeof(unsigned short), 1, stream); + fread(&n, sizeof(short), 1, stream); fread(&spect->amplitude, sizeof(short), 1, stream); fread(&spect->max_y, sizeof(short), 1, stream); fread(&temp, sizeof(short), 1, stream); // unused diff --git a/src/libespeak-ng/speech.c b/src/libespeak-ng/speech.c index f6da4045..934b9874 100644 --- a/src/libespeak-ng/speech.c +++ b/src/libespeak-ng/speech.c @@ -237,7 +237,7 @@ ESPEAK_NG_API espeak_ng_STATUS espeak_ng_InitializeOutput(espeak_ng_OUTPUT_MODE return ENS_OK; } -size_t GetFileLength(const char *filename) +int GetFileLength(const char *filename) { struct stat statbuf; diff --git a/src/libespeak-ng/speech.h b/src/libespeak-ng/speech.h index 2dfc7b4c..960654c8 100644 --- a/src/libespeak-ng/speech.h +++ b/src/libespeak-ng/speech.h @@ -75,7 +75,7 @@ int LookupMnem(MNEM_TAB *table, const char *string); extern char path_home[N_PATH_HOME]; // this is the espeak-data directory extern ESPEAK_NG_API void strncpy0(char *to, const char *from, int size); -extern ESPEAK_NG_API size_t GetFileLength(const char *filename); +extern ESPEAK_NG_API int GetFileLength(const char *filename); char *Alloc(int size); void Free(void *ptr); diff --git a/src/libespeak-ng/synthesize.h b/src/libespeak-ng/synthesize.h index 8a897415..b5e55100 100644 --- a/src/libespeak-ng/synthesize.h +++ b/src/libespeak-ng/synthesize.h @@ -355,10 +355,10 @@ typedef struct { } SOUND_ICON; typedef struct { - unsigned int name; + int name; unsigned int next_phoneme; - unsigned int mbr_name; - unsigned int mbr_name2; + int mbr_name; + int mbr_name2; int percent; // percentage length of first component int control; } MBROLA_TAB; diff --git a/src/libespeak-ng/wave.h b/src/libespeak-ng/wave.h index 99414e9a..59d109b1 100644 --- a/src/libespeak-ng/wave.h +++ b/src/libespeak-ng/wave.h @@ -55,7 +55,7 @@ extern void wave_set_callback_is_output_enabled(t_wave_callback *cb); // general functions extern void clock_gettime2(struct timespec *ts); -extern void add_time_in_ms(struct timespec *ts, uint64_t time_in_ms); +extern void add_time_in_ms(struct timespec *ts, int time_in_ms); // for tests extern void *wave_test_get_write_buffer();