"Dmitry Timoshkov" dmitry@baikal.ru wrote:
/**************************************************************************
- RtlUpperChar (NTDLL.@)
- */
+CHAR WINAPI RtlUpperChar( CHAR ch ) +{
- return toupper(ch);
+}
It's better to avoid using locale dependent functions from an underlying system because Wine internal code page almost always is different from OS locale. The way to go is convert to unicode, do desired things, and
convert
the result back to ansi.
The implementation of RtlUpperString in rtlstr.c gave me the idea to use toupper:
/************************************************************************** * RtlUpperString (NTDLL.@) */ void WINAPI RtlUpperString( STRING *dst, const STRING *src ) { unsigned int i, len = min(src->Length, dst->MaximumLength);
for (i = 0; i < len; i++) dst->Buffer[i] = toupper(src->Buffer[i]); dst->Length = len; }
The docu of RtlUpperChar says:
RtlUpperChar returns the uppercase version of the specified character or returns the value specified by the caller for Character if the specified character cannot be converted.
RtlUpperChar returns the input Character unconverted if it is the lead byte of a multibyte character or if the uppercase equivalent of Character is a double-byte character. To convert such characters, use RtlUpcaseUnicodeChar. --- End of docu --
IMHO RtlUpperChar has nothing to do for unicode chars. Is there a way to use Wine internal code page to do the conversion without converting to unicode and back?
BTW: If it is not ok to use toupper several other places in wine have a problem:
$ grep toupper */*.c */*/*.c */*/*/*.c | grep -v toupperW | grep -v str_toupper
in wine-20030115 gives a longer list of usages of toupper.
Specially msvcrt toupper seems also to use the function from libc.
Greetings Thomas Mertes
thomas.mertes@t-mobile.at wrote:
IMHO RtlUpperChar has nothing to do for unicode chars. Is there a way to use Wine internal code page to do the conversion without converting to unicode and back?
Wine has only unicode case conversion tables and currently there is no way to avoid forth and back conversions.
BTW: If it is not ok to use toupper several other places in wine have a problem:
$ grep toupper */*.c */*/*.c */*/*/*.c | grep -v toupperW | grep -v str_toupper
in wine-20030115 gives a longer list of usages of toupper.
Specially msvcrt toupper seems also to use the function from libc.
Also there are another cases, such as calls to libc's wctomb and similar violations. Sure, all that cases should be fixed. But at least we should try to not introduce new code which causes huge troubles in international environments.