Commit c2b2e1ea authored by Jacek Caban's avatar Jacek Caban Committed by Alexandre Julliard

msxml3: Get rid of not used aggregation support in domelement.

parent 80f02b82
......@@ -1043,7 +1043,7 @@ static HRESULT WINAPI domdoc_createElement(
xmldoc_add_orphan(xmlnode->doc, xmlnode);
TRACE("created xmlptr %p\n", xmlnode);
elem_unk = create_element(xmlnode, NULL);
elem_unk = create_element(xmlnode);
HeapFree(GetProcessHeap(), 0, xml_name);
hr = IUnknown_QueryInterface(elem_unk, &IID_IXMLDOMElement, (void **)element);
......
......@@ -41,8 +41,6 @@ WINE_DEFAULT_DEBUG_CHANNEL(msxml);
typedef struct _domelem
{
const struct IXMLDOMElementVtbl *lpVtbl;
const struct IUnknownVtbl *lpInternalUnkVtbl;
IUnknown *pUnkOuter;
LONG ref;
xmlnode *node;
} domelem;
......@@ -52,11 +50,6 @@ static inline domelem *impl_from_IXMLDOMElement( IXMLDOMElement *iface )
return (domelem *)((char*)iface - FIELD_OFFSET(domelem, lpVtbl));
}
static inline domelem *impl_from_InternalUnknown( IUnknown *iface )
{
return (domelem *)((char*)iface - FIELD_OFFSET(domelem, lpInternalUnkVtbl));
}
static inline xmlNodePtr get_element( domelem *This )
{
return This->node->node;
......@@ -68,23 +61,54 @@ static HRESULT WINAPI domelem_QueryInterface(
void** ppvObject )
{
domelem *This = impl_from_IXMLDOMElement( iface );
TRACE("%p %s %p\n", This, debugstr_guid(riid), ppvObject);
return IUnknown_QueryInterface(This->pUnkOuter, riid, ppvObject);
if ( IsEqualGUID( riid, &IID_IXMLDOMElement ) ||
IsEqualGUID( riid, &IID_IDispatch ) ||
IsEqualGUID( riid, &IID_IUnknown ) )
{
*ppvObject = &This->lpVtbl;
}
else if ( IsEqualGUID( riid, &IID_IXMLDOMNode ) )
{
*ppvObject = IXMLDOMNode_from_impl(This->node);
}
else
{
FIXME("interface %s not implemented\n", debugstr_guid(riid));
return E_NOINTERFACE;
}
IUnknown_AddRef( (IUnknown*)*ppvObject );
return S_OK;
}
static ULONG WINAPI domelem_AddRef(
IXMLDOMElement *iface )
{
domelem *This = impl_from_IXMLDOMElement( iface );
return IUnknown_AddRef(This->pUnkOuter);
LONG ref = InterlockedIncrement(&This->ref);
TRACE("(%p) ref=%d\n", This, ref);
return ref;
}
static ULONG WINAPI domelem_Release(
IXMLDOMElement *iface )
{
domelem *This = impl_from_IXMLDOMElement( iface );
return IUnknown_Release(This->pUnkOuter);
ULONG ref = InterlockedDecrement(&This->ref);
TRACE("(%p) ref=%d\n", This, ref);
if(!ref) {
IXMLDOMNode_Release(IXMLDOMNode_from_impl(This->node));
heap_free(This);
}
return ref;
}
static HRESULT WINAPI domelem_GetTypeInfoCount(
......@@ -727,66 +751,7 @@ static const struct IXMLDOMElementVtbl domelem_vtbl =
domelem_normalize,
};
static HRESULT WINAPI Internal_QueryInterface(
IUnknown *iface,
REFIID riid,
void** ppvObject )
{
domelem *This = impl_from_InternalUnknown( iface );
TRACE("%p %s %p\n", This, debugstr_guid(riid), ppvObject);
if ( IsEqualGUID( riid, &IID_IXMLDOMElement ) ||
IsEqualGUID( riid, &IID_IDispatch ) ||
IsEqualGUID( riid, &IID_IUnknown ) )
{
*ppvObject = &This->lpVtbl;
}
else if ( IsEqualGUID( riid, &IID_IXMLDOMNode ) )
{
*ppvObject = IXMLDOMNode_from_impl(This->node);
}
else
{
FIXME("interface %s not implemented\n", debugstr_guid(riid));
return E_NOINTERFACE;
}
IUnknown_AddRef( (IUnknown*)*ppvObject );
return S_OK;
}
static ULONG WINAPI Internal_AddRef(
IUnknown *iface )
{
domelem *This = impl_from_InternalUnknown( iface );
return InterlockedIncrement( &This->ref );
}
static ULONG WINAPI Internal_Release(
IUnknown *iface )
{
domelem *This = impl_from_InternalUnknown( iface );
ULONG ref;
ref = InterlockedDecrement( &This->ref );
if ( ref == 0 )
{
IXMLDOMNode_Release( IXMLDOMNode_from_impl(This->node) );
HeapFree( GetProcessHeap(), 0, This );
}
return ref;
}
static const struct IUnknownVtbl internal_unk_vtbl =
{
Internal_QueryInterface,
Internal_AddRef,
Internal_Release
};
IUnknown* create_element( xmlNodePtr element, IUnknown *pUnkOuter )
IUnknown* create_element( xmlNodePtr element )
{
domelem *This;
......@@ -796,12 +761,6 @@ IUnknown* create_element( xmlNodePtr element, IUnknown *pUnkOuter )
This->lpVtbl = &domelem_vtbl;
This->ref = 1;
This->lpInternalUnkVtbl = &internal_unk_vtbl;
if(pUnkOuter)
This->pUnkOuter = pUnkOuter; /* Don't take a ref on outer Unknown */
else
This->pUnkOuter = (IUnknown *)&This->lpInternalUnkVtbl;
This->node = create_basic_node( element, (IUnknown*)&This->lpVtbl );
if(!This->node)
......@@ -810,7 +769,7 @@ IUnknown* create_element( xmlNodePtr element, IUnknown *pUnkOuter )
return NULL;
}
return (IUnknown*) &This->lpInternalUnkVtbl;
return (IUnknown*) &This->lpVtbl;
}
#endif
......@@ -39,7 +39,7 @@
extern IUnknown *create_domdoc( xmlNodePtr document );
extern IUnknown *create_xmldoc( void );
extern IXMLDOMNode *create_node( xmlNodePtr node );
extern IUnknown *create_element( xmlNodePtr element, IUnknown *pUnkOuter );
extern IUnknown *create_element( xmlNodePtr element );
extern IUnknown *create_attribute( xmlNodePtr attribute );
extern IUnknown *create_text( xmlNodePtr text );
extern IUnknown *create_pi( xmlNodePtr pi );
......
......@@ -1580,7 +1580,7 @@ IXMLDOMNode *create_node( xmlNodePtr node )
switch(node->type)
{
case XML_ELEMENT_NODE:
pUnk = create_element( node, NULL );
pUnk = create_element( node );
break;
case XML_ATTRIBUTE_NODE:
pUnk = create_attribute( node );
......
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