diff --git a/src/include/compat/strings.h b/src/include/compat/strings.h new file mode 100644 index 00000000..a738310a --- /dev/null +++ b/src/include/compat/strings.h @@ -0,0 +1,30 @@ +/* Compatibility shim for + * + * Copyright (C) 2016 Reece H. Dunn + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, see: . + */ + +#ifndef STRINGS_H_COMPAT_SHIM +#define STRINGS_H_COMPAT_SHIM + +#ifdef _MSC_VER + +#include + +#define strcasecmp stricmp + +#endif + +#endif diff --git a/src/libespeak-ng/voices.c b/src/libespeak-ng/voices.c index 6b22a3fb..6bb3e3c3 100644 --- a/src/libespeak-ng/voices.c +++ b/src/libespeak-ng/voices.c @@ -24,6 +24,7 @@ #include #include #include +#include #include #if defined(_WIN32) || defined(_WIN64) @@ -1242,14 +1243,14 @@ espeak_VOICE *SelectVoiceByName(espeak_VOICE **voices, const char *name2) last_part_len = strlen(last_part); for (ix = 0; voices[ix] != NULL; ix++) { - if (strcmp(name, voices[ix]->name) == 0) { + if (strcasecmp(name, voices[ix]->name) == 0) { match_name = ix; // found matching voice name break; } else { id = voices[ix]->identifier; - if (strcmp(name, id) == 0) + if (strcasecmp(name, id) == 0) match_fname = ix; // matching identifier, use this if no matching name - else if (strcmp(last_part, &id[strlen(id)-last_part_len]) == 0) + else if (strcasecmp(last_part, &id[strlen(id)-last_part_len]) == 0) match_fname2 = ix; } }