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

Alexandre Julliard julliard at winehq.org
Mon Nov 8 11:46:19 CST 2010


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

Author: Jacek Caban <jacek at codeweavers.com>
Date:   Sun Nov  7 20:28:36 2010 +0100

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

---

 dlls/msxml3/attribute.c |    6 +++-
 dlls/msxml3/cdata.c     |    6 +++-
 dlls/msxml3/comment.c   |    6 +++-
 dlls/msxml3/docfrag.c   |    6 +++-
 dlls/msxml3/domdoc.c    |    8 ++++-
 dlls/msxml3/element.c   |    6 +++-
 dlls/msxml3/entityref.c |    6 +++-
 dlls/msxml3/node.c      |   70 +++-------------------------------------------
 dlls/msxml3/pi.c        |    7 ++++-
 dlls/msxml3/text.c      |    6 +++-
 10 files changed, 52 insertions(+), 75 deletions(-)

diff --git a/dlls/msxml3/attribute.c b/dlls/msxml3/attribute.c
index e7e8f48..e634867 100644
--- a/dlls/msxml3/attribute.c
+++ b/dlls/msxml3/attribute.c
@@ -370,7 +370,11 @@ static HRESULT WINAPI domattr_get_nodeTypeString(
     BSTR* p)
 {
     domattr *This = impl_from_IXMLDOMAttribute( iface );
-    return IXMLDOMNode_get_nodeTypeString( IXMLDOMNode_from_impl(&This->node), p );
+    static const WCHAR attributeW[] = {'a','t','t','r','i','b','u','t','e',0};
+
+    TRACE("(%p)->(%p)\n", This, p);
+
+    return return_bstr(attributeW, p);
 }
 
 static HRESULT WINAPI domattr_get_text(
diff --git a/dlls/msxml3/cdata.c b/dlls/msxml3/cdata.c
index d602bfa..e4f24c5 100644
--- a/dlls/msxml3/cdata.c
+++ b/dlls/msxml3/cdata.c
@@ -381,7 +381,11 @@ static HRESULT WINAPI domcdata_get_nodeTypeString(
     BSTR* p)
 {
     domcdata *This = impl_from_IXMLDOMCDATASection( iface );
-    return IXMLDOMNode_get_nodeTypeString( IXMLDOMNode_from_impl(&This->node), p );
+    static const WCHAR cdatasectionW[] = {'c','d','a','t','a','s','e','c','t','i','o','n',0};
+
+    TRACE("(%p)->(%p)\n", This, p);
+
+    return return_bstr(cdatasectionW, p);
 }
 
 static HRESULT WINAPI domcdata_get_text(
diff --git a/dlls/msxml3/comment.c b/dlls/msxml3/comment.c
index 5402a54..6ea3e71 100644
--- a/dlls/msxml3/comment.c
+++ b/dlls/msxml3/comment.c
@@ -374,7 +374,11 @@ static HRESULT WINAPI domcomment_get_nodeTypeString(
     BSTR* p)
 {
     domcomment *This = impl_from_IXMLDOMComment( iface );
-    return IXMLDOMNode_get_nodeTypeString( IXMLDOMNode_from_impl(&This->node), p );
+    static const WCHAR commentW[] = {'c','o','m','m','e','n','t',0};
+
+    TRACE("(%p)->(%p)\n", This, p);
+
+    return return_bstr(commentW, p);
 }
 
 static HRESULT WINAPI domcomment_get_text(
diff --git a/dlls/msxml3/docfrag.c b/dlls/msxml3/docfrag.c
index ec86579..2dcb894 100644
--- a/dlls/msxml3/docfrag.c
+++ b/dlls/msxml3/docfrag.c
@@ -378,7 +378,11 @@ static HRESULT WINAPI domfrag_get_nodeTypeString(
     BSTR* p)
 {
     domfrag *This = impl_from_IXMLDOMDocumentFragment( iface );
-    return IXMLDOMNode_get_nodeTypeString( IXMLDOMNode_from_impl(&This->node), p );
+    static const WCHAR documentfragmentW[] = {'d','o','c','u','m','e','n','t','f','r','a','g','m','e','n','t',0};
+
+    TRACE("(%p)->(%p)\n", This, p);
+
+    return return_bstr(documentfragmentW, p);
 }
 
 static HRESULT WINAPI domfrag_get_text(
diff --git a/dlls/msxml3/domdoc.c b/dlls/msxml3/domdoc.c
index 8e12098..985d33a 100644
--- a/dlls/msxml3/domdoc.c
+++ b/dlls/msxml3/domdoc.c
@@ -1190,10 +1190,14 @@ static HRESULT WINAPI domdoc_cloneNode(
 
 static HRESULT WINAPI domdoc_get_nodeTypeString(
     IXMLDOMDocument3 *iface,
-    BSTR* nodeType )
+    BSTR *p)
 {
     domdoc *This = impl_from_IXMLDOMDocument3( iface );
-    return IXMLDOMNode_get_nodeTypeString( IXMLDOMNode_from_impl(&This->node), nodeType );
+    static const WCHAR documentW[] = {'d','o','c','u','m','e','n','t',0};
+
+    TRACE("(%p)->(%p)\n", This, p);
+
+    return return_bstr(documentW, p);
 }
 
 
diff --git a/dlls/msxml3/element.c b/dlls/msxml3/element.c
index 1400088..f1d38ee 100644
--- a/dlls/msxml3/element.c
+++ b/dlls/msxml3/element.c
@@ -386,7 +386,11 @@ static HRESULT WINAPI domelem_get_nodeTypeString(
     BSTR* p)
 {
     domelem *This = impl_from_IXMLDOMElement( iface );
-    return IXMLDOMNode_get_nodeTypeString( IXMLDOMNode_from_impl(&This->node), p );
+    static const WCHAR elementW[] = {'e','l','e','m','e','n','t',0};
+
+    TRACE("(%p)->(%p)\n", This, p);
+
+    return return_bstr(elementW, p);
 }
 
 static HRESULT WINAPI domelem_get_text(
diff --git a/dlls/msxml3/entityref.c b/dlls/msxml3/entityref.c
index 570d711..698f1e5 100644
--- a/dlls/msxml3/entityref.c
+++ b/dlls/msxml3/entityref.c
@@ -372,7 +372,11 @@ static HRESULT WINAPI entityref_get_nodeTypeString(
     BSTR* p)
 {
     entityref *This = impl_from_IXMLDOMEntityReference( iface );
-    return IXMLDOMNode_get_nodeTypeString( IXMLDOMNode_from_impl(&This->node), p );
+    static const WCHAR entityreferenceW[] = {'e','n','t','i','t','y','r','e','f','e','r','e','n','c','e',0};
+
+    TRACE("(%p)->(%p)\n", This, p);
+
+    return return_bstr(entityreferenceW, p);
 }
 
 static HRESULT WINAPI entityref_get_text(
diff --git a/dlls/msxml3/node.c b/dlls/msxml3/node.c
index 0b81418..3c6748b 100644
--- a/dlls/msxml3/node.c
+++ b/dlls/msxml3/node.c
@@ -521,69 +521,6 @@ HRESULT node_clone(xmlnode *This, VARIANT_BOOL deep, IXMLDOMNode **cloneNode)
     return S_OK;
 }
 
-static HRESULT WINAPI xmlnode_get_nodeTypeString(
-    IXMLDOMNode *iface,
-    BSTR* xmlnodeType)
-{
-    xmlnode *This = impl_from_IXMLDOMNode( iface );
-    const xmlChar *str;
-
-    TRACE("(%p)->(%p)\n", This, xmlnodeType );
-
-    if (!xmlnodeType)
-        return E_INVALIDARG;
-
-    if ( !This->node )
-        return E_FAIL;
-
-    switch( This->node->type )
-    {
-    case XML_ATTRIBUTE_NODE:
-        str = (const xmlChar*) "attribute";
-        break;
-    case XML_CDATA_SECTION_NODE:
-        str = (const xmlChar*) "cdatasection";
-        break;
-    case XML_COMMENT_NODE:
-        str = (const xmlChar*) "comment";
-        break;
-    case XML_DOCUMENT_NODE:
-        str = (const xmlChar*) "document";
-        break;
-    case XML_DOCUMENT_FRAG_NODE:
-        str = (const xmlChar*) "documentfragment";
-        break;
-    case XML_ELEMENT_NODE:
-        str = (const xmlChar*) "element";
-        break;
-    case XML_ENTITY_NODE:
-        str = (const xmlChar*) "entity";
-        break;
-    case XML_ENTITY_REF_NODE:
-        str = (const xmlChar*) "entityreference";
-        break;
-    case XML_NOTATION_NODE:
-        str = (const xmlChar*) "notation";
-        break;
-    case XML_PI_NODE:
-        str = (const xmlChar*) "processinginstruction";
-        break;
-    case XML_TEXT_NODE:
-        str = (const xmlChar*) "text";
-        break;
-    default:
-        FIXME("Unknown node type (%d)\n", This->node->type);
-        str = This->node->name;
-        break;
-    }
-
-    *xmlnodeType = bstr_from_xmlChar( str );
-    if (!*xmlnodeType)
-        return S_FALSE;
-
-    return S_OK;
-}
-
 static inline xmlChar* trim_whitespace(xmlChar* str)
 {
     xmlChar* ret = str;
@@ -1344,7 +1281,7 @@ static const struct IXMLDOMNodeVtbl xmlnode_vtbl =
     xmlnode_hasChildNodes,
     xmlnode_get_ownerDocument,
     NULL,
-    xmlnode_get_nodeTypeString,
+    NULL,
     xmlnode_get_text,
     NULL,
     NULL,
@@ -1726,7 +1663,10 @@ static HRESULT WINAPI unknode_get_nodeTypeString(
     BSTR* p)
 {
     unknode *This = impl_from_unkIXMLDOMNode( iface );
-    return IXMLDOMNode_get_nodeTypeString( IXMLDOMNode_from_impl(&This->node), p );
+
+    FIXME("(%p)->(%p)\n", This, p);
+
+    return node_get_nodeName(&This->node, p);
 }
 
 static HRESULT WINAPI unknode_get_text(
diff --git a/dlls/msxml3/pi.c b/dlls/msxml3/pi.c
index 44ccb96..9ada032 100644
--- a/dlls/msxml3/pi.c
+++ b/dlls/msxml3/pi.c
@@ -388,7 +388,12 @@ static HRESULT WINAPI dom_pi_get_nodeTypeString(
     BSTR* p)
 {
     dom_pi *This = impl_from_IXMLDOMProcessingInstruction( iface );
-    return IXMLDOMNode_get_nodeTypeString( IXMLDOMNode_from_impl(&This->node), p );
+    static const WCHAR processinginstructionW[] =
+        {'p','r','o','c','e','s','s','i','n','g','i','n','s','t','r','u','c','t','i','o','n',0};
+
+    TRACE("(%p)->(%p)\n", This, p);
+
+    return return_bstr(processinginstructionW, p);
 }
 
 static HRESULT WINAPI dom_pi_get_text(
diff --git a/dlls/msxml3/text.c b/dlls/msxml3/text.c
index 47bb1f0..9b25008 100644
--- a/dlls/msxml3/text.c
+++ b/dlls/msxml3/text.c
@@ -387,7 +387,11 @@ static HRESULT WINAPI domtext_get_nodeTypeString(
     BSTR* p)
 {
     domtext *This = impl_from_IXMLDOMText( iface );
-    return IXMLDOMNode_get_nodeTypeString( IXMLDOMNode_from_impl(&This->node), p );
+    static const WCHAR textW[] = {'t','e','x','t',0};
+
+    TRACE("(%p)->(%p)\n", This, p);
+
+    return return_bstr(textW, p);
 }
 
 static HRESULT WINAPI domtext_get_text(




More information about the wine-cvs mailing list