From 97ee9c782090de676e0187fbf158ffc9c092a67f Mon Sep 17 00:00:00 2001 From: Andrew Talbot Date: Mon, 6 Nov 2006 23:26:38 +0000 Subject: [PATCH] ole32: Cast-qual warnings fix. --- dlls/ole32/stg_prop.c | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/dlls/ole32/stg_prop.c b/dlls/ole32/stg_prop.c index 039d168e004..a4be7b7caa8 100644 --- a/dlls/ole32/stg_prop.c +++ b/dlls/ole32/stg_prop.c @@ -393,16 +393,20 @@ static HRESULT PropertyStorage_StringCopy(LPCSTR src, LCID srcCP, LPSTR *dst, } 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,7 @@ static HRESULT PropertyStorage_StringCopy(LPCSTR src, LCID srcCP, LPSTR *dst, } } } - if (wideStr != (LPWSTR)src) - HeapFree(GetProcessHeap(), 0, wideStr); + HeapFree(GetProcessHeap(), 0, wideStr_tmp); } } TRACE("returning 0x%08x (%s)\n", hr,