msvcrt: Use string sort for strncoll/wcsncoll.
This commit is contained in:
parent
65109c725d
commit
588db48be5
3 changed files with 8 additions and 2 deletions
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -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];
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue