Commit f73d74c6 authored by Bartosz Kosiorek's avatar Bartosz Kosiorek Committed by Alexandre Julliard

msvcrt: Add _mbsncmp_l implementation.

parent 8f303050
...@@ -1152,7 +1152,7 @@ ...@@ -1152,7 +1152,7 @@
@ cdecl _mbsnccnt(str long) @ cdecl _mbsnccnt(str long)
@ cdecl _mbsnccnt_l(str long ptr) @ cdecl _mbsnccnt_l(str long ptr)
@ cdecl _mbsncmp(str str long) @ cdecl _mbsncmp(str str long)
@ stub _mbsncmp_l @ cdecl _mbsncmp_l(str str long ptr)
@ stub _mbsncoll(str str long) @ stub _mbsncoll(str str long)
@ stub _mbsncoll_l @ stub _mbsncoll_l
@ cdecl _mbsncpy(ptr str long) @ cdecl _mbsncpy(ptr str long)
......
...@@ -1509,7 +1509,7 @@ ...@@ -1509,7 +1509,7 @@
@ cdecl _mbsnccnt(str long) @ cdecl _mbsnccnt(str long)
@ cdecl _mbsnccnt_l(str long ptr) @ cdecl _mbsnccnt_l(str long ptr)
@ cdecl _mbsncmp(str str long) @ cdecl _mbsncmp(str str long)
@ stub _mbsncmp_l @ cdecl _mbsncmp_l(str str long ptr)
@ stub _mbsncoll(str str long) @ stub _mbsncoll(str str long)
@ stub _mbsncoll_l @ stub _mbsncoll_l
@ cdecl _mbsncpy(ptr str long) @ cdecl _mbsncpy(ptr str long)
......
...@@ -1520,7 +1520,7 @@ ...@@ -1520,7 +1520,7 @@
@ cdecl _mbsnccnt(str long) @ cdecl _mbsnccnt(str long)
@ cdecl _mbsnccnt_l(str long ptr) @ cdecl _mbsnccnt_l(str long ptr)
@ cdecl _mbsncmp(str str long) @ cdecl _mbsncmp(str str long)
@ stub _mbsncmp_l @ cdecl _mbsncmp_l(str str long ptr)
@ stub _mbsncoll(str str long) @ stub _mbsncoll(str str long)
@ stub _mbsncoll_l @ stub _mbsncoll_l
@ cdecl _mbsncpy(ptr str long) @ cdecl _mbsncpy(ptr str long)
......
...@@ -824,7 +824,7 @@ ...@@ -824,7 +824,7 @@
@ cdecl _mbsnccnt(str long) @ cdecl _mbsnccnt(str long)
@ cdecl _mbsnccnt_l(str long ptr) @ cdecl _mbsnccnt_l(str long ptr)
@ cdecl _mbsncmp(str str long) @ cdecl _mbsncmp(str str long)
@ stub _mbsncmp_l @ cdecl _mbsncmp_l(str str long ptr)
@ stub _mbsncoll(str str long) @ stub _mbsncoll(str str long)
@ stub _mbsncoll_l @ stub _mbsncoll_l
@ cdecl _mbsncpy(ptr str long) @ cdecl _mbsncpy(ptr str long)
......
...@@ -802,7 +802,7 @@ ...@@ -802,7 +802,7 @@
@ cdecl _mbsnccnt(str long) @ cdecl _mbsnccnt(str long)
@ cdecl _mbsnccnt_l(str long ptr) @ cdecl _mbsnccnt_l(str long ptr)
@ cdecl _mbsncmp(str str long) @ cdecl _mbsncmp(str str long)
@ stub _mbsncmp_l @ cdecl _mbsncmp_l(str str long ptr)
@ stub _mbsncoll(str str long) @ stub _mbsncoll(str str long)
@ stub _mbsncoll_l @ stub _mbsncoll_l
@ cdecl _mbsncpy(ptr str long) @ cdecl _mbsncpy(ptr str long)
......
...@@ -1225,34 +1225,53 @@ int CDECL _mbsicmp(const unsigned char* str, const unsigned char* cmp) ...@@ -1225,34 +1225,53 @@ int CDECL _mbsicmp(const unsigned char* str, const unsigned char* cmp)
} }
/********************************************************************* /*********************************************************************
* _mbsncmp(MSVCRT.@) * _mbsncmp_l(MSVCRT.@)
*/ */
int CDECL _mbsncmp(const unsigned char* str, const unsigned char* cmp, size_t len) int CDECL _mbsncmp_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)
{
unsigned int strc, cmpc; unsigned int strc, cmpc;
while(len--)
if (!len)
return 0;
if (locale)
mbcinfo = locale->mbcinfo;
else
mbcinfo = get_mbcinfo();
if (!mbcinfo->ismbcodepage)
return u_strncmp(str, cmp, len); /* ASCII CP */
if (!MSVCRT_CHECK_PMT(str && cmp))
return _NLSCMPERROR;
while (len--)
{ {
int inc; int inc;
if(!*str)
return *cmp ? -1 : 0; if (!*str)
if(!*cmp) return *cmp ? -1 : 0;
return 1; if (!*cmp)
strc = _mbsnextc(str); return 1;
cmpc = _mbsnextc(cmp); strc = _mbsnextc_l(str, locale);
if(strc != cmpc) cmpc = _mbsnextc_l(cmp, locale);
return strc < cmpc ? -1 : 1; if (strc != cmpc)
inc=(strc > 255) ? 2 : 1; /* Equal, use same increment */ return strc < cmpc ? -1 : 1;
str += inc; inc = (strc > 255) ? 2 : 1; /* Equal, use same increment */
cmp += inc; str += inc;
cmp += inc;
} }
return 0; /* Matched len chars */ return 0; /* Matched len chars */
} }
return u_strncmp(str, cmp, len); /* ASCII CP */
/*********************************************************************
* _mbsncmp(MSVCRT.@)
*/
int CDECL _mbsncmp(const unsigned char* str, const unsigned char* cmp, size_t len)
{
return _mbsncmp_l(str, cmp, len, NULL);
} }
/********************************************************************* /*********************************************************************
......
...@@ -773,7 +773,7 @@ ...@@ -773,7 +773,7 @@
@ cdecl _mbsnccnt(str long) @ cdecl _mbsnccnt(str long)
@ cdecl _mbsnccnt_l(str long ptr) @ cdecl _mbsnccnt_l(str long ptr)
@ cdecl _mbsncmp(str str long) @ cdecl _mbsncmp(str str long)
# stub _mbsncmp_l(str str long ptr) @ cdecl _mbsncmp_l(str str long ptr)
@ stub _mbsncoll(str str long) @ stub _mbsncoll(str str long)
# stub _mbsncoll_l(str str long ptr) # stub _mbsncoll_l(str str long ptr)
@ cdecl _mbsncpy(ptr str long) @ cdecl _mbsncpy(ptr str long)
......
...@@ -668,7 +668,7 @@ ...@@ -668,7 +668,7 @@
@ cdecl _mbsnccnt(str long) @ cdecl _mbsnccnt(str long)
@ cdecl _mbsnccnt_l(str long ptr) @ cdecl _mbsnccnt_l(str long ptr)
@ cdecl _mbsncmp(str str long) @ cdecl _mbsncmp(str str long)
@ stub _mbsncmp_l @ cdecl _mbsncmp_l(str str long ptr)
@ stub _mbsncoll(str str long) @ stub _mbsncoll(str str long)
@ stub _mbsncoll_l @ stub _mbsncoll_l
@ cdecl _mbsncpy(ptr str long) @ cdecl _mbsncpy(ptr str long)
...@@ -1237,7 +1237,7 @@ ...@@ -1237,7 +1237,7 @@
@ cdecl _o__mbsnccnt(str long) _mbsnccnt @ cdecl _o__mbsnccnt(str long) _mbsnccnt
@ cdecl _o__mbsnccnt_l(str long ptr) _mbsnccnt_l @ cdecl _o__mbsnccnt_l(str long ptr) _mbsnccnt_l
@ cdecl _o__mbsncmp(str str long) _mbsncmp @ cdecl _o__mbsncmp(str str long) _mbsncmp
@ stub _o__mbsncmp_l @ cdecl _o__mbsncmp_l(str str long ptr) _mbsncmp_l
@ stub _o__mbsncoll @ stub _o__mbsncoll
@ stub _o__mbsncoll_l @ stub _o__mbsncoll_l
@ cdecl _o__mbsncpy(ptr str long) _mbsncpy @ cdecl _o__mbsncpy(ptr str long) _mbsncpy
......
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