Jacek Caban : msxml3: Don't use xmlnode' s IXMLDOMNode iface in get_attributes implementations.

Alexandre Julliard julliard at winehq.org
Mon Sep 13 17:14:42 CDT 2010


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

Author: Jacek Caban <jacek at codeweavers.com>
Date:   Fri Sep 10 16:54:06 2010 +0200

msxml3: Don't use xmlnode's IXMLDOMNode iface in get_attributes implementations.

---

 dlls/msxml3/attribute.c     |    5 ++++-
 dlls/msxml3/cdata.c         |    7 +++++--
 dlls/msxml3/comment.c       |    5 ++++-
 dlls/msxml3/docfrag.c       |    5 ++++-
 dlls/msxml3/domdoc.c        |    5 ++++-
 dlls/msxml3/element.c       |    6 +++++-
 dlls/msxml3/entityref.c     |    5 ++++-
 dlls/msxml3/msxml_private.h |    8 ++++++++
 dlls/msxml3/node.c          |   31 ++++++-------------------------
 dlls/msxml3/pi.c            |    6 +++++-
 dlls/msxml3/text.c          |    5 ++++-
 11 files changed, 53 insertions(+), 35 deletions(-)

diff --git a/dlls/msxml3/attribute.c b/dlls/msxml3/attribute.c
index 823234f..5607a03 100644
--- a/dlls/msxml3/attribute.c
+++ b/dlls/msxml3/attribute.c
@@ -293,7 +293,10 @@ static HRESULT WINAPI domattr_get_attributes(
     IXMLDOMNamedNodeMap** attributeMap)
 {
     domattr *This = impl_from_IXMLDOMAttribute( iface );
-    return IXMLDOMNode_get_attributes( IXMLDOMNode_from_impl(&This->node), attributeMap );
+
+    TRACE("(%p)->(%p)\n", This, attributeMap);
+
+    return return_null_ptr((void**)attributeMap);
 }
 
 static HRESULT WINAPI domattr_insertBefore(
diff --git a/dlls/msxml3/cdata.c b/dlls/msxml3/cdata.c
index e537858..98e77c5 100644
--- a/dlls/msxml3/cdata.c
+++ b/dlls/msxml3/cdata.c
@@ -303,8 +303,11 @@ static HRESULT WINAPI domcdata_get_attributes(
     IXMLDOMCDATASection *iface,
     IXMLDOMNamedNodeMap** attributeMap)
 {
-	domcdata *This = impl_from_IXMLDOMCDATASection( iface );
-    return IXMLDOMNode_get_attributes( IXMLDOMNode_from_impl(&This->node), attributeMap );
+    domcdata *This = impl_from_IXMLDOMCDATASection( iface );
+
+    TRACE("(%p)->(%p)\n", This, attributeMap);
+
+    return return_null_ptr((void**)attributeMap);
 }
 
 static HRESULT WINAPI domcdata_insertBefore(
diff --git a/dlls/msxml3/comment.c b/dlls/msxml3/comment.c
index bc53dde..dee94b2 100644
--- a/dlls/msxml3/comment.c
+++ b/dlls/msxml3/comment.c
@@ -297,7 +297,10 @@ static HRESULT WINAPI domcomment_get_attributes(
     IXMLDOMNamedNodeMap** attributeMap)
 {
     domcomment *This = impl_from_IXMLDOMComment( iface );
-    return IXMLDOMNode_get_attributes( IXMLDOMNode_from_impl(&This->node), attributeMap );
+
+    TRACE("(%p)->(%p)\n", This, attributeMap);
+
+    return return_null_ptr((void**)attributeMap);
 }
 
 static HRESULT WINAPI domcomment_insertBefore(
diff --git a/dlls/msxml3/docfrag.c b/dlls/msxml3/docfrag.c
index 9c6c903..0c1b9ae 100644
--- a/dlls/msxml3/docfrag.c
+++ b/dlls/msxml3/docfrag.c
@@ -299,7 +299,10 @@ static HRESULT WINAPI domfrag_get_attributes(
     IXMLDOMNamedNodeMap** attributeMap)
 {
     domfrag *This = impl_from_IXMLDOMDocumentFragment( iface );
-    return IXMLDOMNode_get_attributes( IXMLDOMNode_from_impl(&This->node), attributeMap );
+
+    TRACE("(%p)->(%p)\n", This, attributeMap);
+
+    return return_null_ptr((void**)attributeMap);
 }
 
 static HRESULT WINAPI domfrag_insertBefore(
diff --git a/dlls/msxml3/domdoc.c b/dlls/msxml3/domdoc.c
index 3e1cf90..fbdc280 100644
--- a/dlls/msxml3/domdoc.c
+++ b/dlls/msxml3/domdoc.c
@@ -812,7 +812,10 @@ static HRESULT WINAPI domdoc_get_attributes(
     IXMLDOMNamedNodeMap** attributeMap )
 {
     domdoc *This = impl_from_IXMLDOMDocument3( iface );
-    return IXMLDOMNode_get_attributes( IXMLDOMNode_from_impl(&This->node), attributeMap );
+
+    TRACE("(%p)->(%p)\n", This, attributeMap);
+
+    return return_null_ptr((void**)attributeMap);
 }
 
 
diff --git a/dlls/msxml3/element.c b/dlls/msxml3/element.c
index 7983720..1081ed4 100644
--- a/dlls/msxml3/element.c
+++ b/dlls/msxml3/element.c
@@ -308,7 +308,11 @@ static HRESULT WINAPI domelem_get_attributes(
     IXMLDOMNamedNodeMap** attributeMap)
 {
     domelem *This = impl_from_IXMLDOMElement( iface );
-    return IXMLDOMNode_get_attributes( IXMLDOMNode_from_impl(&This->node), attributeMap );
+
+    TRACE("(%p)->(%p)\n", This, attributeMap);
+
+    *attributeMap = create_nodemap((IXMLDOMNode*)&This->lpVtbl);
+    return S_OK;
 }
 
 static HRESULT WINAPI domelem_insertBefore(
diff --git a/dlls/msxml3/entityref.c b/dlls/msxml3/entityref.c
index 8598cdf..cf0b800 100644
--- a/dlls/msxml3/entityref.c
+++ b/dlls/msxml3/entityref.c
@@ -295,7 +295,10 @@ static HRESULT WINAPI entityref_get_attributes(
     IXMLDOMNamedNodeMap** attributeMap)
 {
     entityref *This = impl_from_IXMLDOMEntityReference( iface );
-    return IXMLDOMNode_get_attributes( IXMLDOMNode_from_impl(&This->node), attributeMap );
+
+    TRACE("(%p)->(%p)\n", This, attributeMap);
+
+    return return_null_ptr((void**)attributeMap);
 }
 
 static HRESULT WINAPI entityref_insertBefore(
diff --git a/dlls/msxml3/msxml_private.h b/dlls/msxml3/msxml_private.h
index 901a374..211300e 100644
--- a/dlls/msxml3/msxml_private.h
+++ b/dlls/msxml3/msxml_private.h
@@ -212,6 +212,14 @@ static inline HRESULT return_null_node(IXMLDOMNode **p)
     return S_FALSE;
 }
 
+static inline HRESULT return_null_ptr(void **p)
+{
+    if(!p)
+        return E_INVALIDARG;
+    *p = NULL;
+    return S_FALSE;
+}
+
 #endif
 
 void* libxslt_handle;
diff --git a/dlls/msxml3/node.c b/dlls/msxml3/node.c
index f72d064..5d25761 100644
--- a/dlls/msxml3/node.c
+++ b/dlls/msxml3/node.c
@@ -369,30 +369,8 @@ static HRESULT WINAPI xmlnode_get_attributes(
     IXMLDOMNode *iface,
     IXMLDOMNamedNodeMap** attributeMap)
 {
-    xmlnode *This = impl_from_IXMLDOMNode( iface );
-    TRACE("(%p)->(%p)\n", This, attributeMap);
-
-    if (!attributeMap)
-        return E_INVALIDARG;
-
-    switch( This->node->type )
-    {
-    /* Attribute, CDataSection, Comment, Documents, Documents Fragments,
-       Entity and Text Nodes does not support get_attributes */
-    case XML_ATTRIBUTE_NODE:
-    case XML_CDATA_SECTION_NODE:
-    case XML_COMMENT_NODE:
-    case XML_DOCUMENT_NODE:
-    case XML_DOCUMENT_FRAG_NODE:
-    case XML_ENTITY_NODE:
-    case XML_ENTITY_REF_NODE:
-    case XML_TEXT_NODE:
-        *attributeMap = NULL;
-        return S_FALSE;
-    default:
-        *attributeMap = create_nodemap( This->iface );
-        return S_OK;
-    }
+    ERR("Should not be called\n");
+    return E_NOTIMPL;
 }
 
 static HRESULT WINAPI xmlnode_insertBefore(
@@ -1852,7 +1830,10 @@ static HRESULT WINAPI unknode_get_attributes(
     IXMLDOMNamedNodeMap** attributeMap)
 {
     unknode *This = impl_from_unkIXMLDOMNode( iface );
-    return IXMLDOMNode_get_attributes( IXMLDOMNode_from_impl(&This->node), attributeMap );
+
+    FIXME("(%p)->(%p)\n", This, attributeMap);
+
+    return return_null_ptr((void**)attributeMap);
 }
 
 static HRESULT WINAPI unknode_insertBefore(
diff --git a/dlls/msxml3/pi.c b/dlls/msxml3/pi.c
index a42c2d7..446b1a7 100644
--- a/dlls/msxml3/pi.c
+++ b/dlls/msxml3/pi.c
@@ -310,7 +310,11 @@ static HRESULT WINAPI dom_pi_get_attributes(
     IXMLDOMNamedNodeMap** attributeMap)
 {
     dom_pi *This = impl_from_IXMLDOMProcessingInstruction( iface );
-    return IXMLDOMNode_get_attributes( IXMLDOMNode_from_impl(&This->node), attributeMap );
+
+    TRACE("(%p)->(%p)\n", This, attributeMap);
+
+    *attributeMap = create_nodemap((IXMLDOMNode*)&This->lpVtbl);
+    return S_OK;
 }
 
 static HRESULT WINAPI dom_pi_insertBefore(
diff --git a/dlls/msxml3/text.c b/dlls/msxml3/text.c
index 3ce9190..b236c54 100644
--- a/dlls/msxml3/text.c
+++ b/dlls/msxml3/text.c
@@ -310,7 +310,10 @@ static HRESULT WINAPI domtext_get_attributes(
     IXMLDOMNamedNodeMap** attributeMap)
 {
     domtext *This = impl_from_IXMLDOMText( iface );
-    return IXMLDOMNode_get_attributes( IXMLDOMNode_from_impl(&This->node), attributeMap );
+
+    TRACE("(%p)->(%p)\n", This, attributeMap);
+
+    return return_null_ptr((void**)attributeMap);
 }
 
 static HRESULT WINAPI domtext_insertBefore(




More information about the wine-cvs mailing list