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 @@ ...@@ -1162,7 +1162,7 @@
@ cdecl _mbsnextc(str) @ cdecl _mbsnextc(str)
@ cdecl _mbsnextc_l(str ptr) @ cdecl _mbsnextc_l(str ptr)
@ cdecl _mbsnicmp(str str long) @ cdecl _mbsnicmp(str str long)
@ stub _mbsnicmp_l @ cdecl _mbsnicmp_l(str str long ptr)
@ stub _mbsnicoll(str str long) @ stub _mbsnicoll(str str long)
@ stub _mbsnicoll_l @ stub _mbsnicoll_l
@ cdecl _mbsninc(str long) @ cdecl _mbsninc(str long)
......
...@@ -1519,7 +1519,7 @@ ...@@ -1519,7 +1519,7 @@
@ cdecl _mbsnextc(str) @ cdecl _mbsnextc(str)
@ cdecl _mbsnextc_l(str ptr) @ cdecl _mbsnextc_l(str ptr)
@ cdecl _mbsnicmp(str str long) @ cdecl _mbsnicmp(str str long)
@ stub _mbsnicmp_l @ cdecl _mbsnicmp_l(str str long ptr)
@ stub _mbsnicoll(str str long) @ stub _mbsnicoll(str str long)
@ stub _mbsnicoll_l @ stub _mbsnicoll_l
@ cdecl _mbsninc(str long) @ cdecl _mbsninc(str long)
......
...@@ -1530,7 +1530,7 @@ ...@@ -1530,7 +1530,7 @@
@ cdecl _mbsnextc(str) @ cdecl _mbsnextc(str)
@ cdecl _mbsnextc_l(str ptr) @ cdecl _mbsnextc_l(str ptr)
@ cdecl _mbsnicmp(str str long) @ cdecl _mbsnicmp(str str long)
@ stub _mbsnicmp_l @ cdecl _mbsnicmp_l(str str long ptr)
@ stub _mbsnicoll(str str long) @ stub _mbsnicoll(str str long)
@ stub _mbsnicoll_l @ stub _mbsnicoll_l
@ cdecl _mbsninc(str long) @ cdecl _mbsninc(str long)
......
...@@ -834,7 +834,7 @@ ...@@ -834,7 +834,7 @@
@ cdecl _mbsnextc(str) @ cdecl _mbsnextc(str)
@ cdecl _mbsnextc_l(str ptr) @ cdecl _mbsnextc_l(str ptr)
@ cdecl _mbsnicmp(str str long) @ cdecl _mbsnicmp(str str long)
@ stub _mbsnicmp_l @ cdecl _mbsnicmp_l(str str long ptr)
@ stub _mbsnicoll(str str long) @ stub _mbsnicoll(str str long)
@ stub _mbsnicoll_l @ stub _mbsnicoll_l
@ cdecl _mbsninc(str long) @ cdecl _mbsninc(str long)
......
...@@ -812,7 +812,7 @@ ...@@ -812,7 +812,7 @@
@ cdecl _mbsnextc(str) @ cdecl _mbsnextc(str)
@ cdecl _mbsnextc_l(str ptr) @ cdecl _mbsnextc_l(str ptr)
@ cdecl _mbsnicmp(str str long) @ cdecl _mbsnicmp(str str long)
@ stub _mbsnicmp_l @ cdecl _mbsnicmp_l(str str long ptr)
@ stub _mbsnicoll(str str long) @ stub _mbsnicoll(str str long)
@ stub _mbsnicoll_l @ stub _mbsnicoll_l
@ cdecl _mbsninc(str long) @ cdecl _mbsninc(str long)
......
...@@ -1297,28 +1297,49 @@ int CDECL _mbsnbcmp(const unsigned char* str, const unsigned char* cmp, size_t l ...@@ -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. * 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 */ pthreadmbcinfo mbcinfo;
if(get_mbcinfo()->ismbcodepage)
{ if (!len)
unsigned int strc, cmpc; return 0;
while(len--) 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) unsigned int strc, cmpc;
return *cmp ? -1 : 0; while (len--)
if(!*cmp) {
return 1; if (!*str)
strc = _mbctolower(_mbsnextc(str)); return *cmp ? -1 : 0;
cmpc = _mbctolower(_mbsnextc(cmp)); if (!*cmp)
if(strc != cmpc) return 1;
return strc < cmpc ? -1 : 1; strc = _mbctolower_l(_mbsnextc_l(str, locale), locale);
str +=(strc > 255) ? 2 : 1; cmpc = _mbctolower_l(_mbsnextc_l(cmp, locale), locale);
cmp +=(strc > 255) ? 2 : 1; /* Equal, use same increment */ 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 @@ ...@@ -783,7 +783,7 @@
@ cdecl _mbsnextc(str) @ cdecl _mbsnextc(str)
@ cdecl _mbsnextc_l(str ptr) @ cdecl _mbsnextc_l(str ptr)
@ cdecl _mbsnicmp(str str long) @ 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(str str long)
# stub _mbsnicoll_l(str str long ptr) # stub _mbsnicoll_l(str str long ptr)
@ cdecl _mbsninc(str long) @ cdecl _mbsninc(str long)
......
...@@ -678,7 +678,7 @@ ...@@ -678,7 +678,7 @@
@ cdecl _mbsnextc(str) @ cdecl _mbsnextc(str)
@ cdecl _mbsnextc_l(str ptr) @ cdecl _mbsnextc_l(str ptr)
@ cdecl _mbsnicmp(str str long) @ cdecl _mbsnicmp(str str long)
@ stub _mbsnicmp_l @ cdecl _mbsnicmp_l(str str long ptr)
@ stub _mbsnicoll(str str long) @ stub _mbsnicoll(str str long)
@ stub _mbsnicoll_l @ stub _mbsnicoll_l
@ cdecl _mbsninc(str long) @ cdecl _mbsninc(str long)
...@@ -1247,7 +1247,7 @@ ...@@ -1247,7 +1247,7 @@
@ cdecl _o__mbsnextc(str) _mbsnextc @ cdecl _o__mbsnextc(str) _mbsnextc
@ cdecl _o__mbsnextc_l(str ptr) _mbsnextc_l @ cdecl _o__mbsnextc_l(str ptr) _mbsnextc_l
@ cdecl _o__mbsnicmp(str str long) _mbsnicmp @ 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
@ stub _o__mbsnicoll_l @ stub _o__mbsnicoll_l
@ cdecl _o__mbsninc(str long) _mbsninc @ 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