From c85ca9e3149f4d8981d7edd2430b2132f4d54592 Mon Sep 17 00:00:00 2001 From: Vincent Povirk Date: Thu, 15 Oct 2009 15:45:05 -0500 Subject: [PATCH] ole32: Don't use IEnumSTATSTGImpl to search in DestroyElement. Remove IEnumSTATSTGImpl_FindProperty because it is unused. --- dlls/ole32/storage32.c | 71 +++++++++--------------------------------------- 1 files changed, 13 insertions(+), 58 deletions(-) diff --git a/dlls/ole32/storage32.c b/dlls/ole32/storage32.c index 9d35de9..3532d43 100644 --- a/dlls/ole32/storage32.c +++ b/dlls/ole32/storage32.c @@ -244,8 +244,6 @@ static IEnumSTATSTGImpl* IEnumSTATSTGImpl_Construct(StorageImpl* This, ULONG fir static void IEnumSTATSTGImpl_Destroy(IEnumSTATSTGImpl* This); static void IEnumSTATSTGImpl_PushSearchNode(IEnumSTATSTGImpl* This, ULONG nodeToPush); static ULONG IEnumSTATSTGImpl_PopSearchNode(IEnumSTATSTGImpl* This, BOOL remove); -static ULONG IEnumSTATSTGImpl_FindProperty(IEnumSTATSTGImpl* This, const OLECHAR* lpszPropName, - StgProperty* buffer); static INT IEnumSTATSTGImpl_FindParentProperty(IEnumSTATSTGImpl *This, ULONG childProperty, StgProperty *currentProperty, ULONG *propertyId); @@ -1666,7 +1664,6 @@ static HRESULT WINAPI StorageImpl_DestroyElement( { StorageImpl* const This=(StorageImpl*)iface; - IEnumSTATSTGImpl* propertyEnumeration; HRESULT hr = S_OK; BOOL res; StgProperty propertyToDelete; @@ -1674,6 +1671,7 @@ static HRESULT WINAPI StorageImpl_DestroyElement( ULONG foundPropertyIndexToDelete; ULONG typeOfRelation; ULONG parentPropertyId = 0; + Dirent deletedDirent; TRACE("(%p, %s)\n", iface, debugstr_w(pwcsName)); @@ -1684,22 +1682,22 @@ static HRESULT WINAPI StorageImpl_DestroyElement( if ( STGM_ACCESS_MODE( This->base.openFlags ) == STGM_READ ) return STG_E_ACCESSDENIED; - propertyEnumeration = IEnumSTATSTGImpl_Construct( - This->base.ancestorStorage, - This->base.rootPropertySetIndex); - - foundPropertyIndexToDelete = IEnumSTATSTGImpl_FindProperty( - propertyEnumeration, - pwcsName, - &propertyToDelete); + hr = Dirent_FindElement(&This->base.dirent, pwcsName, &deletedDirent); - IEnumSTATSTGImpl_Destroy(propertyEnumeration); - - if ( foundPropertyIndexToDelete == PROPERTY_NULL ) + if (SUCCEEDED(hr)) { - return STG_E_FILENOTFOUND; + foundPropertyIndexToDelete = Dirent_GetIndex(&deletedDirent); + + res = StorageImpl_ReadProperty( + This->base.ancestorStorage, + foundPropertyIndexToDelete, + &propertyToDelete); + if (!res) hr = STG_E_READFAULT; } + if (FAILED(hr)) + return hr; + /* * Find the parent property of the property to delete (the one that * link to it). If This->dirProperty == foundPropertyIndexToDelete, @@ -4371,49 +4369,6 @@ static INT IEnumSTATSTGImpl_FindParentProperty( return PROPERTY_NULL; } -static ULONG IEnumSTATSTGImpl_FindProperty( - IEnumSTATSTGImpl* This, - const OLECHAR* lpszPropName, - StgProperty* currentProperty) -{ - ULONG currentSearchNode; - - /* - * Start with the node at the top of the stack. - */ - currentSearchNode = IEnumSTATSTGImpl_PopSearchNode(This, FALSE); - - while (currentSearchNode!=PROPERTY_NULL) - { - /* - * Remove the top node from the stack - */ - IEnumSTATSTGImpl_PopSearchNode(This, TRUE); - - /* - * Read the property from the storage. - */ - StorageImpl_ReadProperty(This->parentStorage, - currentSearchNode, - currentProperty); - - if (propertyNameCmp(currentProperty->name, lpszPropName) == 0) - return currentSearchNode; - - /* - * Push the next search node in the search stack. - */ - IEnumSTATSTGImpl_PushSearchNode(This, currentProperty->nextProperty); - - /* - * continue the iteration. - */ - currentSearchNode = IEnumSTATSTGImpl_PopSearchNode(This, FALSE); - } - - return PROPERTY_NULL; -} - static void IEnumSTATSTGImpl_PushSearchNode( IEnumSTATSTGImpl* This, ULONG nodeToPush) -- 1.5.4.3