Commit f097c2be authored by Piotr Caban's avatar Piotr Caban Committed by Alexandre Julliard

msvcrt: Add mbsnlen_l implementation.

parent bce8330f
...@@ -112,7 +112,7 @@ ...@@ -112,7 +112,7 @@
@ cdecl _mbsinc(str) ucrtbase._mbsinc @ cdecl _mbsinc(str) ucrtbase._mbsinc
@ stub _mbsinc_l @ stub _mbsinc_l
@ cdecl _mbslen(str) ucrtbase._mbslen @ cdecl _mbslen(str) ucrtbase._mbslen
@ stub _mbslen_l @ cdecl _mbslen_l(str ptr) ucrtbase._mbslen_l
@ cdecl _mbslwr(str) ucrtbase._mbslwr @ cdecl _mbslwr(str) ucrtbase._mbslwr
@ stub _mbslwr_l @ stub _mbslwr_l
@ cdecl _mbslwr_s(str long) ucrtbase._mbslwr_s @ cdecl _mbslwr_s(str long) ucrtbase._mbslwr_s
...@@ -161,8 +161,8 @@ ...@@ -161,8 +161,8 @@
@ stub _mbsnicoll_l @ stub _mbsnicoll_l
@ cdecl _mbsninc(str long) ucrtbase._mbsninc @ cdecl _mbsninc(str long) ucrtbase._mbsninc
@ stub _mbsninc_l @ stub _mbsninc_l
@ stub _mbsnlen @ cdecl _mbsnlen(str long) ucrtbase._mbsnlen
@ stub _mbsnlen_l @ cdecl _mbsnlen_l(str long ptr) ucrtbase._mbsnlen_l
@ cdecl _mbsnset(ptr long long) ucrtbase._mbsnset @ cdecl _mbsnset(ptr long long) ucrtbase._mbsnset
@ stub _mbsnset_l @ stub _mbsnset_l
@ stub _mbsnset_s @ stub _mbsnset_s
......
...@@ -1118,7 +1118,7 @@ ...@@ -1118,7 +1118,7 @@
@ cdecl _mbsinc(str) @ cdecl _mbsinc(str)
@ stub _mbsinc_l @ stub _mbsinc_l
@ cdecl _mbslen(str) @ cdecl _mbslen(str)
@ stub _mbslen_l @ cdecl _mbslen_l(str ptr)
@ cdecl _mbslwr(str) @ cdecl _mbslwr(str)
@ stub _mbslwr_l @ stub _mbslwr_l
@ cdecl _mbslwr_s(str long) @ cdecl _mbslwr_s(str long)
...@@ -1167,8 +1167,8 @@ ...@@ -1167,8 +1167,8 @@
@ stub _mbsnicoll_l @ stub _mbsnicoll_l
@ cdecl _mbsninc(str long) @ cdecl _mbsninc(str long)
@ stub _mbsninc_l @ stub _mbsninc_l
@ stub _mbsnlen @ cdecl _mbsnlen(str long)
@ stub _mbsnlen_l @ cdecl _mbsnlen_l(str long ptr)
@ cdecl _mbsnset(ptr long long) @ cdecl _mbsnset(ptr long long)
@ stub _mbsnset_l @ stub _mbsnset_l
@ stub _mbsnset_s @ stub _mbsnset_s
......
...@@ -1475,7 +1475,7 @@ ...@@ -1475,7 +1475,7 @@
@ cdecl _mbsinc(str) @ cdecl _mbsinc(str)
@ stub _mbsinc_l @ stub _mbsinc_l
@ cdecl _mbslen(str) @ cdecl _mbslen(str)
@ stub _mbslen_l @ cdecl _mbslen_l(str ptr)
@ cdecl _mbslwr(str) @ cdecl _mbslwr(str)
@ stub _mbslwr_l @ stub _mbslwr_l
@ cdecl _mbslwr_s(str long) @ cdecl _mbslwr_s(str long)
...@@ -1524,8 +1524,8 @@ ...@@ -1524,8 +1524,8 @@
@ stub _mbsnicoll_l @ stub _mbsnicoll_l
@ cdecl _mbsninc(str long) @ cdecl _mbsninc(str long)
@ stub _mbsninc_l @ stub _mbsninc_l
@ stub _mbsnlen @ cdecl _mbsnlen(str long)
@ stub _mbsnlen_l @ cdecl _mbsnlen_l(str long ptr)
@ cdecl _mbsnset(ptr long long) @ cdecl _mbsnset(ptr long long)
@ stub _mbsnset_l @ stub _mbsnset_l
@ stub _mbsnset_s @ stub _mbsnset_s
......
...@@ -1485,7 +1485,7 @@ ...@@ -1485,7 +1485,7 @@
@ cdecl _mbsinc(str) @ cdecl _mbsinc(str)
@ stub _mbsinc_l @ stub _mbsinc_l
@ cdecl _mbslen(str) @ cdecl _mbslen(str)
@ stub _mbslen_l @ cdecl _mbslen_l(str ptr)
@ cdecl _mbslwr(str) @ cdecl _mbslwr(str)
@ stub _mbslwr_l @ stub _mbslwr_l
@ cdecl _mbslwr_s(str long) @ cdecl _mbslwr_s(str long)
...@@ -1534,8 +1534,8 @@ ...@@ -1534,8 +1534,8 @@
@ stub _mbsnicoll_l @ stub _mbsnicoll_l
@ cdecl _mbsninc(str long) @ cdecl _mbsninc(str long)
@ stub _mbsninc_l @ stub _mbsninc_l
@ stub _mbsnlen @ cdecl _mbsnlen(str long)
@ stub _mbsnlen_l @ cdecl _mbsnlen_l(str long ptr)
@ cdecl _mbsnset(ptr long long) @ cdecl _mbsnset(ptr long long)
@ stub _mbsnset_l @ stub _mbsnset_l
@ stub _mbsnset_s @ stub _mbsnset_s
......
...@@ -790,7 +790,7 @@ ...@@ -790,7 +790,7 @@
@ cdecl _mbsinc(str) @ cdecl _mbsinc(str)
@ stub _mbsinc_l @ stub _mbsinc_l
@ cdecl _mbslen(str) @ cdecl _mbslen(str)
@ stub _mbslen_l @ cdecl _mbslen_l(str ptr)
@ cdecl _mbslwr(str) @ cdecl _mbslwr(str)
@ stub _mbslwr_l @ stub _mbslwr_l
@ cdecl _mbslwr_s(str long) @ cdecl _mbslwr_s(str long)
...@@ -839,8 +839,8 @@ ...@@ -839,8 +839,8 @@
@ stub _mbsnicoll_l @ stub _mbsnicoll_l
@ cdecl _mbsninc(str long) @ cdecl _mbsninc(str long)
@ stub _mbsninc_l @ stub _mbsninc_l
@ stub _mbsnlen @ cdecl _mbsnlen(str long)
@ stub _mbsnlen_l @ cdecl _mbsnlen_l(str long ptr)
@ cdecl _mbsnset(ptr long long) @ cdecl _mbsnset(ptr long long)
@ stub _mbsnset_l @ stub _mbsnset_l
@ stub _mbsnset_s @ stub _mbsnset_s
......
...@@ -768,7 +768,7 @@ ...@@ -768,7 +768,7 @@
@ cdecl _mbsinc(str) @ cdecl _mbsinc(str)
@ stub _mbsinc_l @ stub _mbsinc_l
@ cdecl _mbslen(str) @ cdecl _mbslen(str)
@ stub _mbslen_l @ cdecl _mbslen_l(str ptr)
@ cdecl _mbslwr(str) @ cdecl _mbslwr(str)
@ stub _mbslwr_l @ stub _mbslwr_l
@ cdecl _mbslwr_s(str long) @ cdecl _mbslwr_s(str long)
...@@ -817,8 +817,8 @@ ...@@ -817,8 +817,8 @@
@ stub _mbsnicoll_l @ stub _mbsnicoll_l
@ cdecl _mbsninc(str long) @ cdecl _mbsninc(str long)
@ stub _mbsninc_l @ stub _mbsninc_l
@ stub _mbsnlen @ cdecl _mbsnlen(str long)
@ stub _mbsnlen_l @ cdecl _mbsnlen_l(str long ptr)
@ cdecl _mbsnset(ptr long long) @ cdecl _mbsnset(ptr long long)
@ stub _mbsnset_l @ stub _mbsnset_l
@ stub _mbsnset_s @ stub _mbsnset_s
......
...@@ -569,23 +569,58 @@ unsigned char* CDECL _mbsninc(const unsigned char* str, MSVCRT_size_t num) ...@@ -569,23 +569,58 @@ unsigned char* CDECL _mbsninc(const unsigned char* str, MSVCRT_size_t num)
} }
/********************************************************************* /*********************************************************************
* _mbslen(MSVCRT.@) * _mbsnlen_l(MSVCRT.@)
*/ */
MSVCRT_size_t CDECL _mbslen(const unsigned char* str) MSVCRT_size_t CDECL _mbsnlen_l(const unsigned char *str,
MSVCRT_size_t maxsize, MSVCRT__locale_t locale)
{ {
MSVCRT_size_t len = 0; MSVCRT_pthreadmbcinfo mbcinfo;
while(*str) MSVCRT_size_t i = 0, len = 0;
if(!locale)
mbcinfo = get_mbcinfo();
else
mbcinfo = locale->mbcinfo;
if(!mbcinfo->ismbcodepage)
return MSVCRT_strnlen((const char*)str, maxsize);
while(i<maxsize && str[i])
{ {
if (_ismbblead(*str)) if (_ismbblead_l(str[i], locale))
{ {
str++; i++;
if (!*str) /* count only full chars */ if (!str[i]) /* count only full chars */
break; break;
} }
str++; i++;
len++; len++;
} }
return len; return i < maxsize ? len : maxsize;
}
/*********************************************************************
* _mbslen(MSVCRT.@)
*/
MSVCRT_size_t CDECL _mbslen(const unsigned char* str)
{
return _mbsnlen_l(str, -1, NULL);
}
/*********************************************************************
* _mbslen_l(MSVCRT.@)
*/
MSVCRT_size_t CDECL _mbslen_l(const unsigned char* str, MSVCRT__locale_t locale)
{
return _mbsnlen_l(str, -1, locale);
}
/*********************************************************************
* _mbsnlen(MSVCRT.@)
*/
MSVCRT_size_t CDECL _mbsnlen(const unsigned char* str, MSVCRT_size_t maxsize)
{
return _mbsnlen_l(str, maxsize, NULL);
} }
/********************************************************************* /*********************************************************************
......
...@@ -737,7 +737,7 @@ ...@@ -737,7 +737,7 @@
@ cdecl _mbsinc(str) @ cdecl _mbsinc(str)
# stub _mbsinc_l(str ptr) # stub _mbsinc_l(str ptr)
@ cdecl _mbslen(str) @ cdecl _mbslen(str)
# stub _mbslen_l(str ptr) @ cdecl _mbslen_l(str ptr)
@ cdecl _mbslwr(str) @ cdecl _mbslwr(str)
# stub _mbslwr_l(str ptr) # stub _mbslwr_l(str ptr)
@ cdecl _mbslwr_s(str long) @ cdecl _mbslwr_s(str long)
...@@ -786,8 +786,8 @@ ...@@ -786,8 +786,8 @@
# stub _mbsnicoll_l(str str long ptr) # stub _mbsnicoll_l(str str long ptr)
@ cdecl _mbsninc(str long) @ cdecl _mbsninc(str long)
# stub _mbsninc_l(str long ptr) # stub _mbsninc_l(str long ptr)
# stub _mbsnlen(str long) @ cdecl _mbsnlen(str long)
# stub _mbsnlen_l(str long ptr) @ cdecl _mbsnlen_l(str long ptr)
@ cdecl _mbsnset(ptr long long) @ cdecl _mbsnset(ptr long long)
# stub _mbsnset_l(ptr long long ptr) # stub _mbsnset_l(ptr long long ptr)
# stub _mbsnset_s(ptr long long long) # stub _mbsnset_s(ptr long long long)
......
...@@ -631,7 +631,7 @@ ...@@ -631,7 +631,7 @@
@ cdecl _mbsinc(str) @ cdecl _mbsinc(str)
@ stub _mbsinc_l @ stub _mbsinc_l
@ cdecl _mbslen(str) @ cdecl _mbslen(str)
@ stub _mbslen_l @ cdecl _mbslen_l(str ptr)
@ cdecl _mbslwr(str) @ cdecl _mbslwr(str)
@ stub _mbslwr_l @ stub _mbslwr_l
@ cdecl _mbslwr_s(str long) @ cdecl _mbslwr_s(str long)
...@@ -680,8 +680,8 @@ ...@@ -680,8 +680,8 @@
@ stub _mbsnicoll_l @ stub _mbsnicoll_l
@ cdecl _mbsninc(str long) @ cdecl _mbsninc(str long)
@ stub _mbsninc_l @ stub _mbsninc_l
@ stub _mbsnlen @ cdecl _mbsnlen(str long)
@ stub _mbsnlen_l @ cdecl _mbsnlen_l(str long ptr)
@ cdecl _mbsnset(ptr long long) @ cdecl _mbsnset(ptr long long)
@ stub _mbsnset_l @ stub _mbsnset_l
@ stub _mbsnset_s @ stub _mbsnset_s
......
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