Commit 62efd986 authored by Dmitry Timoshkov's avatar Dmitry Timoshkov Committed by Alexandre Julliard

Exit ealier from LCMapStringA in the case of LCMAP_SORTKEY.

Don't rely on computing string length by MultiByteToWideChar in CompareStringA, do it manually.
parent 104d9d44
......@@ -1154,6 +1154,7 @@ INT WINAPI LCMapStringA(LCID lcid, DWORD flags, LPCSTR src, INT srclen,
goto map_string_exit;
}
ret = wine_get_sortkey(flags, srcW, srclenW, dst, dstlen);
goto map_string_exit;
}
if (flags & SORT_STRINGSORT)
......@@ -1225,6 +1226,9 @@ INT WINAPI CompareStringA(LCID lcid, DWORD style,
return 0;
}
if (len1 < 0) len1 = strlen(str1);
if (len2 < 0) len2 = strlen(str2);
GetLocaleInfoW(lcid, LOCALE_IDEFAULTANSICODEPAGE | LOCALE_RETURN_NUMBER,
(WCHAR *)&locale_cp, (sizeof(locale_cp)/sizeof(WCHAR)));
......
......@@ -719,6 +719,10 @@ char buffer1[BUFFER_SIZE], buffer2[BUFFER_SIZE];
ret = CompareStringA(lcid, NORM_IGNORECASE, buffer1, -1, buffer2, 0);
ok (ret == 3, "CompareStringA (st1=%s str2=%s) expected result=3, got %d", buffer1, buffer2, ret);
strcpy(buffer1, "Salut"); strcpy(buffer2, "saLuT");
ret = CompareStringA(lcid, NORM_IGNORECASE, buffer1, 5, buffer2, -1);
ok (ret == 2, "CompareStringA (st1=%s str2=%s) expected result=2, got %d", buffer1, buffer2, ret);
}
void test_LCMapStringA(void)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment