Commit fb5302c2 authored by Daniel Lehman's avatar Daniel Lehman Committed by Alexandre Julliard

msvcrt: Use string sort for strcoll/wcscoll.

parent 188d8804
...@@ -1162,7 +1162,8 @@ int CDECL _strcoll_l( const char* str1, const char* str2, _locale_t locale ) ...@@ -1162,7 +1162,8 @@ int CDECL _strcoll_l( const char* str1, const char* str2, _locale_t locale )
if(!locinfo->lc_handle[LC_COLLATE]) if(!locinfo->lc_handle[LC_COLLATE])
return strcmp(str1, str2); return strcmp(str1, str2);
return CompareStringA(locinfo->lc_handle[LC_COLLATE], 0, str1, -1, str2, -1)-CSTR_EQUAL; return CompareStringA(locinfo->lc_handle[LC_COLLATE], SORT_STRINGSORT,
str1, -1, str2, -1)-CSTR_EQUAL;
} }
/********************************************************************* /*********************************************************************
......
...@@ -4234,7 +4234,6 @@ static void test__tcscoll(void) ...@@ -4234,7 +4234,6 @@ static void test__tcscoll(void)
const char *str1; const char *str1;
const char *str2; const char *str2;
int exp; int exp;
BOOL todo;
}; };
static const struct test tests[] = { static const struct test tests[] = {
{ "English", "ABCD", "ABCD", 0 }, { "English", "ABCD", "ABCD", 0 },
...@@ -4242,8 +4241,8 @@ static void test__tcscoll(void) ...@@ -4242,8 +4241,8 @@ static void test__tcscoll(void)
{ "English", "ABCD", "ABC", 1 }, { "English", "ABCD", "ABC", 1 },
{ "English", "ABCe", "ABCf", -1 }, { "English", "ABCe", "ABCf", -1 },
{ "English", "abcd", "ABCD", -1 }, { "English", "abcd", "ABCD", -1 },
{ "English", "AB D", "AB-D", 1, TRUE }, { "English", "AB D", "AB-D", 1 },
{ "English", "AB D", "AB'D", 1, TRUE }, { "English", "AB D", "AB'D", 1 },
{ "C", "ABCD", "ABCD", 0 }, { "C", "ABCD", "ABCD", 0 },
{ "C", "ABC", "ABCD", -1 }, { "C", "ABC", "ABCD", -1 },
...@@ -4284,7 +4283,6 @@ static void test__tcscoll(void) ...@@ -4284,7 +4283,6 @@ static void test__tcscoll(void)
ok(ret < 0, "expected < 0, got %d for %s, %s for locale %s\n", ok(ret < 0, "expected < 0, got %d for %s, %s for locale %s\n",
ret, str1, str2, tests[i].locale); ret, str1, str2, tests[i].locale);
else else
todo_wine_if(tests[i].todo)
ok(ret > 0, "expected > 0, got %d for %s, %s for locale %s\n", ok(ret > 0, "expected > 0, got %d for %s, %s for locale %s\n",
ret, str1, str2, tests[i].locale); ret, str1, str2, tests[i].locale);
...@@ -4304,7 +4302,6 @@ static void test__tcscoll(void) ...@@ -4304,7 +4302,6 @@ static void test__tcscoll(void)
ok(ret < 0, "expected < 0, got %d for %s, %s for locale %s\n", ok(ret < 0, "expected < 0, got %d for %s, %s for locale %s\n",
ret, str1, str2, tests[i].locale); ret, str1, str2, tests[i].locale);
else else
todo_wine_if(tests[i].todo)
ok(ret > 0, "expected > 0, got %d for %s, %s for locale %s\n", ok(ret > 0, "expected > 0, got %d for %s, %s for locale %s\n",
ret, str1, str2, tests[i].locale); ret, str1, str2, tests[i].locale);
} }
......
...@@ -1994,7 +1994,8 @@ int CDECL _wcscoll_l(const wchar_t* str1, const wchar_t* str2, _locale_t locale) ...@@ -1994,7 +1994,8 @@ int CDECL _wcscoll_l(const wchar_t* str1, const wchar_t* str2, _locale_t locale)
if(!locinfo->lc_handle[LC_COLLATE]) if(!locinfo->lc_handle[LC_COLLATE])
return wcscmp(str1, str2); return wcscmp(str1, str2);
return CompareStringW(locinfo->lc_handle[LC_COLLATE], 0, str1, -1, str2, -1)-CSTR_EQUAL; return CompareStringW(locinfo->lc_handle[LC_COLLATE], SORT_STRINGSORT,
str1, -1, str2, -1)-CSTR_EQUAL;
} }
/********************************************************************* /*********************************************************************
......
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