msvcrt: Added wcrtomb implementation.

This commit is contained in:
Piotr Caban 2012-11-29 21:49:42 +00:00 committed by Alexandre Julliard
parent 027ef4ccdb
commit c0ce611ebd
2 changed files with 20 additions and 2 deletions

View File

@ -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

View File

@ -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);
}
/*********************************************************************