mirror of
https://github.com/reactos/wine.git
synced 2024-11-25 20:59:54 +00:00
msxml3: Handle all variant types in IXMLDOMDocument::createNode.
This commit is contained in:
parent
27e9a98350
commit
91513caa16
@ -1110,13 +1110,19 @@ static HRESULT WINAPI domdoc_getElementsByTagName(
|
||||
return hr;
|
||||
}
|
||||
|
||||
static DOMNodeType get_node_type(VARIANT Type)
|
||||
static HRESULT get_node_type(VARIANT Type, DOMNodeType * type)
|
||||
{
|
||||
if(V_VT(&Type) == VT_I4)
|
||||
return V_I4(&Type);
|
||||
VARIANT tmp;
|
||||
HRESULT hr;
|
||||
|
||||
FIXME("Unsupported variant type %x\n", V_VT(&Type));
|
||||
return 0;
|
||||
VariantInit(&tmp);
|
||||
hr = VariantChangeType(&tmp, &Type, 0, VT_I4);
|
||||
if(FAILED(hr))
|
||||
return E_INVALIDARG;
|
||||
|
||||
*type = V_I4(&tmp);
|
||||
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
static HRESULT WINAPI domdoc_createNode(
|
||||
@ -1130,10 +1136,14 @@ static HRESULT WINAPI domdoc_createNode(
|
||||
DOMNodeType node_type;
|
||||
xmlNodePtr xmlnode = NULL;
|
||||
xmlChar *xml_name;
|
||||
HRESULT hr;
|
||||
|
||||
TRACE("(%p)->(type,%s,%s,%p)\n", This, debugstr_w(name), debugstr_w(namespaceURI), node);
|
||||
|
||||
node_type = get_node_type(Type);
|
||||
hr = get_node_type(Type, &node_type);
|
||||
if(FAILED(hr))
|
||||
return hr;
|
||||
|
||||
TRACE("node_type %d\n", node_type);
|
||||
|
||||
xml_name = xmlChar_from_wchar((WCHAR*)name);
|
||||
|
@ -1353,6 +1353,8 @@ static void test_refs(void)
|
||||
|
||||
static void test_create(void)
|
||||
{
|
||||
static const WCHAR szOne[] = {'1',0};
|
||||
static const WCHAR szOneGarbage[] = {'1','G','a','r','b','a','g','e',0};
|
||||
HRESULT r;
|
||||
VARIANT var;
|
||||
BSTR str, name;
|
||||
@ -1369,6 +1371,36 @@ static void test_create(void)
|
||||
if( r != S_OK )
|
||||
return;
|
||||
|
||||
V_VT(&var) = VT_I1;
|
||||
V_I1(&var) = NODE_ELEMENT;
|
||||
str = SysAllocString( szlc );
|
||||
r = IXMLDOMDocument_createNode( doc, var, str, NULL, &node );
|
||||
ok( r == S_OK, "returns %08x\n", r );
|
||||
if( SUCCEEDED(r) ) IXMLDOMNode_Release( node );
|
||||
|
||||
V_VT(&var) = VT_R4;
|
||||
V_R4(&var) = NODE_ELEMENT;
|
||||
str = SysAllocString( szlc );
|
||||
r = IXMLDOMDocument_createNode( doc, var, str, NULL, &node );
|
||||
ok( r == S_OK, "returns %08x\n", r );
|
||||
if( SUCCEEDED(r) ) IXMLDOMNode_Release( node );
|
||||
|
||||
V_VT(&var) = VT_BSTR;
|
||||
V_BSTR(&var) = SysAllocString( szOne );
|
||||
str = SysAllocString( szlc );
|
||||
r = IXMLDOMDocument_createNode( doc, var, str, NULL, &node );
|
||||
ok( r == S_OK, "returns %08x\n", r );
|
||||
if( SUCCEEDED(r) ) IXMLDOMNode_Release( node );
|
||||
VariantClear(&var);
|
||||
|
||||
V_VT(&var) = VT_BSTR;
|
||||
V_BSTR(&var) = SysAllocString( szOneGarbage );
|
||||
str = SysAllocString( szlc );
|
||||
r = IXMLDOMDocument_createNode( doc, var, str, NULL, &node );
|
||||
ok( r == E_INVALIDARG, "returns %08x\n", r );
|
||||
if( SUCCEEDED(r) ) IXMLDOMNode_Release( node );
|
||||
VariantClear(&var);
|
||||
|
||||
V_VT(&var) = VT_I4;
|
||||
V_I4(&var) = NODE_ELEMENT;
|
||||
str = SysAllocString( szlc );
|
||||
|
Loading…
Reference in New Issue
Block a user