mirror of
https://github.com/rhasspy/espeak-ng.git
synced 2026-10-31 05:35:35 +00:00
Perform case insensitive comparisons for matching voice names.
This commit is contained in:
@@ -0,0 +1,30 @@
|
||||
/* Compatibility shim for <strings.h>
|
||||
*
|
||||
* 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: <http://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
#ifndef STRINGS_H_COMPAT_SHIM
|
||||
#define STRINGS_H_COMPAT_SHIM
|
||||
|
||||
#ifdef _MSC_VER
|
||||
|
||||
#include <string.h>
|
||||
|
||||
#define strcasecmp stricmp
|
||||
|
||||
#endif
|
||||
|
||||
#endif
|
||||
@@ -24,6 +24,7 @@
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <string.h>
|
||||
#include <strings.h>
|
||||
#include <wctype.h>
|
||||
|
||||
#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;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user