user32: Cast-qual warnings fix (2 of 4)

Andrew Talbot Andrew.Talbot at talbotville.com
Sat Nov 18 08:21:29 CST 2006


Changelog:
    user32: Cast-qual warnings fix.

diff -urN a/dlls/user32/dialog.c b/dlls/user32/dialog.c
--- a/dlls/user32/dialog.c	2006-11-16 14:02:17.000000000 +0000
+++ b/dlls/user32/dialog.c	2006-11-18 12:55:13.000000000 +0000
@@ -285,20 +285,24 @@
         }
         else
         {
-            LPSTR class = (LPSTR)info.className;
-            LPSTR caption = (LPSTR)info.windowName;
+            LPCSTR class = (LPCSTR)info.className;
+            LPCSTR caption = (LPCSTR)info.windowName;
+            LPSTR class_tmp = NULL;
+            LPSTR caption_tmp = NULL;
 
             if (HIWORD(class))
             {
                 DWORD len = WideCharToMultiByte( CP_ACP, 0, info.className, -1, NULL, 0, NULL, NULL );
-                class = HeapAlloc( GetProcessHeap(), 0, len );
-                WideCharToMultiByte( CP_ACP, 0, info.className, -1, class, len, NULL, NULL );
+                class_tmp = HeapAlloc( GetProcessHeap(), 0, len );
+                WideCharToMultiByte( CP_ACP, 0, info.className, -1, class_tmp, len, NULL, NULL );
+                class = class_tmp;
             }
             if (HIWORD(caption))
             {
                 DWORD len = WideCharToMultiByte( CP_ACP, 0, info.windowName, -1, NULL, 0, NULL, NULL );
-                caption = HeapAlloc( GetProcessHeap(), 0, len );
-                WideCharToMultiByte( CP_ACP, 0, info.windowName, -1, caption, len, NULL, NULL );
+                caption_tmp = HeapAlloc( GetProcessHeap(), 0, len );
+                WideCharToMultiByte( CP_ACP, 0, info.windowName, -1, caption_tmp, len, NULL, NULL );
+                caption = caption_tmp;
             }
             hwndCtrl = CreateWindowExA( info.exStyle | WS_EX_NOPARENTNOTIFY,
                                         class, caption, info.style | WS_CHILD,
@@ -308,8 +312,8 @@
                                         MulDiv(info.cy, dlgInfo->yBaseUnit, 8),
                                         hwnd, (HMENU)info.id,
                                         hInst, (LPVOID)info.data );
-            if (HIWORD(class)) HeapFree( GetProcessHeap(), 0, class );
-            if (HIWORD(caption)) HeapFree( GetProcessHeap(), 0, caption );
+            if (HIWORD(class)) HeapFree( GetProcessHeap(), 0, class_tmp );
+            if (HIWORD(caption)) HeapFree( GetProcessHeap(), 0, caption_tmp );
         }
         if (!hwndCtrl)
         {
@@ -595,26 +599,30 @@
     }
     else
     {
-        LPSTR class = (LPSTR)template.className;
-        LPSTR caption = (LPSTR)template.caption;
+        LPCSTR class = (LPCSTR)template.className;
+        LPCSTR caption = (LPCSTR)template.caption;
+        LPSTR class_tmp = NULL;
+        LPSTR caption_tmp = NULL;
 
         if (HIWORD(class))
         {
             DWORD len = WideCharToMultiByte( CP_ACP, 0, template.className, -1, NULL, 0, NULL, NULL );
             class = HeapAlloc( GetProcessHeap(), 0, len );
-            WideCharToMultiByte( CP_ACP, 0, template.className, -1, class, len, NULL, NULL );
+            WideCharToMultiByte( CP_ACP, 0, template.className, -1, class_tmp, len, NULL, NULL );
+            class = class_tmp;
         }
         if (HIWORD(caption))
         {
             DWORD len = WideCharToMultiByte( CP_ACP, 0, template.caption, -1, NULL, 0, NULL, NULL );
             caption = HeapAlloc( GetProcessHeap(), 0, len );
-            WideCharToMultiByte( CP_ACP, 0, template.caption, -1, caption, len, NULL, NULL );
+            WideCharToMultiByte( CP_ACP, 0, template.caption, -1, caption_tmp, len, NULL, NULL );
+            caption = caption_tmp;
         }
         hwnd = CreateWindowExA(template.exStyle, class, caption,
                                template.style & ~WS_VISIBLE, pos.x, pos.y, size.cx, size.cy,
                                owner, hMenu, hInst, NULL );
-        if (HIWORD(class)) HeapFree( GetProcessHeap(), 0, class );
-        if (HIWORD(caption)) HeapFree( GetProcessHeap(), 0, caption );
+        if (HIWORD(class)) HeapFree( GetProcessHeap(), 0, class_tmp );
+        if (HIWORD(caption)) HeapFree( GetProcessHeap(), 0, caption_tmp );
     }
 
     if (!hwnd)



More information about the wine-patches mailing list