From a8bb1ab85b697c97e962a2f829b6a6c415a9c233 Mon Sep 17 00:00:00 2001 From: Michael Stefaniuc Date: Mon, 27 Dec 2010 01:47:29 +0100 Subject: [PATCH] mshtml: COM cleanup for the IHlinkTarget iface. --- dlls/mshtml/hlink.c | 23 +++++++++++++---------- dlls/mshtml/htmldoc.c | 2 +- dlls/mshtml/mshtml_private.h | 3 +-- 3 files changed, 15 insertions(+), 13 deletions(-) diff --git a/dlls/mshtml/hlink.c b/dlls/mshtml/hlink.c index 900a0ec8b10..965318f78e5 100644 --- a/dlls/mshtml/hlink.c +++ b/dlls/mshtml/hlink.c @@ -36,43 +36,46 @@ WINE_DEFAULT_DEBUG_CHANNEL(mshtml); * IHlinkTarget implementation */ -#define HLINKTRG_THIS(iface) DEFINE_THIS(HTMLDocument, HlinkTarget, iface) +static inline HTMLDocument *impl_from_IHlinkTarget(IHlinkTarget *iface) +{ + return CONTAINING_RECORD(iface, HTMLDocument, IHlinkTarget_iface); +} static HRESULT WINAPI HlinkTarget_QueryInterface(IHlinkTarget *iface, REFIID riid, void **ppv) { - HTMLDocument *This = HLINKTRG_THIS(iface); + HTMLDocument *This = impl_from_IHlinkTarget(iface); return htmldoc_query_interface(This, riid, ppv); } static ULONG WINAPI HlinkTarget_AddRef(IHlinkTarget *iface) { - HTMLDocument *This = HLINKTRG_THIS(iface); + HTMLDocument *This = impl_from_IHlinkTarget(iface); return htmldoc_addref(This); } static ULONG WINAPI HlinkTarget_Release(IHlinkTarget *iface) { - HTMLDocument *This = HLINKTRG_THIS(iface); + HTMLDocument *This = impl_from_IHlinkTarget(iface); return htmldoc_release(This); } static HRESULT WINAPI HlinkTarget_SetBrowseContext(IHlinkTarget *iface, IHlinkBrowseContext *pihlbc) { - HTMLDocument *This = HLINKTRG_THIS(iface); + HTMLDocument *This = impl_from_IHlinkTarget(iface); FIXME("(%p)->(%p)\n", This, pihlbc); return E_NOTIMPL; } static HRESULT WINAPI HlinkTarget_GetBrowseContext(IHlinkTarget *iface, IHlinkBrowseContext **ppihlbc) { - HTMLDocument *This = HLINKTRG_THIS(iface); + HTMLDocument *This = impl_from_IHlinkTarget(iface); FIXME("(%p)->(%p)\n", This, ppihlbc); return E_NOTIMPL; } static HRESULT WINAPI HlinkTarget_Navigate(IHlinkTarget *iface, DWORD grfHLNF, LPCWSTR pwzJumpLocation) { - HTMLDocument *This = HLINKTRG_THIS(iface); + HTMLDocument *This = impl_from_IHlinkTarget(iface); TRACE("(%p)->(%08x %s)\n", This, grfHLNF, debugstr_w(pwzJumpLocation)); @@ -87,7 +90,7 @@ static HRESULT WINAPI HlinkTarget_Navigate(IHlinkTarget *iface, DWORD grfHLNF, L static HRESULT WINAPI HlinkTarget_GetMoniker(IHlinkTarget *iface, LPCWSTR pwzLocation, DWORD dwAssign, IMoniker **ppimkLocation) { - HTMLDocument *This = HLINKTRG_THIS(iface); + HTMLDocument *This = impl_from_IHlinkTarget(iface); FIXME("(%p)->(%s %08x %p)\n", This, debugstr_w(pwzLocation), dwAssign, ppimkLocation); return E_NOTIMPL; } @@ -95,7 +98,7 @@ static HRESULT WINAPI HlinkTarget_GetMoniker(IHlinkTarget *iface, LPCWSTR pwzLoc static HRESULT WINAPI HlinkTarget_GetFriendlyName(IHlinkTarget *iface, LPCWSTR pwzLocation, LPWSTR *ppwzFriendlyName) { - HTMLDocument *This = HLINKTRG_THIS(iface); + HTMLDocument *This = impl_from_IHlinkTarget(iface); FIXME("(%p)->(%s %p)\n", This, debugstr_w(pwzLocation), ppwzFriendlyName); return E_NOTIMPL; } @@ -113,5 +116,5 @@ static const IHlinkTargetVtbl HlinkTargetVtbl = { void HTMLDocument_Hlink_Init(HTMLDocument *This) { - This->lpHlinkTargetVtbl = &HlinkTargetVtbl; + This->IHlinkTarget_iface.lpVtbl = &HlinkTargetVtbl; } diff --git a/dlls/mshtml/htmldoc.c b/dlls/mshtml/htmldoc.c index ff07d0d77b0..c25f7f3d930 100644 --- a/dlls/mshtml/htmldoc.c +++ b/dlls/mshtml/htmldoc.c @@ -1782,7 +1782,7 @@ static BOOL htmldoc_qi(HTMLDocument *This, REFIID riid, void **ppv) *ppv = &This->IOleControl_iface; }else if(IsEqualGUID(&IID_IHlinkTarget, riid)) { TRACE("(%p)->(IID_IHlinkTarget, %p)\n", This, ppv); - *ppv = HLNKTARGET(This); + *ppv = &This->IHlinkTarget_iface; }else if(IsEqualGUID(&IID_IConnectionPointContainer, riid)) { TRACE("(%p)->(IID_IConnectionPointContainer %p)\n", This, ppv); *ppv = CONPTCONT(&This->cp_container); diff --git a/dlls/mshtml/mshtml_private.h b/dlls/mshtml/mshtml_private.h index b44dce458c9..97940e2568f 100644 --- a/dlls/mshtml/mshtml_private.h +++ b/dlls/mshtml/mshtml_private.h @@ -360,7 +360,7 @@ struct HTMLDocument { IServiceProvider IServiceProvider_iface; IOleCommandTarget IOleCommandTarget_iface; IOleControl IOleControl_iface; - const IHlinkTargetVtbl *lpHlinkTargetVtbl; + IHlinkTarget IHlinkTarget_iface; IPersistStreamInit IPersistStreamInit_iface; const IDispatchExVtbl *lpIDispatchExVtbl; const ISupportErrorInfoVtbl *lpSupportErrorInfoVtbl; @@ -625,7 +625,6 @@ struct HTMLDocumentNode { #define HTMLWINDOW2(x) ((IHTMLWindow2*) &(x)->lpHTMLWindow2Vtbl) #define HTMLWINDOW3(x) ((IHTMLWindow3*) &(x)->lpHTMLWindow3Vtbl) #define HTMLWINDOW4(x) ((IHTMLWindow4*) &(x)->lpHTMLWindow4Vtbl) -#define HLNKTARGET(x) ((IHlinkTarget*) &(x)->lpHlinkTargetVtbl) #define CONPTCONT(x) ((IConnectionPointContainer*) &(x)->lpConnectionPointContainerVtbl) #define CUSTOMDOC(x) ((ICustomDoc*) &(x)->lpCustomDocVtbl) #define OBJSITE(x) ((IObjectWithSite*) &(x)->lpObjectWithSiteVtbl)