msvcrt: Add _mbsset_l implementation.

This commit is contained in:
Bartosz Kosiorek 2023-11-07 23:06:30 +01:00 committed by Alexandre Julliard
parent 08c603a417
commit 8bb0692ff6
8 changed files with 42 additions and 24 deletions

View file

@ -1180,7 +1180,7 @@
@ cdecl _mbsrev(str)
@ cdecl _mbsrev_l(str ptr)
@ cdecl _mbsset(ptr long)
@ stub _mbsset_l
@ cdecl _mbsset_l(ptr long ptr)
@ stub _mbsset_s
@ stub _mbsset_s_l
@ cdecl _mbsspn(str str)

View file

@ -1537,7 +1537,7 @@
@ cdecl _mbsrev(str)
@ cdecl _mbsrev_l(str ptr)
@ cdecl _mbsset(ptr long)
@ stub _mbsset_l
@ cdecl _mbsset_l(ptr long ptr)
@ stub _mbsset_s
@ stub _mbsset_s_l
@ cdecl _mbsspn(str str)

View file

@ -1548,7 +1548,7 @@
@ cdecl _mbsrev(str)
@ cdecl _mbsrev_l(str ptr)
@ cdecl _mbsset(ptr long)
@ stub _mbsset_l
@ cdecl _mbsset_l(ptr long ptr)
@ stub _mbsset_s
@ stub _mbsset_s_l
@ cdecl _mbsspn(str str)

View file

@ -852,7 +852,7 @@
@ cdecl _mbsrev(str)
@ cdecl _mbsrev_l(str ptr)
@ cdecl _mbsset(ptr long)
@ stub _mbsset_l
@ cdecl _mbsset_l(ptr long ptr)
@ stub _mbsset_s
@ stub _mbsset_s_l
@ cdecl _mbsspn(str str)

View file

@ -830,7 +830,7 @@
@ cdecl _mbsrev(str)
@ cdecl _mbsrev_l(str ptr)
@ cdecl _mbsset(ptr long)
@ stub _mbsset_l
@ cdecl _mbsset_l(ptr long ptr)
@ stub _mbsset_s
@ stub _mbsset_s_l
@ cdecl _mbsspn(str str)

View file

@ -2205,27 +2205,45 @@ int CDECL _mbsbtype(const unsigned char *str, size_t count)
return _mbsbtype_l(str, count, NULL);
}
/*********************************************************************
* _mbsset_l(MSVCRT.@)
*/
unsigned char* CDECL _mbsset_l(unsigned char* str, unsigned int c, _locale_t locale)
{
unsigned char* ret = str;
pthreadmbcinfo mbcinfo;
if (!MSVCRT_CHECK_PMT(str))
return NULL;
if (locale)
mbcinfo = locale->mbcinfo;
else
mbcinfo = get_mbcinfo();
if (!mbcinfo->ismbcodepage || c < 256)
return u__strset(str, c); /* ASCII CP or SB char */
c &= 0xffff; /* Strip high bits */
while (str[0] && str[1])
{
*str++ = c >> 8;
*str++ = c & 0xff;
}
if (str[0])
str[0] = '\0'; /* FIXME: OK to shorten? */
return ret;
}
/*********************************************************************
* _mbsset(MSVCRT.@)
*/
unsigned char* CDECL _mbsset(unsigned char* str, unsigned int c)
{
unsigned char* ret = str;
if(!get_mbcinfo()->ismbcodepage || c < 256)
return u__strset(str, c); /* ASCII CP or SB char */
c &= 0xffff; /* Strip high bits */
while(str[0] && str[1])
{
*str++ = c >> 8;
*str++ = c & 0xff;
}
if(str[0])
str[0] = '\0'; /* FIXME: OK to shorten? */
return ret;
return _mbsset_l(str, c, NULL);
}
/*********************************************************************

View file

@ -801,7 +801,7 @@
@ cdecl _mbsrev(str)
@ cdecl _mbsrev_l(str ptr)
@ cdecl _mbsset(ptr long)
# stub _mbsset_l(ptr long ptr)
@ cdecl _mbsset_l(ptr long ptr)
# stub _mbsset_s(ptr long long)
# stub _mbsset_s_l(ptr long long ptr)
@ cdecl _mbsspn(str str)

View file

@ -696,7 +696,7 @@
@ cdecl _mbsrev(str)
@ cdecl _mbsrev_l(str ptr)
@ cdecl _mbsset(ptr long)
@ stub _mbsset_l
@ cdecl _mbsset_l(ptr long ptr)
@ stub _mbsset_s
@ stub _mbsset_s_l
@ cdecl _mbsspn(str str)
@ -1265,7 +1265,7 @@
@ cdecl _o__mbsrev(str) _mbsrev
@ cdecl _o__mbsrev_l(str ptr) _mbsrev_l
@ cdecl _o__mbsset(ptr long) _mbsset
@ stub _o__mbsset_l
@ cdecl _o__mbsset_l(ptr long ptr) _mbsset_l
@ stub _o__mbsset_s
@ stub _o__mbsset_s_l
@ cdecl _o__mbsspn(str str) _mbsspn