ole32: Simplify IEnumSTATSTG initialization.
This commit is contained in:
parent
3b9568802a
commit
448a44ca5f
@ -732,9 +732,6 @@ static HRESULT WINAPI StorageBaseImpl_EnumElements(
|
|||||||
if (newEnum)
|
if (newEnum)
|
||||||
{
|
{
|
||||||
*ppenum = &newEnum->IEnumSTATSTG_iface;
|
*ppenum = &newEnum->IEnumSTATSTG_iface;
|
||||||
|
|
||||||
IEnumSTATSTG_AddRef(*ppenum);
|
|
||||||
|
|
||||||
return S_OK;
|
return S_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -5599,36 +5596,30 @@ static HRESULT WINAPI IEnumSTATSTGImpl_Clone(
|
|||||||
IEnumSTATSTG** ppenum)
|
IEnumSTATSTG** ppenum)
|
||||||
{
|
{
|
||||||
IEnumSTATSTGImpl* const This = impl_from_IEnumSTATSTG(iface);
|
IEnumSTATSTGImpl* const This = impl_from_IEnumSTATSTG(iface);
|
||||||
|
|
||||||
IEnumSTATSTGImpl* newClone;
|
IEnumSTATSTGImpl* newClone;
|
||||||
|
|
||||||
if (This->parentStorage->reverted)
|
if (This->parentStorage->reverted)
|
||||||
return STG_E_REVERTED;
|
return STG_E_REVERTED;
|
||||||
|
|
||||||
/*
|
|
||||||
* Perform a sanity check on the parameters.
|
|
||||||
*/
|
|
||||||
if (ppenum==0)
|
if (ppenum==0)
|
||||||
return E_INVALIDARG;
|
return E_INVALIDARG;
|
||||||
|
|
||||||
newClone = IEnumSTATSTGImpl_Construct(This->parentStorage,
|
newClone = IEnumSTATSTGImpl_Construct(This->parentStorage,
|
||||||
This->storageDirEntry);
|
This->storageDirEntry);
|
||||||
|
if (!newClone)
|
||||||
|
{
|
||||||
|
*ppenum = NULL;
|
||||||
|
return E_OUTOFMEMORY;
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* The new clone enumeration must point to the same current node as
|
* 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));
|
memcpy(newClone->name, This->name, sizeof(newClone->name));
|
||||||
|
|
||||||
*ppenum = &newClone->IEnumSTATSTG_iface;
|
*ppenum = &newClone->IEnumSTATSTG_iface;
|
||||||
|
|
||||||
/*
|
|
||||||
* Don't forget to nail down a reference to the clone before
|
|
||||||
* returning it.
|
|
||||||
*/
|
|
||||||
IEnumSTATSTGImpl_AddRef(*ppenum);
|
|
||||||
|
|
||||||
return S_OK;
|
return S_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -5658,13 +5649,11 @@ static IEnumSTATSTGImpl* IEnumSTATSTGImpl_Construct(
|
|||||||
|
|
||||||
newEnumeration = HeapAlloc(GetProcessHeap(), 0, sizeof(IEnumSTATSTGImpl));
|
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->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
|
* We want to nail-down the reference to the storage in case the
|
||||||
@ -5674,11 +5663,6 @@ static IEnumSTATSTGImpl* IEnumSTATSTGImpl_Construct(
|
|||||||
IStorage_AddRef(&newEnumeration->parentStorage->IStorage_iface);
|
IStorage_AddRef(&newEnumeration->parentStorage->IStorage_iface);
|
||||||
|
|
||||||
newEnumeration->storageDirEntry = storageDirEntry;
|
newEnumeration->storageDirEntry = storageDirEntry;
|
||||||
|
|
||||||
/*
|
|
||||||
* Make sure the current node of the iterator is the first one.
|
|
||||||
*/
|
|
||||||
IEnumSTATSTGImpl_Reset(&newEnumeration->IEnumSTATSTG_iface);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return newEnumeration;
|
return newEnumeration;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user