"Colin Finck" <mail(a)colinfinck.de> wrote:
-INT CDECL MSVCRT_wctomb( char *dst, MSVCRT_wchar_t ch ) +INT CDECL MSVCRT_wctomb(char *mbchar, MSVCRT_wchar_t wchar)
What's the point of the above change?
{ - return WideCharToMultiByte( CP_ACP, 0, &ch, 1, dst, 6, NULL, NULL ); + BOOL bUsedDefaultChar; + char chMultiByte[MSVCRT_MB_LEN_MAX]; + int nBytes;
Please don't use ugly mixed case variable names. Same for other tests.
+ + /* At least one parameter needs to be given, the length of a null character cannot be queried (verified by tests under WinXP SP2) */ + if(!mbchar && !wchar) + return 0;
Please keep line length close to 80 columns limit. What are you calling a "null character" here? A NULL pointer is not a NUL character. What happens in the code below if mbchar is not NULL but wchar is?
+ + /* Use WideCharToMultiByte for doing the conversion using the codepage currently set with setlocale() */ + nBytes = WideCharToMultiByte(MSVCRT___lc_codepage, 0, &wchar, 1, chMultiByte, MSVCRT_MB_LEN_MAX, NULL, &bUsedDefaultChar);
-- Dmitry.