shell32: Remove superfluous casts; mostly of void pointers.

Michael Stefaniuc mstefani at redhat.de
Wed Nov 5 16:00:50 CST 2008


---
This was painful! In some functions there are up to 4 (four) different
styles of placing whitespace in a function call. That made following
the "coding style" a bit of a challange.



 dlls/shell32/autocomplete.c     |    2 +-
 dlls/shell32/brsfolder.c        |    2 +-
 dlls/shell32/clipboard.c        |    8 ++++----
 dlls/shell32/cpanelfolder.c     |    2 +-
 dlls/shell32/dragdrophelper.c   |    2 +-
 dlls/shell32/enumidlist.c       |    2 +-
 dlls/shell32/iconcache.c        |    6 +++---
 dlls/shell32/pidl.c             |    8 ++++----
 dlls/shell32/shell.c            |    2 +-
 dlls/shell32/shellole.c         |    6 +++---
 dlls/shell32/shellord.c         |    2 +-
 dlls/shell32/shellstring.c      |    2 +-
 dlls/shell32/shfldr_fs.c        |    2 +-
 dlls/shell32/shfldr_netplaces.c |    2 +-
 dlls/shell32/shfldr_unixfs.c    |    6 +++---
 dlls/shell32/shlmenu.c          |    2 +-
 dlls/shell32/shlview.c          |    2 +-
 dlls/shell32/shv_bg_cmenu.c     |    2 +-
 dlls/shell32/tests/string.c     |    2 +-
 19 files changed, 31 insertions(+), 31 deletions(-)

