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.

svn path=/trunk/; revision=33482
This commit is contained in:
Colin Finck 2008-05-12 18:35:21 +00:00
parent cf585bc08a
commit 58f94d1774

View file

@ -52,28 +52,27 @@ GetC1Type(WCHAR Ch)
*/ */
LPSTR LPSTR
WINAPI WINAPI
CharLowerA(LPSTR x) CharLowerA(LPSTR str)
{ {
if (!HIWORD(x)) return (LPSTR)tolower((char)(int)x); if (!HIWORD(str))
CharLowerBuffA(x, strlen(x));
/*
__TRY
{ {
LPSTR s = x; char ch = LOWORD(str);
while (*s) CharLowerBuffA( &ch, 1 );
return (LPSTR)(UINT_PTR)(BYTE)ch;
}
_SEH_TRY
{ {
*s=tolower(*s); CharLowerBuffA( str, strlen(str) );
s++;
} }
} _SEH_HANDLE
__EXCEPT(page_fault)
{ {
SetLastError( ERROR_INVALID_PARAMETER ); SetLastError( ERROR_INVALID_PARAMETER );
return NULL; return NULL;
} }
__ENDTRY _SEH_END;
*/
return x; return str;
} }
/* /*
@ -119,11 +118,8 @@ LPWSTR
WINAPI WINAPI
CharLowerW(LPWSTR x) CharLowerW(LPWSTR x)
{ {
if (HIWORD(x)) { if (HIWORD(x)) return strlwrW(x);
return _wcslwr(x); else return (LPWSTR)((UINT_PTR)tolowerW(LOWORD(x)));
} else {
return (LPWSTR)(INT)towlower((WORD)(((DWORD)(x)) & 0xFFFF));
}
} }
/* /*
@ -256,11 +252,27 @@ CharToOemW(LPCWSTR s, LPSTR d)
/* /*
* @implemented * @implemented
*/ */
LPSTR WINAPI CharUpperA(LPSTR x) LPSTR WINAPI CharUpperA(LPSTR str)
{ {
if (!HIWORD(x)) return (LPSTR)toupper((char)(int)x); if (!HIWORD(str))
CharUpperBuffA(x, strlen(x)); {
return x; 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 @@ LPWSTR
WINAPI WINAPI
CharUpperW(LPWSTR x) CharUpperW(LPWSTR x)
{ {
if (HIWORD(x)) return _wcsupr(x); if (HIWORD(x)) return struprW(x);
else return (LPWSTR)(UINT)towlower((WORD)(((DWORD)(x)) & 0xFFFF)); else return (LPWSTR)((UINT_PTR)toupperW(LOWORD(x)));
} }
/* /*