[WideChar conversion improvements - 2/5] Implement new versionsofwctomb and wcstombs

Colin Finck mail at colinfinck.de
Mon Jul 28 05:47:55 CDT 2008


Dmitry Timoshkov 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?

While rewriting that function, I used the parameter names described on MSDN.
I don't see a point in inventing new parameter names for documented
functions.


> Please don't use ugly mixed case variable names. Same for other tests.

Well, this is the variable naming convention used by most Win32 developers.
Also there are a lot of other components in Wine using this coding style,
just look for example in "notepad" or "regedit".


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

if(mbchar && !wchar)  --> Put a NULL character into mbchar and return 1 as
its length.
if(!mbchar && wchar)  --> Return the length of wchar

You might think that (!mbchar && !wchar) should now return 1 as the length
of a NULL character, but MS seems to have put a check here and returns 0 in
this case.

These behaviours are also covered by some of the added tests in the 4th
patch.

Best regards,

Colin 






More information about the wine-devel mailing list