msvcrt: Add _mblen_l implementation.

This commit is contained in:
Bartosz Kosiorek 2023-11-07 23:06:30 +01:00 committed by Alexandre Julliard
parent 8bb0692ff6
commit 707198babe
9 changed files with 31 additions and 18 deletions

View file

@ -1094,7 +1094,7 @@
@ cdecl _mbctoupper(long)
@ cdecl _mbctoupper_l(long ptr)
@ extern _mbctype MSVCRT_mbctype
@ stub _mblen_l
@ cdecl _mblen_l(str long ptr)
@ cdecl _mbsbtype(str long)
@ cdecl _mbsbtype_l(str long ptr)
@ cdecl _mbscat_s(ptr long str)

View file

@ -1451,7 +1451,7 @@
@ cdecl _mbctoupper(long)
@ cdecl _mbctoupper_l(long ptr)
@ extern _mbctype MSVCRT_mbctype
@ stub _mblen_l
@ cdecl _mblen_l(str long ptr)
@ cdecl _mbsbtype(str long)
@ cdecl _mbsbtype_l(str long ptr)
@ cdecl _mbscat_s(ptr long str)

View file

@ -1462,7 +1462,7 @@
@ cdecl _mbctoupper(long)
@ cdecl _mbctoupper_l(long ptr)
@ extern _mbctype MSVCRT_mbctype
@ stub _mblen_l
@ cdecl _mblen_l(str long ptr)
@ cdecl _mbsbtype(str long)
@ cdecl _mbsbtype_l(str long ptr)
@ cdecl _mbscat_s(ptr long str)

View file

@ -1302,7 +1302,7 @@
@ cdecl _malloc_crt(long) msvcr120._malloc_crt
# extern _mbcasemap
@ extern _mbctype msvcr120._mbctype
@ stub _mblen_l
@ cdecl _mblen_l(str long ptr) msvcr120._mblen_l
@ cdecl _mbstowcs_l(ptr str long ptr) msvcr120._mbstowcs_l
@ cdecl _mbstowcs_s_l(ptr ptr long str long ptr) msvcr120._mbstowcs_s_l
@ cdecl _mbstrlen(str) msvcr120._mbstrlen

View file

@ -766,7 +766,7 @@
@ cdecl _mbctoupper(long)
@ cdecl _mbctoupper_l(long ptr)
@ extern _mbctype MSVCRT_mbctype
@ stub _mblen_l
@ cdecl _mblen_l(str long ptr)
@ cdecl _mbsbtype(str long)
@ cdecl _mbsbtype_l(str long ptr)
@ cdecl _mbscat_s(ptr long str)

View file

@ -744,7 +744,7 @@
@ cdecl _mbctoupper(long)
@ cdecl _mbctoupper_l(long ptr)
@ extern _mbctype MSVCRT_mbctype
@ stub _mblen_l
@ cdecl _mblen_l(str long ptr)
@ cdecl _mbsbtype(str long)
@ cdecl _mbsbtype_l(str long ptr)
@ cdecl _mbscat_s(ptr long str)

View file

@ -2984,21 +2984,34 @@ unsigned char* CDECL _mbspbrk(const unsigned char *str, const unsigned char *acc
*/
/*********************************************************************
* mblen(MSVCRT.@)
* _mblen_l(MSVCRT.@)
* REMARKS
* Unlike most of the multibyte string functions this function uses
* the locale codepage, not the codepage set by _setmbcp
*/
int CDECL _mblen_l(const char* str, size_t size, _locale_t locale)
{
pthreadlocinfo locinfo;
if (!str || !*str || !size)
return 0;
if (locale)
locinfo = locale->locinfo;
else
locinfo = get_locinfo();
if (locinfo->mb_cur_max == 1)
return 1; /* ASCII CP */
return !_isleadbyte_l((unsigned char)*str, locale) ? 1 : (size > 1 ? 2 : -1);
}
/*********************************************************************
* mblen(MSVCRT.@)
*/
int CDECL mblen(const char* str, size_t size)
{
if (str && *str && size)
{
if(get_locinfo()->mb_cur_max == 1)
return 1; /* ASCII CP */
return !isleadbyte((unsigned char)*str) ? 1 : (size>1 ? 2 : -1);
}
return 0;
return _mblen_l(str, size, NULL);
}
/*********************************************************************

View file

@ -711,7 +711,7 @@
@ cdecl _mbctoupper(long)
@ cdecl _mbctoupper_l(long ptr)
@ extern _mbctype MSVCRT_mbctype
# stub _mblen_l(str long ptr)
@ cdecl _mblen_l(str long ptr)
@ cdecl _mbsbtype(str long)
@ cdecl _mbsbtype_l(str long ptr)
@ cdecl _mbscat(str str)

View file

@ -609,7 +609,7 @@
@ cdecl _mbctombb_l(long ptr)
@ cdecl _mbctoupper(long)
@ cdecl _mbctoupper_l(long ptr)
@ stub _mblen_l
@ cdecl _mblen_l(str long ptr)
@ cdecl _mbsbtype(str long)
@ cdecl _mbsbtype_l(str long ptr)
@ cdecl _mbscat_s(ptr long str)
@ -1179,7 +1179,7 @@
@ cdecl _o__mbctombb_l(long ptr) _mbctombb_l
@ cdecl _o__mbctoupper(long) _mbctoupper
@ cdecl _o__mbctoupper_l(long ptr) _mbctoupper_l
@ stub _o__mblen_l
@ cdecl _o__mblen_l(str long ptr) _mblen_l
@ cdecl _o__mbsbtype(str long) _mbsbtype
@ cdecl _o__mbsbtype_l(str long ptr) _mbsbtype_l
@ cdecl _o__mbscat_s(ptr long str) _mbscat_s