will submit a separate request for strcoll/wcscoll
From: Daniel Lehman dlehman25@gmail.com
--- dlls/msvcrt/string.c | 2 +- dlls/msvcrt/tests/string.c | 6 ++++++ dlls/msvcrt/wcs.c | 2 +- 3 files changed, 8 insertions(+), 2 deletions(-)
diff --git a/dlls/msvcrt/string.c b/dlls/msvcrt/string.c index ad57ecc8cda..e6323da3b01 100644 --- a/dlls/msvcrt/string.c +++ b/dlls/msvcrt/string.c @@ -1213,7 +1213,7 @@ int CDECL _strncoll_l( const char* str1, const char* str2, size_t count, _locale
if(!locinfo->lc_handle[LC_COLLATE]) return strncmp(str1, str2, count); - return CompareStringA(locinfo->lc_handle[LC_COLLATE], 0, + return CompareStringA(locinfo->lc_handle[LC_COLLATE], SORT_STRINGSORT, str1, strnlen(str1, count), str2, strnlen(str2, count))-CSTR_EQUAL; } diff --git a/dlls/msvcrt/tests/string.c b/dlls/msvcrt/tests/string.c index 34338fd4a39..3c43d2a78b4 100644 --- a/dlls/msvcrt/tests/string.c +++ b/dlls/msvcrt/tests/string.c @@ -4154,6 +4154,9 @@ static void test__tcsncoll(void) { "English", "ABCe", "ABCf", 3, 0 }, { "English", "abcd", "ABCD", 10, -1 },
+ { "English", "AB D", "AB-D", 4, 1 }, + { "English", "AB D", "AB'D", 4, 1 }, + { "C", "ABCD", "ABCD", 4, 0 }, { "C", "ABCD", "ABCD", 10, 0 },
@@ -4165,6 +4168,9 @@ static void test__tcsncoll(void)
{ "C", "ABCe", "ABCf", 3, 0 }, { "C", "abcd", "ABCD", 10, 1 }, + + { "C", "AB D", "AB-D", 4, -1 }, + { "C", "AB D", "AB'D", 4, -1 }, }; WCHAR str1W[16]; WCHAR str2W[16]; diff --git a/dlls/msvcrt/wcs.c b/dlls/msvcrt/wcs.c index 60a15dfc29c..af684e6be2e 100644 --- a/dlls/msvcrt/wcs.c +++ b/dlls/msvcrt/wcs.c @@ -538,7 +538,7 @@ int CDECL _wcsncoll_l(const wchar_t* str1, const wchar_t* str2,
if(!locinfo->lc_handle[LC_COLLATE]) return wcsncmp(str1, str2, count); - return CompareStringW(locinfo->lc_handle[LC_COLLATE], 0, + return CompareStringW(locinfo->lc_handle[LC_COLLATE], SORT_STRINGSORT, str1, wcsnlen(str1, count), str2, wcsnlen(str2, count))-CSTR_EQUAL; }
From: Daniel Lehman dlehman25@gmail.com
--- dlls/msvcrt/tests/string.c | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-)
diff --git a/dlls/msvcrt/tests/string.c b/dlls/msvcrt/tests/string.c index 3c43d2a78b4..a14e95704f3 100644 --- a/dlls/msvcrt/tests/string.c +++ b/dlls/msvcrt/tests/string.c @@ -4197,11 +4197,14 @@ static void test__tcsncoll(void)
ret = _strncoll(str1, str2, tests[i].count); if (!tests[i].exp) - ok(!ret, "expected 0, got %d for %s, %s, %d\n", ret, str1, str2, (int)tests[i].count); + ok(!ret, "expected 0, got %d for %s, %s, %d for locale %s\n", + ret, str1, str2, (int)tests[i].count, tests[i].locale); else if (tests[i].exp < 0) - ok(ret < 0, "expected < 0, got %d for %s, %s, %d\n", ret, str1, str2, (int)tests[i].count); + ok(ret < 0, "expected < 0, got %d for %s, %s, %d for locale %s\n", + ret, str1, str2, (int)tests[i].count, tests[i].locale); else - ok(ret > 0, "expected > 0, got %d for %s, %s, %d\n", ret, str1, str2, (int)tests[i].count); + ok(ret > 0, "expected > 0, got %d for %s, %s, %d for locale %s\n", + ret, str1, str2, (int)tests[i].count, tests[i].locale);
memset(str1W, 0xee, sizeof(str1W)); len = mbstowcs(str1W, str1, ARRAY_SIZE(str1W)); @@ -4213,11 +4216,14 @@ static void test__tcsncoll(void)
ret = _wcsncoll(str1W, str2W, tests[i].count); if (!tests[i].exp) - ok(!ret, "expected 0, got %d for %s, %s, %d\n", ret, str1, str2, (int)tests[i].count); + ok(!ret, "expected 0, got %d for %s, %s, %d for locale %s\n", + ret, str1, str2, (int)tests[i].count, tests[i].locale); else if (tests[i].exp < 0) - ok(ret < 0, "expected < 0, got %d for %s, %s, %d\n", ret, str1, str2, (int)tests[i].count); + ok(ret < 0, "expected < 0, got %d for %s, %s, %d for locale %s\n", + ret, str1, str2, (int)tests[i].count, tests[i].locale); else - ok(ret > 0, "expected > 0, got %d for %s, %s, %d\n", ret, str1, str2, (int)tests[i].count); + ok(ret > 0, "expected > 0, got %d for %s, %s, %d for locale %s\n", + ret, str1, str2, (int)tests[i].count, tests[i].locale); } }
This merge request was approved by Piotr Caban.