Commit a6ed3d55 authored by Bartosz Kosiorek's avatar Bartosz Kosiorek Committed by Alexandre Julliard

msvcrt: Add _mbsnbcat_s_l implementation.

parent 9365e6f6
......@@ -1126,7 +1126,7 @@
@ cdecl _mbsnbcat(str str long)
@ cdecl _mbsnbcat_l(str str long ptr)
@ cdecl _mbsnbcat_s(str long ptr long)
@ stub _mbsnbcat_s_l
@ cdecl _mbsnbcat_s_l(str long ptr long ptr)
@ cdecl _mbsnbcmp(str str long)
@ cdecl _mbsnbcmp_l(str str long ptr)
@ cdecl _mbsnbcnt(ptr long)
......
......@@ -1483,7 +1483,7 @@
@ cdecl _mbsnbcat(str str long)
@ cdecl _mbsnbcat_l(str str long ptr)
@ cdecl _mbsnbcat_s(str long ptr long)
@ stub _mbsnbcat_s_l
@ cdecl _mbsnbcat_s_l(str long ptr long ptr)
@ cdecl _mbsnbcmp(str str long)
@ cdecl _mbsnbcmp_l(str str long ptr)
@ cdecl _mbsnbcnt(ptr long)
......
......@@ -1494,7 +1494,7 @@
@ cdecl _mbsnbcat(str str long)
@ cdecl _mbsnbcat_l(str str long ptr)
@ cdecl _mbsnbcat_s(str long ptr long)
@ stub _mbsnbcat_s_l
@ cdecl _mbsnbcat_s_l(str long ptr long ptr)
@ cdecl _mbsnbcmp(str str long)
@ cdecl _mbsnbcmp_l(str str long ptr)
@ cdecl _mbsnbcnt(ptr long)
......
......@@ -798,7 +798,7 @@
@ cdecl _mbsnbcat(str str long)
@ cdecl _mbsnbcat_l(str str long ptr)
@ cdecl _mbsnbcat_s(str long ptr long)
@ stub _mbsnbcat_s_l
@ cdecl _mbsnbcat_s_l(str long ptr long ptr)
@ cdecl _mbsnbcmp(str str long)
@ cdecl _mbsnbcmp_l(str str long ptr)
@ cdecl _mbsnbcnt(ptr long)
......
......@@ -776,7 +776,7 @@
@ cdecl _mbsnbcat(str str long)
@ cdecl _mbsnbcat_l(str str long ptr)
@ cdecl _mbsnbcat_s(str long ptr long)
@ stub _mbsnbcat_s_l
@ cdecl _mbsnbcat_s_l(str long ptr long ptr)
@ cdecl _mbsnbcmp(str str long)
@ cdecl _mbsnbcmp_l(str str long ptr)
@ cdecl _mbsnbcnt(ptr long)
......
......@@ -2336,20 +2336,22 @@ unsigned char* CDECL _mbsnbcat(unsigned char *dst, const unsigned char *src, siz
return _mbsnbcat_l(dst, src, len, NULL);
}
int CDECL _mbsnbcat_s(unsigned char *dst, size_t size, const unsigned char *src, size_t len)
/*********************************************************************
* _mbsnbcat_s_l(MSVCRT.@)
*/
int CDECL _mbsnbcat_s_l(unsigned char *dst, size_t size, const unsigned char *src, size_t len, _locale_t locale)
{
unsigned char *ptr = dst;
size_t i;
pthreadmbcinfo mbcinfo;
if (!dst && !size && !src && !len)
if (!dst && !size && !len)
return 0;
if (!dst || !size || !src)
if (!MSVCRT_CHECK_PMT(dst && size && src))
{
if (dst && size)
*dst = '\0';
*_errno() = EINVAL;
return EINVAL;
}
......@@ -2364,9 +2366,14 @@ int CDECL _mbsnbcat_s(unsigned char *dst, size_t size, const unsigned char *src,
return EINVAL;
}
if (locale)
mbcinfo = locale->mbcinfo;
else
mbcinfo = get_mbcinfo();
/* If necessary, check that the character preceding the null terminator is
* a lead byte and move the pointer back by one for later overwrite. */
if (ptr != dst && get_mbcinfo()->ismbcodepage && _ismbblead(*(ptr - 1)))
if (ptr != dst && mbcinfo->ismbcodepage && _ismbblead_l(*(ptr - 1), locale))
size++, ptr--;
for (i = 0; *src && i < len; i++)
......@@ -2387,6 +2394,14 @@ int CDECL _mbsnbcat_s(unsigned char *dst, size_t size, const unsigned char *src,
}
/*********************************************************************
* _mbsnbcat_s(MSVCRT.@)
*/
int CDECL _mbsnbcat_s(unsigned char *dst, size_t size, const unsigned char *src, size_t len)
{
return _mbsnbcat_s_l(dst, size, src, len, NULL);
}
/*********************************************************************
* _mbsncat(MSVCRT.@)
*/
unsigned char* CDECL _mbsncat(unsigned char* dst, const unsigned char* src, size_t len)
......
......@@ -747,7 +747,7 @@
@ cdecl _mbsnbcat(str str long)
@ cdecl _mbsnbcat_l(str str long ptr)
@ cdecl _mbsnbcat_s(str long ptr long)
# stub _mbsnbcat_s_l(str long ptr long ptr)
@ cdecl _mbsnbcat_s_l(str long ptr long ptr)
@ cdecl _mbsnbcmp(str str long)
@ cdecl _mbsnbcmp_l(str str long ptr)
@ cdecl _mbsnbcnt(ptr long)
......
......@@ -642,7 +642,7 @@
@ cdecl _mbsnbcat(str str long)
@ cdecl _mbsnbcat_l(str str long ptr)
@ cdecl _mbsnbcat_s(str long ptr long)
@ stub _mbsnbcat_s_l
@ cdecl _mbsnbcat_s_l(str long ptr long ptr)
@ cdecl _mbsnbcmp(str str long)
@ cdecl _mbsnbcmp_l(str str long ptr)
@ cdecl _mbsnbcnt(ptr long)
......@@ -1211,7 +1211,7 @@
@ cdecl _o__mbsnbcat(str str long) _mbsnbcat
@ cdecl _o__mbsnbcat_l(str str long ptr) _mbsnbcat_l
@ cdecl _o__mbsnbcat_s(str long ptr long) _mbsnbcat_s
@ stub _o__mbsnbcat_s_l
@ cdecl _o__mbsnbcat_s_l(str long ptr long ptr) _mbsnbcat_s_l
@ cdecl _o__mbsnbcmp(str str long) _mbsnbcmp
@ cdecl _o_mbsnbcmp_l(str str long ptr) _mbsnbcmp_l
@ cdecl _o__mbsnbcnt(ptr long) _mbsnbcnt
......
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