Commit 544007be authored by Bartosz Kosiorek's avatar Bartosz Kosiorek Committed by Alexandre Julliard

msvcrt: Add _mbsnbcmp_l implementation.

parent 5556eba0
......@@ -1128,7 +1128,7 @@
@ cdecl _mbsnbcat_s(str long ptr long)
@ stub _mbsnbcat_s_l
@ cdecl _mbsnbcmp(str str long)
@ stub _mbsnbcmp_l
@ cdecl _mbsnbcmp_l(str str long ptr)
@ cdecl _mbsnbcnt(ptr long)
@ stub _mbsnbcnt_l
@ cdecl _mbsnbcoll(str str long)
......
......@@ -1485,7 +1485,7 @@
@ cdecl _mbsnbcat_s(str long ptr long)
@ stub _mbsnbcat_s_l
@ cdecl _mbsnbcmp(str str long)
@ stub _mbsnbcmp_l
@ cdecl _mbsnbcmp_l(str str long ptr)
@ cdecl _mbsnbcnt(ptr long)
@ stub _mbsnbcnt_l
@ cdecl _mbsnbcoll(str str long)
......
......@@ -1496,7 +1496,7 @@
@ cdecl _mbsnbcat_s(str long ptr long)
@ stub _mbsnbcat_s_l
@ cdecl _mbsnbcmp(str str long)
@ stub _mbsnbcmp_l
@ cdecl _mbsnbcmp_l(str str long ptr)
@ cdecl _mbsnbcnt(ptr long)
@ stub _mbsnbcnt_l
@ cdecl _mbsnbcoll(str str long)
......
......@@ -800,7 +800,7 @@
@ cdecl _mbsnbcat_s(str long ptr long)
@ stub _mbsnbcat_s_l
@ cdecl _mbsnbcmp(str str long)
@ stub _mbsnbcmp_l
@ cdecl _mbsnbcmp_l(str str long ptr)
@ cdecl _mbsnbcnt(ptr long)
@ stub _mbsnbcnt_l
@ cdecl _mbsnbcoll(str str long)
......
......@@ -778,7 +778,7 @@
@ cdecl _mbsnbcat_s(str long ptr long)
@ stub _mbsnbcat_s_l
@ cdecl _mbsnbcmp(str str long)
@ stub _mbsnbcmp_l
@ cdecl _mbsnbcmp_l(str str long ptr)
@ cdecl _mbsnbcnt(ptr long)
@ stub _mbsnbcnt_l
@ cdecl _mbsnbcoll(str str long)
......
......@@ -1213,45 +1213,64 @@ int CDECL _mbsncmp(const unsigned char* str, const unsigned char* cmp, size_t le
}
/*********************************************************************
* _mbsnbcmp(MSVCRT.@)
* _mbsnbcmp_l(MSVCRT.@)
*/
int CDECL _mbsnbcmp(const unsigned char* str, const unsigned char* cmp, size_t len)
int CDECL _mbsnbcmp_l(const unsigned char* str, const unsigned char* cmp, size_t len, _locale_t locale)
{
if (!len)
return 0;
if(get_mbcinfo()->ismbcodepage)
{
unsigned int strc, cmpc;
while (len)
pthreadmbcinfo mbcinfo;
if (!len)
return 0;
if (!MSVCRT_CHECK_PMT(str && cmp))
return _NLSCMPERROR;
if (locale)
mbcinfo = locale->mbcinfo;
else
mbcinfo = get_mbcinfo();
if (mbcinfo->ismbcodepage)
{
int clen;
if(!*str)
return *cmp ? -1 : 0;
if(!*cmp)
return 1;
if (_ismbblead(*str))
{
strc=(len>=2)?_mbsnextc(str):0;
clen=2;
}
else
{
strc=*str;
clen=1;
}
if (_ismbblead(*cmp))
cmpc=(len>=2)?_mbsnextc(cmp):0;
else
cmpc=*cmp;
if(strc != cmpc)
return strc < cmpc ? -1 : 1;
len -= clen;
str += clen;
cmp += clen;
unsigned int strc, cmpc;
while (len)
{
int clen;
if (!*str)
return *cmp ? -1 : 0;
if (!*cmp)
return 1;
if (_ismbblead_l(*str, locale))
{
strc = (len >= 2) ? _mbsnextc_l(str, locale) : 0;
clen = 2;
}
else
{
strc = *str;
clen = 1;
}
if (_ismbblead_l(*cmp, locale))
cmpc = (len >= 2) ? _mbsnextc_l(cmp, locale) : 0;
else
cmpc = *cmp;
if(strc != cmpc)
return strc < cmpc ? -1 : 1;
len -= clen;
str += clen;
cmp += clen;
}
return 0; /* Matched len chars */
}
return 0; /* Matched len chars */
}
return u_strncmp(str,cmp,len);
return u_strncmp(str, cmp, len);
}
/*********************************************************************
* _mbsnbcmp(MSVCRT.@)
*/
int CDECL _mbsnbcmp(const unsigned char* str, const unsigned char* cmp, size_t len)
{
return _mbsnbcmp_l(str, cmp, len, NULL);
}
/*********************************************************************
......
......@@ -749,7 +749,7 @@
@ cdecl _mbsnbcat_s(str long ptr long)
# stub _mbsnbcat_s_l(str long ptr long ptr)
@ cdecl _mbsnbcmp(str str long)
# stub _mbsnbcmp_l(str str long ptr)
@ cdecl _mbsnbcmp_l(str str long ptr)
@ cdecl _mbsnbcnt(ptr long)
# stub _mbsnbcnt_l(ptr long ptr)
@ cdecl _mbsnbcoll(str str long)
......
......@@ -644,7 +644,7 @@
@ cdecl _mbsnbcat_s(str long ptr long)
@ stub _mbsnbcat_s_l
@ cdecl _mbsnbcmp(str str long)
@ stub _mbsnbcmp_l
@ cdecl _mbsnbcmp_l(str str long ptr)
@ cdecl _mbsnbcnt(ptr long)
@ stub _mbsnbcnt_l
@ cdecl _mbsnbcoll(str str long)
......@@ -1213,7 +1213,7 @@
@ cdecl _o__mbsnbcat_s(str long ptr long) _mbsnbcat_s
@ stub _o__mbsnbcat_s_l
@ cdecl _o__mbsnbcmp(str str long) _mbsnbcmp
@ stub _o__mbsnbcmp_l
@ cdecl _o_mbsnbcmp_l(str str long ptr) _mbsnbcmp_l
@ cdecl _o__mbsnbcnt(ptr long) _mbsnbcnt
@ stub _o__mbsnbcnt_l
@ cdecl _o__mbsnbcoll(str str long) _mbsnbcoll
......
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