Dan Hipschman : msxml3: Fix IXMLDOMNamedNodeMap_getNamedItem() conformance on error.

Alexandre Julliard julliard at wine.codeweavers.com
Mon Sep 25 09:46:36 CDT 2006


Module: wine
Branch: master
Commit: 47b6d3a1e3a19796eb8b5a4578eba48a7fb23401
URL:    http://source.winehq.org/git/?p=wine.git;a=commit;h=47b6d3a1e3a19796eb8b5a4578eba48a7fb23401

Author: Dan Hipschman <dsh at linux.ucla.edu>
Date:   Wed Sep 20 16:41:30 2006 -0700

msxml3: Fix IXMLDOMNamedNodeMap_getNamedItem() conformance on error.

---

 dlls/msxml3/nodemap.c      |   10 ++++++++--
 dlls/msxml3/tests/domdoc.c |   13 +++++++++++++
 2 files changed, 21 insertions(+), 2 deletions(-)

diff --git a/dlls/msxml3/nodemap.c b/dlls/msxml3/nodemap.c
index 32fd32c..0797436 100644
--- a/dlls/msxml3/nodemap.c
+++ b/dlls/msxml3/nodemap.c
@@ -165,7 +165,10 @@ static HRESULT WINAPI xmlnodemap_getName
     xmlAttrPtr attr;
     xmlNodePtr node;
 
-    TRACE("%p %s\n", This, debugstr_w(name) );
+    TRACE("%p %s %p\n", This, debugstr_w(name), namedItem );
+
+    if ( !namedItem )
+        return E_INVALIDARG;
 
     node = xmlNodePtr_from_domnode( This->node, 0 );
     if ( !node )
@@ -176,7 +179,10 @@ static HRESULT WINAPI xmlnodemap_getName
     HeapFree( GetProcessHeap(), 0, element_name );
 
     if ( !attr )
-        return E_FAIL;
+    {
+        *namedItem = NULL;
+        return S_FALSE;
+    }
 
     *namedItem = create_node( (xmlNodePtr) attr );
 
diff --git a/dlls/msxml3/tests/domdoc.c b/dlls/msxml3/tests/domdoc.c
index aaad036..4a3fdc1 100644
--- a/dlls/msxml3/tests/domdoc.c
+++ b/dlls/msxml3/tests/domdoc.c
@@ -396,6 +396,19 @@ todo_wine
         IXMLDOMNode_Release(node);
         SysFreeString( str );
 
+        str = SysAllocString( szdl );
+        r = IXMLDOMNamedNodeMap_getNamedItem( map, str, NULL );
+        ok( r == E_INVALIDARG, "getNamedItem should return E_INVALIDARG\n");
+        SysFreeString( str );
+
+        /* something that isn't in szComplete4 */
+        str = SysAllocString( szOpen );
+        node = (IXMLDOMNode *) 1;
+        r = IXMLDOMNamedNodeMap_getNamedItem( map, str, &node );
+        ok( r = S_FALSE, "getNamedItem found a node that wasn't there\n");
+        ok( node == NULL, "getNamedItem should have returned NULL\n");
+        SysFreeString( str );
+
 	/* test indexed access of attributes */
         r = IXMLDOMNamedNodeMap_get_length( map, &count );
         ok ( r == S_OK, "get_length wrong code\n");




More information about the wine-cvs mailing list