Michael Stefaniuc : hlink: Use an iface instead of a vtbl pointer in HlinkBCImpl.
Alexandre Julliard
julliard at winehq.org
Sun Dec 5 12:10:08 CST 2010
Module: wine
Branch: master
Commit: 425dd093095d3958d169ffc5d0d41f3fbddafe14
URL: http://source.winehq.org/git/wine.git/?a=commit;h=425dd093095d3958d169ffc5d0d41f3fbddafe14
Author: Michael Stefaniuc <mstefani at redhat.de>
Date: Sat Dec 4 22:13:41 2010 +0100
hlink: Use an iface instead of a vtbl pointer in HlinkBCImpl.
---
dlls/hlink/browse_ctx.c | 29 +++++++++++++++++------------
1 files changed, 17 insertions(+), 12 deletions(-)
diff --git a/dlls/hlink/browse_ctx.c b/dlls/hlink/browse_ctx.c
index 1e15c13..2496f9a 100644
--- a/dlls/hlink/browse_ctx.c
+++ b/dlls/hlink/browse_ctx.c
@@ -28,12 +28,17 @@ static const IHlinkBrowseContextVtbl hlvt;
typedef struct
{
- const IHlinkBrowseContextVtbl *lpVtbl;
+ IHlinkBrowseContext IHlinkBrowseContext_iface;
LONG ref;
HLBWINFO* BrowseWindowInfo;
IHlink* CurrentPage;
} HlinkBCImpl;
+static inline HlinkBCImpl *impl_from_IHlinkBrowseContext(IHlinkBrowseContext *iface)
+{
+ return CONTAINING_RECORD(iface, HlinkBCImpl, IHlinkBrowseContext_iface);
+}
+
HRESULT WINAPI HLinkBrowseContext_Constructor(IUnknown *pUnkOuter, REFIID riid,
LPVOID *ppv)
@@ -51,7 +56,7 @@ HRESULT WINAPI HLinkBrowseContext_Constructor(IUnknown *pUnkOuter, REFIID riid,
return E_OUTOFMEMORY;
hl->ref = 1;
- hl->lpVtbl = &hlvt;
+ hl->IHlinkBrowseContext_iface.lpVtbl = &hlvt;
*ppv = hl;
return S_OK;
@@ -60,7 +65,7 @@ HRESULT WINAPI HLinkBrowseContext_Constructor(IUnknown *pUnkOuter, REFIID riid,
static HRESULT WINAPI IHlinkBC_fnQueryInterface( IHlinkBrowseContext *iface,
REFIID riid, LPVOID* ppvObj)
{
- HlinkBCImpl *This = (HlinkBCImpl*)iface;
+ HlinkBCImpl *This = impl_from_IHlinkBrowseContext(iface);
TRACE ("(%p)->(%s,%p)\n", This, debugstr_guid (riid), ppvObj);
if (IsEqualIID(riid, &IID_IUnknown) ||
@@ -77,7 +82,7 @@ static HRESULT WINAPI IHlinkBC_fnQueryInterface( IHlinkBrowseContext *iface,
static ULONG WINAPI IHlinkBC_fnAddRef (IHlinkBrowseContext* iface)
{
- HlinkBCImpl *This = (HlinkBCImpl*)iface;
+ HlinkBCImpl *This = impl_from_IHlinkBrowseContext(iface);
ULONG refCount = InterlockedIncrement(&This->ref);
TRACE("(%p)->(count=%u)\n", This, refCount - 1);
@@ -87,7 +92,7 @@ static ULONG WINAPI IHlinkBC_fnAddRef (IHlinkBrowseContext* iface)
static ULONG WINAPI IHlinkBC_fnRelease (IHlinkBrowseContext* iface)
{
- HlinkBCImpl *This = (HlinkBCImpl*)iface;
+ HlinkBCImpl *This = impl_from_IHlinkBrowseContext(iface);
ULONG refCount = InterlockedDecrement(&This->ref);
TRACE("(%p)->(count=%u)\n", This, refCount + 1);
@@ -106,7 +111,7 @@ static HRESULT WINAPI IHlinkBC_Register(IHlinkBrowseContext* iface,
DWORD dwReserved, IUnknown *piunk, IMoniker *pimk, DWORD *pdwRegister)
{
static const WCHAR szIdent[] = {'W','I','N','E','H','L','I','N','K',0};
- HlinkBCImpl *This = (HlinkBCImpl*)iface;
+ HlinkBCImpl *This = impl_from_IHlinkBrowseContext(iface);
IMoniker *mon;
IMoniker *composite;
IRunningObjectTable *ROT;
@@ -138,7 +143,7 @@ static HRESULT WINAPI IHlinkBC_Revoke(IHlinkBrowseContext* iface,
{
HRESULT r = S_OK;
IRunningObjectTable *ROT;
- HlinkBCImpl *This = (HlinkBCImpl*)iface;
+ HlinkBCImpl *This = impl_from_IHlinkBrowseContext(iface);
FIXME("(%p)->(%i)\n", This, dwRegister);
@@ -152,7 +157,7 @@ static HRESULT WINAPI IHlinkBC_Revoke(IHlinkBrowseContext* iface,
static HRESULT WINAPI IHlinkBC_SetBrowseWindowInfo(IHlinkBrowseContext* iface,
HLBWINFO *phlbwi)
{
- HlinkBCImpl *This = (HlinkBCImpl*)iface;
+ HlinkBCImpl *This = impl_from_IHlinkBrowseContext(iface);
TRACE("(%p)->(%p)\n", This, phlbwi);
if(!phlbwi)
@@ -168,7 +173,7 @@ static HRESULT WINAPI IHlinkBC_SetBrowseWindowInfo(IHlinkBrowseContext* iface,
static HRESULT WINAPI IHlinkBC_GetBrowseWindowInfo(IHlinkBrowseContext* iface,
HLBWINFO *phlbwi)
{
- HlinkBCImpl *This = (HlinkBCImpl*)iface;
+ HlinkBCImpl *This = impl_from_IHlinkBrowseContext(iface);
TRACE("(%p)->(%p)\n", This, phlbwi);
if(!phlbwi)
@@ -185,7 +190,7 @@ static HRESULT WINAPI IHlinkBC_GetBrowseWindowInfo(IHlinkBrowseContext* iface,
static HRESULT WINAPI IHlinkBC_SetInitialHlink(IHlinkBrowseContext* iface,
IMoniker *pimkTarget, LPCWSTR pwzLocation, LPCWSTR pwzFriendlyName)
{
- HlinkBCImpl *This = (HlinkBCImpl*)iface;
+ HlinkBCImpl *This = impl_from_IHlinkBrowseContext(iface);
FIXME("(%p)->(%p %s %s)\n", This, pimkTarget,
debugstr_w(pwzLocation), debugstr_w(pwzFriendlyName));
@@ -203,7 +208,7 @@ static HRESULT WINAPI IHlinkBC_OnNavigateHlink(IHlinkBrowseContext *iface,
DWORD grfHLNF, IMoniker* pmkTarget, LPCWSTR pwzLocation, LPCWSTR
pwzFriendlyName, ULONG *puHLID)
{
- HlinkBCImpl *This = (HlinkBCImpl*)iface;
+ HlinkBCImpl *This = impl_from_IHlinkBrowseContext(iface);
FIXME("(%p)->(%i %p %s %s %p)\n", This, grfHLNF, pmkTarget,
debugstr_w(pwzLocation), debugstr_w(pwzFriendlyName), puHLID);
@@ -236,7 +241,7 @@ static HRESULT WINAPI IHlinkBC_QueryHlink( IHlinkBrowseContext* iface,
static HRESULT WINAPI IHlinkBC_GetHlink( IHlinkBrowseContext* iface,
ULONG uHLID, IHlink** ppihl)
{
- HlinkBCImpl *This = (HlinkBCImpl*)iface;
+ HlinkBCImpl *This = impl_from_IHlinkBrowseContext(iface);
TRACE("(%p)->(%x %p)\n", This, uHLID, ppihl);
More information about the wine-cvs
mailing list