kernel32: Don't care about case when finding matching locale.

Signed-off-by: Andrew Eikum <aeikum@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Andrew Eikum 2017-01-24 14:44:11 -06:00 committed by Alexandre Julliard
parent 3da1616e84
commit 72b9acd94b
2 changed files with 8 additions and 3 deletions

View file

@ -390,7 +390,7 @@ static BOOL CALLBACK find_locale_id_callback( HMODULE hModule, LPCWSTR type,
GetLocaleInfoW( lcid, LOCALE_SNAME | LOCALE_NOUSEROVERRIDE, GetLocaleInfoW( lcid, LOCALE_SNAME | LOCALE_NOUSEROVERRIDE,
buffer, sizeof(buffer)/sizeof(WCHAR) )) buffer, sizeof(buffer)/sizeof(WCHAR) ))
{ {
if (!strcmpW( data->win_name, buffer )) if (!strcmpiW( data->win_name, buffer ))
{ {
matches = 4; /* everything matches */ matches = 4; /* everything matches */
goto done; goto done;
@ -400,7 +400,7 @@ static BOOL CALLBACK find_locale_id_callback( HMODULE hModule, LPCWSTR type,
if (!GetLocaleInfoW( lcid, LOCALE_SISO639LANGNAME | LOCALE_NOUSEROVERRIDE, if (!GetLocaleInfoW( lcid, LOCALE_SISO639LANGNAME | LOCALE_NOUSEROVERRIDE,
buffer, sizeof(buffer)/sizeof(WCHAR) )) buffer, sizeof(buffer)/sizeof(WCHAR) ))
return TRUE; return TRUE;
if (strcmpW( buffer, data->lang )) return TRUE; if (strcmpiW( buffer, data->lang )) return TRUE;
matches++; /* language name matched */ matches++; /* language name matched */
if (data->country) 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, if (GetLocaleInfoW( lcid, LOCALE_SISO3166CTRYNAME|LOCALE_NOUSEROVERRIDE,
buffer, sizeof(buffer)/sizeof(WCHAR) )) buffer, sizeof(buffer)/sizeof(WCHAR) ))
{ {
if (strcmpW( buffer, data->country )) goto done; if (strcmpiW( buffer, data->country )) goto done;
matches++; /* country name matched */ matches++; /* country name matched */
} }
} }

View file

@ -2704,6 +2704,7 @@ static void test_LocaleNameToLCID(void)
INT ret; INT ret;
WCHAR buffer[LOCALE_NAME_MAX_LENGTH]; WCHAR buffer[LOCALE_NAME_MAX_LENGTH];
static const WCHAR enW[] = {'e','n',0}; static const WCHAR enW[] = {'e','n',0};
static const WCHAR esesW[] = {'e','s','-','e','s',0};
if (!pLocaleNameToLCID) if (!pLocaleNameToLCID)
{ {
@ -2744,6 +2745,10 @@ static void test_LocaleNameToLCID(void)
ok(!lcid && GetLastError() == ERROR_INVALID_PARAMETER, ok(!lcid && GetLastError() == ERROR_INVALID_PARAMETER,
"Expected lcid == 0, got %08x, error %d\n", lcid, GetLastError()); "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 */ /* english neutral name */
lcid = pLocaleNameToLCID(enW, 0); lcid = pLocaleNameToLCID(enW, 0);
ok(lcid == MAKELCID(MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US), SORT_DEFAULT) || ok(lcid == MAKELCID(MAKELANGID(LANG_ENGLISH, SUBLANG_ENGLISH_US), SORT_DEFAULT) ||