ole32: Cast-qual warnings fix.

This commit is contained in:
Andrew Talbot 2006-11-06 23:26:38 +00:00 committed by Alexandre Julliard
parent fb28614a11
commit 97ee9c7820
1 changed files with 10 additions and 7 deletions

View File

@ -393,16 +393,20 @@ static HRESULT PropertyStorage_StringCopy(LPCSTR src, LCID srcCP, LPSTR *dst,
} }
else else
{ {
LPWSTR wideStr; LPCWSTR wideStr = NULL;
LPWSTR wideStr_tmp = NULL;
if (srcCP == CP_UNICODE) if (srcCP == CP_UNICODE)
wideStr = (LPWSTR)src; wideStr = (LPCWSTR)src;
else else
{ {
len = MultiByteToWideChar(srcCP, 0, src, -1, NULL, 0); len = MultiByteToWideChar(srcCP, 0, src, -1, NULL, 0);
wideStr = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR)); wideStr_tmp = HeapAlloc(GetProcessHeap(), 0, len * sizeof(WCHAR));
if (wideStr) if (wideStr_tmp)
MultiByteToWideChar(srcCP, 0, src, -1, wideStr, len); {
MultiByteToWideChar(srcCP, 0, src, -1, wideStr_tmp, len);
wideStr = wideStr_tmp;
}
else else
hr = STG_E_INSUFFICIENTMEMORY; 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_tmp);
HeapFree(GetProcessHeap(), 0, wideStr);
} }
} }
TRACE("returning 0x%08x (%s)\n", hr, TRACE("returning 0x%08x (%s)\n", hr,