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

This commit is contained in:
Jacek Caban 2010-09-07 15:27:31 +02:00 committed by Alexandre Julliard
parent b42a243fec
commit 9413fab39e
11 changed files with 69 additions and 69 deletions

View File

@ -201,10 +201,13 @@ static HRESULT WINAPI domattr_get_nodeValue(
static HRESULT WINAPI domattr_put_nodeValue(
IXMLDOMAttribute *iface,
VARIANT var1 )
VARIANT value)
{
domattr *This = impl_from_IXMLDOMAttribute( iface );
return IXMLDOMNode_put_nodeValue( IXMLDOMNode_from_impl(&This->node), var1 );
TRACE("(%p)->(v%d)\n", This, V_VT(&value));
return node_put_value(&This->node, &value);
}
static HRESULT WINAPI domattr_get_nodeType(
@ -501,10 +504,13 @@ static HRESULT WINAPI domattr_get_value(
static HRESULT WINAPI domattr_put_value(
IXMLDOMAttribute *iface,
VARIANT var1)
VARIANT value)
{
domattr *This = impl_from_IXMLDOMAttribute( iface );
return IXMLDOMNode_put_nodeValue( IXMLDOMNode_from_impl(&This->node), var1 );
TRACE("(%p)->(v%d)\n", This, V_VT(&value));
return node_put_value(&This->node, &value);
}
static const struct IXMLDOMAttributeVtbl domattr_vtbl =

View File

@ -212,10 +212,13 @@ static HRESULT WINAPI domcdata_get_nodeValue(
static HRESULT WINAPI domcdata_put_nodeValue(
IXMLDOMCDATASection *iface,
VARIANT var1 )
VARIANT value)
{
domcdata *This = impl_from_IXMLDOMCDATASection( iface );
return IXMLDOMNode_put_nodeValue( IXMLDOMNode_from_impl(&This->node), var1 );
TRACE("(%p)->(v%d)\n", This, V_VT(&value));
return node_put_value(&This->node, &value);
}
static HRESULT WINAPI domcdata_get_nodeType(

View File

@ -205,10 +205,13 @@ static HRESULT WINAPI domcomment_get_nodeValue(
static HRESULT WINAPI domcomment_put_nodeValue(
IXMLDOMComment *iface,
VARIANT var1 )
VARIANT value)
{
domcomment *This = impl_from_IXMLDOMComment( iface );
return IXMLDOMNode_put_nodeValue( IXMLDOMNode_from_impl(&This->node), var1 );
TRACE("(%p)->(v%d)\n", This, V_VT(&value));
return node_put_value(&This->node, &value);
}
static HRESULT WINAPI domcomment_get_nodeType(
@ -511,8 +514,7 @@ static HRESULT WINAPI domcomment_put_data(
V_VT(&val) = VT_BSTR;
V_BSTR(&val) = data;
return IXMLDOMNode_put_nodeValue( IXMLDOMNode_from_impl(&This->node), val );
return node_put_value(&This->node, &val);
}
static HRESULT WINAPI domcomment_get_length(

View File

@ -209,10 +209,11 @@ static HRESULT WINAPI domfrag_get_nodeValue(
static HRESULT WINAPI domfrag_put_nodeValue(
IXMLDOMDocumentFragment *iface,
VARIANT var1 )
VARIANT value)
{
domfrag *This = impl_from_IXMLDOMDocumentFragment( iface );
return IXMLDOMNode_put_nodeValue( IXMLDOMNode_from_impl(&This->node), var1 );
FIXME("(%p)->(v%d)\n", This, V_VT(&value));
return E_FAIL;
}
static HRESULT WINAPI domfrag_get_nodeType(

View File

@ -717,7 +717,8 @@ static HRESULT WINAPI domdoc_put_nodeValue(
VARIANT value)
{
domdoc *This = impl_from_IXMLDOMDocument3( iface );
return IXMLDOMNode_put_nodeValue( IXMLDOMNode_from_impl(&This->node), value );
FIXME("(%p)->(v%d)\n", This, V_VT(&value));
return E_FAIL;
}
@ -1301,7 +1302,7 @@ static HRESULT WINAPI domdoc_createProcessingInstruction(
V_VT(&v_data) = VT_BSTR;
V_BSTR(&v_data) = data;
hr = IXMLDOMNode_put_nodeValue( IXMLDOMNode_from_impl(node_obj), v_data );
hr = node_put_value(node_obj, &v_data);
IXMLDOMNode_QueryInterface(node, &IID_IXMLDOMProcessingInstruction, (void**)pi);
IXMLDOMNode_Release(node);

View File

@ -218,10 +218,11 @@ static HRESULT WINAPI domelem_get_nodeValue(
static HRESULT WINAPI domelem_put_nodeValue(
IXMLDOMElement *iface,
VARIANT var1 )
VARIANT value)
{
domelem *This = impl_from_IXMLDOMElement( iface );
return IXMLDOMNode_put_nodeValue( IXMLDOMNode_from_impl(&This->node), var1 );
FIXME("(%p)->(v%d)\n", This, V_VT(&value));
return E_FAIL;
}
static HRESULT WINAPI domelem_get_nodeType(

View File

@ -205,10 +205,11 @@ static HRESULT WINAPI entityref_get_nodeValue(
static HRESULT WINAPI entityref_put_nodeValue(
IXMLDOMEntityReference *iface,
VARIANT var1 )
VARIANT value)
{
entityref *This = impl_from_IXMLDOMEntityReference( iface );
return IXMLDOMNode_put_nodeValue( IXMLDOMNode_from_impl(&This->node), var1 );
FIXME("(%p)->(v%d)\n", This, V_VT(&value));
return E_FAIL;
}
static HRESULT WINAPI entityref_get_nodeType(

View File

@ -161,6 +161,7 @@ extern xmlnode *get_node_obj(IXMLDOMNode*);
extern HRESULT node_get_nodeName(xmlnode*,BSTR*);
extern HRESULT node_get_content(xmlnode*,VARIANT*);
extern HRESULT node_put_value(xmlnode*,VARIANT*);
extern HRESULT DOMDocument_create_from_xmldoc(xmlDocPtr xmldoc, IXMLDOMDocument3 **document);

View File

@ -222,52 +222,33 @@ static HRESULT WINAPI xmlnode_get_nodeValue(
return E_NOTIMPL;
}
HRESULT node_put_value(xmlnode *This, VARIANT *value)
{
VARIANT string_value;
xmlChar *str;
HRESULT hr;
VariantInit(&string_value);
hr = VariantChangeType(&string_value, value, 0, VT_BSTR);
if(FAILED(hr)) {
WARN("Couldn't convert to VT_BSTR\n");
return hr;
}
str = xmlChar_from_wchar(V_BSTR(&string_value));
VariantClear(&string_value);
xmlNodeSetContent(This->node, str);
heap_free(str);
return S_OK;
}
static HRESULT WINAPI xmlnode_put_nodeValue(
IXMLDOMNode *iface,
VARIANT value)
{
xmlnode *This = impl_from_IXMLDOMNode( iface );
HRESULT hr;
TRACE("%p type(%d)\n", This, This->node->type);
/* Document, Document Fragment, Document Type, Element,
Entity, Entity Reference, Notation aren't supported. */
switch ( This->node->type )
{
case XML_ATTRIBUTE_NODE:
case XML_CDATA_SECTION_NODE:
case XML_COMMENT_NODE:
case XML_PI_NODE:
case XML_TEXT_NODE:
{
VARIANT string_value;
xmlChar *str;
VariantInit(&string_value);
hr = VariantChangeType(&string_value, &value, 0, VT_BSTR);
if(FAILED(hr))
{
VariantClear(&string_value);
WARN("Couldn't convert to VT_BSTR\n");
return hr;
}
str = xmlChar_from_wchar(V_BSTR(&string_value));
VariantClear(&string_value);
xmlNodeSetContent(This->node, str);
heap_free(str);
hr = S_OK;
break;
}
default:
/* Do nothing for unsupported types. */
hr = E_FAIL;
break;
}
return hr;
ERR("Should not be called\n");
return E_NOTIMPL;
}
static HRESULT WINAPI xmlnode_get_nodeType(
@ -1812,10 +1793,11 @@ static HRESULT WINAPI unknode_get_nodeValue(
static HRESULT WINAPI unknode_put_nodeValue(
IXMLDOMNode *iface,
VARIANT var1 )
VARIANT value)
{
unknode *This = impl_from_unkIXMLDOMNode( iface );
return IXMLDOMNode_put_nodeValue( IXMLDOMNode_from_impl(&This->node), var1 );
FIXME("(%p)->(v%d)\n", This, V_VT(&value));
return E_FAIL;
}
static HRESULT WINAPI unknode_get_nodeType(

View File

@ -202,14 +202,14 @@ static HRESULT WINAPI dom_pi_get_nodeValue(
static HRESULT WINAPI dom_pi_put_nodeValue(
IXMLDOMProcessingInstruction *iface,
VARIANT var1 )
VARIANT value)
{
dom_pi *This = impl_from_IXMLDOMProcessingInstruction( iface );
BSTR sTarget;
static const WCHAR szXML[] = {'x','m','l',0};
HRESULT hr;
TRACE("%p\n", This );
TRACE("(%p)->(v%d)\n", This, V_VT(&value));
/* Cannot set data to a PI node whose target is 'xml' */
hr = dom_pi_get_nodeName(iface, &sTarget);
@ -224,7 +224,7 @@ static HRESULT WINAPI dom_pi_put_nodeValue(
SysFreeString(sTarget);
}
return IXMLDOMNode_put_nodeValue( IXMLDOMNode_from_impl(&This->node), var1 );
return node_put_value(&This->node, &value);
}
static HRESULT WINAPI dom_pi_get_nodeType(

View File

@ -218,10 +218,13 @@ static HRESULT WINAPI domtext_get_nodeValue(
static HRESULT WINAPI domtext_put_nodeValue(
IXMLDOMText *iface,
VARIANT var1 )
VARIANT value)
{
domtext *This = impl_from_IXMLDOMText( iface );
return IXMLDOMNode_put_nodeValue( IXMLDOMNode_from_impl(&This->node), var1 );
TRACE("(%p)->(v%d)\n", This, V_VT(&value));
return node_put_value(&This->node, &value);
}
static HRESULT WINAPI domtext_get_nodeType(
@ -515,8 +518,7 @@ static HRESULT WINAPI domtext_put_data(
V_VT(&val) = VT_BSTR;
V_BSTR(&val) = data;
return IXMLDOMNode_put_nodeValue( IXMLDOMNode_from_impl(&This->node), val );
return node_put_value(&This->node, &val);
}
static HRESULT WINAPI domtext_get_length(