Gerald Pfeifer : shell32: Adjust a format specifier and remove a redundant range check in ILGetDisplayNameExW ().
Alexandre Julliard
julliard at winehq.org
Mon Feb 18 08:50:47 CST 2008
Module: wine
Branch: master
Commit: 8a590e8daa12c9c3eb725d167aacc19ea077baca
URL: http://source.winehq.org/git/wine.git/?a=commit;h=8a590e8daa12c9c3eb725d167aacc19ea077baca
Author: Gerald Pfeifer <gerald at pfeifer.com>
Date: Sun Feb 17 19:47:27 2008 +0100
shell32: Adjust a format specifier and remove a redundant range check in ILGetDisplayNameExW().
---
dlls/shell32/pidl.c | 64 ++++++++++++++++++++++++--------------------------
1 files changed, 31 insertions(+), 33 deletions(-)
diff --git a/dlls/shell32/pidl.c b/dlls/shell32/pidl.c
index 58cb080..e369574 100644
--- a/dlls/shell32/pidl.c
+++ b/dlls/shell32/pidl.c
@@ -97,7 +97,7 @@ BOOL WINAPI ILGetDisplayNameExW(LPSHELLFOLDER psf, LPCITEMIDLIST pidl, LPWSTR pa
STRRET strret;
DWORD flag;
- TRACE("%p %p %p %d\n", psf, pidl, path, type);
+ TRACE("%p %p %p %x\n", psf, pidl, path, type);
if (!pidl || !path)
return FALSE;
@@ -109,46 +109,44 @@ BOOL WINAPI ILGetDisplayNameExW(LPSHELLFOLDER psf, LPCITEMIDLIST pidl, LPWSTR pa
return FALSE;
}
- if (type >= 0 && type <= 2)
+ switch (type)
+ {
+ case ILGDN_FORPARSING:
+ flag = SHGDN_FORPARSING | SHGDN_FORADDRESSBAR;
+ break;
+ case ILGDN_NORMAL:
+ flag = SHGDN_NORMAL;
+ break;
+ case ILGDN_INFOLDER:
+ flag = SHGDN_INFOLDER;
+ break;
+ default:
+ FIXME("Unknown type parameter = %x\n", type);
+ flag = SHGDN_FORPARSING | SHGDN_FORADDRESSBAR;
+ break;
+ }
+
+ if (!*(const WORD*)pidl || type == ILGDN_FORPARSING)
{
- switch (type)
+ ret = IShellFolder_GetDisplayNameOf(lsf, pidl, flag, &strret);
+ if (SUCCEEDED(ret))
{
- case ILGDN_FORPARSING:
- flag = SHGDN_FORPARSING | SHGDN_FORADDRESSBAR;
- break;
- case ILGDN_NORMAL:
- flag = SHGDN_NORMAL;
- break;
- case ILGDN_INFOLDER:
- flag = SHGDN_INFOLDER;
- break;
- default:
- FIXME("Unknown type parameter = %x\n", type);
- flag = SHGDN_FORPARSING | SHGDN_FORADDRESSBAR;
- break;
+ if(!StrRetToStrNW(path, MAX_PATH, &strret, pidl))
+ ret = E_FAIL;
}
- if (!*(const WORD*)pidl || type == ILGDN_FORPARSING)
+ }
+ else
+ {
+ ret = SHBindToParent(pidl, &IID_IShellFolder, (LPVOID*)&psfParent, &pidllast);
+ if (SUCCEEDED(ret))
{
- ret = IShellFolder_GetDisplayNameOf(lsf, pidl, flag, &strret);
+ ret = IShellFolder_GetDisplayNameOf(psfParent, pidllast, flag, &strret);
if (SUCCEEDED(ret))
{
- if(!StrRetToStrNW(path, MAX_PATH, &strret, pidl))
+ if(!StrRetToStrNW(path, MAX_PATH, &strret, pidllast))
ret = E_FAIL;
}
- }
- else
- {
- ret = SHBindToParent(pidl, &IID_IShellFolder, (LPVOID*)&psfParent, &pidllast);
- if (SUCCEEDED(ret))
- {
- ret = IShellFolder_GetDisplayNameOf(psfParent, pidllast, flag, &strret);
- if (SUCCEEDED(ret))
- {
- if(!StrRetToStrNW(path, MAX_PATH, &strret, pidllast))
- ret = E_FAIL;
- }
- IShellFolder_Release(psfParent);
- }
+ IShellFolder_Release(psfParent);
}
}
More information about the wine-cvs
mailing list