msvcrt: Added _mbstrlen_l implementation.

This commit is contained in:
Piotr Caban 2010-05-06 14:27:22 +02:00 committed by Alexandre Julliard
parent df6cd82ccf
commit d367314b46
2 changed files with 25 additions and 18 deletions

View File

@ -1689,18 +1689,16 @@ int CDECL MSVCRT_mblen(const char* str, MSVCRT_size_t size)
} }
/********************************************************************* /*********************************************************************
* _mbstrlen(MSVCRT.@) * _mbstrlen_l(MSVCRT.@)
* REMARKS
* Unlike most of the multibyte string functions this function uses
* the locale codepage, not the codepage set by _setmbcp
*/ */
MSVCRT_size_t CDECL _mbstrlen(const char* str) MSVCRT_size_t CDECL _mbstrlen_l(const char* str, MSVCRT__locale_t locale)
{ {
if(get_locale()->locinfo->mb_cur_max > 1) if(!locale)
{ locale = get_locale();
if(locale->locinfo->mb_cur_max > 1) {
MSVCRT_size_t len = 0; MSVCRT_size_t len = 0;
while(*str) while(*str) {
{
/* FIXME: According to the documentation we are supposed to test for /* FIXME: According to the documentation we are supposed to test for
* multi-byte character validity. Whatever that means * multi-byte character validity. Whatever that means
*/ */
@ -1709,5 +1707,14 @@ MSVCRT_size_t CDECL _mbstrlen(const char* str)
} }
return len; return len;
} }
return strlen(str); /* ASCII CP */
return strlen(str);
}
/*********************************************************************
* _mbstrlen(MSVCRT.@)
*/
MSVCRT_size_t CDECL _mbstrlen(const char* str)
{
return _mbstrlen_l(str, NULL);
} }

View File

@ -734,7 +734,7 @@
# stub _mbstowcs_l # stub _mbstowcs_l
# stub _mbstowcs_s_l # stub _mbstowcs_s_l
@ cdecl _mbstrlen(str) @ cdecl _mbstrlen(str)
# stub _mbstrlen_l @ cdecl _mbstrlen_l(str ptr)
# stub _mbstrnlen # stub _mbstrnlen
# stub _mbstrnlen_l # stub _mbstrnlen_l
@ cdecl _mbsupr(str) @ cdecl _mbsupr(str)