Commit f3810015 authored by Michael Stefaniuc's avatar Michael Stefaniuc Committed by Alexandre Julliard

ole32: Use an iface instead of a vtbl pointer in EnumOleSTATDATA.

parent 740a850a
...@@ -56,13 +56,18 @@ static HRESULT EnumOleSTATDATA_Construct(OleAdviseHolderImpl *pOleAdviseHolder, ...@@ -56,13 +56,18 @@ static HRESULT EnumOleSTATDATA_Construct(OleAdviseHolderImpl *pOleAdviseHolder,
typedef struct typedef struct
{ {
const IEnumSTATDATAVtbl *lpvtbl; IEnumSTATDATA IEnumSTATDATA_iface;
LONG ref; LONG ref;
ULONG index; ULONG index;
OleAdviseHolderImpl *pOleAdviseHolder; OleAdviseHolderImpl *pOleAdviseHolder;
} EnumOleSTATDATA; } EnumOleSTATDATA;
static inline EnumOleSTATDATA *impl_from_IEnumSTATDATA(IEnumSTATDATA *iface)
{
return CONTAINING_RECORD(iface, EnumOleSTATDATA, IEnumSTATDATA_iface);
}
static HRESULT WINAPI EnumOleSTATDATA_QueryInterface( static HRESULT WINAPI EnumOleSTATDATA_QueryInterface(
IEnumSTATDATA *iface, REFIID riid, void **ppv) IEnumSTATDATA *iface, REFIID riid, void **ppv)
{ {
...@@ -80,7 +85,7 @@ static HRESULT WINAPI EnumOleSTATDATA_QueryInterface( ...@@ -80,7 +85,7 @@ static HRESULT WINAPI EnumOleSTATDATA_QueryInterface(
static ULONG WINAPI EnumOleSTATDATA_AddRef( static ULONG WINAPI EnumOleSTATDATA_AddRef(
IEnumSTATDATA *iface) IEnumSTATDATA *iface)
{ {
EnumOleSTATDATA *This = (EnumOleSTATDATA *)iface; EnumOleSTATDATA *This = impl_from_IEnumSTATDATA(iface);
TRACE("()\n"); TRACE("()\n");
return InterlockedIncrement(&This->ref); return InterlockedIncrement(&This->ref);
} }
...@@ -88,7 +93,7 @@ static ULONG WINAPI EnumOleSTATDATA_AddRef( ...@@ -88,7 +93,7 @@ static ULONG WINAPI EnumOleSTATDATA_AddRef(
static ULONG WINAPI EnumOleSTATDATA_Release( static ULONG WINAPI EnumOleSTATDATA_Release(
IEnumSTATDATA *iface) IEnumSTATDATA *iface)
{ {
EnumOleSTATDATA *This = (EnumOleSTATDATA *)iface; EnumOleSTATDATA *This = impl_from_IEnumSTATDATA(iface);
LONG refs = InterlockedDecrement(&This->ref); LONG refs = InterlockedDecrement(&This->ref);
TRACE("()\n"); TRACE("()\n");
if (!refs) if (!refs)
...@@ -103,7 +108,7 @@ static HRESULT WINAPI EnumOleSTATDATA_Next( ...@@ -103,7 +108,7 @@ static HRESULT WINAPI EnumOleSTATDATA_Next(
IEnumSTATDATA *iface, ULONG celt, LPSTATDATA rgelt, IEnumSTATDATA *iface, ULONG celt, LPSTATDATA rgelt,
ULONG *pceltFetched) ULONG *pceltFetched)
{ {
EnumOleSTATDATA *This = (EnumOleSTATDATA *)iface; EnumOleSTATDATA *This = impl_from_IEnumSTATDATA(iface);
HRESULT hr = S_OK; HRESULT hr = S_OK;
TRACE("(%d, %p, %p)\n", celt, rgelt, pceltFetched); TRACE("(%d, %p, %p)\n", celt, rgelt, pceltFetched);
...@@ -140,7 +145,7 @@ static HRESULT WINAPI EnumOleSTATDATA_Next( ...@@ -140,7 +145,7 @@ static HRESULT WINAPI EnumOleSTATDATA_Next(
static HRESULT WINAPI EnumOleSTATDATA_Skip( static HRESULT WINAPI EnumOleSTATDATA_Skip(
IEnumSTATDATA *iface, ULONG celt) IEnumSTATDATA *iface, ULONG celt)
{ {
EnumOleSTATDATA *This = (EnumOleSTATDATA *)iface; EnumOleSTATDATA *This = impl_from_IEnumSTATDATA(iface);
TRACE("(%d)\n", celt); TRACE("(%d)\n", celt);
...@@ -161,7 +166,7 @@ static HRESULT WINAPI EnumOleSTATDATA_Skip( ...@@ -161,7 +166,7 @@ static HRESULT WINAPI EnumOleSTATDATA_Skip(
static HRESULT WINAPI EnumOleSTATDATA_Reset( static HRESULT WINAPI EnumOleSTATDATA_Reset(
IEnumSTATDATA *iface) IEnumSTATDATA *iface)
{ {
EnumOleSTATDATA *This = (EnumOleSTATDATA *)iface; EnumOleSTATDATA *This = impl_from_IEnumSTATDATA(iface);
TRACE("()\n"); TRACE("()\n");
...@@ -173,7 +178,7 @@ static HRESULT WINAPI EnumOleSTATDATA_Clone( ...@@ -173,7 +178,7 @@ static HRESULT WINAPI EnumOleSTATDATA_Clone(
IEnumSTATDATA *iface, IEnumSTATDATA *iface,
IEnumSTATDATA **ppenum) IEnumSTATDATA **ppenum)
{ {
EnumOleSTATDATA *This = (EnumOleSTATDATA *)iface; EnumOleSTATDATA *This = impl_from_IEnumSTATDATA(iface);
return EnumOleSTATDATA_Construct(This->pOleAdviseHolder, This->index, ppenum); return EnumOleSTATDATA_Construct(This->pOleAdviseHolder, This->index, ppenum);
} }
...@@ -193,12 +198,12 @@ static HRESULT EnumOleSTATDATA_Construct(OleAdviseHolderImpl *pOleAdviseHolder, ...@@ -193,12 +198,12 @@ static HRESULT EnumOleSTATDATA_Construct(OleAdviseHolderImpl *pOleAdviseHolder,
EnumOleSTATDATA *This = HeapAlloc(GetProcessHeap(), 0, sizeof(*This)); EnumOleSTATDATA *This = HeapAlloc(GetProcessHeap(), 0, sizeof(*This));
if (!This) if (!This)
return E_OUTOFMEMORY; return E_OUTOFMEMORY;
This->lpvtbl = &EnumOleSTATDATA_VTable; This->IEnumSTATDATA_iface.lpVtbl = &EnumOleSTATDATA_VTable;
This->ref = 1; This->ref = 1;
This->index = index; This->index = index;
This->pOleAdviseHolder = pOleAdviseHolder; This->pOleAdviseHolder = pOleAdviseHolder;
IOleAdviseHolder_AddRef((IOleAdviseHolder *)pOleAdviseHolder); IOleAdviseHolder_AddRef((IOleAdviseHolder *)pOleAdviseHolder);
*ppenum = (IEnumSTATDATA *)&This->lpvtbl; *ppenum = &This->IEnumSTATDATA_iface;
return S_OK; return S_OK;
} }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment