Commit 27b284d4 authored by Michael Stefaniuc's avatar Michael Stefaniuc Committed by Alexandre Julliard

shell32: Simplify RecycleBin_EnumObjects() a little.

parent d81f55fa
...@@ -410,33 +410,27 @@ static HRESULT WINAPI RecycleBin_EnumObjects(IShellFolder2 *iface, HWND hwnd, SH ...@@ -410,33 +410,27 @@ static HRESULT WINAPI RecycleBin_EnumObjects(IShellFolder2 *iface, HWND hwnd, SH
RecycleBin *This = impl_from_IShellFolder2(iface); RecycleBin *This = impl_from_IShellFolder2(iface);
IEnumIDList *list; IEnumIDList *list;
LPITEMIDLIST *pidls; LPITEMIDLIST *pidls;
HRESULT ret; HRESULT ret = E_OUTOFMEMORY;
int pidls_count; int pidls_count;
int i=0; int i=0;
TRACE("(%p, %p, %x, %p)\n", This, hwnd, grfFlags, ppenumIDList); TRACE("(%p, %p, %x, %p)\n", This, hwnd, grfFlags, ppenumIDList);
*ppenumIDList = NULL;
list = IEnumIDList_Constructor();
if (!list)
return E_OUTOFMEMORY;
if (grfFlags & SHCONTF_NONFOLDERS) if (grfFlags & SHCONTF_NONFOLDERS)
{ {
*ppenumIDList = NULL;
if (FAILED(ret = TRASH_EnumItems(&pidls, &pidls_count))) if (FAILED(ret = TRASH_EnumItems(&pidls, &pidls_count)))
return ret;
list = IEnumIDList_Constructor();
if (list == NULL)
goto failed; goto failed;
for (i=0; i<pidls_count; i++) for (i=0; i<pidls_count; i++)
if (!AddToEnumList(list, pidls[i])) if (!AddToEnumList(list, pidls[i]))
goto failed; goto failed;
*ppenumIDList = list;
} }
else
{ *ppenumIDList = list;
*ppenumIDList = IEnumIDList_Constructor();
if (*ppenumIDList == NULL)
return E_OUTOFMEMORY;
}
return S_OK; return S_OK;
failed: failed:
...@@ -445,7 +439,7 @@ failed: ...@@ -445,7 +439,7 @@ failed:
for (; i<pidls_count; i++) for (; i<pidls_count; i++)
ILFree(pidls[i]); ILFree(pidls[i]);
SHFree(pidls); SHFree(pidls);
return E_OUTOFMEMORY; return ret;
} }
static HRESULT WINAPI RecycleBin_BindToObject(IShellFolder2 *This, LPCITEMIDLIST pidl, LPBC pbc, REFIID riid, void **ppv) static HRESULT WINAPI RecycleBin_BindToObject(IShellFolder2 *This, LPCITEMIDLIST pidl, LPBC pbc, REFIID riid, void **ppv)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment