Commit 08da46f0 authored by Piotr Caban's avatar Piotr Caban Committed by Michael Stefaniuc

msvcrt: Add mbsrtowcs_s implementation.

Signed-off-by: 's avatarPiotr Caban <piotr@codeweavers.com> Signed-off-by: 's avatarAlexandre Julliard <julliard@winehq.org> (cherry picked from commit 540d9691) Signed-off-by: 's avatarMichael Stefaniuc <mstefani@winehq.org>
parent 251a085f
......@@ -88,7 +88,7 @@
@ stub mbrtoc32
@ cdecl mbrtowc(ptr str long ptr) ucrtbase.mbrtowc
@ cdecl mbsrtowcs(ptr ptr long ptr) ucrtbase.mbsrtowcs
@ stub mbsrtowcs_s
@ cdecl mbsrtowcs_s(ptr ptr long ptr long ptr) ucrtbase.mbsrtowcs_s
@ cdecl mbstowcs(ptr str long) ucrtbase.mbstowcs
@ cdecl mbstowcs_s(ptr ptr long str long) ucrtbase.mbstowcs_s
@ cdecl mbtowc(ptr str long) ucrtbase.mbtowc
......
......@@ -1744,7 +1744,7 @@
@ cdecl mbrlen(ptr long ptr) MSVCRT_mbrlen
@ cdecl mbrtowc(ptr str long ptr) MSVCRT_mbrtowc
@ cdecl mbsrtowcs(ptr ptr long ptr) MSVCRT_mbsrtowcs
@ stub mbsrtowcs_s
@ cdecl mbsrtowcs_s(ptr ptr long ptr long ptr) MSVCRT_mbsrtowcs_s
@ cdecl mbstowcs(ptr str long) MSVCRT_mbstowcs
@ cdecl mbstowcs_s(ptr ptr long str long) MSVCRT__mbstowcs_s
@ cdecl mbtowc(ptr str long) MSVCRT_mbtowc
......
......@@ -2103,7 +2103,7 @@
@ cdecl mbrlen(ptr long ptr) MSVCRT_mbrlen
@ cdecl mbrtowc(ptr str long ptr) MSVCRT_mbrtowc
@ cdecl mbsrtowcs(ptr ptr long ptr) MSVCRT_mbsrtowcs
@ stub mbsrtowcs_s
@ cdecl mbsrtowcs_s(ptr ptr long ptr long ptr) MSVCRT_mbsrtowcs_s
@ cdecl mbstowcs(ptr str long) MSVCRT_mbstowcs
@ cdecl mbstowcs_s(ptr ptr long str long) MSVCRT__mbstowcs_s
@ cdecl mbtowc(ptr str long) MSVCRT_mbtowc
......
......@@ -2280,7 +2280,7 @@
@ cdecl mbrlen(ptr long ptr) MSVCRT_mbrlen
@ cdecl mbrtowc(ptr str long ptr) MSVCRT_mbrtowc
@ cdecl mbsrtowcs(ptr ptr long ptr) MSVCRT_mbsrtowcs
@ stub mbsrtowcs_s
@ cdecl mbsrtowcs_s(ptr ptr long ptr long ptr) MSVCRT_mbsrtowcs_s
@ cdecl mbstowcs(ptr str long) MSVCRT_mbstowcs
@ cdecl mbstowcs_s(ptr ptr long str long) MSVCRT__mbstowcs_s
@ cdecl mbtowc(ptr str long) MSVCRT_mbtowc
......
......@@ -1943,7 +1943,7 @@
@ cdecl mbrlen(ptr long ptr) msvcr120.mbrlen
@ cdecl mbrtowc(ptr str long ptr) msvcr120.mbrtowc
@ cdecl mbsrtowcs(ptr ptr long ptr) msvcr120.mbsrtowcs
@ stub mbsrtowcs_s
@ cdecl mbsrtowcs_s(ptr ptr long ptr long ptr) msvcr120.mbsrtowcs_s
@ cdecl mbstowcs(ptr str long) msvcr120.mbstowcs
@ cdecl mbstowcs_s(ptr ptr long str long) msvcr120.mbstowcs_s
@ cdecl mbtowc(ptr str long) msvcr120.mbtowc
......
......@@ -1425,7 +1425,7 @@
@ cdecl mbrlen(ptr long ptr) MSVCRT_mbrlen
@ cdecl mbrtowc(ptr str long ptr) MSVCRT_mbrtowc
@ cdecl mbsrtowcs(ptr ptr long ptr) MSVCRT_mbsrtowcs
@ stub mbsrtowcs_s
@ cdecl mbsrtowcs_s(ptr ptr long ptr long ptr) MSVCRT_mbsrtowcs_s
@ cdecl mbstowcs(ptr str long) MSVCRT_mbstowcs
@ cdecl mbstowcs_s(ptr ptr long str long) MSVCRT__mbstowcs_s
@ cdecl mbtowc(ptr str long) MSVCRT_mbtowc
......
......@@ -1397,7 +1397,7 @@
@ cdecl mbrlen(ptr long ptr) MSVCRT_mbrlen
@ cdecl mbrtowc(ptr str long ptr) MSVCRT_mbrtowc
@ cdecl mbsrtowcs(ptr ptr long ptr) MSVCRT_mbsrtowcs
@ stub mbsrtowcs_s
@ cdecl mbsrtowcs_s(ptr ptr long ptr long ptr) MSVCRT_mbsrtowcs_s
@ cdecl mbstowcs(ptr str long) MSVCRT_mbstowcs
@ cdecl mbstowcs_s(ptr ptr long str long) MSVCRT__mbstowcs_s
@ cdecl mbtowc(ptr str long) MSVCRT_mbtowc
......
......@@ -2357,6 +2357,35 @@ MSVCRT_size_t CDECL MSVCRT_mbsrtowcs(MSVCRT_wchar_t *wcstr,
}
/*********************************************************************
* mbsrtowcs_s(MSVCRT.@)
*/
int CDECL MSVCRT_mbsrtowcs_s(MSVCRT_size_t *ret, MSVCRT_wchar_t *wcstr, MSVCRT_size_t len,
const char **mbstr, MSVCRT_size_t count, MSVCRT_mbstate_t *state)
{
MSVCRT_size_t tmp;
if(!ret) ret = &tmp;
if(!MSVCRT_CHECK_PMT(!!wcstr == !!len)) {
*ret = -1;
return MSVCRT_EINVAL;
}
*ret = MSVCRT_mbsrtowcs(wcstr, mbstr, count>len ? len : count, state);
if(*ret == -1) {
if(wcstr) *wcstr = 0;
return *MSVCRT__errno();
}
(*ret)++;
if(*ret > len) {
/* no place for terminating '\0' */
if(wcstr) *wcstr = 0;
return 0;
}
if(wcstr) wcstr[(*ret)-1] = 0;
return 0;
}
/*********************************************************************
* _mbctohira (MSVCRT.@)
*
* Converts a sjis katakana character to hiragana.
......
......@@ -1365,7 +1365,7 @@
@ cdecl mbrtowc(ptr str long ptr) MSVCRT_mbrtowc
# stub mbsdup_dbg(wstr long ptr long)
@ cdecl mbsrtowcs(ptr ptr long ptr) MSVCRT_mbsrtowcs
# stub mbsrtowcs_s(ptr ptr long ptr long ptr)
@ cdecl mbsrtowcs_s(ptr ptr long ptr long ptr) MSVCRT_mbsrtowcs_s
@ cdecl mbstowcs(ptr str long) MSVCRT_mbstowcs
@ cdecl mbstowcs_s(ptr ptr long str long) MSVCRT__mbstowcs_s
@ cdecl mbtowc(ptr str long) MSVCRT_mbtowc
......
......@@ -2415,7 +2415,7 @@
@ stub mbrtoc32
@ cdecl mbrtowc(ptr str long ptr) MSVCRT_mbrtowc
@ cdecl mbsrtowcs(ptr ptr long ptr) MSVCRT_mbsrtowcs
@ stub mbsrtowcs_s
@ cdecl mbsrtowcs_s(ptr ptr long ptr long ptr) MSVCRT_mbsrtowcs_s
@ cdecl mbstowcs(ptr str long) MSVCRT_mbstowcs
@ cdecl mbstowcs_s(ptr ptr long str long) MSVCRT__mbstowcs_s
@ cdecl mbtowc(ptr str long) MSVCRT_mbtowc
......
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