[2/7] msxml3: removeChild can only delete direct children.

Michael Karcher wine at mkarcher.dialup.fu-berlin.de
Sun Oct 5 05:12:38 CDT 2008


Tests still pass on Wine. No changes on XP of course, as only
a todo_wine is removed.
---
 dlls/msxml3/node.c         |   12 +++---------
 dlls/msxml3/tests/domdoc.c |    4 ++--
 2 files changed, 5 insertions(+), 11 deletions(-)

diff --git a/dlls/msxml3/node.c b/dlls/msxml3/node.c
index 39413c9..b4403cb 100644
--- a/dlls/msxml3/node.c
+++ b/dlls/msxml3/node.c
@@ -619,7 +619,7 @@ static HRESULT WINAPI xmlnode_removeChild(
     IXMLDOMNode** oldChild)
 {
     xmlnode *This = impl_from_IXMLDOMNode( iface );
-    xmlNode *ancestor, *child_node_ptr;
+    xmlNode *child_node_ptr;
     HRESULT hr;
     IXMLDOMNode *child;
 
@@ -634,14 +634,8 @@ static HRESULT WINAPI xmlnode_removeChild(
     if(FAILED(hr))
         return hr;
 
-    child_node_ptr = ancestor = impl_from_IXMLDOMNode(child)->node;
-    while(ancestor->parent)
-    {
-        if(ancestor->parent == This->node)
-            break;
-        ancestor = ancestor->parent;
-    }
-    if(!ancestor->parent)
+    child_node_ptr = impl_from_IXMLDOMNode(child)->node;
+    if(child_node_ptr->parent != This->node)
     {
         WARN("childNode %p is not a child of %p\n", childNode, iface);
         IXMLDOMNode_Release(child);
diff --git a/dlls/msxml3/tests/domdoc.c b/dlls/msxml3/tests/domdoc.c
index 8922a3e..b5b543e 100644
--- a/dlls/msxml3/tests/domdoc.c
+++ b/dlls/msxml3/tests/domdoc.c
@@ -1797,8 +1797,8 @@ static void test_removeChild(void)
     /* ba_node is a descendant of element, but not a direct child. */
     removed_node = (void*)0xdeadbeef;
     r = IXMLDOMElement_removeChild( element, ba_node, &removed_node );
-    todo_wine ok( r == E_INVALIDARG, "ret %08x\n", r );
-    todo_wine ok( removed_node == NULL, "%p\n", removed_node );
+    ok( r == E_INVALIDARG, "ret %08x\n", r );
+    ok( removed_node == NULL, "%p\n", removed_node );
 
     r = IXMLDOMElement_removeChild( element, fo_node, &removed_node );
     ok( r == S_OK, "ret %08x\n", r);
-- 
1.5.6.5




More information about the wine-patches mailing list