mirror of
https://github.com/reactos/wine.git
synced 2024-11-24 20:30:01 +00:00
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)
|
||||
{
|
||||
domcdata *This = impl_from_IXMLDOMCDATASection( iface );
|
||||
VARIANT val;
|
||||
|
||||
TRACE("(%p)->(%s)\n", This, debugstr_w(data) );
|
||||
|
||||
V_VT(&val) = VT_BSTR;
|
||||
V_BSTR(&val) = data;
|
||||
|
||||
return IXMLDOMCDATASection_put_nodeValue( iface, val );
|
||||
TRACE("(%p)->(%s)\n", This, debugstr_w(data));
|
||||
return node_set_content(&This->node, data);
|
||||
}
|
||||
|
||||
static HRESULT WINAPI domcdata_get_length(
|
||||
|
@ -554,13 +554,8 @@ static HRESULT WINAPI domcomment_put_data(
|
||||
BSTR data)
|
||||
{
|
||||
domcomment *This = impl_from_IXMLDOMComment( iface );
|
||||
VARIANT val;
|
||||
|
||||
TRACE("(%p)->(%s)\n", This, debugstr_w(data) );
|
||||
|
||||
V_VT(&val) = VT_BSTR;
|
||||
V_BSTR(&val) = data;
|
||||
return node_put_value(&This->node, &val);
|
||||
TRACE("(%p)->(%s)\n", This, debugstr_w(data));
|
||||
return node_set_content(&This->node, data);
|
||||
}
|
||||
|
||||
static HRESULT WINAPI domcomment_get_length(
|
||||
|
@ -602,13 +602,12 @@ static HRESULT WINAPI dom_pi_put_data(
|
||||
BSTR data)
|
||||
{
|
||||
dom_pi *This = impl_from_IXMLDOMProcessingInstruction( iface );
|
||||
VARIANT val;
|
||||
BSTR target;
|
||||
HRESULT hr;
|
||||
|
||||
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);
|
||||
if(hr == S_OK)
|
||||
{
|
||||
@ -622,10 +621,7 @@ static HRESULT WINAPI dom_pi_put_data(
|
||||
SysFreeString(target);
|
||||
}
|
||||
|
||||
V_VT(&val) = VT_BSTR;
|
||||
V_BSTR(&val) = data;
|
||||
|
||||
return IXMLDOMProcessingInstruction_put_nodeValue( iface, val );
|
||||
return node_set_content(&This->node, data);
|
||||
}
|
||||
|
||||
static const struct IXMLDOMProcessingInstructionVtbl dom_pi_vtbl =
|
||||
|
@ -11675,6 +11675,123 @@ todo_wine
|
||||
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)
|
||||
{
|
||||
IXMLDOMDocument *doc;
|
||||
@ -11752,6 +11869,7 @@ START_TEST(domdoc)
|
||||
test_supporterrorinfo();
|
||||
test_nodeValue();
|
||||
test_get_namespaces();
|
||||
test_put_data();
|
||||
|
||||
test_xsltemplate();
|
||||
|
||||
|
@ -608,13 +608,8 @@ static HRESULT WINAPI domtext_put_data(
|
||||
BSTR data)
|
||||
{
|
||||
domtext *This = impl_from_IXMLDOMText( iface );
|
||||
VARIANT val;
|
||||
|
||||
TRACE("(%p)->(%s)\n", This, debugstr_w(data) );
|
||||
|
||||
V_VT(&val) = VT_BSTR;
|
||||
V_BSTR(&val) = data;
|
||||
return node_put_value(&This->node, &val);
|
||||
TRACE("(%p)->(%s)\n", This, debugstr_w(data));
|
||||
return node_set_content(&This->node, data);
|
||||
}
|
||||
|
||||
static HRESULT WINAPI domtext_get_length(
|
||||
|
Loading…
Reference in New Issue
Block a user