Commit 2a89257b authored by Bartosz Kosiorek's avatar Bartosz Kosiorek Committed by Alexandre Julliard

msvcrt: Add _mbsnbcnt_l implementation.

parent 544007be
......@@ -1130,7 +1130,7 @@
@ cdecl _mbsnbcmp(str str long)
@ cdecl _mbsnbcmp_l(str str long ptr)
@ cdecl _mbsnbcnt(ptr long)
@ stub _mbsnbcnt_l
@ cdecl _mbsnbcnt_l(ptr long ptr)
@ cdecl _mbsnbcoll(str str long)
@ cdecl _mbsnbcoll_l(str str long ptr)
@ cdecl _mbsnbcpy(ptr str long)
......
......@@ -1487,7 +1487,7 @@
@ cdecl _mbsnbcmp(str str long)
@ cdecl _mbsnbcmp_l(str str long ptr)
@ cdecl _mbsnbcnt(ptr long)
@ stub _mbsnbcnt_l
@ cdecl _mbsnbcnt_l(ptr long ptr)
@ cdecl _mbsnbcoll(str str long)
@ cdecl _mbsnbcoll_l(str str long ptr)
@ cdecl _mbsnbcpy(ptr str long)
......
......@@ -1498,7 +1498,7 @@
@ cdecl _mbsnbcmp(str str long)
@ cdecl _mbsnbcmp_l(str str long ptr)
@ cdecl _mbsnbcnt(ptr long)
@ stub _mbsnbcnt_l
@ cdecl _mbsnbcnt_l(ptr long ptr)
@ cdecl _mbsnbcoll(str str long)
@ cdecl _mbsnbcoll_l(str str long ptr)
@ cdecl _mbsnbcpy(ptr str long)
......
......@@ -802,7 +802,7 @@
@ cdecl _mbsnbcmp(str str long)
@ cdecl _mbsnbcmp_l(str str long ptr)
@ cdecl _mbsnbcnt(ptr long)
@ stub _mbsnbcnt_l
@ cdecl _mbsnbcnt_l(ptr long ptr)
@ cdecl _mbsnbcoll(str str long)
@ cdecl _mbsnbcoll_l(str str long ptr)
@ cdecl _mbsnbcpy(ptr str long)
......
......@@ -780,7 +780,7 @@
@ cdecl _mbsnbcmp(str str long)
@ cdecl _mbsnbcmp_l(str str long ptr)
@ cdecl _mbsnbcnt(ptr long)
@ stub _mbsnbcnt_l
@ cdecl _mbsnbcnt_l(ptr long ptr)
@ cdecl _mbsnbcoll(str str long)
@ cdecl _mbsnbcoll_l(str str long ptr)
@ cdecl _mbsnbcpy(ptr str long)
......
......@@ -2206,24 +2206,44 @@ size_t CDECL _mbsnccnt(const unsigned char* str, size_t len)
}
/*********************************************************************
* _mbsnbcnt(MSVCRT.@)
* _mbsnbcnt_l(MSVCRT.@)
* 'b' is for byte count.
*/
size_t CDECL _mbsnbcnt(const unsigned char* str, size_t len)
size_t CDECL _mbsnbcnt_l(const unsigned char* str, size_t len, _locale_t locale)
{
size_t ret;
if(get_mbcinfo()->ismbcodepage)
{
const unsigned char* xstr = str;
while(*xstr && len-- > 0)
size_t ret;
pthreadmbcinfo mbcinfo;
if (!len)
return 0;
if (!MSVCRT_CHECK_PMT(str))
return 0;
if (locale)
mbcinfo = locale->mbcinfo;
else
mbcinfo = get_mbcinfo();
if (mbcinfo->ismbcodepage)
{
if (_ismbblead(*xstr++))
xstr++;
const unsigned char* xstr = str;
while (*xstr && len-- > 0)
{
if (_ismbblead_l(*xstr++, locale))
xstr++;
}
return xstr - str;
}
return xstr-str;
}
ret=u_strlen(str);
return min(ret, len); /* ASCII CP */
ret = u_strlen(str);
return min(ret, len); /* ASCII CP */
}
/*********************************************************************
* _mbsnbcnt(MSVCRT.@)
* 'b' is for byte count.
*/
size_t CDECL _mbsnbcnt(const unsigned char* str, size_t len)
{
return _mbsnbcnt_l(str, len, NULL);
}
/*********************************************************************
......
......@@ -751,7 +751,7 @@
@ cdecl _mbsnbcmp(str str long)
@ cdecl _mbsnbcmp_l(str str long ptr)
@ cdecl _mbsnbcnt(ptr long)
# stub _mbsnbcnt_l(ptr long ptr)
@ cdecl _mbsnbcnt_l(ptr long ptr)
@ cdecl _mbsnbcoll(str str long)
@ cdecl _mbsnbcoll_l(str str long ptr)
@ cdecl _mbsnbcpy(ptr str long)
......
......@@ -646,7 +646,7 @@
@ cdecl _mbsnbcmp(str str long)
@ cdecl _mbsnbcmp_l(str str long ptr)
@ cdecl _mbsnbcnt(ptr long)
@ stub _mbsnbcnt_l
@ cdecl _mbsnbcnt_l(ptr long ptr)
@ cdecl _mbsnbcoll(str str long)
@ cdecl _mbsnbcoll_l(str str long ptr)
@ cdecl _mbsnbcpy(ptr str long)
......@@ -1215,7 +1215,7 @@
@ cdecl _o__mbsnbcmp(str str long) _mbsnbcmp
@ cdecl _o_mbsnbcmp_l(str str long ptr) _mbsnbcmp_l
@ cdecl _o__mbsnbcnt(ptr long) _mbsnbcnt
@ stub _o__mbsnbcnt_l
@ cdecl _o__mbsnbcnt_l(ptr long ptr) _mbsnbcnt_l
@ cdecl _o__mbsnbcoll(str str long) _mbsnbcoll
@ cdecl _o__mbsnbcoll_l(str str long ptr) _mbsnbcoll_l
@ cdecl _o__mbsnbcpy(ptr str long) _mbsnbcpy
......
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