Author: cfinck Date: Mon May 12 13:35:21 2008 New Revision: 33482
URL: http://svn.reactos.org/svn/reactos?rev=33482&view=rev Log: Sync CharLowerA/W and CharUpperA/W with Wine (after replacing Wine's SEH with PSEH). This way, we pass all user32 wsprintf Wine tests. Verified under Windows XP SP2.
Modified: trunk/reactos/dll/win32/user32/windows/text.c
Modified: trunk/reactos/dll/win32/user32/windows/text.c URL: http://svn.reactos.org/svn/reactos/trunk/reactos/dll/win32/user32/windows/te... ============================================================================== --- trunk/reactos/dll/win32/user32/windows/text.c [iso-8859-1] (original) +++ trunk/reactos/dll/win32/user32/windows/text.c [iso-8859-1] Mon May 12 13:35:21 2008 @@ -52,28 +52,27 @@ */ LPSTR WINAPI -CharLowerA(LPSTR x) -{ - if (!HIWORD(x)) return (LPSTR)tolower((char)(int)x); - CharLowerBuffA(x, strlen(x)); -/* - __TRY - { - LPSTR s = x; - while (*s) - { - *s=tolower(*s); - s++; - } - } - __EXCEPT(page_fault) +CharLowerA(LPSTR str) +{ + if (!HIWORD(str)) + { + char ch = LOWORD(str); + CharLowerBuffA( &ch, 1 ); + return (LPSTR)(UINT_PTR)(BYTE)ch; + } + + _SEH_TRY + { + CharLowerBuffA( str, strlen(str) ); + } + _SEH_HANDLE { SetLastError( ERROR_INVALID_PARAMETER ); return NULL; } - __ENDTRY - */ - return x; + _SEH_END; + + return str; }
/* @@ -119,11 +118,8 @@ WINAPI CharLowerW(LPWSTR x) { - if (HIWORD(x)) { - return _wcslwr(x); - } else { - return (LPWSTR)(INT)towlower((WORD)(((DWORD)(x)) & 0xFFFF)); - } + if (HIWORD(x)) return strlwrW(x); + else return (LPWSTR)((UINT_PTR)tolowerW(LOWORD(x))); }
/* @@ -256,11 +252,27 @@ /* * @implemented */ -LPSTR WINAPI CharUpperA(LPSTR x) -{ - if (!HIWORD(x)) return (LPSTR)toupper((char)(int)x); - CharUpperBuffA(x, strlen(x)); - return x; +LPSTR WINAPI CharUpperA(LPSTR str) +{ + if (!HIWORD(str)) + { + char ch = LOWORD(str); + CharUpperBuffA( &ch, 1 ); + return (LPSTR)(UINT_PTR)(BYTE)ch; + } + + _SEH_TRY + { + CharUpperBuffA( str, strlen(str) ); + } + _SEH_HANDLE + { + SetLastError( ERROR_INVALID_PARAMETER ); + return NULL; + } + _SEH_END; + + return str; }
/* @@ -306,8 +318,8 @@ WINAPI CharUpperW(LPWSTR x) { - if (HIWORD(x)) return _wcsupr(x); - else return (LPWSTR)(UINT)towlower((WORD)(((DWORD)(x)) & 0xFFFF)); + if (HIWORD(x)) return struprW(x); + else return (LPWSTR)((UINT_PTR)toupperW(LOWORD(x))); }
/*