ole32: Cast-qual warnings fix

Andrew Talbot Andrew.Talbot at talbotville.com
Mon Nov 6 17:26:38 CST 2006


Changelog:
    ole32: Cast-qual warnings fix.

diff -urN a/dlls/ole32/stg_prop.c b/dlls/ole32/stg_prop.c
--- a/dlls/ole32/stg_prop.c	2006-10-20 18:08:04.000000000 +0100
+++ b/dlls/ole32/stg_prop.c	2006-11-06 23:12:21.000000000 +0000
@@ -393,16 +393,20 @@
         }
         else
         {
-            LPWSTR wideStr;
+            LPCWSTR wideStr = NULL;
+            LPWSTR wideStr_tmp = NULL;
 
             if (srcCP == CP_UNICODE)
-                wideStr = (LPWSTR)src;
+                wideStr = (LPCWSTR)src;
             else
             {
                 len = MultiByteToWideChar(srcCP, 0, src, -1, NULL, 0);
-                wideStr = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR));
-                if (wideStr)
-                    MultiByteToWideChar(srcCP, 0, src, -1, wideStr, len);
+                wideStr_tmp = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR));
+                if (wideStr_tmp)
+                {
+                    MultiByteToWideChar(srcCP, 0, src, -1, wideStr_tmp, len);
+                    wideStr = wideStr_tmp;
+                }
                 else
                     hr = STG_E_INSUFFICIENTMEMORY;
             }
@@ -426,8 +430,8 @@
                     }
                 }
             }
-            if (wideStr != (LPWSTR)src)
-                HeapFree(GetProcessHeap(), 0, wideStr);
+            if (wideStr != (LPCWSTR)src)
+                HeapFree(GetProcessHeap(), 0, wideStr_tmp);
         }
     }
     TRACE("returning 0x%08x (%s)\n", hr,



More information about the wine-patches mailing list