From 1f5b774cceba48b5eac833ffb96c8db920a168db Mon Sep 17 00:00:00 2001 From: Valdis Vitolins Date: Thu, 5 Sep 2019 22:04:45 +0300 Subject: [PATCH] Add warning when number of voices reaches limit --- src/libespeak-ng/voices.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/src/libespeak-ng/voices.c b/src/libespeak-ng/voices.c index 58fb8366..3403f2b1 100644 --- a/src/libespeak-ng/voices.c +++ b/src/libespeak-ng/voices.c @@ -1401,8 +1401,10 @@ static void GetVoices(const char *path, int len_path_voices, int is_language_fil return; do { - if (n_voices_list >= (N_VOICES_LIST-2)) + if (n_voices_list >= (N_VOICES_LIST-2)) { + fprintf(stderr, "Warning: maximum number %d of (N_VOICES_LIST = %d - 1) reached\n", n_voices_list + 1, N_VOICES_LIST); break; // voices list is full + } if (FindFileData.cFileName[0] != '.') { sprintf(fname, "%s%c%s", path, PATHSEP, FindFileData.cFileName); @@ -1434,8 +1436,10 @@ static void GetVoices(const char *path, int len_path_voices, int is_language_fil return; while ((ent = readdir(dir)) != NULL) { - if (n_voices_list >= (N_VOICES_LIST-2)) + if (n_voices_list >= (N_VOICES_LIST-2)) { + fprintf(stderr, "Warning: maximum number %d of (N_VOICES_LIST = %d - 1) reached\n", n_voices_list + 1, N_VOICES_LIST); break; // voices list is full + } if (ent->d_name[0] == '.') continue;