kernel32: Treat empty locale name as LOCALE_INVARIANT.

This commit is contained in:
Jacek Caban 2015-06-09 23:18:47 +02:00 committed by Alexandre Julliard
parent 42cbc05e59
commit 09176c3aa0
2 changed files with 11 additions and 2 deletions

View File

@ -453,6 +453,13 @@ static void parse_locale_name( const WCHAR *str, struct locale_name *name )
name->win_name[0] = 0;
lstrcpynW( name->lang, str, sizeof(name->lang)/sizeof(WCHAR) );
if (!*name->lang)
{
name->lcid = LOCALE_INVARIANT;
name->matches = 4;
return;
}
if (!(p = strpbrkW( name->lang, sepW )))
{
if (!strcmpW( name->lang, posixW ) || !strcmpW( name->lang, cW ))

View File

@ -2418,9 +2418,9 @@ static void test_LocaleNameToLCID(void)
buffer[0] = 0;
SetLastError(0xdeadbeef);
lcid = pLocaleNameToLCID(LOCALE_NAME_INVARIANT, 0);
todo_wine ok(lcid == 0x7F, "Expected lcid = 0x7F, got %08x, error %d\n", lcid, GetLastError());
ok(lcid == 0x7F, "Expected lcid = 0x7F, got %08x, error %d\n", lcid, GetLastError());
ret = pLCIDToLocaleName(lcid, buffer, LOCALE_NAME_MAX_LENGTH, 0);
ok(ret > 0, "Expected ret > 0, got %d, error %d\n", ret, GetLastError());
todo_wine ok(ret > 0, "Expected ret > 0, got %d, error %d\n", ret, GetLastError());
trace("%08x, %s\n", lcid, wine_dbgstr_w(buffer));
/* bad name */
@ -4091,6 +4091,8 @@ static void test_IsValidLocaleName(void)
ok(!ret, "IsValidLocaleName should have failed\n");
ret = pIsValidLocaleName(zzzzW);
ok(!ret, "IsValidLocaleName should have failed\n");
ret = pIsValidLocaleName(LOCALE_NAME_INVARIANT);
ok(ret, "IsValidLocaleName failed\n");
}
static void test_CompareStringOrdinal(void)