Commit a07dceb0 authored by Andrew Talbot's avatar Andrew Talbot Committed by Alexandre Julliard

user32: Cast-qual warnings fix.

parent bc95bfd3
...@@ -211,6 +211,8 @@ static LRESULT call_hook_AtoW( HOOKPROC proc, INT id, INT code, WPARAM wparam, L ...@@ -211,6 +211,8 @@ static LRESULT call_hook_AtoW( HOOKPROC proc, INT id, INT code, WPARAM wparam, L
CBT_CREATEWNDA *cbtcwA = (CBT_CREATEWNDA *)lparam; CBT_CREATEWNDA *cbtcwA = (CBT_CREATEWNDA *)lparam;
CBT_CREATEWNDW cbtcwW; CBT_CREATEWNDW cbtcwW;
CREATESTRUCTW csW; CREATESTRUCTW csW;
LPWSTR nameW = NULL;
LPWSTR classW = NULL;
cbtcwW.lpcs = &csW; cbtcwW.lpcs = &csW;
cbtcwW.hwndInsertAfter = cbtcwA->hwndInsertAfter; cbtcwW.hwndInsertAfter = cbtcwA->hwndInsertAfter;
...@@ -219,17 +221,17 @@ static LRESULT call_hook_AtoW( HOOKPROC proc, INT id, INT code, WPARAM wparam, L ...@@ -219,17 +221,17 @@ static LRESULT call_hook_AtoW( HOOKPROC proc, INT id, INT code, WPARAM wparam, L
if (HIWORD(cbtcwA->lpcs->lpszName)) if (HIWORD(cbtcwA->lpcs->lpszName))
{ {
RtlCreateUnicodeStringFromAsciiz(&usBuffer,cbtcwA->lpcs->lpszName); RtlCreateUnicodeStringFromAsciiz(&usBuffer,cbtcwA->lpcs->lpszName);
csW.lpszName = usBuffer.Buffer; csW.lpszName = nameW = usBuffer.Buffer;
} }
if (HIWORD(cbtcwA->lpcs->lpszClass)) if (HIWORD(cbtcwA->lpcs->lpszClass))
{ {
RtlCreateUnicodeStringFromAsciiz(&usBuffer,cbtcwA->lpcs->lpszClass); RtlCreateUnicodeStringFromAsciiz(&usBuffer,cbtcwA->lpcs->lpszClass);
csW.lpszClass = usBuffer.Buffer; csW.lpszClass = classW = usBuffer.Buffer;
} }
ret = proc( code, wparam, (LPARAM)&cbtcwW ); ret = proc( code, wparam, (LPARAM)&cbtcwW );
cbtcwA->hwndInsertAfter = cbtcwW.hwndInsertAfter; cbtcwA->hwndInsertAfter = cbtcwW.hwndInsertAfter;
if (HIWORD(csW.lpszName)) HeapFree( GetProcessHeap(), 0, (LPWSTR)csW.lpszName ); HeapFree( GetProcessHeap(), 0, nameW );
if (HIWORD(csW.lpszClass)) HeapFree( GetProcessHeap(), 0, (LPWSTR)csW.lpszClass ); HeapFree( GetProcessHeap(), 0, classW );
} }
return ret; return ret;
} }
...@@ -249,6 +251,8 @@ static LRESULT call_hook_WtoA( HOOKPROC proc, INT id, INT code, WPARAM wparam, L ...@@ -249,6 +251,8 @@ static LRESULT call_hook_WtoA( HOOKPROC proc, INT id, INT code, WPARAM wparam, L
CBT_CREATEWNDA cbtcwA; CBT_CREATEWNDA cbtcwA;
CREATESTRUCTA csA; CREATESTRUCTA csA;
int len; int len;
LPSTR nameA = NULL;
LPSTR classA = NULL;
cbtcwA.lpcs = &csA; cbtcwA.lpcs = &csA;
cbtcwA.hwndInsertAfter = cbtcwW->hwndInsertAfter; cbtcwA.hwndInsertAfter = cbtcwW->hwndInsertAfter;
...@@ -256,20 +260,22 @@ static LRESULT call_hook_WtoA( HOOKPROC proc, INT id, INT code, WPARAM wparam, L ...@@ -256,20 +260,22 @@ static LRESULT call_hook_WtoA( HOOKPROC proc, INT id, INT code, WPARAM wparam, L
if (HIWORD(cbtcwW->lpcs->lpszName)) { if (HIWORD(cbtcwW->lpcs->lpszName)) {
len = WideCharToMultiByte( CP_ACP, 0, cbtcwW->lpcs->lpszName, -1, NULL, 0, NULL, NULL ); len = WideCharToMultiByte( CP_ACP, 0, cbtcwW->lpcs->lpszName, -1, NULL, 0, NULL, NULL );
csA.lpszName = HeapAlloc( GetProcessHeap(), 0, len*sizeof(CHAR) ); nameA = HeapAlloc( GetProcessHeap(), 0, len*sizeof(CHAR) );
WideCharToMultiByte( CP_ACP, 0, cbtcwW->lpcs->lpszName, -1, (LPSTR)csA.lpszName, len, NULL, NULL ); WideCharToMultiByte( CP_ACP, 0, cbtcwW->lpcs->lpszName, -1, nameA, len, NULL, NULL );
csA.lpszName = nameA;
} }
if (HIWORD(cbtcwW->lpcs->lpszClass)) { if (HIWORD(cbtcwW->lpcs->lpszClass)) {
len = WideCharToMultiByte( CP_ACP, 0, cbtcwW->lpcs->lpszClass, -1, NULL, 0, NULL, NULL ); len = WideCharToMultiByte( CP_ACP, 0, cbtcwW->lpcs->lpszClass, -1, NULL, 0, NULL, NULL );
csA.lpszClass = HeapAlloc( GetProcessHeap(), 0, len*sizeof(CHAR) ); classA = HeapAlloc( GetProcessHeap(), 0, len*sizeof(CHAR) );
WideCharToMultiByte( CP_ACP, 0, cbtcwW->lpcs->lpszClass, -1, (LPSTR)csA.lpszClass, len, NULL, NULL ); WideCharToMultiByte( CP_ACP, 0, cbtcwW->lpcs->lpszClass, -1, classA, len, NULL, NULL );
csA.lpszClass = classA;
} }
ret = proc( code, wparam, (LPARAM)&cbtcwA ); ret = proc( code, wparam, (LPARAM)&cbtcwA );
cbtcwW->hwndInsertAfter = cbtcwA.hwndInsertAfter; cbtcwW->hwndInsertAfter = cbtcwA.hwndInsertAfter;
if (HIWORD(csA.lpszName)) HeapFree( GetProcessHeap(), 0, (LPSTR)csA.lpszName ); HeapFree( GetProcessHeap(), 0, nameA );
if (HIWORD(csA.lpszClass)) HeapFree( GetProcessHeap(), 0, (LPSTR)csA.lpszClass ); HeapFree( GetProcessHeap(), 0, classA );
} }
return ret; return ret;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment