Commit 12106c21 authored by Paul Gofman's avatar Paul Gofman Committed by Alexandre Julliard

msvcrt: Implement _mbscmp_l().

parent 082de781
......@@ -95,7 +95,7 @@
@ cdecl _mbschr(str long) ucrtbase._mbschr
@ stub _mbschr_l
@ cdecl _mbscmp(str str) ucrtbase._mbscmp
@ stub _mbscmp_l
@ cdecl _mbscmp_l(str str ptr) ucrtbase._mbscmp_l
@ cdecl _mbscoll(str str) ucrtbase._mbscoll
@ cdecl _mbscoll_l(str str ptr) ucrtbase._mbscoll_l
@ cdecl _mbscpy_s(ptr long str) ucrtbase._mbscpy_s
......
......@@ -520,7 +520,7 @@
@ cdecl _o__mbschr(str long) ucrtbase._o__mbschr
@ stub _o__mbschr_l
@ cdecl _o__mbscmp(str str) ucrtbase._o__mbscmp
@ stub _o__mbscmp_l
@ cdecl _o__mbscmp_l(str str ptr) ucrtbase._o__mbscmp_l
@ cdecl _o__mbscoll(str str) ucrtbase._o__mbscoll
@ cdecl _o__mbscoll_l(str str ptr) ucrtbase._o__mbscoll_l
@ cdecl _o__mbscpy_s(ptr long str) ucrtbase._o__mbscpy_s
......
......@@ -1102,7 +1102,7 @@
@ cdecl _mbschr(str long)
@ stub _mbschr_l
@ cdecl _mbscmp(str str)
@ stub _mbscmp_l
@ cdecl _mbscmp_l(str str ptr)
@ cdecl _mbscoll(str str)
@ cdecl _mbscoll_l(str str ptr)
@ cdecl _mbscpy_s(ptr long str)
......
......@@ -1459,7 +1459,7 @@
@ cdecl _mbschr(str long)
@ stub _mbschr_l
@ cdecl _mbscmp(str str)
@ stub _mbscmp_l
@ cdecl _mbscmp_l(str str ptr)
@ cdecl _mbscoll(str str)
@ cdecl _mbscoll_l(str str ptr)
@ cdecl _mbscpy_s(ptr long str)
......
......@@ -1469,7 +1469,7 @@
@ cdecl _mbschr(str long)
@ stub _mbschr_l
@ cdecl _mbscmp(str str)
@ stub _mbscmp_l
@ cdecl _mbscmp_l(str str ptr)
@ cdecl _mbscoll(str str)
@ cdecl _mbscoll_l(str str ptr)
@ cdecl _mbscpy_s(ptr long str)
......
......@@ -774,7 +774,7 @@
@ cdecl _mbschr(str long)
@ stub _mbschr_l
@ cdecl _mbscmp(str str)
@ stub _mbscmp_l
@ cdecl _mbscmp_l(str str ptr)
@ cdecl _mbscoll(str str)
@ cdecl _mbscoll_l(str str ptr)
@ cdecl _mbscpy_s(ptr long str)
......
......@@ -752,7 +752,7 @@
@ cdecl _mbschr(str long)
@ stub _mbschr_l
@ cdecl _mbscmp(str str)
@ stub _mbscmp_l
@ cdecl _mbscmp_l(str str ptr)
@ cdecl _mbscoll(str str)
@ cdecl _mbscoll_l(str str ptr)
@ cdecl _mbscpy_s(ptr long str)
......
......@@ -872,13 +872,17 @@ unsigned char* CDECL _mbsnbcpy(unsigned char* dst, const unsigned char* src, MSV
}
/*********************************************************************
* _mbscmp(MSVCRT.@)
* _mbscmp_l(MSVCRT.@)
*/
int CDECL _mbscmp(const unsigned char* str, const unsigned char* cmp)
int CDECL _mbscmp_l(const unsigned char* str, const unsigned char* cmp, MSVCRT__locale_t locale)
{
MSVCRT_pthreadmbcinfo mbcinfo;
if (!str || !cmp) return INT_MAX;
if(get_mbcinfo()->ismbcodepage)
mbcinfo = locale ? locale->mbcinfo : get_mbcinfo();
if(mbcinfo->ismbcodepage)
{
unsigned int strc, cmpc;
do {
......@@ -886,8 +890,8 @@ int CDECL _mbscmp(const unsigned char* str, const unsigned char* cmp)
return *cmp ? -1 : 0;
if(!*cmp)
return 1;
strc = _mbsnextc(str);
cmpc = _mbsnextc(cmp);
strc = _mbsnextc_l(str, locale);
cmpc = _mbsnextc_l(cmp, locale);
if(strc != cmpc)
return strc < cmpc ? -1 : 1;
str +=(strc > 255) ? 2 : 1;
......@@ -898,6 +902,14 @@ int CDECL _mbscmp(const unsigned char* str, const unsigned char* cmp)
}
/*********************************************************************
* _mbscmp(MSVCRT.@)
*/
int CDECL _mbscmp(const unsigned char* str, const unsigned char* cmp, MSVCRT__locale_t locale)
{
return _mbscmp_l(str, cmp, NULL);
}
/*********************************************************************
* _mbsnbicoll_l(MSVCRT.@)
*/
int CDECL _mbsnbicoll_l(const unsigned char *str1, const unsigned char *str2, MSVCRT_size_t len, MSVCRT__locale_t locale)
......
......@@ -717,7 +717,7 @@
@ cdecl _mbschr(str long)
# stub _mbschr_l(str long ptr)
@ cdecl _mbscmp(str str)
# stub _mbscmp_l(str str ptr)
@ cdecl _mbscmp_l(str str ptr)
@ cdecl _mbscoll(str str)
@ cdecl _mbscoll_l(str str ptr)
@ cdecl _mbscpy(ptr str)
......
......@@ -115,6 +115,7 @@ static int (__cdecl *p__memicmp)(const char*, const char*, size_t);
static int (__cdecl *p__memicmp_l)(const char*, const char*, size_t, _locale_t);
static size_t (__cdecl *p___strncnt)(const char*, size_t);
static unsigned int (__cdecl *p_mbsnextc_l)(const unsigned char*, _locale_t);
static int (__cdecl *p_mbscmp_l)(const unsigned char*, const unsigned char*, _locale_t);
int CDECL __STRINGTOLD(_LDOUBLE*, char**, const char*, int);
......@@ -3725,6 +3726,15 @@ static void test__mbscmp(void)
ret = _mbscmp(b, a);
ok(ret == 1, "got %d\n", ret);
if (!p_mbscmp_l)
{
win_skip("_mbscmp_l tests\n");
return;
}
ret = p_mbscmp_l(a, b, NULL);
ok(ret == -1, "got %d\n", ret);
}
static void test__ismbclx(void)
......@@ -4458,6 +4468,7 @@ START_TEST(string)
p__memicmp_l = (void*)GetProcAddress(hMsvcrt, "_memicmp_l");
p___strncnt = (void*)GetProcAddress(hMsvcrt, "__strncnt");
p_mbsnextc_l = (void*)GetProcAddress(hMsvcrt, "_mbsnextc_l");
p_mbscmp_l = (void*)GetProcAddress(hMsvcrt, "_mbscmp_l");
/* MSVCRT memcpy behaves like memmove for overlapping moves,
MFC42 CString::Insert seems to rely on that behaviour */
......
......@@ -614,7 +614,7 @@
@ cdecl _mbschr(str long)
@ stub _mbschr_l
@ cdecl _mbscmp(str str)
@ stub _mbscmp_l
@ cdecl _mbscmp_l(str str ptr)
@ cdecl _mbscoll(str str)
@ cdecl _mbscoll_l(str str ptr)
@ cdecl _mbscpy_s(ptr long str)
......@@ -1184,7 +1184,7 @@
@ cdecl _o__mbschr(str long) _mbschr
@ stub _o__mbschr_l
@ cdecl _o__mbscmp(str str) _mbscmp
@ stub _o__mbscmp_l
@ cdecl _o__mbscmp_l(str str ptr) _mbscmp_l
@ cdecl _o__mbscoll(str str) _mbscoll
@ cdecl _o__mbscoll_l(str str ptr) _mbscoll_l
@ cdecl _o__mbscpy_s(ptr long str) _mbscpy_s
......
......@@ -65,6 +65,7 @@ int __cdecl _mbsbtype(const unsigned char*,size_t);
unsigned char* __cdecl _mbscat(unsigned char*,const unsigned char*);
unsigned char* __cdecl _mbschr(const unsigned char*,unsigned int);
int __cdecl _mbscmp(const unsigned char*,const unsigned char*);
int __cdecl _mbscmp_l(const unsigned char*,const unsigned char*,_locale_t);
int __cdecl _mbscoll(const unsigned char*,const unsigned char*);
unsigned char* __cdecl _mbscpy(unsigned char*,const unsigned char*);
size_t __cdecl _mbscspn(const unsigned char*,const unsigned char*);
......
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