msvcrt: Add _mbccpy_s_l implementation.

Signed-off-by: Piotr Caban <piotr@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Piotr Caban 2017-10-06 12:07:18 +02:00 committed by Alexandre Julliard
parent afdf7491ef
commit eb7d55761e
13 changed files with 89 additions and 39 deletions

View File

@ -67,10 +67,10 @@
@ cdecl _mbbtype(long long) ucrtbase._mbbtype
@ stub _mbbtype_l
@ stub _mbcasemap
@ cdecl _mbccpy(ptr str) ucrtbase._mbccpy
@ stub _mbccpy_l
@ stub _mbccpy_s
@ stub _mbccpy_s_l
@ cdecl _mbccpy(ptr ptr) ucrtbase._mbccpy
@ cdecl _mbccpy_l(ptr ptr ptr) ucrtbase._mbccpy_l
@ cdecl _mbccpy_s(ptr long ptr ptr) ucrtbase._mbccpy_s
@ cdecl _mbccpy_s_l(ptr long ptr ptr ptr) ucrtbase._mbccpy_s_l
@ cdecl _mbcjistojms(long) ucrtbase._mbcjistojms
@ stub _mbcjistojms_l
@ cdecl _mbcjmstojis(long) ucrtbase._mbcjmstojis

View File

@ -188,7 +188,7 @@
@ cdecl _matherr(ptr) msvcrt._matherr
@ cdecl _mbbtombc(long) msvcrt._mbbtombc
@ cdecl _mbbtype(long long) msvcrt._mbbtype
@ cdecl _mbccpy(ptr str) msvcrt._mbccpy
@ cdecl _mbccpy(ptr ptr) msvcrt._mbccpy
@ cdecl _mbcjistojms(long) msvcrt._mbcjistojms
@ cdecl _mbcjmstojis(long) msvcrt._mbcjmstojis
@ cdecl _mbclen(ptr) msvcrt._mbclen

View File

@ -1073,10 +1073,10 @@
@ cdecl _mbbtype(long long)
@ stub _mbbtype_l
# extern _mbcasemap
@ cdecl _mbccpy(ptr str)
@ stub _mbccpy_l
@ stub _mbccpy_s
@ stub _mbccpy_s_l
@ cdecl _mbccpy(ptr ptr)
@ cdecl _mbccpy_l(ptr ptr ptr)
@ cdecl _mbccpy_s(ptr long ptr ptr)
@ cdecl _mbccpy_s_l(ptr long ptr ptr ptr)
@ cdecl _mbcjistojms(long)
@ stub _mbcjistojms_l
@ cdecl _mbcjmstojis(long)

View File

@ -1430,10 +1430,10 @@
@ cdecl _mbbtype(long long)
@ stub _mbbtype_l
# extern _mbcasemap
@ cdecl _mbccpy(ptr str)
@ stub _mbccpy_l
@ stub _mbccpy_s
@ stub _mbccpy_s_l
@ cdecl _mbccpy(ptr ptr)
@ cdecl _mbccpy_l(ptr ptr ptr)
@ cdecl _mbccpy_s(ptr long ptr ptr)
@ cdecl _mbccpy_s_l(ptr long ptr ptr ptr)
@ cdecl _mbcjistojms(long)
@ stub _mbcjistojms_l
@ cdecl _mbcjmstojis(long)

View File

@ -1440,10 +1440,10 @@
@ cdecl _mbbtype(long long)
@ stub _mbbtype_l
# extern _mbcasemap
@ cdecl _mbccpy(ptr str)
@ stub _mbccpy_l
@ stub _mbccpy_s
@ stub _mbccpy_s_l
@ cdecl _mbccpy(ptr ptr)
@ cdecl _mbccpy_l(ptr ptr ptr)
@ cdecl _mbccpy_s(ptr long ptr ptr)
@ cdecl _mbccpy_s_l(ptr long ptr ptr ptr)
@ cdecl _mbcjistojms(long)
@ stub _mbcjistojms_l
@ cdecl _mbcjmstojis(long)

View File

@ -745,10 +745,10 @@
@ cdecl _mbbtype(long long)
@ stub _mbbtype_l
# extern _mbcasemap
@ cdecl _mbccpy(ptr str)
@ stub _mbccpy_l
@ stub _mbccpy_s
@ stub _mbccpy_s_l
@ cdecl _mbccpy(ptr ptr)
@ cdecl _mbccpy_l(ptr ptr ptr)
@ cdecl _mbccpy_s(ptr long ptr ptr)
@ cdecl _mbccpy_s_l(ptr long ptr ptr ptr)
@ cdecl _mbcjistojms(long)
@ stub _mbcjistojms_l
@ cdecl _mbcjmstojis(long)

View File

@ -723,10 +723,10 @@
@ cdecl _mbbtype(long long)
@ stub _mbbtype_l
# extern _mbcasemap
@ cdecl _mbccpy(ptr str)
@ stub _mbccpy_l
@ stub _mbccpy_s
@ stub _mbccpy_s_l
@ cdecl _mbccpy(ptr ptr)
@ cdecl _mbccpy_l(ptr ptr ptr)
@ cdecl _mbccpy_s(ptr long ptr ptr)
@ cdecl _mbccpy_s_l(ptr long ptr ptr ptr)
@ cdecl _mbcjistojms(long)
@ stub _mbcjistojms_l
@ cdecl _mbcjmstojis(long)

View File

