[PATCH 2/2] shell32: Get rid of some casts by using IShellFolder2 internally
Nikolay Sivov
nsivov at codeweavers.com
Sun Nov 27 08:01:48 CST 2016
Signed-off-by: Nikolay Sivov <nsivov at codeweavers.com>
---
dlls/shell32/cpanelfolder.c | 2 +-
dlls/shell32/shfldr.h | 2 +-
dlls/shell32/shfldr_desktop.c | 6 ++----
dlls/shell32/shfldr_fs.c | 16 +++++++---------
dlls/shell32/shfldr_mycomp.c | 13 ++++++-------
dlls/shell32/shfldr_netplaces.c | 13 ++++++-------
dlls/shell32/shlfolder.c | 5 ++---
7 files changed, 25 insertions(+), 32 deletions(-)
diff --git a/dlls/shell32/cpanelfolder.c b/dlls/shell32/cpanelfolder.c
index 1a3b379..206ce13 100644
--- a/dlls/shell32/cpanelfolder.c
+++ b/dlls/shell32/cpanelfolder.c
@@ -561,7 +561,7 @@ static HRESULT WINAPI ISF_ControlPanel_fnGetAttributesOf(IShellFolder2 *iface, U
while(cidl > 0 && *apidl) {
pdump(*apidl);
- SHELL32_GetItemAttributes((IShellFolder *)&This->IShellFolder2_iface, *apidl, rgfInOut);
+ SHELL32_GetItemAttributes(&This->IShellFolder2_iface, *apidl, rgfInOut);
apidl++;
cidl--;
}
diff --git a/dlls/shell32/shfldr.h b/dlls/shell32/shfldr.h
index b6ebfb2..1f4194e 100644
--- a/dlls/shell32/shfldr.h
+++ b/dlls/shell32/shfldr.h
@@ -39,7 +39,7 @@ BOOL SHELL32_GetCustomFolderAttribute (LPCITEMIDLIST pidl, LPCWSTR pwszHeading,
LPCWSTR GetNextElementW (LPCWSTR pszNext, LPWSTR pszOut, DWORD dwOut) DECLSPEC_HIDDEN;
HRESULT SHELL32_ParseNextElement (IShellFolder2 * psf, HWND hwndOwner, LPBC pbc, LPITEMIDLIST * pidlInOut,
LPOLESTR szNext, DWORD * pEaten, DWORD * pdwAttributes) DECLSPEC_HIDDEN;
-HRESULT SHELL32_GetItemAttributes (IShellFolder * psf, LPCITEMIDLIST pidl, LPDWORD pdwAttributes) DECLSPEC_HIDDEN;
+HRESULT SHELL32_GetItemAttributes (IShellFolder2 *folder, LPCITEMIDLIST pidl, DWORD *attributes) DECLSPEC_HIDDEN;
HRESULT SHELL32_GetDisplayNameOfChild (IShellFolder2 * psf, LPCITEMIDLIST pidl, DWORD dwFlags, LPWSTR szOut,
DWORD dwOutLen) DECLSPEC_HIDDEN;
diff --git a/dlls/shell32/shfldr_desktop.c b/dlls/shell32/shfldr_desktop.c
index 40cd752..8721a9a 100644
--- a/dlls/shell32/shfldr_desktop.c
+++ b/dlls/shell32/shfldr_desktop.c
@@ -155,7 +155,6 @@ static HRESULT WINAPI ISF_Desktop_fnParseDisplayName (IShellFolder2 * iface,
DWORD * pchEaten, LPITEMIDLIST * ppidl, DWORD * pdwAttributes)
{
IDesktopFolderImpl *This = impl_from_IShellFolder2(iface);
- IShellFolder *shell_folder = (IShellFolder*)iface;
WCHAR szElement[MAX_PATH];
LPCWSTR szNext = NULL;
LPITEMIDLIST pidlTemp = NULL;
@@ -268,7 +267,7 @@ static HRESULT WINAPI ISF_Desktop_fnParseDisplayName (IShellFolder2 * iface,
else
{
if (pdwAttributes && *pdwAttributes)
- hr = SHELL32_GetItemAttributes(shell_folder, pidlTemp, pdwAttributes);
+ hr = SHELL32_GetItemAttributes(iface, pidlTemp, pdwAttributes);
}
}
@@ -454,7 +453,6 @@ static HRESULT WINAPI ISF_Desktop_fnGetAttributesOf (IShellFolder2 * iface,
UINT cidl, LPCITEMIDLIST * apidl, DWORD * rgfInOut)
{
IDesktopFolderImpl *This = impl_from_IShellFolder2(iface);
- IShellFolder *shell_folder = (IShellFolder*)iface;
static const DWORD dwDesktopAttributes =
SFGAO_STORAGE | SFGAO_HASPROPSHEET | SFGAO_STORAGEANCESTOR |
@@ -484,7 +482,7 @@ static HRESULT WINAPI ISF_Desktop_fnGetAttributesOf (IShellFolder2 * iface,
} else if (_ILIsMyComputer(*apidl)) {
*rgfInOut &= dwMyComputerAttributes;
} else {
- SHELL32_GetItemAttributes ( shell_folder, *apidl, rgfInOut);
+ SHELL32_GetItemAttributes(iface, *apidl, rgfInOut);
}
apidl++;
cidl--;
diff --git a/dlls/shell32/shfldr_fs.c b/dlls/shell32/shfldr_fs.c
index 2f49eb2..c725927 100644
--- a/dlls/shell32/shfldr_fs.c
+++ b/dlls/shell32/shfldr_fs.c
@@ -342,10 +342,8 @@ IShellFolder_fnParseDisplayName (IShellFolder2 * iface,
&pidlTemp, (LPOLESTR) szNext, pchEaten, pdwAttributes);
} else {
/* it's the last element */
- if (pdwAttributes && *pdwAttributes) {
- hr = SHELL32_GetItemAttributes((IShellFolder *)&This->IShellFolder2_iface,
- pidlTemp, pdwAttributes);
- }
+ if (pdwAttributes && *pdwAttributes)
+ hr = SHELL32_GetItemAttributes(&This->IShellFolder2_iface, pidlTemp, pdwAttributes);
}
}
}
@@ -511,19 +509,19 @@ IShellFolder_fnGetAttributesOf (IShellFolder2 * iface, UINT cidl,
*rgfInOut = ~0;
if(cidl == 0){
- IShellFolder *psfParent = NULL;
+ IShellFolder2 *parent = NULL;
LPCITEMIDLIST rpidl = NULL;
- hr = SHBindToParent(This->pidlRoot, &IID_IShellFolder, (LPVOID*)&psfParent, &rpidl);
+ hr = SHBindToParent(This->pidlRoot, &IID_IShellFolder2, (void **)&parent, &rpidl);
if(SUCCEEDED(hr)) {
- SHELL32_GetItemAttributes (psfParent, rpidl, rgfInOut);
- IShellFolder_Release(psfParent);
+ SHELL32_GetItemAttributes(parent, rpidl, rgfInOut);
+ IShellFolder2_Release(parent);
}
}
else {
while (cidl > 0 && *apidl) {
pdump (*apidl);
- SHELL32_GetItemAttributes((IShellFolder *)&This->IShellFolder2_iface, *apidl, rgfInOut);
+ SHELL32_GetItemAttributes(&This->IShellFolder2_iface, *apidl, rgfInOut);
apidl++;
cidl--;
}
diff --git a/dlls/shell32/shfldr_mycomp.c b/dlls/shell32/shfldr_mycomp.c
index 767509b..4022c8d 100644
--- a/dlls/shell32/shfldr_mycomp.c
+++ b/dlls/shell32/shfldr_mycomp.c
@@ -232,8 +232,7 @@ static HRESULT WINAPI ISF_MyComputer_fnParseDisplayName (IShellFolder2 *iface,
else
{
if (pdwAttributes && *pdwAttributes)
- SHELL32_GetItemAttributes ((IShellFolder*)&This->IShellFolder2_iface, pidlTemp,
- pdwAttributes);
+ SHELL32_GetItemAttributes (&This->IShellFolder2_iface, pidlTemp, pdwAttributes);
hr = S_OK;
}
@@ -477,18 +476,18 @@ static HRESULT WINAPI ISF_MyComputer_fnGetAttributesOf (IShellFolder2 * iface,
*rgfInOut = ~0;
if(cidl == 0){
- IShellFolder *psfParent = NULL;
+ IShellFolder2 *parent = NULL;
LPCITEMIDLIST rpidl = NULL;
- hr = SHBindToParent(This->pidlRoot, &IID_IShellFolder, (LPVOID*)&psfParent, &rpidl);
+ hr = SHBindToParent(This->pidlRoot, &IID_IShellFolder2, (void **)&parent, &rpidl);
if(SUCCEEDED(hr)) {
- SHELL32_GetItemAttributes (psfParent, rpidl, rgfInOut);
- IShellFolder_Release(psfParent);
+ SHELL32_GetItemAttributes(parent, rpidl, rgfInOut);
+ IShellFolder2_Release(parent);
}
} else {
while (cidl > 0 && *apidl) {
pdump (*apidl);
- SHELL32_GetItemAttributes ((IShellFolder*)&This->IShellFolder2_iface, *apidl, rgfInOut);
+ SHELL32_GetItemAttributes(&This->IShellFolder2_iface, *apidl, rgfInOut);
apidl++;
cidl--;
}
diff --git a/dlls/shell32/shfldr_netplaces.c b/dlls/shell32/shfldr_netplaces.c
index 16e7cd5..b9513a9 100644
--- a/dlls/shell32/shfldr_netplaces.c
+++ b/dlls/shell32/shfldr_netplaces.c
@@ -220,8 +220,7 @@ static HRESULT WINAPI ISF_NetworkPlaces_fnParseDisplayName (IShellFolder2 * ifac
else
{
if (pdwAttributes && *pdwAttributes)
- hr = SHELL32_GetItemAttributes((IShellFolder *)&This->IShellFolder2_iface, pidlTemp,
- pdwAttributes);
+ hr = SHELL32_GetItemAttributes(&This->IShellFolder2_iface, pidlTemp, pdwAttributes);
}
}
@@ -364,14 +363,14 @@ static HRESULT WINAPI ISF_NetworkPlaces_fnGetAttributesOf (IShellFolder2 * iface
if (cidl == 0)
{
- IShellFolder *psfParent = NULL;
+ IShellFolder2 *parent = NULL;
LPCITEMIDLIST rpidl = NULL;
- hr = SHBindToParent(This->pidlRoot, &IID_IShellFolder, (void**)&psfParent, &rpidl);
+ hr = SHBindToParent(This->pidlRoot, &IID_IShellFolder2, (void **)&parent, &rpidl);
if(SUCCEEDED(hr))
{
- SHELL32_GetItemAttributes (psfParent, rpidl, rgfInOut);
- IShellFolder_Release(psfParent);
+ SHELL32_GetItemAttributes(parent, rpidl, rgfInOut);
+ IShellFolder2_Release(parent);
}
}
else
@@ -379,7 +378,7 @@ static HRESULT WINAPI ISF_NetworkPlaces_fnGetAttributesOf (IShellFolder2 * iface
while (cidl > 0 && *apidl)
{
pdump (*apidl);
- SHELL32_GetItemAttributes ((IShellFolder *)&This->IShellFolder2_iface, *apidl, rgfInOut);
+ SHELL32_GetItemAttributes(&This->IShellFolder2_iface, *apidl, rgfInOut);
apidl++;
cidl--;
}
diff --git a/dlls/shell32/shlfolder.c b/dlls/shell32/shlfolder.c
index c39d968..8688c5d 100644
--- a/dlls/shell32/shlfolder.c
+++ b/dlls/shell32/shlfolder.c
@@ -389,7 +389,7 @@ HRESULT SHELL32_GetDisplayNameOfChild (IShellFolder2 * psf,
* According to the MSDN documentation this function should not set flags. It claims only to reset flags when necessary.
* However it turns out the native shell32.dll _sets_ flags in several cases - so do we.
*/
-HRESULT SHELL32_GetItemAttributes (IShellFolder * psf, LPCITEMIDLIST pidl, LPDWORD pdwAttributes)
+HRESULT SHELL32_GetItemAttributes (IShellFolder2 *psf, LPCITEMIDLIST pidl, LPDWORD pdwAttributes)
{
DWORD dwAttributes;
BOOL has_guid;
@@ -435,8 +435,7 @@ HRESULT SHELL32_GetItemAttributes (IShellFolder * psf, LPCITEMIDLIST pidl, LPDWO
/* File attributes are not present in the internal PIDL structure, so get them from the file system. */
- HRESULT hr = IShellFolder_GetDisplayNameOf(psf, pidl, SHGDN_FORPARSING, &strret);
-
+ HRESULT hr = IShellFolder2_GetDisplayNameOf(psf, pidl, SHGDN_FORPARSING, &strret);
if (SUCCEEDED(hr)) {
hr = StrRetToBufW(&strret, pidl, path, MAX_PATH);
--
2.10.2
More information about the wine-patches
mailing list