Commit 841fbd5b authored by Piotr Caban's avatar Piotr Caban Committed by Alexandre Julliard

msvcrt: Don't use strcmpW in wcscmp.

parent 2a12ccd8
......@@ -4210,6 +4210,20 @@ static void test_iswdigit(void)
}
}
static void test_wcscmp(void)
{
int r;
r = wcscmp(L"a", L"z");
ok(r == -1, "wcscmp returned %d\n", r);
r = wcscmp(L"z", L"a");
ok(r == 1, "wcscmp returned %d\n", r);
r = wcscmp(L"f", L"f");
ok(!r, "wcscmp returned %d\n", r);
}
START_TEST(string)
{
char mem[100];
......@@ -4359,4 +4373,5 @@ START_TEST(string)
test_C_locale();
test_strstr();
test_iswdigit();
test_wcscmp();
}
......@@ -1584,6 +1584,24 @@ int WINAPIV MSVCRT_swprintf_p_l(MSVCRT_wchar_t *buffer, MSVCRT_size_t length,
}
/*********************************************************************
* wcscmp (MSVCRT.@)
*/
int CDECL MSVCRT_wcscmp(const MSVCRT_wchar_t *str1, const MSVCRT_wchar_t *str2)
{
while (*str1 && (*str1 == *str2))
{
str1++;
str2++;
}
if (*str1 < *str2)
return -1;
if (*str1 > *str2)
return 1;
return 0;
}
/*********************************************************************
* _wcscoll_l (MSVCRT.@)
*/
int CDECL MSVCRT__wcscoll_l(const MSVCRT_wchar_t* str1, const MSVCRT_wchar_t* str2, MSVCRT__locale_t locale)
......@@ -1596,7 +1614,7 @@ int CDECL MSVCRT__wcscoll_l(const MSVCRT_wchar_t* str1, const MSVCRT_wchar_t* st
locinfo = locale->locinfo;
if(!locinfo->lc_handle[MSVCRT_LC_COLLATE])
return strcmpW(str1, str2);
return MSVCRT_wcscmp(str1, str2);
return CompareStringW(locinfo->lc_handle[MSVCRT_LC_COLLATE], 0, str1, -1, str2, -1)-CSTR_EQUAL;
}
......@@ -2668,11 +2686,3 @@ MSVCRT_size_t CDECL MSVCRT_wcsxfrm(MSVCRT_wchar_t *dest,
{
return MSVCRT__wcsxfrm_l(dest, src, len, NULL);
}
/*********************************************************************
* wcscmp (MSVCRT.@)
*/
int CDECL MSVCRT_wcscmp(const MSVCRT_wchar_t *str1, const MSVCRT_wchar_t *str2)
{
return strcmpW(str1, str2);
}
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