@ -623,14 +623,64 @@ MSVCRT_size_t CDECL _mbsnlen(const unsigned char* str, MSVCRT_size_t maxsize)
return _mbsnlen_l(str, maxsize, NULL);
}
/*********************************************************************
* _mbccpy_s_l(MSVCRT.@)
*/
int CDECL _mbccpy_s_l(unsigned char* dest, MSVCRT_size_t maxsize,
int *copied, const unsigned char* src, MSVCRT__locale_t locale)
{
if(copied) *copied = 0;
if(!MSVCRT_CHECK_PMT(dest != NULL && maxsize >= 1)) return MSVCRT_EINVAL;
dest[0] = 0;
if(!MSVCRT_CHECK_PMT(src != NULL)) return MSVCRT_EINVAL;
if(_ismbblead_l(*src, locale)) {
if(!src[1]) {
if(copied) *copied = 1;
*MSVCRT__errno() = MSVCRT_EILSEQ;
return MSVCRT_EILSEQ;
}
if(maxsize < 2) {
MSVCRT_INVALID_PMT("dst buffer is too small", MSVCRT_ERANGE);
return MSVCRT_ERANGE;
}
*dest++ = *src++;
*dest = *src;
if(copied) *copied = 2;
}else {
*dest = *src;
if(copied) *copied = 1;
}
return 0;
}
/*********************************************************************
* _mbccpy(MSVCRT.@)
*/
void CDECL _mbccpy(unsigned char* dest, const unsigned char* src)
{
*dest = *src;
if(_ismbblead(*src))
*++dest = *++src; /* MB char */
_mbccpy_s_l(dest, 2, NULL, src, NULL);
}
/*********************************************************************
* _mbccpy_l(MSVCRT.@)
*/
void CDECL _mbccpy_l(unsigned char* dest, const unsigned char* src,
MSVCRT__locale_t locale)
{
_mbccpy_s_l(dest, 2, NULL, src, locale);
}
/*********************************************************************
* _mbccpy_s(MSVCRT.@)
*/
int CDECL _mbccpy_s(unsigned char* dest, MSVCRT_size_t maxsize,
int *copied, const unsigned char* src)
{
return _mbccpy_s_l(dest, maxsize, copied, src, NULL);
}
/*********************************************************************

View File

@ -688,10 +688,10 @@
# stub _mbbtombc_l(long ptr)
@ cdecl _mbbtype(long long)
# extern _mbcasemap
@ cdecl _mbccpy(ptr str)
# stub _mbccpy_l(ptr str ptr)
# stub _mbccpy_s(ptr long ptr str)
# stub _mbccpy_s_l(ptr long ptr str ptr)
@ cdecl _mbccpy(ptr ptr)
@ cdecl _mbccpy_l(ptr ptr ptr)
@ cdecl _mbccpy_s(ptr long ptr ptr)
@ cdecl _mbccpy_s_l(ptr long ptr ptr ptr)
@ cdecl _mbcjistojms (long)
# stub _mbcjistojms_l(long ptr)
@ cdecl _mbcjmstojis(long)

View File

@ -1015,7 +1015,7 @@
@ cdecl _matherr(ptr) msvcrt._matherr
@ cdecl _mbbtombc(long) msvcrt._mbbtombc
@ cdecl _mbbtype(long long) msvcrt._mbbtype
@ cdecl _mbccpy(ptr str) msvcrt._mbccpy
@ cdecl _mbccpy(ptr ptr) msvcrt._mbccpy
@ cdecl _mbcjistojms(long) msvcrt._mbcjistojms
@ cdecl _mbcjmstojis(long) msvcrt._mbcjmstojis
@ cdecl _mbclen(ptr) msvcrt._mbclen

View File

@ -1106,7 +1106,7 @@
@ cdecl _makepath(ptr str str str str) msvcrt._makepath
@ cdecl _mbbtombc(long) msvcrt._mbbtombc
@ cdecl _mbbtype(long long) msvcrt._mbbtype
@ cdecl _mbccpy(ptr str) msvcrt._mbccpy
@ cdecl _mbccpy(ptr ptr) msvcrt._mbccpy
@ cdecl _mbcjistojms(long) msvcrt._mbcjistojms
@ cdecl _mbcjmstojis(long) msvcrt._mbcjmstojis
@ cdecl _mbclen(ptr) msvcrt._mbclen

View File

@ -396,7 +396,7 @@
@ cdecl _mbbtombc(long) msvcrt._mbbtombc
@ cdecl _mbbtype(long long) msvcrt._mbbtype
# extern _mbcasemap
@ cdecl _mbccpy(ptr str) msvcrt._mbccpy
@ cdecl _mbccpy(ptr ptr) msvcrt._mbccpy
@ cdecl _mbcjistojms(long) msvcrt._mbcjistojms
@ cdecl _mbcjmstojis(long) msvcrt._mbcjmstojis
@ cdecl _mbclen(ptr) msvcrt._mbclen

View File

@ -586,10 +586,10 @@
@ cdecl _mbbtype(long long)
@ stub _mbbtype_l
@ stub _mbcasemap
@ cdecl _mbccpy(ptr str)
@ stub _mbccpy_l
@ stub _mbccpy_s
@ stub _mbccpy_s_l
@ cdecl _mbccpy(ptr ptr)
@ cdecl _mbccpy_l(ptr ptr ptr)
@ cdecl _mbccpy_s(ptr long ptr ptr)
@ cdecl _mbccpy_s_l(ptr long ptr ptr ptr)
@ cdecl _mbcjistojms(long)
@ stub _mbcjistojms_l
@ cdecl _mbcjmstojis(long)