Nikolay Sivov : ole32: Simplify IEnumSTATSTG initialization.
Alexandre Julliard
julliard at winehq.org
Fri Apr 19 14:25:07 CDT 2013
Module: wine
Branch: master
Commit: 448a44ca5f586400ee1bda3e104df516f985441a
URL: http://source.winehq.org/git/wine.git/?a=commit;h=448a44ca5f586400ee1bda3e104df516f985441a
Author: Nikolay Sivov <nsivov at codeweavers.com>
Date: Fri Apr 19 13:38:13 2013 +0400
ole32: Simplify IEnumSTATSTG initialization.
---
dlls/ole32/storage32.c | 36 ++++++++++--------------------------
1 files changed, 10 insertions(+), 26 deletions(-)
diff --git a/dlls/ole32/storage32.c b/dlls/ole32/storage32.c
index d3e351b..425fd12 100644
--- a/dlls/ole32/storage32.c
+++ b/dlls/ole32/storage32.c
@@ -732,9 +732,6 @@ static HRESULT WINAPI StorageBaseImpl_EnumElements(
if (newEnum)
{
*ppenum = &newEnum->IEnumSTATSTG_iface;
-
- IEnumSTATSTG_AddRef(*ppenum);
-
return S_OK;
}
@@ -5599,36 +5596,30 @@ static HRESULT WINAPI IEnumSTATSTGImpl_Clone(
IEnumSTATSTG** ppenum)
{
IEnumSTATSTGImpl* const This = impl_from_IEnumSTATSTG(iface);
-
IEnumSTATSTGImpl* newClone;
if (This->parentStorage->reverted)
return STG_E_REVERTED;
- /*
- * Perform a sanity check on the parameters.
- */
if (ppenum==0)
return E_INVALIDARG;
newClone = IEnumSTATSTGImpl_Construct(This->parentStorage,
This->storageDirEntry);
-
+ if (!newClone)
+ {
+ *ppenum = NULL;
+ return E_OUTOFMEMORY;
+ }
/*
* The new clone enumeration must point to the same current node as
- * the ole one.
+ * the old one.
*/
memcpy(newClone->name, This->name, sizeof(newClone->name));
*ppenum = &newClone->IEnumSTATSTG_iface;
- /*
- * Don't forget to nail down a reference to the clone before
- * returning it.
- */
- IEnumSTATSTGImpl_AddRef(*ppenum);
-
return S_OK;
}
@@ -5658,13 +5649,11 @@ static IEnumSTATSTGImpl* IEnumSTATSTGImpl_Construct(
newEnumeration = HeapAlloc(GetProcessHeap(), 0, sizeof(IEnumSTATSTGImpl));
- if (newEnumeration!=0)
+ if (newEnumeration)
{
- /*
- * Set-up the virtual function table and reference count.
- */
newEnumeration->IEnumSTATSTG_iface.lpVtbl = &IEnumSTATSTGImpl_Vtbl;
- newEnumeration->ref = 0;
+ newEnumeration->ref = 1;
+ newEnumeration->name[0] = 0;
/*
* We want to nail-down the reference to the storage in case the
@@ -5673,12 +5662,7 @@ static IEnumSTATSTGImpl* IEnumSTATSTGImpl_Construct(
newEnumeration->parentStorage = parentStorage;
IStorage_AddRef(&newEnumeration->parentStorage->IStorage_iface);
- newEnumeration->storageDirEntry = storageDirEntry;
-
- /*
- * Make sure the current node of the iterator is the first one.
- */
- IEnumSTATSTGImpl_Reset(&newEnumeration->IEnumSTATSTG_iface);
+ newEnumeration->storageDirEntry = storageDirEntry;
}
return newEnumeration;
More information about the wine-cvs
mailing list