From 72b9acd94bc891b993b69730d6ceb3878342dcad Mon Sep 17 00:00:00 2001 From: Andrew Eikum Date: Tue, 24 Jan 2017 14:44:11 -0600 Subject: [PATCH] kernel32: Don't care about case when finding matching locale. Signed-off-by: Andrew Eikum Signed-off-by: Alexandre Julliard --- dlls/kernel32/locale.c | 6 +++--- dlls/kernel32/tests/locale.c | 5 +++++ 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/dlls/kernel32/locale.c b/dlls/kernel32/locale.c index 2bf1024c032..ca5975137f1 100644 --- a/dlls/kernel32/locale.c +++ b/dlls/kernel32/locale.c @@ -390,7 +390,7 @@ static BOOL CALLBACK find_locale_id_callback( HMODULE hModule, LPCWSTR type, GetLocaleInfoW( lcid, LOCALE_SNAME | LOCALE_NOUSEROVERRIDE, buffer, sizeof(buffer)/sizeof(WCHAR) )) { - if (!strcmpW( data->win_name, buffer )) + if (!strcmpiW( data->win_name, buffer )) { matches = 4; /* everything matches */ goto done; @@ -400,7 +400,7 @@ static BOOL CALLBACK find_locale_id_callback( HMODULE hModule, LPCWSTR type, if (!GetLocaleInfoW( lcid, LOCALE_SISO639LANGNAME | LOCALE_NOUSEROVERRIDE, buffer, sizeof(buffer)/sizeof(WCHAR) )) return TRUE; - if (strcmpW( buffer, data->lang )) return TRUE; + if (strcmpiW( buffer, data->lang )) return TRUE; matches++; /* language name matched */ if (data->country) @@ -408,7 +408,7 @@ static BOOL CALLBACK find_locale_id_callback( HMODULE hModule, LPCWSTR type, if (GetLocaleInfoW( lcid, LOCALE_SISO3166CTRYNAME|LOCALE_NOUSEROVERRIDE, buffer, sizeof(buffer)/sizeof(WCHAR) )) { - if (strcmpW( buffer, data->country )) goto done; + if (strcmpiW( buffer, data->country )) goto done; matches++; /* country name matched */ } } diff --git a/dlls/kernel32/tests/locale.c b/dlls/kernel32/tests/locale.c index 1bac84603a5..05564c43924 100644 --- a/dlls/kernel32/tests/locale.c +++ b/dlls/kernel32/tests/locale.c @@ -2704,6 +2704,7 @@ static void test_LocaleNameToLCID(void) INT ret; WCHAR buffer[LOCALE_NAME_MAX_LENGTH]; static const WCHAR enW[] = {'e','n',0}; + static const WCHAR esesW[] = {'e','s','-','e','s',0}; if (!pLocaleNameToLCID) { @@ -2744,6 +2745,10 @@ static void test_LocaleNameToLCID(void) ok(!lcid && GetLastError() == ERROR_INVALID_PARAMETER, "Expected lcid == 0, got %08x, error %d\n", lcid, GetLastError()); + /* lower-case */ + lcid = pLocaleNameToLCID(esesW, 0); + ok(lcid == MAKELCID(MAKELANGID(LANG_SPANISH, SUBLANG_SPANISH_MODERN), SORT_DEFAULT), "Got wrong lcid for es-es: 0x%x\n", lcid); + /* english neutral name */ lcid = pLocaleNameToLCID(enW, 0); ok(lcid == MAKELCID(MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US), SORT_DEFAULT) ||