From 27b4f11c0bb9f0b9d9023259ca6a2f9852a2d033 Mon Sep 17 00:00:00 2001 From: Jacek Caban Date: Sat, 4 Sep 2010 17:56:08 +0200 Subject: [PATCH] msxml3: Use xmlnode child object's IXMLDOMNode implementation as base interface. The plan is to get rid of IXMLDOMNode interface in xmlnode object and use proper inheritance. --- dlls/msxml3/attribute.c | 5 +- dlls/msxml3/cdata.c | 10 ++-- dlls/msxml3/comment.c | 7 +-- dlls/msxml3/docfrag.c | 5 +- dlls/msxml3/domdoc.c | 11 ++--- dlls/msxml3/element.c | 5 +- dlls/msxml3/entityref.c | 5 +- dlls/msxml3/node.c | 100 ++++++++-------------------------------- dlls/msxml3/pi.c | 10 ++-- dlls/msxml3/text.c | 8 +--- 10 files changed, 38 insertions(+), 128 deletions(-) diff --git a/dlls/msxml3/attribute.c b/dlls/msxml3/attribute.c index 3554859208d..a004981d6c3 100644 --- a/dlls/msxml3/attribute.c +++ b/dlls/msxml3/attribute.c @@ -58,15 +58,12 @@ static HRESULT WINAPI domattr_QueryInterface( TRACE("(%p)->(%s %p)\n", This, debugstr_guid(riid), ppvObject); if ( IsEqualGUID( riid, &IID_IXMLDOMAttribute ) || + IsEqualGUID( riid, &IID_IXMLDOMNode ) || IsEqualGUID( riid, &IID_IDispatch ) || IsEqualGUID( riid, &IID_IUnknown ) ) { *ppvObject = iface; } - else if ( IsEqualGUID( riid, &IID_IXMLDOMNode ) ) - { - *ppvObject = IXMLDOMNode_from_impl(&This->node); - } else if(node_query_interface(&This->node, riid, ppvObject)) { return *ppvObject ? S_OK : E_NOINTERFACE; diff --git a/dlls/msxml3/cdata.c b/dlls/msxml3/cdata.c index e37829517e0..6baacc81e7b 100644 --- a/dlls/msxml3/cdata.c +++ b/dlls/msxml3/cdata.c @@ -59,15 +59,12 @@ static HRESULT WINAPI domcdata_QueryInterface( if ( IsEqualGUID( riid, &IID_IXMLDOMCDATASection ) || IsEqualGUID( riid, &IID_IXMLDOMCharacterData) || + IsEqualGUID( riid, &IID_IXMLDOMNode ) || IsEqualGUID( riid, &IID_IDispatch ) || IsEqualGUID( riid, &IID_IUnknown ) ) { *ppvObject = iface; } - else if ( IsEqualGUID( riid, &IID_IXMLDOMNode ) ) - { - *ppvObject = IXMLDOMNode_from_impl(&This->node); - } else if ( IsEqualGUID( riid, &IID_IXMLDOMText ) || IsEqualGUID( riid, &IID_IXMLDOMElement ) ) { @@ -483,14 +480,13 @@ static HRESULT WINAPI domcdata_get_data( IXMLDOMCDATASection *iface, BSTR *p) { - domcdata *This = impl_from_IXMLDOMCDATASection( iface ); HRESULT hr; VARIANT vRet; if(!p) return E_INVALIDARG; - hr = IXMLDOMNode_get_nodeValue( IXMLDOMNode_from_impl(&This->node), &vRet ); + hr = IXMLDOMCDATASection_get_nodeValue( iface, &vRet ); if(hr == S_OK) { *p = V_BSTR(&vRet); @@ -511,7 +507,7 @@ static HRESULT WINAPI domcdata_put_data( V_VT(&val) = VT_BSTR; V_BSTR(&val) = data; - return IXMLDOMNode_put_nodeValue( IXMLDOMNode_from_impl(&This->node), val ); + return IXMLDOMCDATASection_put_nodeValue( iface, val ); } static HRESULT WINAPI domcdata_get_length( diff --git a/dlls/msxml3/comment.c b/dlls/msxml3/comment.c index f496625735b..68fa9b8a149 100644 --- a/dlls/msxml3/comment.c +++ b/dlls/msxml3/comment.c @@ -59,15 +59,12 @@ static HRESULT WINAPI domcomment_QueryInterface( if ( IsEqualGUID( riid, &IID_IXMLDOMComment ) || IsEqualGUID( riid, &IID_IXMLDOMCharacterData) || + IsEqualGUID( riid, &IID_IXMLDOMNode ) || IsEqualGUID( riid, &IID_IDispatch ) || IsEqualGUID( riid, &IID_IUnknown ) ) { *ppvObject = iface; } - else if ( IsEqualGUID( riid, &IID_IXMLDOMNode ) ) - { - *ppvObject = IXMLDOMNode_from_impl(&This->node); - } else if(node_query_interface(&This->node, riid, ppvObject)) { return *ppvObject ? S_OK : E_NOINTERFACE; @@ -486,7 +483,7 @@ static HRESULT WINAPI domcomment_get_data( if(!p) return E_INVALIDARG; - hr = IXMLDOMNode_get_nodeValue( IXMLDOMNode_from_impl(&This->node), &vRet ); + hr = IXMLDOMComment_get_nodeValue( iface, &vRet ); if(hr == S_OK) { *p = V_BSTR(&vRet); diff --git a/dlls/msxml3/docfrag.c b/dlls/msxml3/docfrag.c index b013deb4c21..df6676e585f 100644 --- a/dlls/msxml3/docfrag.c +++ b/dlls/msxml3/docfrag.c @@ -58,15 +58,12 @@ static HRESULT WINAPI domfrag_QueryInterface( TRACE("(%p)->(%s %p)\n", This, debugstr_guid(riid), ppvObject); if ( IsEqualGUID( riid, &IID_IXMLDOMDocumentFragment ) || + IsEqualGUID( riid, &IID_IXMLDOMNode ) || IsEqualGUID( riid, &IID_IDispatch ) || IsEqualGUID( riid, &IID_IUnknown ) ) { *ppvObject = iface; } - else if ( IsEqualGUID( riid, &IID_IXMLDOMNode ) ) - { - *ppvObject = IXMLDOMNode_from_impl(&This->node); - } else if(node_query_interface(&This->node, riid, ppvObject)) { return *ppvObject ? S_OK : E_NOINTERFACE; diff --git a/dlls/msxml3/domdoc.c b/dlls/msxml3/domdoc.c index 5360d06a517..b1228803062 100644 --- a/dlls/msxml3/domdoc.c +++ b/dlls/msxml3/domdoc.c @@ -425,7 +425,7 @@ static HRESULT WINAPI domdoc_IPersistStreamInit_Save( TRACE("(%p)->(%p %d)\n", This, stream, clr_dirty); - hr = IXMLDOMNode_get_xml( IXMLDOMNode_from_impl(&This->node), &xmlString ); + hr = IXMLDOMDocument3_get_xml( (IXMLDOMDocument3*)&This->lpVtbl, &xmlString ); if(hr == S_OK) { DWORD len = SysStringLen(xmlString) * sizeof(WCHAR); @@ -518,16 +518,13 @@ static HRESULT WINAPI domdoc_QueryInterface( IXMLDOMDocument3 *iface, REFIID rii if ( IsEqualGUID( riid, &IID_IUnknown ) || IsEqualGUID( riid, &IID_IDispatch ) || + IsEqualGUID( riid, &IID_IXMLDOMNode ) || IsEqualGUID( riid, &IID_IXMLDOMDocument ) || IsEqualGUID( riid, &IID_IXMLDOMDocument2 )|| IsEqualGUID( riid, &IID_IXMLDOMDocument3 )) { *ppvObject = iface; } - else if ( IsEqualGUID( riid, &IID_IXMLDOMNode ) ) - { - *ppvObject = IXMLDOMNode_from_impl(&This->node); - } else if (IsEqualGUID(&IID_IPersistStream, riid) || IsEqualGUID(&IID_IPersistStreamInit, riid)) { @@ -1284,12 +1281,14 @@ static HRESULT WINAPI domdoc_createProcessingInstruction( if (hr == S_OK) { VARIANT v_data; + xmlnode *node_obj; /* this is to bypass check in ::put_data() that blocks "(%s %p)\n", This, debugstr_guid(riid), ppvObject); if ( IsEqualGUID( riid, &IID_IXMLDOMElement ) || + IsEqualGUID( riid, &IID_IXMLDOMNode ) || IsEqualGUID( riid, &IID_IDispatch ) || IsEqualGUID( riid, &IID_IUnknown ) ) { *ppvObject = &This->lpVtbl; } - else if ( IsEqualGUID( riid, &IID_IXMLDOMNode ) ) - { - *ppvObject = IXMLDOMNode_from_impl(&This->node); - } else if(node_query_interface(&This->node, riid, ppvObject)) { return *ppvObject ? S_OK : E_NOINTERFACE; diff --git a/dlls/msxml3/entityref.c b/dlls/msxml3/entityref.c index 396db9b0038..63c962b6e92 100644 --- a/dlls/msxml3/entityref.c +++ b/dlls/msxml3/entityref.c @@ -58,15 +58,12 @@ static HRESULT WINAPI entityref_QueryInterface( TRACE("(%p)->(%s %p)\n", This, debugstr_guid(riid), ppvObject); if ( IsEqualGUID( riid, &IID_IXMLDOMEntityReference ) || + IsEqualGUID( riid, &IID_IXMLDOMNode ) || IsEqualGUID( riid, &IID_IDispatch ) || IsEqualGUID( riid, &IID_IUnknown ) ) { *ppvObject = iface; } - else if ( IsEqualGUID( riid, &IID_IXMLDOMNode ) ) - { - *ppvObject = IXMLDOMNode_from_impl(&This->node); - } else if(node_query_interface(&This->node, riid, ppvObject)) { return *ppvObject ? S_OK : E_NOINTERFACE; diff --git a/dlls/msxml3/node.c b/dlls/msxml3/node.c index a7d2ddf4190..6143f13cfbe 100644 --- a/dlls/msxml3/node.c +++ b/dlls/msxml3/node.c @@ -115,55 +115,30 @@ static HRESULT WINAPI xmlnode_QueryInterface( REFIID riid, void** ppvObject ) { - xmlnode *This = impl_from_IXMLDOMNode( iface ); - - TRACE("(%p)->(%s %p)\n", This, debugstr_guid(riid), ppvObject); - - if(This->iface) - return IXMLDOMNode_QueryInterface(This->iface, riid, ppvObject); - - if (IsEqualGUID(riid, &IID_IUnknown)) { - *ppvObject = iface; - }else if (IsEqualGUID( riid, &IID_IDispatch) || - IsEqualGUID( riid, &IID_IXMLDOMNode)) { - *ppvObject = &This->lpVtbl; - }else if(node_query_interface(This, riid, ppvObject)) { - return *ppvObject ? S_OK : E_NOINTERFACE; - }else { - FIXME("interface %s not implemented\n", debugstr_guid(riid)); - *ppvObject = NULL; - return E_NOINTERFACE; - } - - IUnknown_AddRef( (IUnknown*)*ppvObject ); - return S_OK; + ERR("Should not be called\n"); + return E_NOINTERFACE; } static ULONG WINAPI xmlnode_AddRef( IXMLDOMNode *iface ) { - xmlnode *This = impl_from_IXMLDOMNode( iface ); - return IXMLDOMNode_AddRef(This->iface); + ERR("Should not be called\n"); + return 2; } static ULONG WINAPI xmlnode_Release( IXMLDOMNode *iface ) { - xmlnode *This = impl_from_IXMLDOMNode( iface ); - return IXMLDOMNode_Release(This->iface); + ERR("Should not be called\n"); + return 1; } static HRESULT WINAPI xmlnode_GetTypeInfoCount( IXMLDOMNode *iface, UINT* pctinfo ) { - xmlnode *This = impl_from_IXMLDOMNode( iface ); - - TRACE("(%p)->(%p)\n", This, pctinfo); - - *pctinfo = 1; - - return S_OK; + ERR("Should not be called\n"); + return E_NOTIMPL; } static HRESULT WINAPI xmlnode_GetTypeInfo( @@ -172,14 +147,8 @@ static HRESULT WINAPI xmlnode_GetTypeInfo( LCID lcid, ITypeInfo** ppTInfo ) { - xmlnode *This = impl_from_IXMLDOMNode( iface ); - HRESULT hr; - - TRACE("(%p)->(%u %u %p)\n", This, iTInfo, lcid, ppTInfo); - - hr = get_typeinfo(IXMLDOMNode_tid, ppTInfo); - - return hr; + ERR("Should not be called\n"); + return E_NOTIMPL; } static HRESULT WINAPI xmlnode_GetIDsOfNames( @@ -190,25 +159,8 @@ static HRESULT WINAPI xmlnode_GetIDsOfNames( LCID lcid, DISPID* rgDispId ) { - xmlnode *This = impl_from_IXMLDOMNode( iface ); - - ITypeInfo *typeinfo; - HRESULT hr; - - TRACE("(%p)->(%s %p %u %u %p)\n", This, debugstr_guid(riid), rgszNames, cNames, - lcid, rgDispId); - - if(!rgszNames || cNames == 0 || !rgDispId) - return E_INVALIDARG; - - hr = get_typeinfo(IXMLDOMNode_tid, &typeinfo); - if(SUCCEEDED(hr)) - { - hr = ITypeInfo_GetIDsOfNames(typeinfo, rgszNames, cNames, rgDispId); - ITypeInfo_Release(typeinfo); - } - - return hr; + ERR("Should not be called\n"); + return E_NOTIMPL; } static HRESULT WINAPI xmlnode_Invoke( @@ -222,22 +174,8 @@ static HRESULT WINAPI xmlnode_Invoke( EXCEPINFO* pExcepInfo, UINT* puArgErr ) { - xmlnode *This = impl_from_IXMLDOMNode( iface ); - ITypeInfo *typeinfo; - HRESULT hr; - - TRACE("(%p)->(%d %s %d %d %p %p %p %p)\n", This, dispIdMember, debugstr_guid(riid), - lcid, wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr); - - hr = get_typeinfo(IXMLDOMNode_tid, &typeinfo); - if(SUCCEEDED(hr)) - { - hr = ITypeInfo_Invoke(typeinfo, &(This->lpVtbl), dispIdMember, wFlags, pDispParams, - pVarResult, pExcepInfo, puArgErr); - ITypeInfo_Release(typeinfo); - } - - return hr; + ERR("Should not be called\n"); + return E_NOTIMPL; } static HRESULT WINAPI xmlnode_get_nodeName( @@ -556,7 +494,7 @@ static HRESULT WINAPI xmlnode_get_attributes( *attributeMap = NULL; return S_FALSE; default: - *attributeMap = create_nodemap( iface ); + *attributeMap = create_nodemap( This->iface ); return S_OK; } } @@ -764,7 +702,7 @@ static HRESULT WINAPI xmlnode_appendChild( } VariantInit(&var); - return IXMLDOMNode_insertBefore(iface, newChild, var, outNewChild); + return IXMLDOMNode_insertBefore(This->iface, newChild, var, outNewChild); } static HRESULT WINAPI xmlnode_hasChildNodes( @@ -1176,10 +1114,10 @@ static HRESULT WINAPI xmlnode_get_nodeTypedValue( if(This->node->type == XML_ELEMENT_NODE || This->node->type == XML_TEXT_NODE || This->node->type == XML_ENTITY_REF_NODE) - hres = IXMLDOMNode_get_dataType(iface, &type); + hres = IXMLDOMNode_get_dataType(This->iface, &type); if(hres != S_OK && This->node->type != XML_ELEMENT_NODE) - return IXMLDOMNode_get_nodeValue(iface, typedValue); + return IXMLDOMNode_get_nodeValue(This->iface, typedValue); content = xmlNodeGetContent(This->node); hres = VARIANT_from_xmlChar(content, typedValue, @@ -1566,7 +1504,7 @@ static HRESULT WINAPI xmlnode_selectSingleNode( TRACE("(%p)->(%s %p)\n", This, debugstr_w(queryString), resultNode ); *resultNode = NULL; - r = IXMLDOMNode_selectNodes(iface, queryString, &list); + r = IXMLDOMNode_selectNodes(This->iface, queryString, &list); if(r == S_OK) { r = IXMLDOMNodeList_nextNode(list, resultNode); diff --git a/dlls/msxml3/pi.c b/dlls/msxml3/pi.c index 0b2a7e72a20..c86fd4673b0 100644 --- a/dlls/msxml3/pi.c +++ b/dlls/msxml3/pi.c @@ -58,15 +58,12 @@ static HRESULT WINAPI dom_pi_QueryInterface( TRACE("(%p)->(%s %p)\n", This, debugstr_guid(riid), ppvObject); if ( IsEqualGUID( riid, &IID_IXMLDOMProcessingInstruction ) || + IsEqualGUID( riid, &IID_IXMLDOMNode ) || IsEqualGUID( riid, &IID_IDispatch ) || IsEqualGUID( riid, &IID_IUnknown ) ) { *ppvObject = iface; } - else if ( IsEqualGUID( riid, &IID_IXMLDOMNode ) ) - { - *ppvObject = IXMLDOMNode_from_impl(&This->node); - } else if(node_query_interface(&This->node, riid, ppvObject)) { return *ppvObject ? S_OK : E_NOINTERFACE; @@ -504,14 +501,13 @@ static HRESULT WINAPI dom_pi_get_data( IXMLDOMProcessingInstruction *iface, BSTR *p) { - dom_pi *This = impl_from_IXMLDOMProcessingInstruction( iface ); HRESULT hr = E_FAIL; VARIANT vRet; if(!p) return E_INVALIDARG; - hr = IXMLDOMNode_get_nodeValue( IXMLDOMNode_from_impl(&This->node), &vRet ); + hr = IXMLDOMProcessingInstruction_get_nodeValue( iface, &vRet ); if(hr == S_OK) { *p = V_BSTR(&vRet); @@ -548,7 +544,7 @@ static HRESULT WINAPI dom_pi_put_data( V_VT(&val) = VT_BSTR; V_BSTR(&val) = data; - hr = IXMLDOMNode_put_nodeValue( IXMLDOMNode_from_impl(&This->node), val ); + hr = IXMLDOMProcessingInstruction_put_nodeValue( iface, val ); return hr; } diff --git a/dlls/msxml3/text.c b/dlls/msxml3/text.c index 0ae5aa6f078..b131be1c51f 100644 --- a/dlls/msxml3/text.c +++ b/dlls/msxml3/text.c @@ -60,15 +60,12 @@ static HRESULT WINAPI domtext_QueryInterface( if ( IsEqualGUID( riid, &IID_IXMLDOMText ) || IsEqualGUID( riid, &IID_IXMLDOMCharacterData) || + IsEqualGUID( riid, &IID_IXMLDOMNode ) || IsEqualGUID( riid, &IID_IDispatch ) || IsEqualGUID( riid, &IID_IUnknown ) ) { *ppvObject = iface; } - else if ( IsEqualGUID( riid, &IID_IXMLDOMNode ) ) - { - *ppvObject = IXMLDOMNode_from_impl(&This->node); - } else if(node_query_interface(&This->node, riid, ppvObject)) { return *ppvObject ? S_OK : E_NOINTERFACE; @@ -485,14 +482,13 @@ static HRESULT WINAPI domtext_get_data( IXMLDOMText *iface, BSTR *p) { - domtext *This = impl_from_IXMLDOMText( iface ); HRESULT hr; VARIANT vRet; if(!p) return E_INVALIDARG; - hr = IXMLDOMNode_get_nodeValue( IXMLDOMNode_from_impl(&This->node), &vRet ); + hr = IXMLDOMNode_get_nodeValue( iface, &vRet ); if(hr == S_OK) { *p = V_BSTR(&vRet);