Commit c0ce611e authored by Piotr Caban's avatar Piotr Caban Committed by Alexandre Julliard

msvcrt: Added wcrtomb implementation.

parent 027ef4cc
......@@ -1445,7 +1445,7 @@
@ cdecl vswprintf_s(ptr long wstr ptr) MSVCRT_vswprintf_s
@ cdecl vwprintf(wstr ptr) MSVCRT_vwprintf
@ cdecl vwprintf_s(wstr ptr) MSVCRT_vwprintf_s
# stub wcrtomb(ptr long ptr)
@ cdecl wcrtomb(ptr long ptr) MSVCRT_wcrtomb
# stub wcrtomb_s(ptr ptr long long ptr)
@ cdecl wcscat(wstr wstr) ntdll.wcscat
@ cdecl wcscat_s(wstr long wstr) MSVCRT_wcscat_s
......
......@@ -1083,7 +1083,25 @@ INT CDECL MSVCRT_wctob( MSVCRT_wint_t wchar )
*/
INT CDECL MSVCRT_wctomb( char *dst, MSVCRT_wchar_t ch )
{
return WideCharToMultiByte( get_locinfo()->lc_codepage, 0, &ch, 1, dst, 6, NULL, NULL );
BOOL error;
INT size;
size = WideCharToMultiByte(get_locinfo()->lc_codepage, 0, &ch, 1, dst, dst ? 6 : 0, NULL, &error);
if(!size || error) {
*MSVCRT__errno() = MSVCRT_EINVAL;
return MSVCRT_EOF;
}
return size;
}
/*********************************************************************
* wcrtomb (MSVCRT.@)
*/
MSVCRT_size_t CDECL MSVCRT_wcrtomb( char *dst, MSVCRT_wchar_t ch, MSVCRT_mbstate_t *s)
{
if(s)
*s = 0;
return MSVCRT_wctomb(dst, ch);
}
/*********************************************************************
......
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