Michael Stefaniuc : quartz: Use an iface instead of a vtbl pointer in EnumMonikerImpl.
Alexandre Julliard
julliard at winehq.org
Thu Dec 9 12:26:24 CST 2010
Module: wine
Branch: master
Commit: 80db15faa1dc4af449484a032310890b33d7c94f
URL: http://source.winehq.org/git/wine.git/?a=commit;h=80db15faa1dc4af449484a032310890b33d7c94f
Author: Michael Stefaniuc <mstefani at redhat.de>
Date: Wed Dec 8 22:54:07 2010 +0100
quartz: Use an iface instead of a vtbl pointer in EnumMonikerImpl.
---
dlls/quartz/enummoniker.c | 23 ++++++++++++++---------
1 files changed, 14 insertions(+), 9 deletions(-)
diff --git a/dlls/quartz/enummoniker.c b/dlls/quartz/enummoniker.c
index 0cc804a..ba4e687 100644
--- a/dlls/quartz/enummoniker.c
+++ b/dlls/quartz/enummoniker.c
@@ -31,7 +31,7 @@ WINE_DEFAULT_DEBUG_CHANNEL(quartz);
typedef struct EnumMonikerImpl
{
- const IEnumMonikerVtbl *lpVtbl;
+ IEnumMoniker IEnumMoniker_iface;
LONG ref;
IMoniker ** ppMoniker;
ULONG nMonikerCount;
@@ -40,6 +40,11 @@ typedef struct EnumMonikerImpl
static const IEnumMonikerVtbl EnumMonikerImpl_Vtbl;
+static inline EnumMonikerImpl *impl_from_IEnumMoniker(IEnumMoniker *iface)
+{
+ return CONTAINING_RECORD(iface, EnumMonikerImpl, IEnumMoniker_iface);
+}
+
static ULONG WINAPI EnumMonikerImpl_AddRef(LPENUMMONIKER iface);
HRESULT EnumMonikerImpl_Create(IMoniker ** ppMoniker, ULONG nMonikerCount, IEnumMoniker ** ppEnum)
@@ -56,14 +61,14 @@ HRESULT EnumMonikerImpl_Create(IMoniker ** ppMoniker, ULONG nMonikerCount, IEnum
if (!pemi)
return E_OUTOFMEMORY;
- pemi->lpVtbl = &EnumMonikerImpl_Vtbl;
+ pemi->IEnumMoniker_iface.lpVtbl = &EnumMonikerImpl_Vtbl;
pemi->ref = 1;
pemi->ppMoniker = CoTaskMemAlloc(nMonikerCount * sizeof(IMoniker*));
memcpy(pemi->ppMoniker, ppMoniker, nMonikerCount*sizeof(IMoniker*));
pemi->nMonikerCount = nMonikerCount;
pemi->index = 0;
- *ppEnum = (IEnumMoniker *)pemi;
+ *ppEnum = &pemi->IEnumMoniker_iface;
return S_OK;
}
@@ -76,7 +81,7 @@ static HRESULT WINAPI EnumMonikerImpl_QueryInterface(
REFIID riid,
LPVOID *ppvObj)
{
- EnumMonikerImpl *This = (EnumMonikerImpl *)iface;
+ EnumMonikerImpl *This = impl_from_IEnumMoniker(iface);
TRACE("\n\tIID:\t%s\n",debugstr_guid(riid));
if (This == NULL || ppvObj == NULL) return E_POINTER;
@@ -99,7 +104,7 @@ static HRESULT WINAPI EnumMonikerImpl_QueryInterface(
*/
static ULONG WINAPI EnumMonikerImpl_AddRef(LPENUMMONIKER iface)
{
- EnumMonikerImpl *This = (EnumMonikerImpl *)iface;
+ EnumMonikerImpl *This = impl_from_IEnumMoniker(iface);
ULONG ref;
if (This == NULL) return E_POINTER;
@@ -116,7 +121,7 @@ static ULONG WINAPI EnumMonikerImpl_AddRef(LPENUMMONIKER iface)
*/
static ULONG WINAPI EnumMonikerImpl_Release(LPENUMMONIKER iface)
{
- EnumMonikerImpl *This = (EnumMonikerImpl *)iface;
+ EnumMonikerImpl *This = impl_from_IEnumMoniker(iface);
ULONG ref = InterlockedDecrement(&This->ref);
TRACE("(%p)->() Release from %d\n", iface, ref + 1);
@@ -139,7 +144,7 @@ static ULONG WINAPI EnumMonikerImpl_Release(LPENUMMONIKER iface)
static HRESULT WINAPI EnumMonikerImpl_Next(LPENUMMONIKER iface, ULONG celt, IMoniker ** rgelt, ULONG * pceltFetched)
{
ULONG fetched;
- EnumMonikerImpl *This = (EnumMonikerImpl *)iface;
+ EnumMonikerImpl *This = impl_from_IEnumMoniker(iface);
TRACE("(%p)->(%d, %p, %p)\n", iface, celt, rgelt, pceltFetched);
@@ -164,7 +169,7 @@ static HRESULT WINAPI EnumMonikerImpl_Next(LPENUMMONIKER iface, ULONG celt, IMon
static HRESULT WINAPI EnumMonikerImpl_Skip(LPENUMMONIKER iface, ULONG celt)
{
- EnumMonikerImpl *This = (EnumMonikerImpl *)iface;
+ EnumMonikerImpl *This = impl_from_IEnumMoniker(iface);
TRACE("(%p)->(%d)\n", iface, celt);
@@ -175,7 +180,7 @@ static HRESULT WINAPI EnumMonikerImpl_Skip(LPENUMMONIKER iface, ULONG celt)
static HRESULT WINAPI EnumMonikerImpl_Reset(LPENUMMONIKER iface)
{
- EnumMonikerImpl *This = (EnumMonikerImpl *)iface;
+ EnumMonikerImpl *This = impl_from_IEnumMoniker(iface);
TRACE("(%p)->()\n", iface);
More information about the wine-cvs
mailing list