From 6ce537baacd6a78ceb8165238941eef9c65e8f8a Mon Sep 17 00:00:00 2001 From: Jacek Caban Date: Sat, 4 Sep 2010 17:56:45 +0200 Subject: [PATCH] msxml3: Don't use xmlnode's IXMLDOMNode iface in get_nodeValue implementations. --- dlls/msxml3/attribute.c | 14 +++++--- dlls/msxml3/cdata.c | 7 ++-- dlls/msxml3/comment.c | 7 ++-- dlls/msxml3/docfrag.c | 11 +++++-- dlls/msxml3/domdoc.c | 10 +++++- dlls/msxml3/element.c | 12 +++++-- dlls/msxml3/entityref.c | 11 +++++-- dlls/msxml3/msxml_private.h | 1 + dlls/msxml3/node.c | 65 ++++++++++++++----------------------- dlls/msxml3/pi.c | 7 ++-- dlls/msxml3/text.c | 24 +++++++------- 11 files changed, 100 insertions(+), 69 deletions(-) diff --git a/dlls/msxml3/attribute.c b/dlls/msxml3/attribute.c index 30a05cdb90..2e06512f2e 100644 --- a/dlls/msxml3/attribute.c +++ b/dlls/msxml3/attribute.c @@ -190,10 +190,13 @@ static HRESULT WINAPI domattr_get_nodeName( static HRESULT WINAPI domattr_get_nodeValue( IXMLDOMAttribute *iface, - VARIANT* var1 ) + VARIANT* value) { domattr *This = impl_from_IXMLDOMAttribute( iface ); - return IXMLDOMNode_get_nodeValue( IXMLDOMNode_from_impl(&This->node), var1 ); + + TRACE("(%p)->(%p)\n", This, value); + + return node_get_content(&This->node, value); } static HRESULT WINAPI domattr_put_nodeValue( @@ -487,10 +490,13 @@ static HRESULT WINAPI domattr_get_name( static HRESULT WINAPI domattr_get_value( IXMLDOMAttribute *iface, - VARIANT *var1) + VARIANT *value) { domattr *This = impl_from_IXMLDOMAttribute( iface ); - return IXMLDOMNode_get_nodeValue( IXMLDOMNode_from_impl(&This->node), var1 ); + + TRACE("(%p)->(%p)\n", This, value); + + return node_get_content(&This->node, value); } static HRESULT WINAPI domattr_put_value( diff --git a/dlls/msxml3/cdata.c b/dlls/msxml3/cdata.c index 903f36f9a9..b29a6cd60d 100644 --- a/dlls/msxml3/cdata.c +++ b/dlls/msxml3/cdata.c @@ -201,10 +201,13 @@ static HRESULT WINAPI domcdata_get_nodeName( static HRESULT WINAPI domcdata_get_nodeValue( IXMLDOMCDATASection *iface, - VARIANT* var1 ) + VARIANT* value) { domcdata *This = impl_from_IXMLDOMCDATASection( iface ); - return IXMLDOMNode_get_nodeValue( IXMLDOMNode_from_impl(&This->node), var1 ); + + TRACE("(%p)->(%p)\n", This, value); + + return node_get_content(&This->node, value); } static HRESULT WINAPI domcdata_put_nodeValue( diff --git a/dlls/msxml3/comment.c b/dlls/msxml3/comment.c index 513ce0cb6a..3649dafc68 100644 --- a/dlls/msxml3/comment.c +++ b/dlls/msxml3/comment.c @@ -194,10 +194,13 @@ static HRESULT WINAPI domcomment_get_nodeName( static HRESULT WINAPI domcomment_get_nodeValue( IXMLDOMComment *iface, - VARIANT* var1 ) + VARIANT* value) { domcomment *This = impl_from_IXMLDOMComment( iface ); - return IXMLDOMNode_get_nodeValue( IXMLDOMNode_from_impl(&This->node), var1 ); + + TRACE("(%p)->(%p)\n", This, value); + + return node_get_content(&This->node, value); } static HRESULT WINAPI domcomment_put_nodeValue( diff --git a/dlls/msxml3/docfrag.c b/dlls/msxml3/docfrag.c index 5264d9697a..fb6308e3ac 100644 --- a/dlls/msxml3/docfrag.c +++ b/dlls/msxml3/docfrag.c @@ -194,10 +194,17 @@ static HRESULT WINAPI domfrag_get_nodeName( static HRESULT WINAPI domfrag_get_nodeValue( IXMLDOMDocumentFragment *iface, - VARIANT* var1 ) + VARIANT* value) { domfrag *This = impl_from_IXMLDOMDocumentFragment( iface ); - return IXMLDOMNode_get_nodeValue( IXMLDOMNode_from_impl(&This->node), var1 ); + + FIXME("(%p)->(%p)\n", This, value); + + if(!value) + return E_INVALIDARG; + + V_VT(value) = VT_NULL; + return S_FALSE; } static HRESULT WINAPI domfrag_put_nodeValue( diff --git a/dlls/msxml3/domdoc.c b/dlls/msxml3/domdoc.c index 6046c1e506..d591afaae7 100644 --- a/dlls/msxml3/domdoc.c +++ b/dlls/msxml3/domdoc.c @@ -700,7 +700,15 @@ static HRESULT WINAPI domdoc_get_nodeValue( VARIANT* value ) { domdoc *This = impl_from_IXMLDOMDocument3( iface ); - return IXMLDOMNode_get_nodeValue( IXMLDOMNode_from_impl(&This->node), value ); + + TRACE("(%p)->(%p)\n", This, value); + + if(!value) + return E_INVALIDARG; + + V_VT(value) = VT_NULL; + V_BSTR(value) = NULL; /* tests show that we should do this */ + return S_FALSE; } diff --git a/dlls/msxml3/element.c b/dlls/msxml3/element.c index 4e5522c7d2..0e8559acba 100644 --- a/dlls/msxml3/element.c +++ b/dlls/msxml3/element.c @@ -202,10 +202,18 @@ static HRESULT WINAPI domelem_get_nodeName( static HRESULT WINAPI domelem_get_nodeValue( IXMLDOMElement *iface, - VARIANT* var1 ) + VARIANT* value) { domelem *This = impl_from_IXMLDOMElement( iface ); - return IXMLDOMNode_get_nodeValue( IXMLDOMNode_from_impl(&This->node), var1 ); + + TRACE("(%p)->(%p)\n", This, value); + + if(!value) + return E_INVALIDARG; + + V_VT(value) = VT_NULL; + V_BSTR(value) = NULL; /* tests show that we should do this */ + return S_FALSE; } static HRESULT WINAPI domelem_put_nodeValue( diff --git a/dlls/msxml3/entityref.c b/dlls/msxml3/entityref.c index db7d16264f..a779d92132 100644 --- a/dlls/msxml3/entityref.c +++ b/dlls/msxml3/entityref.c @@ -190,10 +190,17 @@ static HRESULT WINAPI entityref_get_nodeName( static HRESULT WINAPI entityref_get_nodeValue( IXMLDOMEntityReference *iface, - VARIANT* var1 ) + VARIANT* value) { entityref *This = impl_from_IXMLDOMEntityReference( iface ); - return IXMLDOMNode_get_nodeValue( IXMLDOMNode_from_impl(&This->node), var1 ); + + FIXME("(%p)->(%p)\n", This, value); + + if(!value) + return E_INVALIDARG; + + V_VT(value) = VT_NULL; + return S_FALSE; } static HRESULT WINAPI entityref_put_nodeValue( diff --git a/dlls/msxml3/msxml_private.h b/dlls/msxml3/msxml_private.h index b249d90292..3fc9666206 100644 --- a/dlls/msxml3/msxml_private.h +++ b/dlls/msxml3/msxml_private.h @@ -160,6 +160,7 @@ extern BOOL node_query_interface(xmlnode*,REFIID,void**); extern xmlnode *get_node_obj(IXMLDOMNode*); extern HRESULT node_get_nodeName(xmlnode*,BSTR*); +extern HRESULT node_get_content(xmlnode*,VARIANT*); extern HRESULT DOMDocument_create_from_xmldoc(xmlDocPtr xmldoc, IXMLDOMDocument3 **document); diff --git a/dlls/msxml3/node.c b/dlls/msxml3/node.c index f057a9586d..905ae4139b 100644 --- a/dlls/msxml3/node.c +++ b/dlls/msxml3/node.c @@ -198,52 +198,28 @@ static HRESULT WINAPI xmlnode_get_nodeName( return E_NOTIMPL; } -static HRESULT WINAPI xmlnode_get_nodeValue( - IXMLDOMNode *iface, - VARIANT* value) +HRESULT node_get_content(xmlnode *This, VARIANT *value) { - xmlnode *This = impl_from_IXMLDOMNode( iface ); - HRESULT r = S_FALSE; - - TRACE("(%p)->(%p)\n", This, value); + xmlChar *content; if(!value) return E_INVALIDARG; - V_BSTR(value) = NULL; - V_VT(value) = VT_NULL; + content = xmlNodeGetContent(This->node); + V_VT(value) = VT_BSTR; + V_BSTR(value) = bstr_from_xmlChar( content ); + xmlFree(content); - switch ( This->node->type ) - { - case XML_CDATA_SECTION_NODE: - case XML_COMMENT_NODE: - case XML_PI_NODE: - case XML_ATTRIBUTE_NODE: - { - xmlChar *content = xmlNodeGetContent(This->node); - V_VT(value) = VT_BSTR; - V_BSTR(value) = bstr_from_xmlChar( content ); - xmlFree(content); - r = S_OK; - break; - } - case XML_TEXT_NODE: - V_VT(value) = VT_BSTR; - V_BSTR(value) = bstr_from_xmlChar( This->node->content ); - r = S_OK; - break; - case XML_ELEMENT_NODE: - case XML_DOCUMENT_NODE: - /* these seem to return NULL */ - break; + TRACE("%p returned %s\n", This, debugstr_w(V_BSTR(value))); + return S_OK; +} - default: - FIXME("node %p type %d\n", This, This->node->type); - } - - TRACE("%p returned %s\n", This, debugstr_w( V_BSTR(value) ) ); - - return r; +static HRESULT WINAPI xmlnode_get_nodeValue( + IXMLDOMNode *iface, + VARIANT* value) +{ + ERR("Should not be called\n"); + return E_NOTIMPL; } static HRESULT WINAPI xmlnode_put_nodeValue( @@ -1821,10 +1797,17 @@ static HRESULT WINAPI unknode_get_nodeName( static HRESULT WINAPI unknode_get_nodeValue( IXMLDOMNode *iface, - VARIANT* var1 ) + VARIANT* value) { unknode *This = impl_from_unkIXMLDOMNode( iface ); - return IXMLDOMNode_get_nodeValue( IXMLDOMNode_from_impl(&This->node), var1 ); + + FIXME("(%p)->(%p)\n", This, value); + + if(!value) + return E_INVALIDARG; + + V_VT(value) = VT_NULL; + return S_FALSE; } static HRESULT WINAPI unknode_put_nodeValue( diff --git a/dlls/msxml3/pi.c b/dlls/msxml3/pi.c index aeb296e4bd..518fa664bf 100644 --- a/dlls/msxml3/pi.c +++ b/dlls/msxml3/pi.c @@ -191,10 +191,13 @@ static HRESULT WINAPI dom_pi_get_nodeName( static HRESULT WINAPI dom_pi_get_nodeValue( IXMLDOMProcessingInstruction *iface, - VARIANT* var1 ) + VARIANT* value) { dom_pi *This = impl_from_IXMLDOMProcessingInstruction( iface ); - return IXMLDOMNode_get_nodeValue( IXMLDOMNode_from_impl(&This->node), var1 ); + + TRACE("(%p)->(%p)\n", This, value); + + return node_get_content(&This->node, value); } static HRESULT WINAPI dom_pi_put_nodeValue( diff --git a/dlls/msxml3/text.c b/dlls/msxml3/text.c index ccfc36e2e1..07f9de538b 100644 --- a/dlls/msxml3/text.c +++ b/dlls/msxml3/text.c @@ -202,10 +202,18 @@ static HRESULT WINAPI domtext_get_nodeName( static HRESULT WINAPI domtext_get_nodeValue( IXMLDOMText *iface, - VARIANT* var1 ) + VARIANT* value ) { domtext *This = impl_from_IXMLDOMText( iface ); - return IXMLDOMNode_get_nodeValue( IXMLDOMNode_from_impl(&This->node), var1 ); + + TRACE("(%p)->(%p)\n", This, value); + + if(!value) + return E_INVALIDARG; + + V_VT(value) = VT_BSTR; + V_BSTR(value) = bstr_from_xmlChar(This->node.node->content); + return S_OK; } static HRESULT WINAPI domtext_put_nodeValue( @@ -487,19 +495,13 @@ static HRESULT WINAPI domtext_get_data( IXMLDOMText *iface, BSTR *p) { - HRESULT hr; - VARIANT vRet; + domtext *This = impl_from_IXMLDOMText( iface ); if(!p) return E_INVALIDARG; - hr = IXMLDOMNode_get_nodeValue( iface, &vRet ); - if(hr == S_OK) - { - *p = V_BSTR(&vRet); - } - - return hr; + *p = bstr_from_xmlChar(This->node.node->content); + return S_OK; } static HRESULT WINAPI domtext_put_data(