Commit 49d3236d authored by Bartosz Kosiorek's avatar Bartosz Kosiorek Committed by Alexandre Julliard

msvcrt: Add _mbsnicmp_l implementation.

parent 5098bab5
......@@ -1162,7 +1162,7 @@
@ cdecl _mbsnextc(str)
@ cdecl _mbsnextc_l(str ptr)
@ cdecl _mbsnicmp(str str long)
@ stub _mbsnicmp_l
@ cdecl _mbsnicmp_l(str str long ptr)
@ stub _mbsnicoll(str str long)
@ stub _mbsnicoll_l
@ cdecl _mbsninc(str long)
......
......@@ -1519,7 +1519,7 @@
@ cdecl _mbsnextc(str)
@ cdecl _mbsnextc_l(str ptr)
@ cdecl _mbsnicmp(str str long)
@ stub _mbsnicmp_l
@ cdecl _mbsnicmp_l(str str long ptr)
@ stub _mbsnicoll(str str long)
@ stub _mbsnicoll_l
@ cdecl _mbsninc(str long)
......
......@@ -1530,7 +1530,7 @@
@ cdecl _mbsnextc(str)
@ cdecl _mbsnextc_l(str ptr)
@ cdecl _mbsnicmp(str str long)
@ stub _mbsnicmp_l
@ cdecl _mbsnicmp_l(str str long ptr)
@ stub _mbsnicoll(str str long)
@ stub _mbsnicoll_l
@ cdecl _mbsninc(str long)
......
......@@ -834,7 +834,7 @@
@ cdecl _mbsnextc(str)
@ cdecl _mbsnextc_l(str ptr)
@ cdecl _mbsnicmp(str str long)
@ stub _mbsnicmp_l
@ cdecl _mbsnicmp_l(str str long ptr)
@ stub _mbsnicoll(str str long)
@ stub _mbsnicoll_l
@ cdecl _mbsninc(str long)
......
......@@ -812,7 +812,7 @@
@ cdecl _mbsnextc(str)
@ cdecl _mbsnextc_l(str ptr)
@ cdecl _mbsnicmp(str str long)
@ stub _mbsnicmp_l
@ cdecl _mbsnicmp_l(str str long ptr)
@ stub _mbsnicoll(str str long)
@ stub _mbsnicoll_l
@ cdecl _mbsninc(str long)
......
......@@ -1297,28 +1297,49 @@ int CDECL _mbsnbcmp(const unsigned char* str, const unsigned char* cmp, size_t l
*
* Compare two multibyte strings case insensitively to 'len' characters.
*/
int CDECL _mbsnicmp(const unsigned char* str, const unsigned char* cmp, size_t len)
int CDECL _mbsnicmp_l(const unsigned char* str, const unsigned char* cmp, size_t len, _locale_t locale)
{
/* FIXME: No tolower() for mb strings yet */
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();
/* FIXME: No tolower() for mb strings yet */
if (mbcinfo->ismbcodepage)
{
if(!*str)
return *cmp ? -1 : 0;
if(!*cmp)
return 1;
strc = _mbctolower(_mbsnextc(str));
cmpc = _mbctolower(_mbsnextc(cmp));
if(strc != cmpc)
return strc < cmpc ? -1 : 1;
str +=(strc > 255) ? 2 : 1;
cmp +=(strc > 255) ? 2 : 1; /* Equal, use same increment */
unsigned int strc, cmpc;
while (len--)
{
if (!*str)
return *cmp ? -1 : 0;
if (!*cmp)
return 1;
strc = _mbctolower_l(_mbsnextc_l(str, locale), locale);
cmpc = _mbctolower_l(_mbsnextc_l(cmp, locale), locale);
if (strc != cmpc)
return strc < cmpc ? -1 : 1;
str += (strc > 255) ? 2 : 1;
cmp += (strc > 255) ? 2 : 1; /* Equal, use same increment */
}
return 0; /* Matched len chars */
}
return 0; /* Matched len chars */
}
return u_strncasecmp(str, cmp, len); /* ASCII CP */
return u_strncasecmp(str, cmp, len); /* ASCII CP */
}
/*********************************************************************
* _mbsnicmp(MSVCRT.@)
*
* Compare two multibyte strings case insensitively to 'len' characters.
*/
int CDECL _mbsnicmp(const unsigned char* str, const unsigned char* cmp, size_t len)
{
return _mbsnicmp_l(str, cmp, len, NULL);
}
/*********************************************************************
......
......@@ -783,7 +783,7 @@
@ cdecl _mbsnextc(str)
@ cdecl _mbsnextc_l(str ptr)
@ cdecl _mbsnicmp(str str long)
# stub _mbsnicmp_l(str str long ptr)
@ cdecl _mbsnicmp_l(str str long ptr)
@ stub _mbsnicoll(str str long)
# stub _mbsnicoll_l(str str long ptr)
@ cdecl _mbsninc(str long)
......
......@@ -678,7 +678,7 @@
@ cdecl _mbsnextc(str)
@ cdecl _mbsnextc_l(str ptr)
@ cdecl _mbsnicmp(str str long)
@ stub _mbsnicmp_l
@ cdecl _mbsnicmp_l(str str long ptr)
@ stub _mbsnicoll(str str long)
@ stub _mbsnicoll_l
@ cdecl _mbsninc(str long)
......@@ -1247,7 +1247,7 @@
@ cdecl _o__mbsnextc(str) _mbsnextc
@ cdecl _o__mbsnextc_l(str ptr) _mbsnextc_l
@ cdecl _o__mbsnicmp(str str long) _mbsnicmp
@ stub _o__mbsnicmp_l
@ cdecl _o__mbsnicmp_l(str str long ptr) _mbsnicmp_l
@ stub _o__mbsnicoll
@ stub _o__mbsnicoll_l
@ cdecl _o__mbsninc(str long) _mbsninc
......
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