Module: wine Branch: master Commit: 97ee9c782090de676e0187fbf158ffc9c092a67f URL: http://source.winehq.org/git/wine.git/?a=commit;h=97ee9c782090de676e0187fbf1...
Author: Andrew Talbot Andrew.Talbot@talbotville.com Date: Mon Nov 6 23:26:38 2006 +0000
ole32: Cast-qual warnings fix.
---
dlls/ole32/stg_prop.c | 17 ++++++++++------- 1 files changed, 10 insertions(+), 7 deletions(-)
diff --git a/dlls/ole32/stg_prop.c b/dlls/ole32/stg_prop.c index 039d168..a4be7b7 100644 --- a/dlls/ole32/stg_prop.c +++ b/dlls/ole32/stg_prop.c @@ -393,16 +393,20 @@ static HRESULT PropertyStorage_StringCop } 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_StringCop } } } - if (wideStr != (LPWSTR)src) - HeapFree(GetProcessHeap(), 0, wideStr); + HeapFree(GetProcessHeap(), 0, wideStr_tmp); } } TRACE("returning 0x%08x (%s)\n", hr,