[PATCH 4/9] mshtml: COM cleanup for the IHTMLOptionElement* ifaces.
Michael Stefaniuc
mstefani at redhat.de
Sun Jan 2 18:04:25 CST 2011
---
dlls/mshtml/htmloption.c | 86 +++++++++++++++++++++---------------------
dlls/mshtml/htmlwindow.c | 4 +-
dlls/mshtml/mshtml_private.h | 3 +-
3 files changed, 46 insertions(+), 47 deletions(-)
diff --git a/dlls/mshtml/htmloption.c b/dlls/mshtml/htmloption.c
index d61af83..9137765 100644
--- a/dlls/mshtml/htmloption.c
+++ b/dlls/mshtml/htmloption.c
@@ -34,47 +34,48 @@ WINE_DEFAULT_DEBUG_CHANNEL(mshtml);
struct HTMLOptionElement {
HTMLElement element;
- const IHTMLOptionElementVtbl *lpHTMLOptionElementVtbl;
+ IHTMLOptionElement IHTMLOptionElement_iface;
nsIDOMHTMLOptionElement *nsoption;
};
-#define HTMLOPTION(x) (&(x)->lpHTMLOptionElementVtbl)
-
-#define HTMLOPTION_THIS(iface) DEFINE_THIS(HTMLOptionElement, HTMLOptionElement, iface)
+static inline HTMLOptionElement *impl_from_IHTMLOptionElement(IHTMLOptionElement *iface)
+{
+ return CONTAINING_RECORD(iface, HTMLOptionElement, IHTMLOptionElement_iface);
+}
static HRESULT WINAPI HTMLOptionElement_QueryInterface(IHTMLOptionElement *iface,
REFIID riid, void **ppv)
{
- HTMLOptionElement *This = HTMLOPTION_THIS(iface);
+ HTMLOptionElement *This = impl_from_IHTMLOptionElement(iface);
return IHTMLDOMNode_QueryInterface(&This->element.node.IHTMLDOMNode_iface, riid, ppv);
}
static ULONG WINAPI HTMLOptionElement_AddRef(IHTMLOptionElement *iface)
{
- HTMLOptionElement *This = HTMLOPTION_THIS(iface);
+ HTMLOptionElement *This = impl_from_IHTMLOptionElement(iface);
return IHTMLDOMNode_AddRef(&This->element.node.IHTMLDOMNode_iface);
}
static ULONG WINAPI HTMLOptionElement_Release(IHTMLOptionElement *iface)
{
- HTMLOptionElement *This = HTMLOPTION_THIS(iface);
+ HTMLOptionElement *This = impl_from_IHTMLOptionElement(iface);
return IHTMLDOMNode_Release(&This->element.node.IHTMLDOMNode_iface);
}
static HRESULT WINAPI HTMLOptionElement_GetTypeInfoCount(IHTMLOptionElement *iface, UINT *pctinfo)
{
- HTMLOptionElement *This = HTMLOPTION_THIS(iface);
+ HTMLOptionElement *This = impl_from_IHTMLOptionElement(iface);
return IDispatchEx_GetTypeInfoCount(&This->element.node.dispex.IDispatchEx_iface, pctinfo);
}
static HRESULT WINAPI HTMLOptionElement_GetTypeInfo(IHTMLOptionElement *iface, UINT iTInfo,
LCID lcid, ITypeInfo **ppTInfo)
{
- HTMLOptionElement *This = HTMLOPTION_THIS(iface);
+ HTMLOptionElement *This = impl_from_IHTMLOptionElement(iface);
return IDispatchEx_GetTypeInfo(&This->element.node.dispex.IDispatchEx_iface, iTInfo, lcid,
ppTInfo);
}
@@ -83,7 +84,7 @@ static HRESULT WINAPI HTMLOptionElement_GetIDsOfNames(IHTMLOptionElement *iface,
LPOLESTR *rgszNames, UINT cNames,
LCID lcid, DISPID *rgDispId)
{
- HTMLOptionElement *This = HTMLOPTION_THIS(iface);
+ HTMLOptionElement *This = impl_from_IHTMLOptionElement(iface);
return IDispatchEx_GetIDsOfNames(&This->element.node.dispex.IDispatchEx_iface, riid, rgszNames,
cNames, lcid, rgDispId);
}
@@ -92,14 +93,14 @@ static HRESULT WINAPI HTMLOptionElement_Invoke(IHTMLOptionElement *iface, DISPID
REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams,
VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr)
{
- HTMLOptionElement *This = HTMLOPTION_THIS(iface);
+ HTMLOptionElement *This = impl_from_IHTMLOptionElement(iface);
return IDispatchEx_Invoke(&This->element.node.dispex.IDispatchEx_iface, dispIdMember, riid,
lcid, wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr);
}
static HRESULT WINAPI HTMLOptionElement_put_selected(IHTMLOptionElement *iface, VARIANT_BOOL v)
{
- HTMLOptionElement *This = HTMLOPTION_THIS(iface);
+ HTMLOptionElement *This = impl_from_IHTMLOptionElement(iface);
nsresult nsres;
TRACE("(%p)->(%x)\n", This, v);
@@ -115,7 +116,7 @@ static HRESULT WINAPI HTMLOptionElement_put_selected(IHTMLOptionElement *iface,
static HRESULT WINAPI HTMLOptionElement_get_selected(IHTMLOptionElement *iface, VARIANT_BOOL *p)
{
- HTMLOptionElement *This = HTMLOPTION_THIS(iface);
+ HTMLOptionElement *This = impl_from_IHTMLOptionElement(iface);
PRBool selected;
nsresult nsres;
@@ -133,7 +134,7 @@ static HRESULT WINAPI HTMLOptionElement_get_selected(IHTMLOptionElement *iface,
static HRESULT WINAPI HTMLOptionElement_put_value(IHTMLOptionElement *iface, BSTR v)
{
- HTMLOptionElement *This = HTMLOPTION_THIS(iface);
+ HTMLOptionElement *This = impl_from_IHTMLOptionElement(iface);
nsAString value_str;
nsresult nsres;
@@ -150,7 +151,7 @@ static HRESULT WINAPI HTMLOptionElement_put_value(IHTMLOptionElement *iface, BST
static HRESULT WINAPI HTMLOptionElement_get_value(IHTMLOptionElement *iface, BSTR *p)
{
- HTMLOptionElement *This = HTMLOPTION_THIS(iface);
+ HTMLOptionElement *This = impl_from_IHTMLOptionElement(iface);
nsAString value_str;
const PRUnichar *value;
nsresult nsres;
@@ -173,35 +174,35 @@ static HRESULT WINAPI HTMLOptionElement_get_value(IHTMLOptionElement *iface, BST
static HRESULT WINAPI HTMLOptionElement_put_defaultSelected(IHTMLOptionElement *iface, VARIANT_BOOL v)
{
- HTMLOptionElement *This = HTMLOPTION_THIS(iface);
+ HTMLOptionElement *This = impl_from_IHTMLOptionElement(iface);
FIXME("(%p)->(%x)\n", This, v);
return E_NOTIMPL;
}
static HRESULT WINAPI HTMLOptionElement_get_defaultSelected(IHTMLOptionElement *iface, VARIANT_BOOL *p)
{
- HTMLOptionElement *This = HTMLOPTION_THIS(iface);
+ HTMLOptionElement *This = impl_from_IHTMLOptionElement(iface);
FIXME("(%p)->(%p)\n", This, p);
return E_NOTIMPL;
}
static HRESULT WINAPI HTMLOptionElement_put_index(IHTMLOptionElement *iface, LONG v)
{
- HTMLOptionElement *This = HTMLOPTION_THIS(iface);
+ HTMLOptionElement *This = impl_from_IHTMLOptionElement(iface);
FIXME("(%p)->(%d)\n", This, v);
return E_NOTIMPL;
}
static HRESULT WINAPI HTMLOptionElement_get_index(IHTMLOptionElement *iface, LONG *p)
{
- HTMLOptionElement *This = HTMLOPTION_THIS(iface);
+ HTMLOptionElement *This = impl_from_IHTMLOptionElement(iface);
FIXME("(%p)->(%p)\n", This, p);
return E_NOTIMPL;
}
static HRESULT WINAPI HTMLOptionElement_put_text(IHTMLOptionElement *iface, BSTR v)
{
- HTMLOptionElement *This = HTMLOPTION_THIS(iface);
+ HTMLOptionElement *This = impl_from_IHTMLOptionElement(iface);
nsIDOMText *text_node;
nsAString text_str;
nsIDOMNode *tmp;
@@ -250,7 +251,7 @@ static HRESULT WINAPI HTMLOptionElement_put_text(IHTMLOptionElement *iface, BSTR
static HRESULT WINAPI HTMLOptionElement_get_text(IHTMLOptionElement *iface, BSTR *p)
{
- HTMLOptionElement *This = HTMLOPTION_THIS(iface);
+ HTMLOptionElement *This = impl_from_IHTMLOptionElement(iface);
nsAString text_str;
const PRUnichar *text;
nsresult nsres;
@@ -273,13 +274,11 @@ static HRESULT WINAPI HTMLOptionElement_get_text(IHTMLOptionElement *iface, BSTR
static HRESULT WINAPI HTMLOptionElement_get_form(IHTMLOptionElement *iface, IHTMLFormElement **p)
{
- HTMLOptionElement *This = HTMLOPTION_THIS(iface);
+ HTMLOptionElement *This = impl_from_IHTMLOptionElement(iface);
FIXME("(%p)->(%p)\n", This, p);
return E_NOTIMPL;
}
-#undef HTMLOPTION_THIS
-
static const IHTMLOptionElementVtbl HTMLOptionElementVtbl = {
HTMLOptionElement_QueryInterface,
HTMLOptionElement_AddRef,
@@ -314,13 +313,13 @@ static HRESULT HTMLOptionElement_QI(HTMLDOMNode *iface, REFIID riid, void **ppv)
if(IsEqualGUID(&IID_IUnknown, riid)) {
TRACE("(%p)->(IID_IUnknown %p)\n", This, ppv);
- *ppv = HTMLOPTION(This);
+ *ppv = &This->IHTMLOptionElement_iface;
}else if(IsEqualGUID(&IID_IDispatch, riid)) {
TRACE("(%p)->(IID_IDispatch %p)\n", This, ppv);
- *ppv = HTMLOPTION(This);
+ *ppv = &This->IHTMLOptionElement_iface;
}else if(IsEqualGUID(&IID_IHTMLOptionElement, riid)) {
TRACE("(%p)->(IID_IHTMLOptionElement %p)\n", This, ppv);
- *ppv = HTMLOPTION(This);
+ *ppv = &This->IHTMLOptionElement_iface;
}
if(*ppv) {
@@ -368,7 +367,7 @@ HRESULT HTMLOptionElement_Create(HTMLDocumentNode *doc, nsIDOMHTMLElement *nsele
if(!ret)
return E_OUTOFMEMORY;
- ret->lpHTMLOptionElementVtbl = &HTMLOptionElementVtbl;
+ ret->IHTMLOptionElement_iface.lpVtbl = &HTMLOptionElementVtbl;
ret->element.node.vtbl = &HTMLOptionElementImplVtbl;
nsres = nsIDOMHTMLElement_QueryInterface(nselem, &IID_nsIDOMHTMLOptionElement, (void**)&ret->nsoption);
@@ -384,24 +383,27 @@ HRESULT HTMLOptionElement_Create(HTMLDocumentNode *doc, nsIDOMHTMLElement *nsele
return S_OK;
}
-#define HTMLOPTFACTORY_THIS(iface) DEFINE_THIS(HTMLOptionElementFactory, HTMLOptionElementFactory, iface)
+static inline HTMLOptionElementFactory *impl_from_IHTMLOptionElementFactory(IHTMLOptionElementFactory *iface)
+{
+ return CONTAINING_RECORD(iface, HTMLOptionElementFactory, IHTMLOptionElementFactory_iface);
+}
static HRESULT WINAPI HTMLOptionElementFactory_QueryInterface(IHTMLOptionElementFactory *iface,
REFIID riid, void **ppv)
{
- HTMLOptionElementFactory *This = HTMLOPTFACTORY_THIS(iface);
+ HTMLOptionElementFactory *This = impl_from_IHTMLOptionElementFactory(iface);
*ppv = NULL;
if(IsEqualGUID(&IID_IUnknown, riid)) {
TRACE("(%p)->(IID_IUnknown %p)\n", This, ppv);
- *ppv = HTMLOPTFACTORY(This);
+ *ppv = &This->IHTMLOptionElementFactory_iface;
}else if(IsEqualGUID(&IID_IDispatch, riid)) {
TRACE("(%p)->(IID_IDispatch %p)\n", This, ppv);
- *ppv = HTMLOPTFACTORY(This);
+ *ppv = &This->IHTMLOptionElementFactory_iface;
}else if(IsEqualGUID(&IID_IHTMLOptionElementFactory, riid)) {
TRACE("(%p)->(IID_IHTMLOptionElementFactory %p)\n", This, ppv);
- *ppv = HTMLOPTFACTORY(This);
+ *ppv = &This->IHTMLOptionElementFactory_iface;
}
if(*ppv) {
@@ -415,7 +417,7 @@ static HRESULT WINAPI HTMLOptionElementFactory_QueryInterface(IHTMLOptionElement
static ULONG WINAPI HTMLOptionElementFactory_AddRef(IHTMLOptionElementFactory *iface)
{
- HTMLOptionElementFactory *This = HTMLOPTFACTORY_THIS(iface);
+ HTMLOptionElementFactory *This = impl_from_IHTMLOptionElementFactory(iface);
LONG ref = InterlockedIncrement(&This->ref);
TRACE("(%p) ref=%d\n", This, ref);
@@ -425,7 +427,7 @@ static ULONG WINAPI HTMLOptionElementFactory_AddRef(IHTMLOptionElementFactory *i
static ULONG WINAPI HTMLOptionElementFactory_Release(IHTMLOptionElementFactory *iface)
{
- HTMLOptionElementFactory *This = HTMLOPTFACTORY_THIS(iface);
+ HTMLOptionElementFactory *This = impl_from_IHTMLOptionElementFactory(iface);
LONG ref = InterlockedDecrement(&This->ref);
TRACE("(%p) ref=%d\n", This, ref);
@@ -438,7 +440,7 @@ static ULONG WINAPI HTMLOptionElementFactory_Release(IHTMLOptionElementFactory *
static HRESULT WINAPI HTMLOptionElementFactory_GetTypeInfoCount(IHTMLOptionElementFactory *iface, UINT *pctinfo)
{
- HTMLOptionElementFactory *This = HTMLOPTFACTORY_THIS(iface);
+ HTMLOptionElementFactory *This = impl_from_IHTMLOptionElementFactory(iface);
FIXME("(%p)->(%p)\n", This, pctinfo);
return E_NOTIMPL;
}
@@ -446,7 +448,7 @@ static HRESULT WINAPI HTMLOptionElementFactory_GetTypeInfoCount(IHTMLOptionEleme
static HRESULT WINAPI HTMLOptionElementFactory_GetTypeInfo(IHTMLOptionElementFactory *iface, UINT iTInfo,
LCID lcid, ITypeInfo **ppTInfo)
{
- HTMLOptionElementFactory *This = HTMLOPTFACTORY_THIS(iface);
+ HTMLOptionElementFactory *This = impl_from_IHTMLOptionElementFactory(iface);
FIXME("(%p)->(%u %u %p)\n", This, iTInfo, lcid, ppTInfo);
return E_NOTIMPL;
}
@@ -455,7 +457,7 @@ static HRESULT WINAPI HTMLOptionElementFactory_GetIDsOfNames(IHTMLOptionElementF
LPOLESTR *rgszNames, UINT cNames,
LCID lcid, DISPID *rgDispId)
{
- HTMLOptionElementFactory *This = HTMLOPTFACTORY_THIS(iface);
+ HTMLOptionElementFactory *This = impl_from_IHTMLOptionElementFactory(iface);
FIXME("(%p)->(%s %p %u %u %p)\n", This, debugstr_guid(riid), rgszNames, cNames,
lcid, rgDispId);
return E_NOTIMPL;
@@ -465,7 +467,7 @@ static HRESULT WINAPI HTMLOptionElementFactory_Invoke(IHTMLOptionElementFactory
REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams,
VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr)
{
- HTMLOptionElementFactory *This = HTMLOPTFACTORY_THIS(iface);
+ HTMLOptionElementFactory *This = impl_from_IHTMLOptionElementFactory(iface);
FIXME("(%p)->(%d %s %d %d %p %p %p %p)\n", This, dispIdMember, debugstr_guid(riid),
lcid, wFlags, pDispParams, pVarResult, pExcepInfo, puArgErr);
return E_NOTIMPL;
@@ -475,7 +477,7 @@ static HRESULT WINAPI HTMLOptionElementFactory_create(IHTMLOptionElementFactory
VARIANT text, VARIANT value, VARIANT defaultselected, VARIANT selected,
IHTMLOptionElement **optelem)
{
- HTMLOptionElementFactory *This = HTMLOPTFACTORY_THIS(iface);
+ HTMLOptionElementFactory *This = impl_from_IHTMLOptionElementFactory(iface);
nsIDOMHTMLElement *nselem;
HTMLDOMNode *node;
HRESULT hres;
@@ -522,8 +524,6 @@ static HRESULT WINAPI HTMLOptionElementFactory_create(IHTMLOptionElementFactory
return S_OK;
}
-#undef HTMLOPTFACTORY_THIS
-
static const IHTMLOptionElementFactoryVtbl HTMLOptionElementFactoryVtbl = {
HTMLOptionElementFactory_QueryInterface,
HTMLOptionElementFactory_AddRef,
@@ -541,7 +541,7 @@ HTMLOptionElementFactory *HTMLOptionElementFactory_Create(HTMLWindow *window)
ret = heap_alloc(sizeof(HTMLOptionElementFactory));
- ret->lpHTMLOptionElementFactoryVtbl = &HTMLOptionElementFactoryVtbl;
+ ret->IHTMLOptionElementFactory_iface.lpVtbl = &HTMLOptionElementFactoryVtbl;
ret->ref = 1;
ret->window = window;
diff --git a/dlls/mshtml/htmlwindow.c b/dlls/mshtml/htmlwindow.c
index 87b4a60..5a936e7 100644
--- a/dlls/mshtml/htmlwindow.c
+++ b/dlls/mshtml/htmlwindow.c
@@ -239,7 +239,7 @@ static ULONG WINAPI HTMLWindow2_Release(IHTMLWindow2 *iface)
if(This->option_factory) {
This->option_factory->window = NULL;
- IHTMLOptionElementFactory_Release(HTMLOPTFACTORY(This->option_factory));
+ IHTMLOptionElementFactory_Release(&This->option_factory->IHTMLOptionElementFactory_iface);
}
if(This->image_factory) {
@@ -1065,7 +1065,7 @@ static HRESULT WINAPI HTMLWindow2_get_Option(IHTMLWindow2 *iface, IHTMLOptionEle
if(!This->option_factory)
This->option_factory = HTMLOptionElementFactory_Create(This);
- *p = HTMLOPTFACTORY(This->option_factory);
+ *p = &This->option_factory->IHTMLOptionElementFactory_iface;
IHTMLOptionElementFactory_AddRef(*p);
return S_OK;
diff --git a/dlls/mshtml/mshtml_private.h b/dlls/mshtml/mshtml_private.h
index 07e73f9..70046b2 100644
--- a/dlls/mshtml/mshtml_private.h
+++ b/dlls/mshtml/mshtml_private.h
@@ -228,7 +228,7 @@ typedef struct {
} global_prop_t;
typedef struct {
- const IHTMLOptionElementFactoryVtbl *lpHTMLOptionElementFactoryVtbl;
+ IHTMLOptionElementFactory IHTMLOptionElementFactory_iface;
LONG ref;
@@ -634,7 +634,6 @@ struct HTMLDocumentNode {
#define HTMLTEXTCONT(x) ((IHTMLTextContainer*) &(x)->lpHTMLTextContainerVtbl)
-#define HTMLOPTFACTORY(x) ((IHTMLOptionElementFactory*) &(x)->lpHTMLOptionElementFactoryVtbl)
#define HTMLIMGFACTORY(x) ((IHTMLImageElementFactory*) &(x)->lpHTMLImageElementFactoryVtbl)
#define HTMLLOCATION(x) ((IHTMLLocation*) &(x)->lpHTMLLocationVtbl)
--
1.7.3.4
More information about the wine-patches
mailing list