OLE32: eliminate casts of the return value of HeapAlloc

Mike McCormack mike at codeweavers.com
Sat Mar 19 07:15:32 CST 2005


ChangeLog:
* eliminate casts of the return value of HeapAlloc
-------------- next part --------------
Index: dlls/ole32/clipboard.c
===================================================================
RCS file: /home/wine/wine/dlls/ole32/clipboard.c,v
retrieving revision 1.41
diff -u -p -r1.41 clipboard.c
--- dlls/ole32/clipboard.c	14 Mar 2005 10:46:50 -0000	1.41
+++ dlls/ole32/clipboard.c	19 Mar 2005 13:12:20 -0000
@@ -1448,7 +1448,7 @@ static HRESULT WINAPI OLEClipbrd_IDataOb
    * and create an IEnumFORMATETC enumerator from this list.
    */
   cfmt = CountClipboardFormats();
-  afmt = (FORMATETC *)HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY,
+  afmt = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY,
                                 sizeof(FORMATETC) * cfmt);
   /*
    * Open the Windows clipboard, associating it with our hidden window
@@ -1576,9 +1576,7 @@ LPENUMFORMATETC OLEClipbrd_IEnumFORMATET
   DWORD size=cfmt * sizeof(FORMATETC);
   LPMALLOC pIMalloc;
 
-  ef = (IEnumFORMATETCImpl*)HeapAlloc(GetProcessHeap(),
-                                      HEAP_ZERO_MEMORY,
-                                      sizeof(IEnumFORMATETCImpl));
+  ef = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IEnumFORMATETCImpl));
   if (!ef)
     return NULL;
 
Index: dlls/ole32/compobj.c
===================================================================
RCS file: /home/wine/wine/dlls/ole32/compobj.c,v
retrieving revision 1.145
diff -u -p -r1.145 compobj.c
--- dlls/ole32/compobj.c	17 Mar 2005 10:26:20 -0000	1.145
+++ dlls/ole32/compobj.c	19 Mar 2005 13:12:21 -0000
@@ -441,7 +441,7 @@ static void COMPOBJ_DLLList_Add(HANDLE h
 
     if (openDllList == NULL) {
         /* empty list -- add first node */
