shlwapi: Remove superfluous casts of/to void pointers.

This commit is contained in:
Michael Stefaniuc 2008-11-05 23:04:51 +01:00 committed by Alexandre Julliard
parent 095568dfe9
commit 5f55f154bf
7 changed files with 28 additions and 32 deletions

View File

@ -91,8 +91,7 @@ HRESULT WINAPI SHAddDataBlock(LPDBLIST* lppList, const DATABLOCK_HEADER *lpNewIt
if(!*lppList)
{
/* An empty list. Allocate space for terminal ulSize also */
*lppList = (LPDATABLOCK_HEADER)LocalAlloc(LMEM_ZEROINIT,
ulSize + sizeof(ULONG));
*lppList = LocalAlloc(LMEM_ZEROINIT, ulSize + sizeof(ULONG));
lpInsertAt = *lppList;
}
else
@ -109,8 +108,7 @@ HRESULT WINAPI SHAddDataBlock(LPDBLIST* lppList, const DATABLOCK_HEADER *lpNewIt
}
/* Increase the size of the list */
lpIter = (LPDATABLOCK_HEADER)LocalReAlloc((HLOCAL)*lppList,
ulTotalSize + ulSize+sizeof(ULONG),
lpIter = LocalReAlloc(*lppList, ulTotalSize + ulSize+sizeof(ULONG),
LMEM_ZEROINIT | LMEM_MOVEABLE);
if(lpIter)
{
@ -247,7 +245,7 @@ HRESULT WINAPI SHReadDataBlockList(IStream* lpStream, LPDBLIST* lppList)
if(*lppList)
{
/* Free any existing list */
LocalFree((HLOCAL)*lppList);
LocalFree(*lppList);
*lppList = NULL;
}
@ -283,10 +281,9 @@ HRESULT WINAPI SHReadDataBlockList(IStream* lpStream, LPDBLIST* lppList)
LPDATABLOCK_HEADER lpTemp;
if (pItem == bBuff)
lpTemp = (LPDATABLOCK_HEADER)LocalAlloc(LMEM_ZEROINIT, ulSize);
lpTemp = LocalAlloc(LMEM_ZEROINIT, ulSize);
else
lpTemp = (LPDATABLOCK_HEADER)LocalReAlloc((HLOCAL)pItem, ulSize,
LMEM_ZEROINIT|LMEM_MOVEABLE);
lpTemp = LocalReAlloc(pItem, ulSize, LMEM_ZEROINIT|LMEM_MOVEABLE);
if(!lpTemp)
{
@ -312,7 +309,7 @@ HRESULT WINAPI SHReadDataBlockList(IStream* lpStream, LPDBLIST* lppList)
/* If we allocated space, free it */
if(pItem != bBuff)
LocalFree((HLOCAL)pItem);
LocalFree(pItem);
return hRet;
}
@ -336,7 +333,7 @@ VOID WINAPI SHFreeDataBlockList(LPDBLIST lpList)
TRACE("(%p)\n", lpList);
if (lpList)
LocalFree((HLOCAL)lpList);
LocalFree(lpList);
}
/*************************************************************************
@ -389,20 +386,19 @@ BOOL WINAPI SHRemoveDataBlock(LPDBLIST* lppList, DWORD dwSignature)
lpList = NextItem(lpList);
/* Resize the list */
ulNewSize = LocalSize((HLOCAL)*lppList) - lpItem->cbSize;
ulNewSize = LocalSize(*lppList) - lpItem->cbSize;
/* Copy following elements over lpItem */
memmove(lpItem, lpNext, (char *)lpList - (char *)lpNext + sizeof(ULONG));
if(ulNewSize <= sizeof(ULONG))
{
LocalFree((HLOCAL)*lppList);
LocalFree(*lppList);
*lppList = NULL; /* Removed the last element */
}
else
{
lpList = (LPDATABLOCK_HEADER)LocalReAlloc((HLOCAL)*lppList, ulNewSize,
LMEM_ZEROINIT|LMEM_MOVEABLE);
lpList = LocalReAlloc(*lppList, ulNewSize, LMEM_ZEROINIT|LMEM_MOVEABLE);
if(lpList)
*lppList = lpList;
}

View File

@ -101,7 +101,7 @@ static ULONG WINAPI IStream_fnRelease(IStream *iface)
if (!refCount)
{
IStream_fnCommit(iface, 0); /* If ever buffered, this will be needed */
LocalFree((HLOCAL)This->lpszPath);
LocalFree(This->lpszPath);
CloseHandle(This->hFile);
HeapFree(GetProcessHeap(), 0, This);
}

View File

@ -4335,7 +4335,7 @@ INT WINAPIV ShellMessageBoxWrapW(HINSTANCE hInstance, HWND hWnd, LPCWSTR lpText,
va_end(args);
ret = MessageBoxW(hWnd, pszTemp, pszTitle, uType);
LocalFree((HLOCAL)pszTemp);
LocalFree(pszTemp);
return ret;
}

View File

@ -68,8 +68,8 @@ HRESULT WINAPI SHRegGetCLSIDKeyW(REFGUID,LPCWSTR,BOOL,BOOL,PHKEY);
*/
static HKEY WINAPI REG_GetHKEYFromHUSKEY(HUSKEY hUSKey, BOOL which)
{
HKEY test = (HKEY) hUSKey;
LPSHUSKEY mihk = (LPSHUSKEY) hUSKey;
HKEY test = hUSKey;
LPSHUSKEY mihk = hUSKey;
if ((test == HKEY_CLASSES_ROOT) ||
(test == HKEY_CURRENT_CONFIG) ||
@ -174,7 +174,7 @@ LONG WINAPI SHRegOpenUSKeyW(LPCWSTR Path, REGSAM AccessType, HUSKEY hRelativeUSK
TRACE("HUSKEY=%p\n", hKey);
if (phNewUSKey)
*phNewUSKey = (HUSKEY)hKey;
*phNewUSKey = hKey;
return ERROR_SUCCESS;
}
@ -1398,21 +1398,21 @@ DWORD WINAPI SHQueryValueExA( HKEY hKey, LPCSTR lpszValue,
char cNull = '\0';
nBytesToAlloc = dwUnExpDataLen;
szData = (LPSTR) LocalAlloc(LMEM_ZEROINIT, nBytesToAlloc);
szData = LocalAlloc(LMEM_ZEROINIT, nBytesToAlloc);
RegQueryValueExA (hKey, lpszValue, lpReserved, NULL, (LPBYTE)szData, &nBytesToAlloc);
dwExpDataLen = ExpandEnvironmentStringsA(szData, &cNull, 1);
dwUnExpDataLen = max(nBytesToAlloc, dwExpDataLen);
LocalFree((HLOCAL) szData);
LocalFree(szData);
}
else
{
nBytesToAlloc = (lstrlenA(pvData)+1) * sizeof (CHAR);
szData = (LPSTR) LocalAlloc(LMEM_ZEROINIT, nBytesToAlloc );
szData = LocalAlloc(LMEM_ZEROINIT, nBytesToAlloc);
lstrcpyA(szData, pvData);
dwExpDataLen = ExpandEnvironmentStringsA(szData, pvData, *pcbData / sizeof(CHAR));
if (dwExpDataLen > *pcbData) dwRet = ERROR_MORE_DATA;
dwUnExpDataLen = max(nBytesToAlloc, dwExpDataLen);
LocalFree((HLOCAL) szData);
LocalFree(szData);
}
}
@ -1459,21 +1459,21 @@ DWORD WINAPI SHQueryValueExW(HKEY hKey, LPCWSTR lpszValue,
WCHAR cNull = '\0';
nBytesToAlloc = dwUnExpDataLen;
szData = (LPWSTR) LocalAlloc(LMEM_ZEROINIT, nBytesToAlloc);
szData = LocalAlloc(LMEM_ZEROINIT, nBytesToAlloc);
RegQueryValueExW (hKey, lpszValue, lpReserved, NULL, (LPBYTE)szData, &nBytesToAlloc);
dwExpDataLen = ExpandEnvironmentStringsW(szData, &cNull, 1);
dwUnExpDataLen = max(nBytesToAlloc, dwExpDataLen);
LocalFree((HLOCAL) szData);
LocalFree(szData);
}
else
{
nBytesToAlloc = (lstrlenW(pvData) + 1) * sizeof(WCHAR);
szData = (LPWSTR) LocalAlloc(LMEM_ZEROINIT, nBytesToAlloc );
szData = LocalAlloc(LMEM_ZEROINIT, nBytesToAlloc);
lstrcpyW(szData, pvData);
dwExpDataLen = ExpandEnvironmentStringsW(szData, pvData, *pcbData/sizeof(WCHAR) );
if (dwExpDataLen > *pcbData) dwRet = ERROR_MORE_DATA;
dwUnExpDataLen = max(nBytesToAlloc, dwExpDataLen);
LocalFree((HLOCAL) szData);
LocalFree(szData);
}
}

View File

@ -911,7 +911,7 @@ LPSTR WINAPI StrDupA(LPCSTR lpszStr)
TRACE("(%s)\n",debugstr_a(lpszStr));
iLen = lpszStr ? strlen(lpszStr) + 1 : 1;
lpszRet = (LPSTR)LocalAlloc(LMEM_FIXED, iLen);
lpszRet = LocalAlloc(LMEM_FIXED, iLen);
if (lpszRet)
{
@ -936,7 +936,7 @@ LPWSTR WINAPI StrDupW(LPCWSTR lpszStr)
TRACE("(%s)\n",debugstr_w(lpszStr));
iLen = (lpszStr ? strlenW(lpszStr) + 1 : 1) * sizeof(WCHAR);
lpszRet = (LPWSTR)LocalAlloc(LMEM_FIXED, iLen);
lpszRet = LocalAlloc(LMEM_FIXED, iLen);
if (lpszRet)
{

View File

@ -486,7 +486,7 @@ static void test_StrDupA(void)
if (lpszStr)
{
ok(!strcmp(result->byte_size_64, lpszStr), "Copied string wrong\n");
LocalFree((HLOCAL)lpszStr);
LocalFree(lpszStr);
}
result++;
}
@ -496,7 +496,7 @@ static void test_StrDupA(void)
*/
lpszStr = StrDupA(NULL);
ok(lpszStr == NULL || *lpszStr == '\0', "NULL string returned %p\n", lpszStr);
LocalFree((HLOCAL)lpszStr);
LocalFree(lpszStr);
}
static void test_StrFormatByteSize64A(void)

View File

@ -140,7 +140,7 @@ HRESULT WINAPI SHGetThreadRef(IUnknown **lppUnknown)
if (!lppUnknown || SHLWAPI_ThreadRef_index == TLS_OUT_OF_INDEXES)
return E_NOINTERFACE;
*lppUnknown = (IUnknown*)TlsGetValue(SHLWAPI_ThreadRef_index);
*lppUnknown = TlsGetValue(SHLWAPI_ThreadRef_index);
if (!*lppUnknown)
return E_NOINTERFACE;