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,24 +1297,35 @@ int CDECL _mbsnbcmp(const unsigned char* str, const unsigned char* cmp, size_t l ...@@ -1297,24 +1297,35 @@ 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)
{ {
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 */ /* FIXME: No tolower() for mb strings yet */
if(get_mbcinfo()->ismbcodepage) if (mbcinfo->ismbcodepage)
{ {
unsigned int strc, cmpc; unsigned int strc, cmpc;
while(len--) while (len--)
{ {
if(!*str) if (!*str)
return *cmp ? -1 : 0; return *cmp ? -1 : 0;
if(!*cmp) if (!*cmp)
return 1; return 1;
strc = _mbctolower(_mbsnextc(str)); strc = _mbctolower_l(_mbsnextc_l(str, locale), locale);
cmpc = _mbctolower(_mbsnextc(cmp)); cmpc = _mbctolower_l(_mbsnextc_l(cmp, locale), locale);
if(strc != cmpc) if (strc != cmpc)
return strc < cmpc ? -1 : 1; return strc < cmpc ? -1 : 1;
str +=(strc > 255) ? 2 : 1; str += (strc > 255) ? 2 : 1;
cmp +=(strc > 255) ? 2 : 1; /* Equal, use same increment */ cmp += (strc > 255) ? 2 : 1; /* Equal, use same increment */
} }
return 0; /* Matched len chars */ return 0; /* Matched len chars */
} }
...@@ -1322,6 +1333,16 @@ int CDECL _mbsnicmp(const unsigned char* str, const unsigned char* cmp, size_t l ...@@ -1322,6 +1333,16 @@ int CDECL _mbsnicmp(const unsigned char* str, const unsigned char* cmp, size_t l
} }
/********************************************************************* /*********************************************************************
* _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);
}
/*********************************************************************
* _mbsnbicmp(MSVCRT.@) * _mbsnbicmp(MSVCRT.@)
*/ */
int CDECL _mbsnbicmp(const unsigned char* str, const unsigned char* cmp, size_t len) int CDECL _mbsnbicmp(const unsigned char* str, const unsigned char* cmp, size_t len)
......
...@@ -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