-        openDllList = (OpenDll*)HeapAlloc(GetProcessHeap(),0, sizeof(OpenDll));
+        openDllList = HeapAlloc(GetProcessHeap(),0, sizeof(OpenDll));
 	openDllList->hLibrary=hLibrary;
 	openDllList->next = NULL;
     } else {
@@ -456,7 +456,7 @@ static void COMPOBJ_DLLList_Add(HANDLE h
 	if (!found) {
 	    /* dll not found, add it */
  	    tmp = openDllList;
-	    openDllList = (OpenDll*)HeapAlloc(GetProcessHeap(),0, sizeof(OpenDll));
+	    openDllList = HeapAlloc(GetProcessHeap(),0, sizeof(OpenDll));
 	    openDllList->hLibrary = hLibrary;
 	    openDllList->next = tmp;
 	}
Index: dlls/ole32/errorinfo.c
===================================================================
RCS file: /home/wine/wine/dlls/ole32/errorinfo.c,v
retrieving revision 1.26
diff -u -p -r1.26 errorinfo.c
--- dlls/ole32/errorinfo.c	14 Feb 2005 11:07:55 -0000	1.26
+++ dlls/ole32/errorinfo.c	19 Mar 2005 13:12:21 -0000
@@ -63,8 +63,7 @@ static BSTR WINAPI ERRORINFO_SysAllocStr
      * buffer for the character count and an extra character at the
      * end for the '\0'.
      */
-    newBuffer = (DWORD*)HeapAlloc(GetProcessHeap(),
-                                 0,
+    newBuffer = HeapAlloc(GetProcessHeap(), 0,
                                  bufferSize + sizeof(WCHAR) + sizeof(DWORD));
 
     /*
Index: dlls/ole32/ftmarshal.c
===================================================================
RCS file: /home/wine/wine/dlls/ole32/ftmarshal.c,v
retrieving revision 1.13
diff -u -p -r1.13 ftmarshal.c
--- dlls/ole32/ftmarshal.c	9 Jan 2005 16:52:51 -0000	1.13
+++ dlls/ole32/ftmarshal.c	19 Mar 2005 13:12:21 -0000
@@ -224,7 +224,7 @@ HRESULT WINAPI CoCreateFreeThreadedMarsh
 
     TRACE ("(%p %p)\n", punkOuter, ppunkMarshal);
 
-    ftm = (FTMarshalImpl *) HeapAlloc (GetProcessHeap (), 0, sizeof (FTMarshalImpl));
+    ftm = HeapAlloc (GetProcessHeap (), 0, sizeof (FTMarshalImpl));
     if (!ftm)
 	return E_OUTOFMEMORY;
 
Index: dlls/ole32/oleobj.c
===================================================================
RCS file: /home/wine/wine/dlls/ole32/oleobj.c,v
retrieving revision 1.22
diff -u -p -r1.22 oleobj.c
--- dlls/ole32/oleobj.c	9 Jan 2005 17:29:21 -0000	1.22
+++ dlls/ole32/oleobj.c	19 Mar 2005 13:12:21 -0000
@@ -88,9 +88,7 @@ static LPOLEADVISEHOLDER OleAdviseHolder
   OleAdviseHolderImpl* lpoah;
   DWORD                index;
 
-  lpoah= (OleAdviseHolderImpl*)HeapAlloc(GetProcessHeap(),
-					 0,
-					 sizeof(OleAdviseHolderImpl));
+  lpoah = HeapAlloc(GetProcessHeap(), 0, sizeof(OleAdviseHolderImpl));
 
   lpoah->lpVtbl = &oahvt;
   lpoah->ref = 1;
@@ -430,9 +428,7 @@ static IDataAdviseHolder* DataAdviseHold
 {
   DataAdviseHolder* newHolder;
 
-  newHolder = (DataAdviseHolder*)HeapAlloc(GetProcessHeap(),
-					   0,
-					   sizeof(DataAdviseHolder));
+  newHolder = HeapAlloc(GetProcessHeap(), 0, sizeof(DataAdviseHolder));
 
   newHolder->lpVtbl = &DataAdviseHolderImpl_VTable;
   newHolder->ref = 1;
Index: dlls/ole32/stg_bigblockfile.c
===================================================================
RCS file: /home/wine/wine/dlls/ole32/stg_bigblockfile.c,v
retrieving revision 1.16
diff -u -p -r1.16 stg_bigblockfile.c
--- dlls/ole32/stg_bigblockfile.c	7 Mar 2005 12:24:42 -0000	1.16
+++ dlls/ole32/stg_bigblockfile.c	19 Mar 2005 13:12:21 -0000
@@ -172,7 +172,7 @@ BigBlockFile * BIGBLOCKFILE_Construct(
 {
   LPBIGBLOCKFILE This;
 
-  This = (LPBIGBLOCKFILE)HeapAlloc(GetProcessHeap(), 0, sizeof(BigBlockFile));
+  This = HeapAlloc(GetProcessHeap(), 0, sizeof(BigBlockFile));
 
   if (This == NULL)
     return NULL;
Index: dlls/ole32/storage32.c
===================================================================
RCS file: /home/wine/wine/dlls/ole32/storage32.c,v
retrieving revision 1.77
diff -u -p -r1.77 storage32.c
--- dlls/ole32/storage32.c	17 Mar 2005 10:25:13 -0000	1.77
+++ dlls/ole32/storage32.c	19 Mar 2005 13:12:21 -0000
@@ -3416,7 +3416,7 @@ BlockChainStream* Storage32Impl_SmallBlo
   cbTotalRead = 0;
   cbTotalWritten = 0;
 
-  buffer = (BYTE *) HeapAlloc(GetProcessHeap(),0,DEF_SMALL_BLOCK_SIZE);
+  buffer = HeapAlloc(GetProcessHeap(),0,DEF_SMALL_BLOCK_SIZE);
   do
   {
     successRead = SmallBlockChainStream_ReadAt(*ppsbChain,
@@ -6331,7 +6331,7 @@ HRESULT OLECONVERT_LoadOLE10(LPOLESTREAM
 			{
 					if(pData->dwOleObjFileNameLength < 1) /* there is no file name exist */
 						pData->dwOleObjFileNameLength = sizeof(pData->dwOleObjFileNameLength);
-					pData->pstrOleObjFileName = (CHAR *)HeapAlloc(GetProcessHeap(), 0, pData->dwOleObjFileNameLength);
+					pData->pstrOleObjFileName = HeapAlloc(GetProcessHeap(), 0, pData->dwOleObjFileNameLength);
 					if(pData->pstrOleObjFileName)
 					{
 						dwSize = pOleStream->lpstbl->Get(pOleStream, (void *)(pData->pstrOleObjFileName),pData->dwOleObjFileNameLength);
@@ -6388,7 +6388,7 @@ HRESULT OLECONVERT_LoadOLE10(LPOLESTREAM
 			{
 				if(pData->dwDataLength > 0)
 				{
-					pData->pData = (BYTE *)HeapAlloc(GetProcessHeap(),0,pData->dwDataLength);
+					pData->pData = HeapAlloc(GetProcessHeap(),0,pData->dwDataLength);
 
 					/* Get Data (ex. IStorage, Metafile, or BMP) */
 					if(pData->pData)
@@ -6615,7 +6615,7 @@ DWORD OLECONVERT_WriteOLE20ToBuffer(LPST
         if(hFile != INVALID_HANDLE_VALUE)
         {
             nDataLength = GetFileSize(hFile, NULL);
-            *pData = (BYTE *) HeapAlloc(GetProcessHeap(),0,nDataLength);
+            *pData = HeapAlloc(GetProcessHeap(),0,nDataLength);
             ReadFile(hFile, *pData, nDataLength, &nDataLength, 0);
             CloseHandle(hFile);
         }
@@ -7294,7 +7294,7 @@ void OLECONVERT_GetOle10PresData(LPSTORA
         IStream_Read(pStream, &(pOleStreamData->dwDataLength), sizeof(pOleStreamData->dwDataLength), NULL);
         if(pOleStreamData->dwDataLength > 0)
         {
-            pOleStreamData->pData = (LPSTR) HeapAlloc(GetProcessHeap(),0,pOleStreamData->dwDataLength);
+            pOleStreamData->pData = HeapAlloc(GetProcessHeap(),0,pOleStreamData->dwDataLength);
             IStream_Read(pStream, pOleStreamData->pData, pOleStreamData->dwDataLength, NULL);
         }
         IStream_Release(pStream);
@@ -7383,7 +7383,7 @@ void OLECONVERT_GetOle20PresData(LPSTORA
             MetaFilePict.hMF = 0;
 
             /* Get Metafile Data */
-            pOleStreamData[1].pData = (BYTE *) HeapAlloc(GetProcessHeap(),0,pOleStreamData[1].dwDataLength);
+            pOleStreamData[1].pData = HeapAlloc(GetProcessHeap(),0,pOleStreamData[1].dwDataLength);
             memcpy(pOleStreamData[1].pData, &MetaFilePict, sizeof(MetaFilePict));
             IStream_Read(pStream, &(pOleStreamData[1].pData[sizeof(MetaFilePict)]), pOleStreamData[1].dwDataLength-sizeof(METAFILEPICT16), NULL);
         }


More information about the wine-patches mailing list