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