[WideChar conversion improvements - 2/5] Implement new versions ofwctomb and wcstombs
Dmitry Timoshkov
dmitry at codeweavers.com
Mon Jul 28 00:07:55 CDT 2008
"Colin Finck" <mail at 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.
More information about the wine-devel
mailing list