Commit 7f84185a authored by Piotr Caban's avatar Piotr Caban Committed by Alexandre Julliard

msxml3: Split DOMDocument_create.

parent 8221a650
...@@ -2200,13 +2200,10 @@ static const IObjectSafetyVtbl domdocObjectSafetyVtbl = { ...@@ -2200,13 +2200,10 @@ static const IObjectSafetyVtbl domdocObjectSafetyVtbl = {
xmldoc_Safety_SetInterfaceSafetyOptions xmldoc_Safety_SetInterfaceSafetyOptions
}; };
HRESULT DOMDocument_create(IUnknown *pUnkOuter, LPVOID *ppObj) HRESULT DOMDocument_create_from_xmldoc(xmlDocPtr xmldoc, IXMLDOMDocument2 **document)
{ {
domdoc *doc; domdoc *doc;
HRESULT hr; HRESULT hr;
xmlDocPtr xmldoc;
TRACE("(%p,%p)\n", pUnkOuter, ppObj);
doc = HeapAlloc( GetProcessHeap(), 0, sizeof (*doc) ); doc = HeapAlloc( GetProcessHeap(), 0, sizeof (*doc) );
if( !doc ) if( !doc )
...@@ -2229,19 +2226,9 @@ HRESULT DOMDocument_create(IUnknown *pUnkOuter, LPVOID *ppObj) ...@@ -2229,19 +2226,9 @@ HRESULT DOMDocument_create(IUnknown *pUnkOuter, LPVOID *ppObj)
doc->safeopt = 0; doc->safeopt = 0;
doc->bsc = NULL; doc->bsc = NULL;
xmldoc = xmlNewDoc(NULL);
if(!xmldoc)
{
HeapFree(GetProcessHeap(), 0, doc);
return E_OUTOFMEMORY;
}
xmldoc->_private = 0;
doc->node_unk = create_basic_node( (xmlNodePtr)xmldoc, (IUnknown*)&doc->lpVtbl ); doc->node_unk = create_basic_node( (xmlNodePtr)xmldoc, (IUnknown*)&doc->lpVtbl );
if(!doc->node_unk) if(!doc->node_unk)
{ {
xmlFreeDoc(xmldoc);
HeapFree(GetProcessHeap(), 0, doc); HeapFree(GetProcessHeap(), 0, doc);
return E_FAIL; return E_FAIL;
} }
...@@ -2256,12 +2243,32 @@ HRESULT DOMDocument_create(IUnknown *pUnkOuter, LPVOID *ppObj) ...@@ -2256,12 +2243,32 @@ HRESULT DOMDocument_create(IUnknown *pUnkOuter, LPVOID *ppObj)
/* The ref on doc->node is actually looped back into this object, so release it */ /* The ref on doc->node is actually looped back into this object, so release it */
IXMLDOMNode_Release(doc->node); IXMLDOMNode_Release(doc->node);
*ppObj = &doc->lpVtbl; *document = (IXMLDOMDocument2*)&doc->lpVtbl;
TRACE("returning iface %p\n", *ppObj); TRACE("returning iface %p\n", *document);
return S_OK; return S_OK;
} }
HRESULT DOMDocument_create(IUnknown *pUnkOuter, LPVOID *ppObj)
{
xmlDocPtr xmldoc;
HRESULT hr;
TRACE("(%p,%p)\n", pUnkOuter, ppObj);
xmldoc = xmlNewDoc(NULL);
if(!xmldoc)
return E_OUTOFMEMORY;
xmldoc->_private = 0;
hr = DOMDocument_create_from_xmldoc(xmldoc, (IXMLDOMDocument2**)ppObj);
if(FAILED(hr))
xmlFreeDoc(xmldoc);
return hr;
}
#else #else
HRESULT DOMDocument_create(IUnknown *pUnkOuter, LPVOID *ppObj) HRESULT DOMDocument_create(IUnknown *pUnkOuter, LPVOID *ppObj)
......
...@@ -91,6 +91,8 @@ extern HRESULT SchemaCache_create( IUnknown *pUnkOuter, LPVOID *ppObj ); ...@@ -91,6 +91,8 @@ extern HRESULT SchemaCache_create( IUnknown *pUnkOuter, LPVOID *ppObj );
extern HRESULT XMLDocument_create( IUnknown *pUnkOuter, LPVOID *ppObj ); extern HRESULT XMLDocument_create( IUnknown *pUnkOuter, LPVOID *ppObj );
extern HRESULT SAXXMLReader_create(IUnknown *pUnkOuter, LPVOID *ppObj ); extern HRESULT SAXXMLReader_create(IUnknown *pUnkOuter, LPVOID *ppObj );
extern HRESULT DOMDocument_create_from_xmldoc(xmlDocPtr xmldoc, IXMLDOMDocument2 **document);
/* typelibs */ /* typelibs */
enum tid_t { enum tid_t {
IXMLDOMAttribute_tid, IXMLDOMAttribute_tid,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment