WINE_UNICODE_TEXT

Francois Gouget fgouget at free.fr
Thu Feb 1 03:51:45 CST 2001


On Mon, 29 Jan 2001, Jon Griffiths wrote:

> Hi,
> 
> This patch removes the warnings from the WINE_UNICODE_TEXT macro and fixes an 
> obscure (read: uninvestgated) bug where the value of WCHAR('x') + 1 is off by 

   You mean WINE_UNICODE_TEXT('x')+1 != WINE_UNICODE_TEXT('y') ?
  I see why this could happen: gcc considers that the expression is of
type WCHAR* and since sizeof(WCHAR)==2, it just adds two.


> one. Currently 2-3 warnings are generated whenever TEXT() is used in Winelib 
> programs, depending on whether a string or char is the target.
> 
> Only one warning remains, when using WCHAR('x') the result should be 
> explicitly cast to WCHAR to get rid of it. If you do this -Wall is blissfully 
> silent once again...

   Which means you get warnings too. I'm not too convinced about this
patch especially because it does not return the proper type. On the
other hand it seems what I did returns a WCHAR* (after a fashion). But
it seems there's no really good solution (besides -fshort-wchar) :-(.

   If you are going to modify your source, I think casting TEXT('x') to
WCHAR is not the solution. The solution is to not use TEXT (and
equivalents) on characters.


--
Francois Gouget         fgouget at free.fr        http://fgouget.free.fr/
                Linux: It is now safe to turn on your computer.




More information about the wine-devel mailing list