msxml3: Make ::put_data() use passed BSTR as general WCHAR buffer.
This commit is contained in:
parent
cb53b7a8e1
commit
b80c71abe6
|
@ -552,14 +552,8 @@ static HRESULT WINAPI domcdata_put_data(
|
||||||
BSTR data)
|
BSTR data)
|
||||||
{
|
{
|
||||||
domcdata *This = impl_from_IXMLDOMCDATASection( iface );
|
domcdata *This = impl_from_IXMLDOMCDATASection( iface );
|
||||||
VARIANT val;
|
TRACE("(%p)->(%s)\n", This, debugstr_w(data));
|
||||||
|
return node_set_content(&This->node, data);
|
||||||
TRACE("(%p)->(%s)\n", This, debugstr_w(data) );
|
|
||||||
|
|
||||||
V_VT(&val) = VT_BSTR;
|
|
||||||
V_BSTR(&val) = data;
|
|
||||||
|
|
||||||
return IXMLDOMCDATASection_put_nodeValue( iface, val );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static HRESULT WINAPI domcdata_get_length(
|
static HRESULT WINAPI domcdata_get_length(
|
||||||
|
|
|
@ -554,13 +554,8 @@ static HRESULT WINAPI domcomment_put_data(
|
||||||
BSTR data)
|
BSTR data)
|
||||||
{
|
{
|
||||||
domcomment *This = impl_from_IXMLDOMComment( iface );
|
domcomment *This = impl_from_IXMLDOMComment( iface );
|
||||||
VARIANT val;
|
TRACE("(%p)->(%s)\n", This, debugstr_w(data));
|
||||||
|
return node_set_content(&This->node, data);
|
||||||
TRACE("(%p)->(%s)\n", This, debugstr_w(data) );
|
|
||||||
|
|
||||||
V_VT(&val) = VT_BSTR;
|
|
||||||
V_BSTR(&val) = data;
|
|
||||||
return node_put_value(&This->node, &val);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static HRESULT WINAPI domcomment_get_length(
|
static HRESULT WINAPI domcomment_get_length(
|
||||||
|
|
|
@ -602,13 +602,12 @@ static HRESULT WINAPI dom_pi_put_data(
|
||||||
BSTR data)
|
BSTR data)
|
||||||
{
|
{
|
||||||
dom_pi *This = impl_from_IXMLDOMProcessingInstruction( iface );
|
dom_pi *This = impl_from_IXMLDOMProcessingInstruction( iface );
|
||||||
VARIANT val;
|
|
||||||
BSTR target;
|
BSTR target;
|
||||||
HRESULT hr;
|
HRESULT hr;
|
||||||
|
|
||||||
TRACE("(%p)->(%s)\n", This, debugstr_w(data) );
|
TRACE("(%p)->(%s)\n", This, debugstr_w(data) );
|
||||||
|
|
||||||
/* Cannot set data to a PI node whose target is 'xml' */
|
/* cannot set data to a PI node whose target is 'xml' */
|
||||||
hr = IXMLDOMProcessingInstruction_get_nodeName(iface, &target);
|
hr = IXMLDOMProcessingInstruction_get_nodeName(iface, &target);
|
||||||
if(hr == S_OK)
|
if(hr == S_OK)
|
||||||
{
|
{
|
||||||
|
@ -622,10 +621,7 @@ static HRESULT WINAPI dom_pi_put_data(
|
||||||
SysFreeString(target);
|
SysFreeString(target);
|
||||||
}
|
}
|
||||||
|
|
||||||
V_VT(&val) = VT_BSTR;
|
return node_set_content(&This->node, data);
|
||||||
V_BSTR(&val) = data;
|
|
||||||
|
|
||||||
return IXMLDOMProcessingInstruction_put_nodeValue( iface, val );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static const struct IXMLDOMProcessingInstructionVtbl dom_pi_vtbl =
|
static const struct IXMLDOMProcessingInstructionVtbl dom_pi_vtbl =
|
||||||
|
|
|
@ -11675,6 +11675,123 @@ todo_wine
|
||||||
free_bstrs();
|
free_bstrs();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static DOMNodeType put_data_types[] = {
|
||||||
|
NODE_TEXT,
|
||||||
|
NODE_CDATA_SECTION,
|
||||||
|
NODE_PROCESSING_INSTRUCTION,
|
||||||
|
NODE_COMMENT,
|
||||||
|
NODE_INVALID
|
||||||
|
};
|
||||||
|
|
||||||
|
static void test_put_data(void)
|
||||||
|
{
|
||||||
|
static const WCHAR test_data[] = {'t','e','s','t',' ','n','o','d','e',' ','d','a','t','a',0};
|
||||||
|
WCHAR buff[100], *data;
|
||||||
|
IXMLDOMDocument *doc;
|
||||||
|
DOMNodeType *type;
|
||||||
|
BSTR get_data;
|
||||||
|
HRESULT hr;
|
||||||
|
|
||||||
|
doc = create_document(&IID_IXMLDOMDocument);
|
||||||
|
if (!doc) return;
|
||||||
|
|
||||||
|
memcpy(&buff[2], test_data, sizeof(test_data));
|
||||||
|
/* just a big length */
|
||||||
|
*(DWORD*)buff = 0xf0f0;
|
||||||
|
data = &buff[2];
|
||||||
|
|
||||||
|
type = put_data_types;
|
||||||
|
while (*type != NODE_INVALID)
|
||||||
|
{
|
||||||
|
IXMLDOMNode *node;
|
||||||
|
VARIANT v;
|
||||||
|
|
||||||
|
V_VT(&v) = VT_I2;
|
||||||
|
V_I2(&v) = *type;
|
||||||
|
|
||||||
|
hr = IXMLDOMDocument_createNode(doc, v, _bstr_("name"), NULL, &node);
|
||||||
|
EXPECT_HR(hr, S_OK);
|
||||||
|
|
||||||
|
/* put_data() is interface-specific */
|
||||||
|
switch (*type)
|
||||||
|
{
|
||||||
|
case NODE_TEXT:
|
||||||
|
{
|
||||||
|
IXMLDOMText *text;
|
||||||
|
|
||||||
|
hr = IXMLDOMNode_QueryInterface(node, &IID_IXMLDOMText, (void**)&text);
|
||||||
|
EXPECT_HR(hr, S_OK);
|
||||||
|
hr = IXMLDOMText_put_data(text, data);
|
||||||
|
EXPECT_HR(hr, S_OK);
|
||||||
|
|
||||||
|
hr = IXMLDOMText_get_data(text, &get_data);
|
||||||
|
EXPECT_HR(hr, S_OK);
|
||||||
|
|
||||||
|
IXMLDOMText_Release(text);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case NODE_CDATA_SECTION:
|
||||||
|
{
|
||||||
|
IXMLDOMCDATASection *cdata;
|
||||||
|
|
||||||
|
hr = IXMLDOMNode_QueryInterface(node, &IID_IXMLDOMCDATASection, (void**)&cdata);
|
||||||
|
EXPECT_HR(hr, S_OK);
|
||||||
|
hr = IXMLDOMCDATASection_put_data(cdata, data);
|
||||||
|
EXPECT_HR(hr, S_OK);
|
||||||
|
|
||||||
|
hr = IXMLDOMCDATASection_get_data(cdata, &get_data);
|
||||||
|
EXPECT_HR(hr, S_OK);
|
||||||
|
|
||||||
|
IXMLDOMCDATASection_Release(cdata);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case NODE_PROCESSING_INSTRUCTION:
|
||||||
|
{
|
||||||
|
IXMLDOMProcessingInstruction *pi;
|
||||||
|
|
||||||
|
hr = IXMLDOMNode_QueryInterface(node, &IID_IXMLDOMProcessingInstruction, (void**)&pi);
|
||||||
|
EXPECT_HR(hr, S_OK);
|
||||||
|
hr = IXMLDOMProcessingInstruction_put_data(pi, data);
|
||||||
|
EXPECT_HR(hr, S_OK);
|
||||||
|
|
||||||
|
hr = IXMLDOMProcessingInstruction_get_data(pi, &get_data);
|
||||||
|
EXPECT_HR(hr, S_OK);
|
||||||
|
|
||||||
|
IXMLDOMProcessingInstruction_Release(pi);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case NODE_COMMENT:
|
||||||
|
{
|
||||||
|
IXMLDOMComment *comment;
|
||||||
|
|
||||||
|
hr = IXMLDOMNode_QueryInterface(node, &IID_IXMLDOMComment, (void**)&comment);
|
||||||
|
EXPECT_HR(hr, S_OK);
|
||||||
|
hr = IXMLDOMComment_put_data(comment, data);
|
||||||
|
EXPECT_HR(hr, S_OK);
|
||||||
|
|
||||||
|
hr = IXMLDOMComment_get_data(comment, &get_data);
|
||||||
|
EXPECT_HR(hr, S_OK);
|
||||||
|
|
||||||
|
IXMLDOMComment_Release(comment);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
default:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
/* compare */
|
||||||
|
ok(!lstrcmpW(data, get_data), "%d: got wrong data %s, expected %s\n", *type, wine_dbgstr_w(get_data),
|
||||||
|
wine_dbgstr_w(data));
|
||||||
|
SysFreeString(get_data);
|
||||||
|
|
||||||
|
IXMLDOMNode_Release(node);
|
||||||
|
type++;
|
||||||
|
}
|
||||||
|
|
||||||
|
IXMLDOMDocument_Release(doc);
|
||||||
|
free_bstrs();
|
||||||
|
}
|
||||||
|
|
||||||
START_TEST(domdoc)
|
START_TEST(domdoc)
|
||||||
{
|
{
|
||||||
IXMLDOMDocument *doc;
|
IXMLDOMDocument *doc;
|
||||||
|
@ -11752,6 +11869,7 @@ START_TEST(domdoc)
|
||||||
test_supporterrorinfo();
|
test_supporterrorinfo();
|
||||||
test_nodeValue();
|
test_nodeValue();
|
||||||
test_get_namespaces();
|
test_get_namespaces();
|
||||||
|
test_put_data();
|
||||||
|
|
||||||
test_xsltemplate();
|
test_xsltemplate();
|
||||||
|
|
||||||
|
|
|
@ -608,13 +608,8 @@ static HRESULT WINAPI domtext_put_data(
|
||||||
BSTR data)
|
BSTR data)
|
||||||
{
|
{
|
||||||
domtext *This = impl_from_IXMLDOMText( iface );
|
domtext *This = impl_from_IXMLDOMText( iface );
|
||||||
VARIANT val;
|
TRACE("(%p)->(%s)\n", This, debugstr_w(data));
|
||||||
|
return node_set_content(&This->node, data);
|
||||||
TRACE("(%p)->(%s)\n", This, debugstr_w(data) );
|
|
||||||
|
|
||||||
V_VT(&val) = VT_BSTR;
|
|
||||||
V_BSTR(&val) = data;
|
|
||||||
return node_put_value(&This->node, &val);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
static HRESULT WINAPI domtext_get_length(
|
static HRESULT WINAPI domtext_get_length(
|
||||||
|
|
Loading…
Reference in New Issue