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

This commit is contained in:
Nikolay Sivov 2010-10-31 12:22:53 +03:00 committed by Alexandre Julliard
parent 936d4cf911
commit 6556ad57f3
12 changed files with 97 additions and 32 deletions

View File

@ -497,10 +497,11 @@ static HRESULT WINAPI domattr_get_namespaceURI(
static HRESULT WINAPI domattr_get_prefix(
IXMLDOMAttribute *iface,
BSTR* p)
BSTR* prefix)
{
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(

View File

@ -508,10 +508,11 @@ static HRESULT WINAPI domcdata_get_namespaceURI(
static HRESULT WINAPI domcdata_get_prefix(
IXMLDOMCDATASection *iface,
BSTR* p)
BSTR* prefix)
{
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(

View File

@ -501,10 +501,11 @@ static HRESULT WINAPI domcomment_get_namespaceURI(
static HRESULT WINAPI domcomment_get_prefix(
IXMLDOMComment *iface,
BSTR* p)
BSTR* prefix)
{
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(

View File

@ -505,10 +505,11 @@ static HRESULT WINAPI domfrag_get_namespaceURI(
static HRESULT WINAPI domfrag_get_prefix(
IXMLDOMDocumentFragment *iface,
BSTR* p)
BSTR* prefix)
{
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(

View File

@ -1331,10 +1331,11 @@ static HRESULT WINAPI domdoc_get_namespaceURI(
static HRESULT WINAPI domdoc_get_prefix(
IXMLDOMDocument3 *iface,
BSTR* prefixString )
BSTR* prefix )
{
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 );
}

View File

@ -553,10 +553,11 @@ static HRESULT WINAPI domelem_get_namespaceURI(
static HRESULT WINAPI domelem_get_prefix(
IXMLDOMElement *iface,
BSTR* p)
BSTR* prefix)
{
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(

View File

@ -499,10 +499,11 @@ static HRESULT WINAPI entityref_get_namespaceURI(
static HRESULT WINAPI entityref_get_prefix(
IXMLDOMEntityReference *iface,
BSTR* p)
BSTR* prefix)
{
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(

View File

@ -193,6 +193,7 @@ extern HRESULT node_replace_child(xmlnode*,IXMLDOMNode*,IXMLDOMNode*,IXMLDOMNode
extern HRESULT node_put_text(xmlnode*,BSTR);
extern HRESULT node_get_xml(xmlnode*,BOOL,BOOL,BSTR*);
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);
@ -253,6 +254,15 @@ static inline HRESULT return_null_var(VARIANT *p)
return S_FALSE;
}
static inline HRESULT return_null_bstr(BSTR *p)
{
if(!p)
return E_INVALIDARG;
*p = NULL;
return S_FALSE;
}
#endif
extern void* libxslt_handle;

View File

@ -1151,29 +1151,23 @@ static HRESULT WINAPI xmlnode_get_namespaceURI(
return *namespaceURI ? S_OK : S_FALSE;
}
static HRESULT WINAPI xmlnode_get_prefix(
IXMLDOMNode *iface,
BSTR* prefixString)
HRESULT node_get_prefix(xmlnode *This, BSTR *prefix)
{
xmlnode *This = impl_from_IXMLDOMNode( iface );
xmlNsPtr *ns;
TRACE("(%p)->(%p)\n", This, prefixString );
if (!prefix) return E_INVALIDARG;
if(!prefixString)
return E_INVALIDARG;
*prefixString = NULL;
*prefix = NULL;
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);
}
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(
@ -1264,7 +1258,7 @@ static const struct IXMLDOMNodeVtbl xmlnode_vtbl =
xmlnode_selectSingleNode,
NULL,
xmlnode_get_namespaceURI,
xmlnode_get_prefix,
NULL,
xmlnode_get_baseName,
xmlnode_transformNodeToObject,
};

View File

@ -515,10 +515,11 @@ static HRESULT WINAPI dom_pi_get_namespaceURI(
static HRESULT WINAPI dom_pi_get_prefix(
IXMLDOMProcessingInstruction *iface,
BSTR* p)
BSTR* prefix)
{
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(

View File

@ -7248,14 +7248,66 @@ static void test_createNode(void)
static void test_get_prefix(void)
{
IXMLDOMDocument *doc;
IXMLDOMDocumentFragment *fragment;
IXMLDOMCDATASection *cdata;
IXMLDOMElement *element;
IXMLDOMComment *comment;
IXMLDOMDocument *doc;
HRESULT hr;
BSTR str;
doc = create_document(&IID_IXMLDOMDocument);
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 */
hr = IXMLDOMDocument_createElement(doc, _bstr_("elem"), &element);
ok( hr == S_OK, "got 0x%08x\n", hr);

View File

@ -514,10 +514,11 @@ static HRESULT WINAPI domtext_get_namespaceURI(
static HRESULT WINAPI domtext_get_prefix(
IXMLDOMText *iface,
BSTR* p)
BSTR* prefix)
{
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(