msvcrt: Add _mbsnbset_l implementation.

This commit is contained in:
Bartosz Kosiorek 2023-11-06 20:35:53 +01:00 committed by Alexandre Julliard
parent 62ba4a8261
commit 12a00363f6
8 changed files with 48 additions and 31 deletions

View file

@ -1142,7 +1142,7 @@
@ cdecl _mbsnbicoll(str str long)
@ cdecl _mbsnbicoll_l(str str long ptr)
@ cdecl _mbsnbset(ptr long long)
@ stub _mbsnbset_l
@ cdecl _mbsnbset_l(str long long ptr)
@ stub _mbsnbset_s
@ stub _mbsnbset_s_l
@ cdecl _mbsncat(str str long)

View file

@ -1499,7 +1499,7 @@
@ cdecl _mbsnbicoll(str str long)
@ cdecl _mbsnbicoll_l(str str long ptr)
@ cdecl _mbsnbset(ptr long long)
@ stub _mbsnbset_l
@ cdecl _mbsnbset_l(str long long ptr)
@ stub _mbsnbset_s
@ stub _mbsnbset_s_l
@ cdecl _mbsncat(str str long)

View file

@ -1510,7 +1510,7 @@
@ cdecl _mbsnbicoll(str str long)
@ cdecl _mbsnbicoll_l(str str long ptr)
@ cdecl _mbsnbset(ptr long long)
@ stub _mbsnbset_l
@ cdecl _mbsnbset_l(str long long ptr)
@ stub _mbsnbset_s
@ stub _mbsnbset_s_l
@ cdecl _mbsncat(str str long)

View file

@ -814,7 +814,7 @@
@ cdecl _mbsnbicoll(str str long)
@ cdecl _mbsnbicoll_l(str str long ptr)
@ cdecl _mbsnbset(ptr long long)
@ stub _mbsnbset_l
@ cdecl _mbsnbset_l(str long long ptr)
@ stub _mbsnbset_s
@ stub _mbsnbset_s_l
@ cdecl _mbsncat(str str long)

View file

@ -792,7 +792,7 @@
@ cdecl _mbsnbicoll(str str long)
@ cdecl _mbsnbicoll_l(str str long ptr)
@ cdecl _mbsnbset(ptr long long)
@ stub _mbsnbset_l
@ cdecl _mbsnbset_l(str long long ptr)
@ stub _mbsnbset_s
@ stub _mbsnbset_s_l
@ cdecl _mbsncat(str str long)

View file

@ -2200,16 +2200,24 @@ unsigned char* CDECL _mbsset(unsigned char* str, unsigned int c)
}
/*********************************************************************
* _mbsnbset(MSVCRT.@)
* _mbsnbset_l(MSVCRT.@)
*/
unsigned char* CDECL _mbsnbset(unsigned char *str, unsigned int c, size_t len)
unsigned char* CDECL _mbsnbset_l(unsigned char *str, unsigned int c, size_t len, _locale_t locale)
{
unsigned char *ret = str;
pthreadmbcinfo mbcinfo;
if (!len)
return ret;
if (!MSVCRT_CHECK_PMT(str))
return NULL;
if(!get_mbcinfo()->ismbcodepage || c < 256)
if (locale)
mbcinfo = locale->mbcinfo;
else
mbcinfo = get_mbcinfo();
if (!mbcinfo->ismbcodepage || c < 256)
return u__strnset(str, c, len); /* ASCII CP or SB char */
c &= 0xffff; /* Strip high bits */
@ -2221,7 +2229,8 @@ unsigned char* CDECL _mbsnbset(unsigned char *str, unsigned int c, size_t len)
*str++ = c & 0xff;
len--;
}
if(len && str[0]) {
if (len && str[0])
{
/* as per msdn pad with a blank character */
str[0] = ' ';
}
@ -2229,6 +2238,14 @@ unsigned char* CDECL _mbsnbset(unsigned char *str, unsigned int c, size_t len)
return ret;
}
/*********************************************************************
* _mbsnbset(MSVCRT.@)
*/
unsigned char* CDECL _mbsnbset(unsigned char *str, unsigned int c, size_t len)
{
return _mbsnbset_l(str, c, len, NULL);
}
/*********************************************************************
* _mbsnset(MSVCRT.@)
*/

View file

@ -763,7 +763,7 @@
@ cdecl _mbsnbicoll(str str long)
@ cdecl _mbsnbicoll_l(str str long ptr)
@ cdecl _mbsnbset(ptr long long)
# stub _mbsnbset_l(str long long ptr)
@ cdecl _mbsnbset_l(str long long ptr)
# stub _mbsnbset_s(ptr long long long)
# stub _mbsnbset_s_l(ptr long long long ptr)
@ cdecl _mbsncat(str str long)

View file

@ -658,7 +658,7 @@
@ cdecl _mbsnbicoll(str str long)
@ cdecl _mbsnbicoll_l(str str long ptr)
@ cdecl _mbsnbset(ptr long long)
@ stub _mbsnbset_l
@ cdecl _mbsnbset_l(str long long ptr)
@ stub _mbsnbset_s
@ stub _mbsnbset_s_l
@ cdecl _mbsncat(str str long)
@ -1227,7 +1227,7 @@
@ cdecl _o__mbsnbicoll(str str long) _mbsnbicoll
@ cdecl _o__mbsnbicoll_l(str str long ptr) _mbsnbicoll_l
@ cdecl _o__mbsnbset(ptr long long) _mbsnbset
@ stub _o__mbsnbset_l
@ cdecl _o__mbsnbset_l(str long long ptr) _mbsnbset_l
@ stub _o__mbsnbset_s
@ stub _o__mbsnbset_s_l
@ cdecl _o__mbsncat(str str long) _mbsncat