msvcrt: Don't use strncmpW in wcsncmp.

Signed-off-by: Piotr Caban <piotr@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Piotr Caban 2020-07-14 20:23:02 +02:00 committed by Alexandre Julliard
parent 1ca971a248
commit f20f4dee00
1 changed files with 16 additions and 9 deletions

View File

@ -413,6 +413,21 @@ MSVCRT_wchar_t* CDECL MSVCRT__wcslwr( MSVCRT_wchar_t* str )
return str;
}
/*********************************************************************
* wcsncmp (MSVCRT.@)
*/
int CDECL MSVCRT_wcsncmp(const MSVCRT_wchar_t *str1, const MSVCRT_wchar_t *str2, MSVCRT_size_t n)
{
if (!n)
return 0;
while(--n && *str1 && (*str1 == *str2))
{
str1++;
str2++;
}
return *str1 - *str2;
}
/*********************************************************************
* _wcsncoll_l (MSVCRT.@)
*/
@ -427,7 +442,7 @@ int CDECL MSVCRT__wcsncoll_l(const MSVCRT_wchar_t* str1, const MSVCRT_wchar_t* s
locinfo = locale->locinfo;
if(!locinfo->lc_handle[MSVCRT_LC_COLLATE])
return strncmpW(str1, str2, count);
return MSVCRT_wcsncmp(str1, str2, count);
return CompareStringW(locinfo->lc_handle[MSVCRT_LC_COLLATE], 0,
str1, MSVCRT_wcsnlen(str1, count),
str2, MSVCRT_wcsnlen(str2, count))-CSTR_EQUAL;
@ -2643,14 +2658,6 @@ __int64 CDECL MSVCRT__wtoi64(const MSVCRT_wchar_t *str)
return MSVCRT__wtoi64_l(str, NULL);
}
/*********************************************************************
* wcsncmp (MSVCRT.@)
*/
int CDECL MSVCRT_wcsncmp(const MSVCRT_wchar_t *str1, const MSVCRT_wchar_t *str2, int n)
{
return strncmpW(str1, str2, n);
}
/*********************************************************************
* _wcsxfrm_l (MSVCRT.@)
*/