Fix gcc sign conversion warnings in espeak-ng.c.

This commit is contained in:
Reece H. Dunn
2016-01-10 11:38:05 +00:00
parent cf740ae6e8
commit 0cc0300328
3 changed files with 15 additions and 16 deletions
+13 -14
View File
@@ -36,7 +36,7 @@
extern ESPEAK_NG_API void strncpy0(char *to, const char *from, int size); 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 int utf8_in(int *c, const char *buf);
extern ESPEAK_NG_API int GetFileLength(const char *filename); extern ESPEAK_NG_API size_t GetFileLength(const char *filename);
// This version of the command-line speak program uses the // This version of the command-line speak program uses the
// libespeak.so.1 library // libespeak.so.1 library
@@ -112,9 +112,9 @@ static const char *help_text =
int samplerate; int samplerate;
int quiet = 0; int quiet = 0;
unsigned int samples_total = 0; int samples_total = 0;
unsigned int samples_split = 0; int samples_split = 0;
unsigned int samples_split_seconds = 0; int samples_split_seconds = 0;
unsigned int wavefile_count = 0; unsigned int wavefile_count = 0;
FILE *f_wavfile = NULL; FILE *f_wavfile = NULL;
@@ -227,7 +227,7 @@ int OpenWavFile(char *path, int rate)
static void CloseWavFile() static void CloseWavFile()
{ {
unsigned int pos; int pos;
if ((f_wavfile == NULL) || (f_wavfile == stdout)) if ((f_wavfile == NULL) || (f_wavfile == stdout))
return; return;
@@ -282,7 +282,7 @@ static int SynthCallback(short *wav, int numsamples, espeak_EVENT *events)
if (numsamples > 0) { if (numsamples > 0) {
samples_total += numsamples; samples_total += numsamples;
fwrite(wav, numsamples*2, 1, f_wavfile); fwrite(wav, (size_t)(numsamples*2), 1, f_wavfile);
} }
return 0; return 0;
} }
@@ -343,13 +343,13 @@ int main(int argc, char **argv)
int option_index = 0; int option_index = 0;
int c; int c;
int ix; size_t ix;
char *optarg2; char *optarg2;
int value; unsigned int value;
int flag_stdin = 0; int flag_stdin = 0;
int flag_compile = 0; int flag_compile = 0;
int filesize = 0; size_t filesize = 0;
int synth_flags = espeakCHARS_AUTO | espeakPHONEMES | espeakENDPAUSE; unsigned int synth_flags = espeakCHARS_AUTO | espeakPHONEMES | espeakENDPAUSE;
int volume = -1; int volume = -1;
int speed = -1; int speed = -1;
@@ -488,7 +488,7 @@ int main(int argc, char **argv)
strncpy0(wavefile, optarg2, sizeof(filename)); strncpy0(wavefile, optarg2, sizeof(filename));
break; break;
case 'z': // remove pause from the end of a sentence case 'z': // remove pause from the end of a sentence
synth_flags &= ~espeakENDPAUSE; synth_flags &= (unsigned int)~espeakENDPAUSE;
break; break;
case 0x100: // --stdin case 0x100: // --stdin
flag_stdin = 1; flag_stdin = 1;
@@ -716,11 +716,10 @@ int main(int argc, char **argv)
} }
if (p_text != NULL) { if (p_text != NULL) {
int size; size_t size = strlen(p_text);
size = strlen(p_text);
espeak_Synth(p_text, size+1, 0, POS_CHARACTER, 0, synth_flags, NULL, NULL); espeak_Synth(p_text, size+1, 0, POS_CHARACTER, 0, synth_flags, NULL, NULL);
} else if (flag_stdin) { } else if (flag_stdin) {
int max = 1000; size_t max = 1000;
p_text = (char *)malloc(max); p_text = (char *)malloc(max);
if (flag_stdin == 2) { if (flag_stdin == 2) {
+1 -1
View File
@@ -237,7 +237,7 @@ ESPEAK_NG_API espeak_ng_STATUS espeak_ng_InitializeOutput(espeak_ng_OUTPUT_MODE
return ENS_OK; return ENS_OK;
} }
int GetFileLength(const char *filename) size_t GetFileLength(const char *filename)
{ {
struct stat statbuf; struct stat statbuf;
+1 -1
View File
@@ -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 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 void strncpy0(char *to, const char *from, int size);
extern ESPEAK_NG_API int GetFileLength(const char *filename); extern ESPEAK_NG_API size_t GetFileLength(const char *filename);
char *Alloc(int size); char *Alloc(int size);
void Free(void *ptr); void Free(void *ptr);