Commit 62ba4a82 authored by Bartosz Kosiorek's avatar Bartosz Kosiorek Committed by Alexandre Julliard

msvcrt: Add _mbsnbicmp_l implementation.

parent bf9ac906
......@@ -1138,7 +1138,7 @@
@ cdecl _mbsnbcpy_s(ptr long str long)
@ cdecl _mbsnbcpy_s_l(ptr long str long ptr)
@ cdecl _mbsnbicmp(str str long)
@ stub _mbsnbicmp_l
@ cdecl _mbsnbicmp_l(str str long ptr)
@ cdecl _mbsnbicoll(str str long)
@ cdecl _mbsnbicoll_l(str str long ptr)
@ cdecl _mbsnbset(ptr long long)
......
......@@ -1495,7 +1495,7 @@
@ cdecl _mbsnbcpy_s(ptr long str long)
@ cdecl _mbsnbcpy_s_l(ptr long str long ptr)
@ cdecl _mbsnbicmp(str str long)
@ stub _mbsnbicmp_l
@ cdecl _mbsnbicmp_l(str str long ptr)
@ cdecl _mbsnbicoll(str str long)
@ cdecl _mbsnbicoll_l(str str long ptr)
@ cdecl _mbsnbset(ptr long long)
......
......@@ -1506,7 +1506,7 @@
@ cdecl _mbsnbcpy_s(ptr long str long)
@ cdecl _mbsnbcpy_s_l(ptr long str long ptr)
@ cdecl _mbsnbicmp(str str long)
@ stub _mbsnbicmp_l
@ cdecl _mbsnbicmp_l(str str long ptr)
@ cdecl _mbsnbicoll(str str long)
@ cdecl _mbsnbicoll_l(str str long ptr)
@ cdecl _mbsnbset(ptr long long)
......
......@@ -810,7 +810,7 @@
@ cdecl _mbsnbcpy_s(ptr long str long)
@ cdecl _mbsnbcpy_s_l(ptr long str long ptr)
@ cdecl _mbsnbicmp(str str long)
@ stub _mbsnbicmp_l
@ cdecl _mbsnbicmp_l(str str long ptr)
@ cdecl _mbsnbicoll(str str long)
@ cdecl _mbsnbicoll_l(str str long ptr)
@ cdecl _mbsnbset(ptr long long)
......
......@@ -788,7 +788,7 @@
@ cdecl _mbsnbcpy_s(ptr long str long)
@ cdecl _mbsnbcpy_s_l(ptr long str long ptr)
@ cdecl _mbsnbicmp(str str long)
@ stub _mbsnbicmp_l
@ cdecl _mbsnbicmp_l(str str long ptr)
@ cdecl _mbsnbicoll(str str long)
@ cdecl _mbsnbicoll_l(str str long ptr)
@ cdecl _mbsnbset(ptr long long)
......
......@@ -1362,47 +1362,66 @@ int CDECL _mbsnicmp(const unsigned char* str, const unsigned char* cmp, size_t l
}
/*********************************************************************
* _mbsnbicmp(MSVCRT.@)
* _mbsnbicmp_l(MSVCRT.@)
*/
int CDECL _mbsnbicmp(const unsigned char* str, const unsigned char* cmp, size_t len)
int CDECL _mbsnbicmp_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;
strc = _mbctolower(strc);
cmpc = _mbctolower(cmpc);
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;
strc = _mbctolower_l(strc, locale);
cmpc = _mbctolower_l(cmpc, locale);
if (strc != cmpc)
return strc < cmpc ? -1 : 1;
len -= clen;
str += clen;
cmp += clen;
}
return 0; /* Matched len bytes */
}
return 0; /* Matched len bytes */
}
return u_strncasecmp(str,cmp,len);
return u_strncasecmp(str, cmp, len);
}
/*********************************************************************
* _mbsnbicmp(MSVCRT.@)
*/
int CDECL _mbsnbicmp(const unsigned char* str, const unsigned char* cmp, size_t len)
{
return _mbsnbicmp_l(str, cmp, len, NULL);
}
/*********************************************************************
......
......@@ -759,7 +759,7 @@
@ cdecl _mbsnbcpy_s(ptr long str long)
@ cdecl _mbsnbcpy_s_l(ptr long str long ptr)
@ cdecl _mbsnbicmp(str str long)
# stub _mbsnbicmp_l(str str long ptr)
@ cdecl _mbsnbicmp_l(str str long ptr)
@ cdecl _mbsnbicoll(str str long)
@ cdecl _mbsnbicoll_l(str str long ptr)
@ cdecl _mbsnbset(ptr long long)
......
......@@ -654,7 +654,7 @@
@ cdecl _mbsnbcpy_s(ptr long str long)
@ cdecl _mbsnbcpy_s_l(ptr long str long ptr)
@ cdecl _mbsnbicmp(str str long)
@ stub _mbsnbicmp_l
@ cdecl _mbsnbicmp_l(str str long ptr)
@ cdecl _mbsnbicoll(str str long)
@ cdecl _mbsnbicoll_l(str str long ptr)
@ cdecl _mbsnbset(ptr long long)
......@@ -1223,7 +1223,7 @@
@ cdecl _o__mbsnbcpy_s(ptr long str long) _mbsnbcpy_s
@ cdecl _o__mbsnbcpy_s_l(ptr long str long ptr) _mbsnbcpy_s_l
@ cdecl _o__mbsnbicmp(str str long) _mbsnbicmp
@ stub _o__mbsnbicmp_l
@ cdecl _o__mbsnbicmp_l(str str long ptr) _mbsnbicmp_l
@ cdecl _o__mbsnbicoll(str str long) _mbsnbicoll
@ cdecl _o__mbsnbicoll_l(str str long ptr) _mbsnbicoll_l
@ cdecl _o__mbsnbset(ptr long long) _mbsnbset
......
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