Michael Stefaniuc : gameux: COM cleanup in gameexplorer.c.
Alexandre Julliard
julliard at winehq.org
Mon Aug 22 13:29:05 CDT 2011
Module: wine
Branch: master
Commit: 75ba717967b5943631d1f1538f589f69889b402b
URL: http://source.winehq.org/git/wine.git/?a=commit;h=75ba717967b5943631d1f1538f589f69889b402b
Author: Michael Stefaniuc <mstefani at redhat.de>
Date: Thu Aug 11 00:06:47 2011 +0200
gameux: COM cleanup in gameexplorer.c.
---
dlls/gameux/gameexplorer.c | 34 ++++++++++++----------------------
1 files changed, 12 insertions(+), 22 deletions(-)
diff --git a/dlls/gameux/gameexplorer.c b/dlls/gameux/gameexplorer.c
index 8b57247..322dd7a 100644
--- a/dlls/gameux/gameexplorer.c
+++ b/dlls/gameux/gameexplorer.c
@@ -774,29 +774,19 @@ HRESULT GAMEUX_FindGameInstanceId(
typedef struct _GameExplorerImpl
{
- const struct IGameExplorerVtbl *lpGameExplorerVtbl;
- const struct IGameExplorer2Vtbl *lpGameExplorer2Vtbl;
+ IGameExplorer IGameExplorer_iface;
+ IGameExplorer2 IGameExplorer2_iface;
LONG ref;
} GameExplorerImpl;
static inline GameExplorerImpl *impl_from_IGameExplorer(IGameExplorer *iface)
{
- return (GameExplorerImpl*)((char*)iface - FIELD_OFFSET(GameExplorerImpl, lpGameExplorerVtbl));
-}
-
-static inline IGameExplorer* IGameExplorer_from_impl(GameExplorerImpl* This)
-{
- return (struct IGameExplorer*)&This->lpGameExplorerVtbl;
+ return CONTAINING_RECORD(iface, GameExplorerImpl, IGameExplorer_iface);
}
static inline GameExplorerImpl *impl_from_IGameExplorer2(IGameExplorer2 *iface)
{
- return (GameExplorerImpl*)((char*)iface - FIELD_OFFSET(GameExplorerImpl, lpGameExplorer2Vtbl));
-}
-
-static inline IGameExplorer2* IGameExplorer2_from_impl(GameExplorerImpl* This)
-{
- return (struct IGameExplorer2*)&This->lpGameExplorer2Vtbl;
+ return CONTAINING_RECORD(iface, GameExplorerImpl, IGameExplorer2_iface);
}
static HRESULT WINAPI GameExplorerImpl_QueryInterface(
@@ -813,11 +803,11 @@ static HRESULT WINAPI GameExplorerImpl_QueryInterface(
if(IsEqualGUID(riid, &IID_IUnknown) ||
IsEqualGUID(riid, &IID_IGameExplorer))
{
- *ppvObject = IGameExplorer_from_impl(This);
+ *ppvObject = &This->IGameExplorer_iface;
}
else if(IsEqualGUID(riid, &IID_IGameExplorer2))
{
- *ppvObject = IGameExplorer2_from_impl(This);
+ *ppvObject = &This->IGameExplorer2_iface;
}
else
{
@@ -919,19 +909,19 @@ static HRESULT WINAPI GameExplorer2Impl_QueryInterface(
void **ppvObject)
{
GameExplorerImpl *This = impl_from_IGameExplorer2(iface);
- return GameExplorerImpl_QueryInterface(IGameExplorer_from_impl(This), riid, ppvObject);
+ return GameExplorerImpl_QueryInterface(&This->IGameExplorer_iface, riid, ppvObject);
}
static ULONG WINAPI GameExplorer2Impl_AddRef(IGameExplorer2 *iface)
{
GameExplorerImpl *This = impl_from_IGameExplorer2(iface);
- return GameExplorerImpl_AddRef(IGameExplorer_from_impl(This));
+ return GameExplorerImpl_AddRef(&This->IGameExplorer_iface);
}
static ULONG WINAPI GameExplorer2Impl_Release(IGameExplorer2 *iface)
{
GameExplorerImpl *This = impl_from_IGameExplorer2(iface);
- return GameExplorerImpl_Release(IGameExplorer_from_impl(This));
+ return GameExplorerImpl_Release(&This->IGameExplorer_iface);
}
static HRESULT WINAPI GameExplorer2Impl_CheckAccess(
@@ -1026,11 +1016,11 @@ HRESULT GameExplorer_create(
if(!pGameExplorer)
return E_OUTOFMEMORY;
- pGameExplorer->lpGameExplorerVtbl = &GameExplorerImplVtbl;
- pGameExplorer->lpGameExplorer2Vtbl = &GameExplorer2ImplVtbl;
+ pGameExplorer->IGameExplorer_iface.lpVtbl = &GameExplorerImplVtbl;
+ pGameExplorer->IGameExplorer2_iface.lpVtbl = &GameExplorer2ImplVtbl;
pGameExplorer->ref = 1;
- *ppObj = (IUnknown*)(&pGameExplorer->lpGameExplorerVtbl);
+ *ppObj = (IUnknown*)&pGameExplorer->IGameExplorer_iface;
TRACE("returning iface: %p\n", *ppObj);
return S_OK;
More information about the wine-cvs
mailing list