diff --git a/dlls/shell32/autocomplete.c b/dlls/shell32/autocomplete.c
index 6c02310..fd1f1dd 100644
--- a/dlls/shell32/autocomplete.c
+++ b/dlls/shell32/autocomplete.c
@@ -638,7 +638,7 @@ static LRESULT APIENTRY ACLBoxSubclassProc(HWND hwnd, UINT uMsg, WPARAM wParam,
     switch (uMsg) {
 	case WM_MOUSEMOVE:
 	    sel = SendMessageW(hwnd, LB_ITEMFROMPOINT, 0, lParam);
-	    SendMessageW(hwnd, LB_SETCURSEL, (WPARAM)sel, (LPARAM)0);
+            SendMessageW(hwnd, LB_SETCURSEL, sel, 0);
 	    break;
 	case WM_LBUTTONDOWN:
 	    sel = SendMessageW(hwnd, LB_GETCURSEL, 0, 0);
diff --git a/dlls/shell32/brsfolder.c b/dlls/shell32/brsfolder.c
index da72e06..48bb943 100644
--- a/dlls/shell32/brsfolder.c
+++ b/dlls/shell32/brsfolder.c
@@ -813,7 +813,7 @@ static INT_PTR CALLBACK BrsFolderDlgProc( HWND hWnd, UINT msg, WPARAM wParam,
     if (msg == WM_INITDIALOG)
         return BrsFolder_OnCreate( hWnd, (browse_info*) lParam );
 
-    info = (browse_info*) GetPropW( hWnd, szBrowseFolderInfo );
+    info = GetPropW( hWnd, szBrowseFolderInfo );
 
     switch (msg)
     {
diff --git a/dlls/shell32/clipboard.c b/dlls/shell32/clipboard.c
index 7e8c920..36a04ea 100644
--- a/dlls/shell32/clipboard.c
+++ b/dlls/shell32/clipboard.c
@@ -88,7 +88,7 @@ HGLOBAL RenderHDROP(LPITEMIDLIST pidlRoot, LPITEMIDLIST * apidl, UINT cidl)
 	hGlobal = GlobalAlloc(GHND|GMEM_SHARE, size);
 	if(!hGlobal) return hGlobal;
 
-        pDropFiles = (DROPFILES *)GlobalLock(hGlobal);
+        pDropFiles = GlobalLock(hGlobal);
 	offset = (sizeof(DROPFILES) + sizeof(WCHAR) - 1) / sizeof(WCHAR);
         pDropFiles->pFiles = offset * sizeof(WCHAR);
         pDropFiles->fWide = TRUE;
@@ -194,7 +194,7 @@ HGLOBAL RenderFILENAMEA (LPITEMIDLIST pidlRoot, LPITEMIDLIST * apidl, UINT cidl)
 	/* fill the structure */
 	hGlobal = GlobalAlloc(GHND|GMEM_SHARE, size);
 	if(!hGlobal) return hGlobal;
-	szFileName = (char *)GlobalLock(hGlobal);
+	szFileName = GlobalLock(hGlobal);
 	memcpy(szFileName, szTemp, size);
 	GlobalUnlock(hGlobal);
 
@@ -226,7 +226,7 @@ HGLOBAL RenderFILENAMEW (LPITEMIDLIST pidlRoot, LPITEMIDLIST * apidl, UINT cidl)
 	/* fill the structure */
 	hGlobal = GlobalAlloc(GHND|GMEM_SHARE, size);
 	if(!hGlobal) return hGlobal;
-	szFileName = (WCHAR *)GlobalLock(hGlobal);
+	szFileName = GlobalLock(hGlobal);
 	memcpy(szFileName, szTemp, size);
 	GlobalUnlock(hGlobal);
 
@@ -242,7 +242,7 @@ HGLOBAL RenderPREFEREDDROPEFFECT (DWORD dwFlags)
 
 	hGlobal = GlobalAlloc(GHND|GMEM_SHARE, sizeof(DWORD));
 	if(!hGlobal) return hGlobal;
-        pdwFlag = (DWORD*)GlobalLock(hGlobal);
+	pdwFlag = GlobalLock(hGlobal);
 	*pdwFlag = dwFlags;
 	GlobalUnlock(hGlobal);
 	return hGlobal;
diff --git a/dlls/shell32/cpanelfolder.c b/dlls/shell32/cpanelfolder.c
index aec19f1..5ef78af 100644
--- a/dlls/shell32/cpanelfolder.c
+++ b/dlls/shell32/cpanelfolder.c
@@ -131,7 +131,7 @@ HRESULT WINAPI IControlPanel_Constructor(IUnknown* pUnkOuter, REFIID riid, LPVOI
     if (pUnkOuter && !IsEqualIID (riid, &IID_IUnknown))
 	return CLASS_E_NOAGGREGATION;
 
-    sf = (ICPanelImpl *) LocalAlloc(LMEM_ZEROINIT, sizeof(ICPanelImpl));
+    sf = LocalAlloc(LMEM_ZEROINIT, sizeof(ICPanelImpl));
     if (!sf)
 	return E_OUTOFMEMORY;
 
diff --git a/dlls/shell32/dragdrophelper.c b/dlls/shell32/dragdrophelper.c
index d101457..82ad0d9 100644
--- a/dlls/shell32/dragdrophelper.c
+++ b/dlls/shell32/dragdrophelper.c
@@ -71,7 +71,7 @@ HRESULT WINAPI IDropTargetHelper_Constructor (IUnknown * pUnkOuter, REFIID riid,
     if (pUnkOuter)
 	return CLASS_E_NOAGGREGATION;
 
-    dth = (IDropTargetHelperImpl *) LocalAlloc (LMEM_ZEROINIT, sizeof (IDropTargetHelperImpl));
+    dth = LocalAlloc (LMEM_ZEROINIT, sizeof (IDropTargetHelperImpl));
     if (!dth) return E_OUTOFMEMORY;
 
     dth->ref = 0;
diff --git a/dlls/shell32/enumidlist.c b/dlls/shell32/enumidlist.c
index 6356c4d..9665ccd 100644
--- a/dlls/shell32/enumidlist.c
+++ b/dlls/shell32/enumidlist.c
@@ -71,7 +71,7 @@ BOOL AddToEnumList(
     if (!iface || !pidl)
         return FALSE;
 
-	pNew = (LPENUMLIST)SHAlloc(sizeof(ENUMLIST));
+        pNew = SHAlloc(sizeof(ENUMLIST));
 	if(pNew)
 	{
 	  /*set the next pointer */
diff --git a/dlls/shell32/iconcache.c b/dlls/shell32/iconcache.c
index dc4a3ef..1cc7e59 100644
--- a/dlls/shell32/iconcache.c
+++ b/dlls/shell32/iconcache.c
@@ -260,7 +260,7 @@ static INT SIC_IconAppend (LPCWSTR sSourceFile, INT dwSourceIndex, HICON hSmallI
 	WCHAR path[MAX_PATH];
 	TRACE("%s %i %p %p\n", debugstr_w(sSourceFile), dwSourceIndex, hSmallIcon ,hBigIcon);
 
-	lpsice = (LPSIC_ENTRY) SHAlloc (sizeof (SIC_ENTRY));
+	lpsice = SHAlloc(sizeof(SIC_ENTRY));
 
 	GetFullPathNameW(sSourceFile, MAX_PATH, path, NULL);
 	lpsice->sSourceFile = HeapAlloc( GetProcessHeap(), 0, (strlenW(path)+1)*sizeof(WCHAR) );
@@ -413,9 +413,9 @@ BOOL SIC_Initialize(void)
         ImageList_SetBkColor(ShellBigIconList, CLR_NONE);
 
         /* Load the document icon, which is used as the default if an icon isn't found. */
-        hSm = (HICON)LoadImageA(shell32_hInstance, MAKEINTRESOURCEA(IDI_SHELL_DOCUMENT), 
+        hSm = LoadImageA(shell32_hInstance, MAKEINTRESOURCEA(IDI_SHELL_DOCUMENT),
                                 IMAGE_ICON, cx_small, cy_small, LR_SHARED);
-        hLg = (HICON)LoadImageA(shell32_hInstance, MAKEINTRESOURCEA(IDI_SHELL_DOCUMENT), 
+        hLg = LoadImageA(shell32_hInstance, MAKEINTRESOURCEA(IDI_SHELL_DOCUMENT),
                                 IMAGE_ICON, cx_large, cy_large, LR_SHARED);
 
         if (!hSm || !hLg) 
diff --git a/dlls/shell32/pidl.c b/dlls/shell32/pidl.c
index 564b103..af299d5 100644
--- a/dlls/shell32/pidl.c
+++ b/dlls/shell32/pidl.c
@@ -232,7 +232,7 @@ LPITEMIDLIST WINAPI ILClone (LPCITEMIDLIST pidl)
         return NULL;
 
     len = ILGetSize(pidl);
-    newpidl = (LPITEMIDLIST)SHAlloc(len);
+    newpidl = SHAlloc(len);
     if (newpidl)
         memcpy(newpidl,pidl,len);
 
@@ -259,7 +259,7 @@ LPITEMIDLIST WINAPI ILCloneFirst(LPCITEMIDLIST pidl)
     if (pidl)
     {
         len = pidl->mkid.cb;
-        pidlNew = (LPITEMIDLIST) SHAlloc (len+2);
+        pidlNew = SHAlloc(len+2);
         if (pidlNew)
         {
             memcpy(pidlNew,pidl,len+2);        /* 2 -> mind a desktop pidl */
@@ -464,7 +464,7 @@ LPITEMIDLIST WINAPI ILGlobalClone(LPCITEMIDLIST pidl)
         return NULL;
 
     len = ILGetSize(pidl);
-    newpidl = (LPITEMIDLIST)Alloc(len);
+    newpidl = Alloc(len);
     if (newpidl)
         memcpy(newpidl,pidl,len);
 
@@ -725,7 +725,7 @@ HRESULT WINAPI SHGetRealIDL(LPSHELLFOLDER lpsf, LPCITEMIDLIST pidlSimple, LPITEM
         if (SUCCEEDED(hr))
         {
             /*assert(pida->cidl==1);*/
-            LPIDA pida = (LPIDA)GlobalLock(medium.u.hGlobal);
+            LPIDA pida = GlobalLock(medium.u.hGlobal);
 
             LPCITEMIDLIST pidl_folder = (LPCITEMIDLIST) ((LPBYTE)pida+pida->aoffset[0]);
             LPCITEMIDLIST pidl_child = (LPCITEMIDLIST) ((LPBYTE)pida+pida->aoffset[1]);
diff --git a/dlls/shell32/shell.c b/dlls/shell32/shell.c
index 3b88309..7edc97b 100644
--- a/dlls/shell32/shell.c
+++ b/dlls/shell32/shell.c
@@ -198,7 +198,7 @@ HGLOBAL16 WINAPI InternalExtractIcon16(HINSTANCE16 hInstance,
 	  return 0;
 
 	hRet = GlobalAlloc16(GMEM_FIXED | GMEM_ZEROINIT, sizeof(*RetPtr) * n);
-	RetPtr = (HICON16*)GlobalLock16(hRet);
+        RetPtr = GlobalLock16(hRet);
 
 	if (nIconIndex == (UINT16)-1)  /* get number of icons */
 	{
diff --git a/dlls/shell32/shellole.c b/dlls/shell32/shellole.c
index a4f191a..eae8bc3 100644
--- a/dlls/shell32/shellole.c
+++ b/dlls/shell32/shellole.c
@@ -548,7 +548,7 @@ BOOL WINAPI DragQueryPoint(HDROP hDrop, POINT *p)
 
 	TRACE("\n");
 
-	lpDropFileStruct = (DROPFILES *) GlobalLock(hDrop);
+	lpDropFileStruct = GlobalLock(hDrop);
 
         *p = lpDropFileStruct->pt;
 	bRet = lpDropFileStruct->fNC;
@@ -569,7 +569,7 @@ UINT WINAPI DragQueryFileA(
 {
 	LPSTR lpDrop;
 	UINT i = 0;
-	DROPFILES *lpDropFileStruct = (DROPFILES *) GlobalLock(hDrop);
+	DROPFILES *lpDropFileStruct = GlobalLock(hDrop);
 
 	TRACE("(%p, %x, %p, %u)\n",	hDrop,lFile,lpszFile,lLength);
 
@@ -624,7 +624,7 @@ UINT WINAPI DragQueryFileW(
 {
 	LPWSTR lpwDrop;
 	UINT i = 0;
-	DROPFILES *lpDropFileStruct = (DROPFILES *) GlobalLock(hDrop);
+	DROPFILES *lpDropFileStruct = GlobalLock(hDrop);
 
 	TRACE("(%p, %x, %p, %u)\n", hDrop,lFile,lpszwFile,lLength);
 
diff --git a/dlls/shell32/shellord.c b/dlls/shell32/shellord.c
index 56eb3ba..a945569 100644
--- a/dlls/shell32/shellord.c
+++ b/dlls/shell32/shellord.c
@@ -1641,7 +1641,7 @@ HPSXA WINAPI SHCreatePropSheetExtArrayEx(HKEY hKey, LPCWSTR pszSubKey, UINT max_
     if (lRet == ERROR_SUCCESS)
     {
         /* Create and initialize the Property Sheet Extensions Array */
-        psxa = (PPSXA)LocalAlloc(LMEM_FIXED, FIELD_OFFSET(PSXA, pspsx[max_iface]));
+        psxa = LocalAlloc(LMEM_FIXED, FIELD_OFFSET(PSXA, pspsx[max_iface]));
         if (psxa)
         {
             ZeroMemory(psxa, FIELD_OFFSET(PSXA, pspsx[max_iface]));
diff --git a/dlls/shell32/shellstring.c b/dlls/shell32/shellstring.c
index a35e15c..435b37b 100644
--- a/dlls/shell32/shellstring.c
+++ b/dlls/shell32/shellstring.c
@@ -242,7 +242,7 @@ DWORD WINAPI CheckEscapesA(
 	DWORD ret = 0;
 
 	TRACE("(%s %d)\n", debugstr_a(string), len);
-	wString = (LPWSTR)LocalAlloc(LPTR, len * sizeof(WCHAR));
+	wString = LocalAlloc(LPTR, len * sizeof(WCHAR));
 	if (wString)
 	{
 	  MultiByteToWideChar(CP_ACP, 0, string, len, wString, len);
diff --git a/dlls/shell32/shfldr_fs.c b/dlls/shell32/shfldr_fs.c
index cc30b1f..891ff4a 100644
--- a/dlls/shell32/shfldr_fs.c
+++ b/dlls/shell32/shfldr_fs.c
@@ -235,7 +235,7 @@ IFSFolder_Constructor (IUnknown * pUnkOuter, REFIID riid, LPVOID * ppv)
 
     if (pUnkOuter && !IsEqualIID (riid, &IID_IUnknown))
         return CLASS_E_NOAGGREGATION;
-    sf = (IGenericSFImpl *) LocalAlloc (LMEM_ZEROINIT, sizeof (IGenericSFImpl));
+    sf = LocalAlloc (LMEM_ZEROINIT, sizeof (IGenericSFImpl));
     if (!sf)
         return E_OUTOFMEMORY;
 
diff --git a/dlls/shell32/shfldr_netplaces.c b/dlls/shell32/shfldr_netplaces.c
index c661c51..39f61a7 100644
--- a/dlls/shell32/shfldr_netplaces.c
+++ b/dlls/shell32/shfldr_netplaces.c
@@ -94,7 +94,7 @@ HRESULT WINAPI ISF_NetworkPlaces_Constructor (IUnknown * pUnkOuter, REFIID riid,
     if (pUnkOuter)
         return CLASS_E_NOAGGREGATION;
 
-    sf = (IGenericSFImpl *) HeapAlloc ( GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof (IGenericSFImpl));
+    sf = HeapAlloc (GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof (IGenericSFImpl));
     if (!sf)
         return E_OUTOFMEMORY;
 
diff --git a/dlls/shell32/shfldr_unixfs.c b/dlls/shell32/shfldr_unixfs.c
index b612ef7..5f0ae3f 100644
--- a/dlls/shell32/shfldr_unixfs.c
+++ b/dlls/shell32/shfldr_unixfs.c
@@ -614,7 +614,7 @@ static HRESULT UNIXFS_path_to_pidl(UnixFolder *pUnixFolder, const WCHAR *path, L
 
     /* Special case for the root folder. */
     if (!strcmp(szCompletePath, "/")) {
-        *ppidl = pidl = (LPITEMIDLIST)SHAlloc(sizeof(USHORT));
+        *ppidl = pidl = SHAlloc(sizeof(USHORT));
         if (!pidl) return E_FAIL;
         pidl->mkid.cb = 0; /* Terminate the ITEMIDLIST */
         return S_OK;
@@ -657,7 +657,7 @@ static HRESULT UNIXFS_path_to_pidl(UnixFolder *pUnixFolder, const WCHAR *path, L
     SHFree(pszAPath);
     SHFree(pwszPath);
 
-    *ppidl = pidl = (LPITEMIDLIST)SHAlloc(cPidlLen);
+    *ppidl = pidl = SHAlloc(cPidlLen);
     if (!pidl) return E_FAIL;
 
     /* Concatenate the SHITEMIDs of the sub-directories. */
@@ -2342,7 +2342,7 @@ static HRESULT WINAPI UnixSubFolderIterator_IEnumIDList_Skip(IEnumIDList* iface,
     TRACE("(iface=%p, celt=%d)\n", iface, celt);
 
     /* Call IEnumIDList::Next and delete the resulting pidls. */
-    apidl = (LPITEMIDLIST*)SHAlloc(celt * sizeof(LPITEMIDLIST));
+    apidl = SHAlloc(celt * sizeof(LPITEMIDLIST));
     hr = IEnumIDList_Next(iface, celt, apidl, &cFetched);
     if (SUCCEEDED(hr))
         while (cFetched--) 
diff --git a/dlls/shell32/shlmenu.c b/dlls/shell32/shlmenu.c
index c44f8c1..b9da3a9 100644
--- a/dlls/shell32/shlmenu.c
+++ b/dlls/shell32/shlmenu.c
@@ -330,7 +330,7 @@ static BOOL FileMenu_AppendItemW(
 	if (lpText != FM_SEPARATOR)
 	{
 	  int len = strlenW (lpText);
-	  myItem = (LPFMITEM) SHAlloc( sizeof(FMITEM) + len*sizeof(WCHAR));
+          myItem = SHAlloc (sizeof(FMITEM) + len*sizeof(WCHAR));
 	  strcpyW (myItem->szItemText, lpText);
 	  myItem->cchItemText = len;
 	  myItem->iIconIndex = icon;
diff --git a/dlls/shell32/shlview.c b/dlls/shell32/shlview.c
index e3727ba..77ba2ec 100644
--- a/dlls/shell32/shlview.c
+++ b/dlls/shell32/shlview.c
@@ -837,7 +837,7 @@ static UINT ShellView_GetSelections(IShellViewImpl * This)
 	SHFree(This->apidl);
 
 	This->cidl = ListView_GetSelectedCount(This->hWndList);
-	This->apidl = (LPITEMIDLIST*)SHAlloc(This->cidl * sizeof(LPITEMIDLIST));
+	This->apidl = SHAlloc(This->cidl * sizeof(LPITEMIDLIST));
 
 	TRACE("selected=%i\n", This->cidl);
 
diff --git a/dlls/shell32/shv_bg_cmenu.c b/dlls/shell32/shv_bg_cmenu.c
index b4bc6e1..7f59b6d 100644
--- a/dlls/shell32/shv_bg_cmenu.c
+++ b/dlls/shell32/shv_bg_cmenu.c
@@ -292,7 +292,7 @@ static BOOL DoPaste(
 
 	if(hMem)
 	{
-	  char * pDropFiles = (char *)GlobalLock(hMem);
+          char * pDropFiles = GlobalLock(hMem);
 	  if(pDropFiles)
 	  {
 	    int len, offset = sizeof(DROPFILESTRUCT);
diff --git a/dlls/shell32/tests/string.c b/dlls/shell32/tests/string.c
index 61fab0f..1d55ecf 100644
--- a/dlls/shell32/tests/string.c
+++ b/dlls/shell32/tests/string.c
@@ -37,7 +37,7 @@ static HRESULT (WINAPI *pStrRetToStrNAW)(LPVOID,DWORD,LPSTRRET,const ITEMIDLIST
 static WCHAR *CoDupStrW(const char* src)
 {
   INT len = MultiByteToWideChar(CP_ACP, 0, src, -1, NULL, 0);
-  WCHAR* szTemp = (WCHAR*)CoTaskMemAlloc(len * sizeof(WCHAR));
+  WCHAR* szTemp = CoTaskMemAlloc(len * sizeof(WCHAR));
   MultiByteToWideChar(CP_ACP, 0, src, -1, szTemp, len);
   return szTemp;
 }
-- 
1.6.0.3
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
Url : http://www.winehq.org/pipermail/wine-patches/attachments/20081105/30c684e0/attachment.pgp 


More information about the wine-patches mailing list