SHELL32: eliminate casts of the return value of HeapAlloc

Mike McCormack mike at codeweavers.com
Sat Mar 19 07:31:04 CST 2005


ChangeLog:
* eliminate casts of the return value of HeapAlloc
-------------- next part --------------
? dlls/shell32/version.res
? dlls/shell32/x
? dlls/shell32/tests/cabinet.c
? dlls/shell32/tests/pidl.c
? dlls/shell32/tests/pidl.ok
Index: dlls/shell32/autocomplete.c
===================================================================
RCS file: /home/wine/wine/dlls/shell32/autocomplete.c,v
retrieving revision 1.13
diff -u -p -r1.13 autocomplete.c
--- dlls/shell32/autocomplete.c	14 Jan 2005 16:02:20 -0000	1.13
+++ dlls/shell32/autocomplete.c	19 Mar 2005 13:27:55 -0000
@@ -101,8 +101,7 @@ HRESULT WINAPI IAutoComplete_Constructor
     if (pUnkOuter && !IsEqualIID (riid, &IID_IUnknown))
 	return CLASS_E_NOAGGREGATION;
 
-    lpac = (IAutoCompleteImpl*)HeapAlloc(GetProcessHeap(),
-      HEAP_ZERO_MEMORY, sizeof(IAutoCompleteImpl));
+    lpac = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IAutoCompleteImpl));
     if (!lpac) 
 	return E_OUTOFMEMORY;
 
@@ -280,7 +279,7 @@ static HRESULT WINAPI IAutoComplete_fnIn
 	LONG len;
 
 	/* pwszRegKeyPath contains the key as well as the value, so we split */
-	key = (WCHAR*)HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, (lstrlenW(pwzsRegKeyPath)+1)*sizeof(WCHAR));
+	key = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, (lstrlenW(pwzsRegKeyPath)+1)*sizeof(WCHAR));
 	strcpyW(key, pwzsRegKeyPath);
 	value = strrchrW(key, '\\');
 	*value = 0;
@@ -294,7 +293,7 @@ static HRESULT WINAPI IAutoComplete_fnIn
 	if (res == ERROR_SUCCESS) {
 	    res = RegQueryValueW(hKey, value, result, &len);
 	    if (res == ERROR_SUCCESS) {
-		This->quickComplete = (WCHAR*)HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, len*sizeof(WCHAR));
+		This->quickComplete = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, len*sizeof(WCHAR));
 		strcpyW(This->quickComplete, result);
 	    }
 	    RegCloseKey(hKey);
@@ -303,7 +302,7 @@ static HRESULT WINAPI IAutoComplete_fnIn
     }
 
     if ((pwszQuickComplete) && (!This->quickComplete)) {
-	This->quickComplete = (WCHAR*)HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, (lstrlenW(pwszQuickComplete)+1)*sizeof(WCHAR));
+	This->quickComplete = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, (lstrlenW(pwszQuickComplete)+1)*sizeof(WCHAR));
 	lstrcpyW(This->quickComplete, pwszQuickComplete);
     }
 
@@ -482,7 +481,7 @@ static LRESULT APIENTRY ACEditSubclassPr
 		    /* If quickComplete is set and control is pressed, replace the string */
 		    control = GetKeyState(VK_CONTROL) & 0x8000;		    
 		    if (control && This->quickComplete) {
-			hwndQCText = (WCHAR*)HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, 
+			hwndQCText = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, 
 						       (lstrlenW(This->quickComplete)+lstrlenW(hwndText))*sizeof(WCHAR));
 			sel = sprintfW(hwndQCText, This->quickComplete, hwndText);
 			SendMessageW(hwnd, WM_SETTEXT, 0, (LPARAM)hwndQCText);
@@ -525,7 +524,7 @@ static LRESULT APIENTRY ACEditSubclassPr
 				int len;
 				
 				len = SendMessageW(This->hwndListBox, LB_GETTEXTLEN, sel, (LPARAM)NULL);
