Module: wine Branch: master Commit: d4b05232883eb0696cd7b6f601288f0baeb11b4a URL: http://source.winehq.org/git/wine.git/?a=commit;h=d4b05232883eb0696cd7b6f601...
Author: Michael Stefaniuc mstefani@redhat.de Date: Mon Dec 6 23:32:17 2010 +0100
mshtml: Use an iface instead of a vtbl pointer in HTMLSelectionObject.
---
dlls/mshtml/selection.c | 43 +++++++++++++++++++++---------------------- 1 files changed, 21 insertions(+), 22 deletions(-)
diff --git a/dlls/mshtml/selection.c b/dlls/mshtml/selection.c index 4c670a6..1ffc567 100644 --- a/dlls/mshtml/selection.c +++ b/dlls/mshtml/selection.c @@ -33,7 +33,7 @@ WINE_DEFAULT_DEBUG_CHANNEL(mshtml);
typedef struct { - const IHTMLSelectionObjectVtbl *lpHTMLSelectionObjectVtbl; + IHTMLSelectionObject IHTMLSelectionObject_iface;
LONG ref;
@@ -43,26 +43,27 @@ typedef struct { struct list entry; } HTMLSelectionObject;
-#define HTMLSELOBJ(x) ((IHTMLSelectionObject*) &(x)->lpHTMLSelectionObjectVtbl) - -#define HTMLSELOBJ_THIS(iface) DEFINE_THIS(HTMLSelectionObject, HTMLSelectionObject, iface) +static inline HTMLSelectionObject *impl_from_IHTMLSelectionObject(IHTMLSelectionObject *iface) +{ + return CONTAINING_RECORD(iface, HTMLSelectionObject, IHTMLSelectionObject_iface); +}
static HRESULT WINAPI HTMLSelectionObject_QueryInterface(IHTMLSelectionObject *iface, REFIID riid, void **ppv) { - HTMLSelectionObject *This = HTMLSELOBJ_THIS(iface); + HTMLSelectionObject *This = impl_from_IHTMLSelectionObject(iface);
*ppv = NULL;
if(IsEqualGUID(&IID_IUnknown, riid)) { TRACE("(%p)->(IID_IUnknown %p)\n", This, ppv); - *ppv = HTMLSELOBJ(This); + *ppv = &This->IHTMLSelectionObject_iface; }else if(IsEqualGUID(&IID_IDispatch, riid)) { TRACE("(%p)->(IID_IUnknown %p)\n", This, ppv); - *ppv = HTMLSELOBJ(This); + *ppv = &This->IHTMLSelectionObject_iface; }else if(IsEqualGUID(&IID_IHTMLSelectionObject, riid)) { TRACE("(%p)->(IID_IUnknown %p)\n", This, ppv); - *ppv = HTMLSELOBJ(This); + *ppv = &This->IHTMLSelectionObject_iface; }
if(*ppv) { @@ -76,7 +77,7 @@ static HRESULT WINAPI HTMLSelectionObject_QueryInterface(IHTMLSelectionObject *i
static ULONG WINAPI HTMLSelectionObject_AddRef(IHTMLSelectionObject *iface) { - HTMLSelectionObject *This = HTMLSELOBJ_THIS(iface); + HTMLSelectionObject *This = impl_from_IHTMLSelectionObject(iface); LONG ref = InterlockedIncrement(&This->ref);
TRACE("(%p) ref=%d\n", This, ref); @@ -86,7 +87,7 @@ static ULONG WINAPI HTMLSelectionObject_AddRef(IHTMLSelectionObject *iface)
static ULONG WINAPI HTMLSelectionObject_Release(IHTMLSelectionObject *iface) { - HTMLSelectionObject *This = HTMLSELOBJ_THIS(iface); + HTMLSelectionObject *This = impl_from_IHTMLSelectionObject(iface); LONG ref = InterlockedDecrement(&This->ref);
TRACE("(%p) ref=%d\n", This, ref); @@ -104,7 +105,7 @@ static ULONG WINAPI HTMLSelectionObject_Release(IHTMLSelectionObject *iface)
static HRESULT WINAPI HTMLSelectionObject_GetTypeInfoCount(IHTMLSelectionObject *iface, UINT *pctinfo) { - HTMLSelectionObject *This = HTMLSELOBJ_THIS(iface); + HTMLSelectionObject *This = impl_from_IHTMLSelectionObject(iface); FIXME("(%p)->(%p)\n", This, pctinfo); return E_NOTIMPL; } @@ -112,7 +113,7 @@ static HRESULT WINAPI HTMLSelectionObject_GetTypeInfoCount(IHTMLSelectionObject static HRESULT WINAPI HTMLSelectionObject_GetTypeInfo(IHTMLSelectionObject *iface, UINT iTInfo, LCID lcid, ITypeInfo **ppTInfo) { - HTMLSelectionObject *This = HTMLSELOBJ_THIS(iface); + HTMLSelectionObject *This = impl_from_IHTMLSelectionObject(iface); FIXME("(%p)->(%u %u %p)\n", This, iTInfo, lcid, ppTInfo); return E_NOTIMPL; } @@ -121,7 +122,7 @@ static HRESULT WINAPI HTMLSelectionObject_GetIDsOfNames(IHTMLSelectionObject *if LPOLESTR *rgszNames, UINT cNames, LCID lcid, DISPID *rgDispId) { - HTMLSelectionObject *This = HTMLSELOBJ_THIS(iface); + HTMLSelectionObject *This = impl_from_IHTMLSelectionObject(iface); FIXME("(%p)->(%s %p %u %u %p)\n", This, debugstr_guid(riid), rgszNames, cNames, lcid, rgDispId); return E_NOTIMPL; @@ -131,7 +132,7 @@ static HRESULT WINAPI HTMLSelectionObject_Invoke(IHTMLSelectionObject *iface, DI REFIID riid, LCID lcid, WORD wFlags, DISPPARAMS *pDispParams, VARIANT *pVarResult, EXCEPINFO *pExcepInfo, UINT *puArgErr) { - HTMLSelectionObject *This = HTMLSELOBJ_THIS(iface); + HTMLSelectionObject *This = impl_from_IHTMLSelectionObject(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; @@ -139,7 +140,7 @@ static HRESULT WINAPI HTMLSelectionObject_Invoke(IHTMLSelectionObject *iface, DI
static HRESULT WINAPI HTMLSelectionObject_createRange(IHTMLSelectionObject *iface, IDispatch **range) { - HTMLSelectionObject *This = HTMLSELOBJ_THIS(iface); + HTMLSelectionObject *This = impl_from_IHTMLSelectionObject(iface); IHTMLTxtRange *range_obj = NULL; nsIDOMRange *nsrange = NULL; HRESULT hres; @@ -189,21 +190,21 @@ static HRESULT WINAPI HTMLSelectionObject_createRange(IHTMLSelectionObject *ifac
static HRESULT WINAPI HTMLSelectionObject_empty(IHTMLSelectionObject *iface) { - HTMLSelectionObject *This = HTMLSELOBJ_THIS(iface); + HTMLSelectionObject *This = impl_from_IHTMLSelectionObject(iface); FIXME("(%p)\n", This); return E_NOTIMPL; }
static HRESULT WINAPI HTMLSelectionObject_clear(IHTMLSelectionObject *iface) { - HTMLSelectionObject *This = HTMLSELOBJ_THIS(iface); + HTMLSelectionObject *This = impl_from_IHTMLSelectionObject(iface); FIXME("(%p)\n", This); return E_NOTIMPL; }
static HRESULT WINAPI HTMLSelectionObject_get_type(IHTMLSelectionObject *iface, BSTR *p) { - HTMLSelectionObject *This = HTMLSELOBJ_THIS(iface); + HTMLSelectionObject *This = impl_from_IHTMLSelectionObject(iface); PRBool collapsed = TRUE;
static const WCHAR wszNone[] = {'N','o','n','e',0}; @@ -219,8 +220,6 @@ static HRESULT WINAPI HTMLSelectionObject_get_type(IHTMLSelectionObject *iface, return S_OK; }
-#undef HTMLSELOBJ_THIS - static const IHTMLSelectionObjectVtbl HTMLSelectionObjectVtbl = { HTMLSelectionObject_QueryInterface, HTMLSelectionObject_AddRef, @@ -243,14 +242,14 @@ HRESULT HTMLSelectionObject_Create(HTMLDocumentNode *doc, nsISelection *nsselect if(!selection) return E_OUTOFMEMORY;
- selection->lpHTMLSelectionObjectVtbl = &HTMLSelectionObjectVtbl; + selection->IHTMLSelectionObject_iface.lpVtbl = &HTMLSelectionObjectVtbl; selection->ref = 1; selection->nsselection = nsselection; /* We shouldn't call AddRef here */
selection->doc = doc; list_add_head(&doc->selection_list, &selection->entry);
- *ret = HTMLSELOBJ(selection); + *ret = &selection->IHTMLSelectionObject_iface; return S_OK; }