diff --git a/dlls/crtdll/crtdll.spec b/dlls/crtdll/crtdll.spec index bed251341ff..80e25d7a142 100644 --- a/dlls/crtdll/crtdll.spec +++ b/dlls/crtdll/crtdll.spec @@ -495,8 +495,8 @@ init CRTDLL_Init @ cdecl tmpnam(str) CRTDLL_tmpnam @ cdecl tolower(long) tolower @ cdecl toupper(long) toupper -@ cdecl towlower(long) towlower -@ cdecl towupper(long) towupper +@ cdecl towlower(long) CRTDLL_towlower +@ cdecl towupper(long) CRTDLL_towupper @ stub ungetc @ stub ungetwc @ cdecl vfprintf(ptr str ptr) CRTDLL_vfprintf diff --git a/dlls/crtdll/wcstring.c b/dlls/crtdll/wcstring.c index 0b677c9fdd2..fbcbb8a8590 100644 --- a/dlls/crtdll/wcstring.c +++ b/dlls/crtdll/wcstring.c @@ -18,6 +18,7 @@ #endif #include "windef.h" +#include "ntddk.h" #include "crtdll.h" #include "debugtools.h" @@ -144,12 +145,7 @@ LPWSTR __cdecl CRTDLL__wcsupr( LPWSTR str ) */ WCHAR __cdecl CRTDLL_towlower( WCHAR ch ) { -#ifdef HAVE_WCTYPE_H - ch = (WCHAR)towlower( (wchar_t)ch ); -#else - if (!HIBYTE(ch)) ch = (WCHAR)tolower( LOBYTE(ch) ); /* FIXME */ -#endif - return ch; + return NTDLL_towlower(ch); } @@ -158,12 +154,7 @@ WCHAR __cdecl CRTDLL_towlower( WCHAR ch ) */ WCHAR __cdecl CRTDLL_towupper( WCHAR ch ) { -#ifdef HAVE_WCTYPE_H - ch = (WCHAR)towupper( (wchar_t)ch ); -#else - if (!HIBYTE(ch)) ch = (WCHAR)toupper( LOBYTE(ch) ); /* FIXME */ -#endif - return ch; + return NTDLL_towupper(ch); } diff --git a/dlls/ntdll/ntdll.spec b/dlls/ntdll/ntdll.spec index e65bd364578..ebcaaba53bd 100644 --- a/dlls/ntdll/ntdll.spec +++ b/dlls/ntdll/ntdll.spec @@ -935,8 +935,8 @@ type win32 @ stub tan @ cdecl tolower(long) tolower @ cdecl toupper(long) toupper -@ cdecl towlower(long) towlower -@ cdecl towupper(long) towupper +@ cdecl towlower(long) NTDLL_towlower +@ cdecl towupper(long) NTDLL_towupper @ cdecl vsprintf(ptr str ptr) CRTDLL_vsprintf @ cdecl wcscat(wstr wstr) CRTDLL_wcscat @ cdecl wcschr(wstr long) CRTDLL_wcschr diff --git a/dlls/ntdll/rtlstr.c b/dlls/ntdll/rtlstr.c index 10499ec54ef..8528896b16a 100644 --- a/dlls/ntdll/rtlstr.c +++ b/dlls/ntdll/rtlstr.c @@ -9,9 +9,6 @@ #include #include #include -#ifdef HAVE_WCTYPE_H -# include -#endif #include "wine/winestring.h" #include "crtdll.h" #include "heap.h" @@ -20,10 +17,30 @@ #include "ntdll_misc.h" #include "ntddk.h" +#include "casemap.h" + DEFAULT_DEBUG_CHANNEL(ntdll) /* STRING FUNCTIONS */ +/************************************************************************** + * NTDLL.towupper + */ +WCHAR CDECL NTDLL_towupper(WCHAR code) +{ + const WCHAR * ptr = uprtable[HIBYTE(code)]; + return ptr ? ptr[LOBYTE(code)] : code; +} + +/************************************************************************** + * NTDLL.towlower + */ +WCHAR CDECL NTDLL_towlower(WCHAR code) +{ + const WCHAR * ptr = lwrtable[HIBYTE(code)]; + return ptr ? ptr[LOBYTE(code)] : code; +} + /************************************************************************** * RtlInitString */ @@ -242,7 +259,7 @@ DWORD WINAPI RtlUpcaseUnicodeString( for (i=0; i < len/sizeof(WCHAR); i++) { - dest->Buffer[i] = towupper(src->Buffer[i]); + dest->Buffer[i] = NTDLL_towupper(src->Buffer[i]); } dest->Length = len; return STATUS_SUCCESS; @@ -346,7 +363,7 @@ WINAPI RtlUpcaseUnicodeStringToOemString( for (i=0; i < len; i++) { - oem->Buffer[i] = towupper((char)(uni->Buffer[i])); + oem->Buffer[i] = NTDLL_towupper((char)(uni->Buffer[i])); } oem->Buffer[i] = 0; return STATUS_SUCCESS; diff --git a/dlls/shell32/shellpath.c b/dlls/shell32/shellpath.c index 866f001eb27..d389ce329fc 100644 --- a/dlls/shell32/shellpath.c +++ b/dlls/shell32/shellpath.c @@ -468,7 +468,7 @@ int WINAPI PathGetDriveNumberA(LPCSTR lpszPath) */ int WINAPI PathGetDriveNumberW(LPCWSTR lpszPath) { - int chr = towlower(lpszPath[0]); + int chr = CRTDLL_towlower(lpszPath[0]); TRACE ("%s\n",debugstr_w(lpszPath)); @@ -1313,7 +1313,7 @@ static BOOL PathMatchSingleMaskW(LPCWSTR name, LPCWSTR mask) } while (*name++); return 0; } - if (towupper(*mask)!=towupper(*name) && *mask!='?') return 0; + if (CRTDLL_towupper(*mask)!=CRTDLL_towupper(*name) && *mask!='?') return 0; name++; mask++; } @@ -1428,7 +1428,7 @@ BOOL WINAPI PathIsSameRootW(LPCWSTR lpszPath1, LPCWSTR lpszPath2) if (PathIsRelativeW(lpszPath1) || PathIsRelativeW(lpszPath2)) return FALSE; /* usual path */ - if ( towupper(lpszPath1[0])==towupper(lpszPath2[0]) && + if ( CRTDLL_towupper(lpszPath1[0])==CRTDLL_towupper(lpszPath2[0]) && lpszPath1[1]==':' && lpszPath2[1]==':' && lpszPath1[2]=='\\' && lpszPath2[2]=='\\') return TRUE; diff --git a/include/ntddk.h b/include/ntddk.h index 9c573d6549a..3acb95496d5 100644 --- a/include/ntddk.h +++ b/include/ntddk.h @@ -585,6 +585,9 @@ DWORD WINAPI RtlGetAce( /* string functions */ +WCHAR CDECL NTDLL_towupper(WCHAR code); +WCHAR CDECL NTDLL_towlower(WCHAR code); + VOID WINAPI RtlInitAnsiString( PANSI_STRING target, LPCSTR source); diff --git a/include/winnls.h b/include/winnls.h index 05dc53ea7c4..1be65201af4 100644 --- a/include/winnls.h +++ b/include/winnls.h @@ -7,7 +7,6 @@ #ifdef __WINE__ # undef wsprintf #endif -#include /* needed for towupper */ #endif #include "windef.h" @@ -417,12 +416,6 @@ /* use this in a WineLib program if you really want all types */ #define LOCALE_TIMEDATEBOTH 0x00000300 /* full set */ -#ifndef HAVE_WCTYPE_H /* fight native wctype.h */ -/* Prototypes for Unicode case conversion routines */ -WCHAR towupper(WCHAR); -WCHAR towlower(WCHAR); -#endif - /* Definitions for IsTextUnicode() function */ #define IS_TEXT_UNICODE_ASCII16 0x0001 #define IS_TEXT_UNICODE_SIGNATURE 0x0008 diff --git a/memory/string.c b/memory/string.c index 34a5303bd85..5dce9c116ed 100644 --- a/memory/string.c +++ b/memory/string.c @@ -12,6 +12,7 @@ #include "winbase.h" #include "wingdi.h" #include "winuser.h" +#include "ntddk.h" #include "wine/winbase16.h" #include "wine/winuser16.h" #include "wine/keyboard16.h" @@ -224,12 +225,12 @@ INT WINAPI lstrcmpiW( LPCWSTR str1, LPCWSTR str2 ) if ((*str1<0x100 ) && (*str2<0x100)) { if ((res = toupper(*str1) - toupper(*str2)) != 0) return res; } else { - if ((res = towupper(*str1) - towupper(*str2)) != 0) return res; + if ((res = NTDLL_towupper(*str1) - NTDLL_towupper(*str2)) != 0) return res; } str1++; str2++; } - return towupper(*str1) - towupper(*str2); + return NTDLL_towupper(*str1) - NTDLL_towupper(*str2); } diff --git a/misc/lstr.c b/misc/lstr.c index f3ecd7bc04a..d367ce07224 100644 --- a/misc/lstr.c +++ b/misc/lstr.c @@ -26,6 +26,7 @@ #include "winbase.h" #include "wingdi.h" #include "winuser.h" +#include "ntddk.h" #include "wine/winbase16.h" #include "wine/winuser16.h" #include "winnls.h" @@ -40,38 +41,8 @@ DEFAULT_DEBUG_CHANNEL(resource); extern const WORD OLE2NLS_CT_CType3_LUT[]; /* FIXME: does not belong here */ - /* Funny to divide them between user and kernel. */ -/* be careful: always use functions from wctype.h if character > 255 */ - -/* - * Unicode case conversion routines ... these should be used where - * toupper/tolower are used for ASCII. - */ -#ifndef HAVE_WCTYPE_H -/* FIXME: should probably get rid of wctype.h altogether */ -#include "casemap.h" - -/*********************************************************************** - * towupper - */ -WCHAR towupper(WCHAR code) -{ - const WCHAR * ptr = uprtable[HIBYTE(code)]; - return ptr ? ptr[LOBYTE(code)] : code; -} - -/*********************************************************************** - * towlower - */ -WCHAR towlower(WCHAR code) -{ - const WCHAR * ptr = lwrtable[HIBYTE(code)]; - return ptr ? ptr[LOBYTE(code)] : code; -} -#endif /* HAVE_WCTYPE_H */ - /*********************************************************************** * IsCharAlpha (USER.433) */ @@ -321,7 +292,7 @@ DWORD WINAPI CharLowerBuffW(LPWSTR x,DWORD buflen) if (!x) return 0; /* YES */ while (*x && (buflen--)) { - *x=towlower(*x); + *x=NTDLL_towlower(*x); x++; done++; } @@ -339,12 +310,12 @@ LPWSTR WINAPI CharLowerW(LPWSTR x) LPWSTR s = x; while (*s) { - *s=towlower(*s); + *s=NTDLL_towlower(*s); s++; } return x; } - else return (LPWSTR)((UINT)towlower(LOWORD(x))); + else return (LPWSTR)((UINT)NTDLL_towlower(LOWORD(x))); } /*********************************************************************** @@ -395,7 +366,7 @@ DWORD WINAPI CharUpperBuffW(LPWSTR x,DWORD buflen) if (!x) return 0; /* YES */ while (*x && (buflen--)) { - *x=towupper(*x); + *x=NTDLL_towupper(*x); x++; done++; } @@ -413,12 +384,12 @@ LPWSTR WINAPI CharUpperW(LPWSTR x) LPWSTR s = x; while (*s) { - *s=towupper(*s); + *s=NTDLL_towupper(*s); s++; } return x; } - else return (LPWSTR)((UINT)towupper(LOWORD(x))); + else return (LPWSTR)((UINT)NTDLL_towupper(LOWORD(x))); } /***********************************************************************