-				msg = (WCHAR*) HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, (len+1)*sizeof(WCHAR));
+				msg = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, (len+1)*sizeof(WCHAR));
 				SendMessageW(This->hwndListBox, LB_GETTEXT, sel, (LPARAM)msg);
 				SendMessageW(hwnd, WM_SETTEXT, 0, (LPARAM)msg);
 				SendMessageW(hwnd, EM_SETSEL, lstrlenW(msg), lstrlenW(msg));
@@ -562,7 +561,7 @@ static LRESULT APIENTRY ACEditSubclassPr
 	    SendMessageW(This->hwndListBox, LB_RESETCONTENT, 0, 0);
 
 	    HeapFree(GetProcessHeap(), 0, This->txtbackup);
-	    This->txtbackup = (WCHAR*) HeapAlloc(GetProcessHeap(),
+	    This->txtbackup = HeapAlloc(GetProcessHeap(),
 						 HEAP_ZERO_MEMORY, (lstrlenW(hwndText)+1)*sizeof(WCHAR));							      
 	    lstrcpyW(This->txtbackup, hwndText);
 
@@ -631,7 +630,7 @@ static LRESULT APIENTRY ACLBoxSubclassPr
 	    break;
 	case WM_LBUTTONDOWN:
 	    len = SendMessageW(This->hwndListBox, LB_GETTEXTLEN, sel, (LPARAM)NULL);
-	    msg = (WCHAR*) HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, (len+1)*sizeof(WCHAR));
+	    msg = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, (len+1)*sizeof(WCHAR));
 	    sel = (INT)SendMessageW(hwnd, LB_GETCURSEL, 0, 0);
 	    SendMessageW(hwnd, LB_GETTEXT, sel, (LPARAM)msg);
 	    SendMessageW(This->hwndEdit, WM_SETTEXT, 0, (LPARAM)msg);
Index: dlls/shell32/enumidlist.c
===================================================================
RCS file: /home/wine/wine/dlls/shell32/enumidlist.c,v
retrieving revision 1.43
diff -u -p -r1.43 enumidlist.c
--- dlls/shell32/enumidlist.c	23 Feb 2005 12:45:12 -0000	1.43
+++ dlls/shell32/enumidlist.c	19 Mar 2005 13:27:56 -0000
@@ -193,7 +193,7 @@ static BOOL DeleteList(
 
 IEnumIDList * IEnumIDList_Constructor(void)
 {
-    IEnumIDListImpl *lpeidl = (IEnumIDListImpl*)HeapAlloc(GetProcessHeap(),
+    IEnumIDListImpl *lpeidl = HeapAlloc(GetProcessHeap(),
      HEAP_ZERO_MEMORY, sizeof(IEnumIDListImpl));
 
     if (lpeidl)
Index: dlls/shell32/folders.c
===================================================================
RCS file: /home/wine/wine/dlls/shell32/folders.c,v
retrieving revision 1.56
diff -u -p -r1.56 folders.c
--- dlls/shell32/folders.c	7 Mar 2005 11:05:03 -0000	1.56
+++ dlls/shell32/folders.c	19 Mar 2005 13:27:56 -0000
@@ -74,7 +74,7 @@ IExtractIconW* IExtractIconW_Constructor
 	
 	TRACE("%p\n", pidl);
 
-	ei = (IExtractIconWImpl*)HeapAlloc(GetProcessHeap(),0,sizeof(IExtractIconWImpl));
+	ei = HeapAlloc(GetProcessHeap(),0,sizeof(IExtractIconWImpl));
 	ei->ref=1;
 	ei->lpVtbl = &eivt;
 	ei->lpvtblPersistFile = &pfvt;
Index: dlls/shell32/shell.c
===================================================================
RCS file: /home/wine/wine/dlls/shell32/shell.c,v
retrieving revision 1.61
diff -u -p -r1.61 shell.c
--- dlls/shell32/shell.c	15 Jun 2004 18:27:50 -0000	1.61
+++ dlls/shell32/shell.c	19 Mar 2005 13:27:56 -0000
@@ -287,11 +287,11 @@ HICON16 WINAPI ExtractIconEx16(
     int		i;
 
     if (phiconLarge)
-    	ilarge = (HICON*)HeapAlloc(GetProcessHeap(),0,nIcons*sizeof(HICON));
+    	ilarge = HeapAlloc(GetProcessHeap(),0,nIcons*sizeof(HICON));
     else
     	ilarge = NULL;
     if (phiconSmall)
-    	ismall = (HICON*)HeapAlloc(GetProcessHeap(),0,nIcons*sizeof(HICON));
+    	ismall = HeapAlloc(GetProcessHeap(),0,nIcons*sizeof(HICON));
     else
     	ismall = NULL;
     ret = HICON_16(ExtractIconExA(lpszFile,nIconIndex,ilarge,ismall,nIcons));
@@ -368,7 +368,7 @@ SEGPTR WINAPI FindEnvironmentString16(LP
 DWORD WINAPI DoEnvironmentSubst16(LPSTR str,WORD length)
 {
   LPSTR   lpEnv = MapSL(GetDOSEnvironment16());
-  LPSTR   lpBuffer = (LPSTR)HeapAlloc( GetProcessHeap(), 0, length);
+  LPSTR   lpBuffer = HeapAlloc( GetProcessHeap(), 0, length);
   LPSTR   lpstr = str;
   LPSTR   lpbstr = lpBuffer;
 
Index: dlls/shell32/shellole.c
===================================================================
RCS file: /home/wine/wine/dlls/shell32/shellole.c,v
retrieving revision 1.76
diff -u -p -r1.76 shellole.c
--- dlls/shell32/shellole.c	17 Mar 2005 20:53:37 -0000	1.76
+++ dlls/shell32/shellole.c	19 Mar 2005 13:27:56 -0000
@@ -518,7 +518,7 @@ IClassFactory * IDefClF_fnConstructor(LP
 {
 	IDefClFImpl* lpclf;
 
-	lpclf = (IDefClFImpl*)HeapAlloc(GetProcessHeap(),0,sizeof(IDefClFImpl));
+	lpclf = HeapAlloc(GetProcessHeap(),0,sizeof(IDefClFImpl));
 	lpclf->ref = 1;
 	lpclf->lpVtbl = &dclfvt;
 	lpclf->lpfnCI = lpfnCI;
@@ -713,7 +713,7 @@ UINT WINAPI DragQueryFileA(
             LPWSTR lpszFileW = NULL;
 
             if(lpszFile) {
-                lpszFileW = (LPWSTR) HeapAlloc(GetProcessHeap(), 0, lLength*sizeof(WCHAR));
+                lpszFileW = HeapAlloc(GetProcessHeap(), 0, lLength*sizeof(WCHAR));
                 if(lpszFileW == NULL) {
                     goto end;
                 }
@@ -770,7 +770,7 @@ UINT WINAPI DragQueryFileW(
             LPSTR lpszFileA = NULL;
 
             if(lpszwFile) {
-                lpszFileA = (LPSTR) HeapAlloc(GetProcessHeap(), 0, lLength);
+                lpszFileA = HeapAlloc(GetProcessHeap(), 0, lLength);
                 if(lpszFileA == NULL) {
                     goto end;
                 }
Index: dlls/shell32/shlmenu.c
===================================================================
RCS file: /home/wine/wine/dlls/shell32/shlmenu.c,v
retrieving revision 1.37
diff -u -p -r1.37 shlmenu.c
--- dlls/shell32/shlmenu.c	19 Oct 2004 03:56:40 -0000	1.37
+++ dlls/shell32/shlmenu.c	19 Mar 2005 13:27:56 -0000
@@ -198,7 +198,7 @@ static int FM_InitMenuPopup(HMENU hmenu,
 		    MENUINFO MenuInfo;
 		    HMENU hMenuPopup = CreatePopupMenu();
 
-		    lpFmMi = (LPFMINFO) HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(FMINFO));
+		    lpFmMi = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(FMINFO));
 
 		    lpFmMi->pidl = ILCombine(pidl, pidlTemp);
 		    lpFmMi->uEnumFlags = SHCONTF_FOLDERS | SHCONTF_NONFOLDERS;
@@ -269,7 +269,7 @@ HMENU WINAPI FileMenu_Create (
 	TRACE("0x%08lx 0x%08x %p 0x%08x 0x%08x  hMenu=%p\n",
 	crBorderColor, nBorderWidth, hBorderBmp, nSelHeight, uFlags, hMenu);
 
-	menudata = (LPFMINFO)HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(FMINFO));
+	menudata = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(FMINFO));
 	menudata->crBorderColor = crBorderColor;
 	menudata->nBorderWidth = nBorderWidth;
 	menudata->hBorderBmp = hBorderBmp;
Index: dlls/shell32/shlview.c
===================================================================
RCS file: /home/wine/wine/dlls/shell32/shlview.c,v
retrieving revision 1.112
diff -u -p -r1.112 shlview.c
--- dlls/shell32/shlview.c	14 Mar 2005 10:49:03 -0000	1.112
+++ dlls/shell32/shlview.c	19 Mar 2005 13:27:57 -0000
@@ -172,7 +172,7 @@ typedef void (CALLBACK *PFNSHGETSETTINGS
  */
 IShellView * IShellView_Constructor( IShellFolder * pFolder)
 {	IShellViewImpl * sv;
-	sv=(IShellViewImpl*)HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IShellViewImpl));
+	sv=HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(IShellViewImpl));
 	sv->ref=1;
 	sv->lpVtbl=&svvt;
 	sv->lpvtblOleCommandTarget=&ctvt;
Index: dlls/shell32/shv_bg_cmenu.c
===================================================================
RCS file: /home/wine/wine/dlls/shell32/shv_bg_cmenu.c,v
retrieving revision 1.37
diff -u -p -r1.37 shv_bg_cmenu.c
--- dlls/shell32/shv_bg_cmenu.c	14 Mar 2005 10:49:03 -0000	1.37
+++ dlls/shell32/shv_bg_cmenu.c	19 Mar 2005 13:27:57 -0000
@@ -59,7 +59,7 @@ IContextMenu2 *ISvBgCm_Constructor(IShel
 {
 	BgCmImpl* cm;
 
-	cm = (BgCmImpl*)HeapAlloc(GetProcessHeap(),HEAP_ZERO_MEMORY,sizeof(BgCmImpl));
+	cm = HeapAlloc(GetProcessHeap(),HEAP_ZERO_MEMORY,sizeof(BgCmImpl));
 	cm->lpVtbl = &cmvt;
 	cm->ref = 1;
 	cm->pSFParent = pSFParent;
Index: dlls/shell32/shv_item_cmenu.c
===================================================================
RCS file: /home/wine/wine/dlls/shell32/shv_item_cmenu.c,v
retrieving revision 1.29
diff -u -p -r1.29 shv_item_cmenu.c
--- dlls/shell32/shv_item_cmenu.c	14 Jan 2005 16:02:20 -0000	1.29
+++ dlls/shell32/shv_item_cmenu.c	19 Mar 2005 13:27:57 -0000
@@ -82,7 +82,7 @@ IContextMenu2 *ISvItemCm_Constructor(LPS
 {	ItemCmImpl* cm;
 	UINT  u;
 
-	cm = (ItemCmImpl*)HeapAlloc(GetProcessHeap(),HEAP_ZERO_MEMORY,sizeof(ItemCmImpl));
+	cm = HeapAlloc(GetProcessHeap(),HEAP_ZERO_MEMORY,sizeof(ItemCmImpl));
 	cm->lpVtbl = &cmvt;
 	cm->ref = 1;
 	cm->pidl = ILClone(pidl);


More information about the wine-patches mailing list