Commit 6556ad57 authored by Nikolay Sivov's avatar Nikolay Sivov Committed by Alexandre Julliard

msxml3: Get rid of ::get_prefix() forward.

parent 936d4cf9
...@@ -497,10 +497,11 @@ static HRESULT WINAPI domattr_get_namespaceURI( ...@@ -497,10 +497,11 @@ static HRESULT WINAPI domattr_get_namespaceURI(
static HRESULT WINAPI domattr_get_prefix( static HRESULT WINAPI domattr_get_prefix(
IXMLDOMAttribute *iface, IXMLDOMAttribute *iface,
BSTR* p) BSTR* prefix)
{ {
domattr *This = impl_from_IXMLDOMAttribute( iface ); domattr *This = impl_from_IXMLDOMAttribute( iface );
return IXMLDOMNode_get_prefix( IXMLDOMNode_from_impl(&This->node), p ); TRACE("(%p)->(%p)\n", This, prefix);
return node_get_prefix( &This->node, prefix );
} }
static HRESULT WINAPI domattr_get_baseName( static HRESULT WINAPI domattr_get_baseName(
......
...@@ -508,10 +508,11 @@ static HRESULT WINAPI domcdata_get_namespaceURI( ...@@ -508,10 +508,11 @@ static HRESULT WINAPI domcdata_get_namespaceURI(
static HRESULT WINAPI domcdata_get_prefix( static HRESULT WINAPI domcdata_get_prefix(
IXMLDOMCDATASection *iface, IXMLDOMCDATASection *iface,
BSTR* p) BSTR* prefix)
{ {
domcdata *This = impl_from_IXMLDOMCDATASection( iface ); domcdata *This = impl_from_IXMLDOMCDATASection( iface );
return IXMLDOMNode_get_prefix( IXMLDOMNode_from_impl(&This->node), p ); TRACE("(%p)->(%p)\n", This, prefix);
return return_null_bstr( prefix );
} }
static HRESULT WINAPI domcdata_get_baseName( static HRESULT WINAPI domcdata_get_baseName(
......
...@@ -501,10 +501,11 @@ static HRESULT WINAPI domcomment_get_namespaceURI( ...@@ -501,10 +501,11 @@ static HRESULT WINAPI domcomment_get_namespaceURI(
static HRESULT WINAPI domcomment_get_prefix( static HRESULT WINAPI domcomment_get_prefix(
IXMLDOMComment *iface, IXMLDOMComment *iface,
BSTR* p) BSTR* prefix)
{ {
domcomment *This = impl_from_IXMLDOMComment( iface ); domcomment *This = impl_from_IXMLDOMComment( iface );
return IXMLDOMNode_get_prefix( IXMLDOMNode_from_impl(&This->node), p ); TRACE("(%p)->(%p)\n", This, prefix);
return return_null_bstr( prefix );
} }
static HRESULT WINAPI domcomment_get_baseName( static HRESULT WINAPI domcomment_get_baseName(
......
...@@ -505,10 +505,11 @@ static HRESULT WINAPI domfrag_get_namespaceURI( ...@@ -505,10 +505,11 @@ static HRESULT WINAPI domfrag_get_namespaceURI(
static HRESULT WINAPI domfrag_get_prefix( static HRESULT WINAPI domfrag_get_prefix(
IXMLDOMDocumentFragment *iface, IXMLDOMDocumentFragment *iface,
BSTR* p) BSTR* prefix)
{ {
domfrag *This = impl_from_IXMLDOMDocumentFragment( iface ); domfrag *This = impl_from_IXMLDOMDocumentFragment( iface );
return IXMLDOMNode_get_prefix( IXMLDOMNode_from_impl(&This->node), p ); TRACE("(%p)->(%p)\n", This, prefix);
return return_null_bstr( prefix );
} }
static HRESULT WINAPI domfrag_get_baseName( static HRESULT WINAPI domfrag_get_baseName(
......
...@@ -1331,10 +1331,11 @@ static HRESULT WINAPI domdoc_get_namespaceURI( ...@@ -1331,10 +1331,11 @@ static HRESULT WINAPI domdoc_get_namespaceURI(
static HRESULT WINAPI domdoc_get_prefix( static HRESULT WINAPI domdoc_get_prefix(
IXMLDOMDocument3 *iface, IXMLDOMDocument3 *iface,
BSTR* prefixString ) BSTR* prefix )
{ {
domdoc *This = impl_from_IXMLDOMDocument3( iface ); domdoc *This = impl_from_IXMLDOMDocument3( iface );
return IXMLDOMNode_get_prefix( IXMLDOMNode_from_impl(&This->node), prefixString ); TRACE("(%p)->(%p)\n", This, prefix);
return return_null_bstr( prefix );
} }
......
...@@ -553,10 +553,11 @@ static HRESULT WINAPI domelem_get_namespaceURI( ...@@ -553,10 +553,11 @@ static HRESULT WINAPI domelem_get_namespaceURI(
static HRESULT WINAPI domelem_get_prefix( static HRESULT WINAPI domelem_get_prefix(
IXMLDOMElement *iface, IXMLDOMElement *iface,
BSTR* p) BSTR* prefix)
{ {
domelem *This = impl_from_IXMLDOMElement( iface ); domelem *This = impl_from_IXMLDOMElement( iface );
return IXMLDOMNode_get_prefix( IXMLDOMNode_from_impl(&This->node), p ); TRACE("(%p)->(%p)\n", This, prefix);
return node_get_prefix( &This->node, prefix );
} }
static HRESULT WINAPI domelem_get_baseName( static HRESULT WINAPI domelem_get_baseName(
......
...@@ -499,10 +499,11 @@ static HRESULT WINAPI entityref_get_namespaceURI( ...@@ -499,10 +499,11 @@ static HRESULT WINAPI entityref_get_namespaceURI(
static HRESULT WINAPI entityref_get_prefix( static HRESULT WINAPI entityref_get_prefix(
IXMLDOMEntityReference *iface, IXMLDOMEntityReference *iface,
BSTR* p) BSTR* prefix)
{ {
entityref *This = impl_from_IXMLDOMEntityReference( iface ); entityref *This = impl_from_IXMLDOMEntityReference( iface );
return IXMLDOMNode_get_prefix( IXMLDOMNode_from_impl(&This->node), p ); TRACE("(%p)->(%p)\n", This, prefix);
return node_get_prefix( &This->node, prefix );
} }
static HRESULT WINAPI entityref_get_baseName( static HRESULT WINAPI entityref_get_baseName(
......
...@@ -193,6 +193,7 @@ extern HRESULT node_replace_child(xmlnode*,IXMLDOMNode*,IXMLDOMNode*,IXMLDOMNode ...@@ -193,6 +193,7 @@ extern HRESULT node_replace_child(xmlnode*,IXMLDOMNode*,IXMLDOMNode*,IXMLDOMNode
extern HRESULT node_put_text(xmlnode*,BSTR); extern HRESULT node_put_text(xmlnode*,BSTR);
extern HRESULT node_get_xml(xmlnode*,BOOL,BOOL,BSTR*); extern HRESULT node_get_xml(xmlnode*,BOOL,BOOL,BSTR*);
extern HRESULT node_clone(xmlnode*,VARIANT_BOOL,IXMLDOMNode**); extern HRESULT node_clone(xmlnode*,VARIANT_BOOL,IXMLDOMNode**);
extern HRESULT node_get_prefix(xmlnode*,BSTR*);
extern HRESULT DOMDocument_create_from_xmldoc(xmlDocPtr xmldoc, IXMLDOMDocument3 **document); extern HRESULT DOMDocument_create_from_xmldoc(xmlDocPtr xmldoc, IXMLDOMDocument3 **document);
...@@ -253,6 +254,15 @@ static inline HRESULT return_null_var(VARIANT *p) ...@@ -253,6 +254,15 @@ static inline HRESULT return_null_var(VARIANT *p)
return S_FALSE; return S_FALSE;
} }
static inline HRESULT return_null_bstr(BSTR *p)
{
if(!p)
return E_INVALIDARG;
*p = NULL;
return S_FALSE;
}
#endif #endif
extern void* libxslt_handle; extern void* libxslt_handle;
......
...@@ -1151,29 +1151,23 @@ static HRESULT WINAPI xmlnode_get_namespaceURI( ...@@ -1151,29 +1151,23 @@ static HRESULT WINAPI xmlnode_get_namespaceURI(
return *namespaceURI ? S_OK : S_FALSE; return *namespaceURI ? S_OK : S_FALSE;
} }
static HRESULT WINAPI xmlnode_get_prefix( HRESULT node_get_prefix(xmlnode *This, BSTR *prefix)
IXMLDOMNode *iface,
BSTR* prefixString)
{ {
xmlnode *This = impl_from_IXMLDOMNode( iface );
xmlNsPtr *ns; xmlNsPtr *ns;
TRACE("(%p)->(%p)\n", This, prefixString ); if (!prefix) return E_INVALIDARG;
if(!prefixString) *prefix = NULL;
return E_INVALIDARG;
*prefixString = NULL;
if ((ns = xmlGetNsList(This->node->doc, This->node))) if ((ns = xmlGetNsList(This->node->doc, This->node)))
{ {
if (ns[0]->prefix) *prefixString = bstr_from_xmlChar( ns[0]->prefix ); if (ns[0]->prefix) *prefix = bstr_from_xmlChar( ns[0]->prefix );
xmlFree(ns); xmlFree(ns);
} }
TRACE("prefix: %s\n", debugstr_w(*prefixString)); TRACE("prefix: %s\n", debugstr_w(*prefix));
return *prefixString ? S_OK : S_FALSE; return *prefix ? S_OK : S_FALSE;
} }
static HRESULT WINAPI xmlnode_get_baseName( static HRESULT WINAPI xmlnode_get_baseName(
...@@ -1264,7 +1258,7 @@ static const struct IXMLDOMNodeVtbl xmlnode_vtbl = ...@@ -1264,7 +1258,7 @@ static const struct IXMLDOMNodeVtbl xmlnode_vtbl =
xmlnode_selectSingleNode, xmlnode_selectSingleNode,
NULL, NULL,
xmlnode_get_namespaceURI, xmlnode_get_namespaceURI,
xmlnode_get_prefix, NULL,
xmlnode_get_baseName, xmlnode_get_baseName,
xmlnode_transformNodeToObject, xmlnode_transformNodeToObject,
}; };
......
...@@ -515,10 +515,11 @@ static HRESULT WINAPI dom_pi_get_namespaceURI( ...@@ -515,10 +515,11 @@ static HRESULT WINAPI dom_pi_get_namespaceURI(
static HRESULT WINAPI dom_pi_get_prefix( static HRESULT WINAPI dom_pi_get_prefix(
IXMLDOMProcessingInstruction *iface, IXMLDOMProcessingInstruction *iface,
BSTR* p) BSTR* prefix)
{ {
dom_pi *This = impl_from_IXMLDOMProcessingInstruction( iface ); dom_pi *This = impl_from_IXMLDOMProcessingInstruction( iface );
return IXMLDOMNode_get_prefix( IXMLDOMNode_from_impl(&This->node), p ); TRACE("(%p)->(%p)\n", This, prefix);
return return_null_bstr( prefix );
} }
static HRESULT WINAPI dom_pi_get_baseName( static HRESULT WINAPI dom_pi_get_baseName(
......
...@@ -7248,14 +7248,66 @@ static void test_createNode(void) ...@@ -7248,14 +7248,66 @@ static void test_createNode(void)
static void test_get_prefix(void) static void test_get_prefix(void)
{ {
IXMLDOMDocument *doc; IXMLDOMDocumentFragment *fragment;
IXMLDOMCDATASection *cdata;
IXMLDOMElement *element; IXMLDOMElement *element;
IXMLDOMComment *comment;
IXMLDOMDocument *doc;
HRESULT hr; HRESULT hr;
BSTR str; BSTR str;
doc = create_document(&IID_IXMLDOMDocument); doc = create_document(&IID_IXMLDOMDocument);
if (!doc) return; if (!doc) return;
/* nodes that can't support prefix */
/* 1. document */
str = (void*)0xdeadbeef;
hr = IXMLDOMDocument_get_prefix(doc, &str);
ok( hr == S_FALSE, "got 0x%08x\n", hr);
ok( str == 0, "got %p\n", str);
hr = IXMLDOMDocument_get_prefix(doc, NULL);
ok( hr == E_INVALIDARG, "got 0x%08x\n", hr);
/* 2. cdata */
hr = IXMLDOMDocument_createCDATASection(doc, NULL, &cdata);
ok(hr == S_OK, "got %08x\n", hr );
str = (void*)0xdeadbeef;
hr = IXMLDOMCDATASection_get_prefix(cdata, &str);
ok(hr == S_FALSE, "got %08x\n", hr);
ok( str == 0, "got %p\n", str);
hr = IXMLDOMCDATASection_get_prefix(cdata, NULL);
ok(hr == E_INVALIDARG, "got %08x\n", hr);
IXMLDOMCDATASection_Release(cdata);
/* 3. comment */
hr = IXMLDOMDocument_createComment(doc, NULL, &comment);
ok(hr == S_OK, "got %08x\n", hr );
str = (void*)0xdeadbeef;
hr = IXMLDOMComment_get_prefix(comment, &str);
ok(hr == S_FALSE, "got %08x\n", hr);
ok( str == 0, "got %p\n", str);
hr = IXMLDOMComment_get_prefix(comment, NULL);
ok(hr == E_INVALIDARG, "got %08x\n", hr);
IXMLDOMComment_Release(comment);
/* 4. fragment */
hr = IXMLDOMDocument_createDocumentFragment(doc, &fragment);
ok(hr == S_OK, "got %08x\n", hr );
str = (void*)0xdeadbeef;
hr = IXMLDOMDocumentFragment_get_prefix(fragment, &str);
ok(hr == S_FALSE, "got %08x\n", hr);
ok( str == 0, "got %p\n", str);
hr = IXMLDOMDocumentFragment_get_prefix(fragment, NULL);
ok(hr == E_INVALIDARG, "got %08x\n", hr);
IXMLDOMDocumentFragment_Release(fragment);
/* no prefix */ /* no prefix */
hr = IXMLDOMDocument_createElement(doc, _bstr_("elem"), &element); hr = IXMLDOMDocument_createElement(doc, _bstr_("elem"), &element);
ok( hr == S_OK, "got 0x%08x\n", hr); ok( hr == S_OK, "got 0x%08x\n", hr);
......
...@@ -514,10 +514,11 @@ static HRESULT WINAPI domtext_get_namespaceURI( ...@@ -514,10 +514,11 @@ static HRESULT WINAPI domtext_get_namespaceURI(
static HRESULT WINAPI domtext_get_prefix( static HRESULT WINAPI domtext_get_prefix(
IXMLDOMText *iface, IXMLDOMText *iface,
BSTR* p) BSTR* prefix)
{ {
domtext *This = impl_from_IXMLDOMText( iface ); domtext *This = impl_from_IXMLDOMText( iface );
return IXMLDOMNode_get_prefix( IXMLDOMNode_from_impl(&This->node), p ); TRACE("(%p)->(%p)\n", This, prefix);
return return_null_bstr( prefix );
} }
static HRESULT WINAPI domtext_get_baseName( static HRESULT WINAPI domtext_get_baseName(
......
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