quartz: Use an iface instead of a vtbl pointer in IEnumRegFiltersImpl.

This commit is contained in:
Michael Stefaniuc 2010-12-08 22:59:34 +01:00 committed by Alexandre Julliard
parent 8e77be63f4
commit e86dff725f
1 changed files with 12 additions and 7 deletions

View File

@ -28,13 +28,18 @@ WINE_DEFAULT_DEBUG_CHANNEL(quartz);
typedef struct IEnumRegFiltersImpl typedef struct IEnumRegFiltersImpl
{ {
const IEnumRegFiltersVtbl * lpVtbl; IEnumRegFilters IEnumRegFilters_iface;
LONG refCount; LONG refCount;
ULONG size; ULONG size;
REGFILTER* RegFilters; REGFILTER* RegFilters;
ULONG uIndex; ULONG uIndex;
} IEnumRegFiltersImpl; } IEnumRegFiltersImpl;
static inline IEnumRegFiltersImpl *impl_from_IEnumRegFilters(IEnumRegFilters *iface)
{
return CONTAINING_RECORD(iface, IEnumRegFiltersImpl, IEnumRegFilters_iface);
}
static const struct IEnumRegFiltersVtbl IEnumRegFiltersImpl_Vtbl; static const struct IEnumRegFiltersVtbl IEnumRegFiltersImpl_Vtbl;
HRESULT IEnumRegFiltersImpl_Construct(REGFILTER* pInRegFilters, const ULONG size, IEnumRegFilters ** ppEnum) HRESULT IEnumRegFiltersImpl_Construct(REGFILTER* pInRegFilters, const ULONG size, IEnumRegFilters ** ppEnum)
@ -79,13 +84,13 @@ HRESULT IEnumRegFiltersImpl_Construct(REGFILTER* pInRegFilters, const ULONG size
CopyMemory(pRegFilters[i].Name, pInRegFilters[i].Name, (strlenW(pInRegFilters[i].Name)+1)*sizeof(WCHAR)); CopyMemory(pRegFilters[i].Name, pInRegFilters[i].Name, (strlenW(pInRegFilters[i].Name)+1)*sizeof(WCHAR));
} }
pEnumRegFilters->lpVtbl = &IEnumRegFiltersImpl_Vtbl; pEnumRegFilters->IEnumRegFilters_iface.lpVtbl = &IEnumRegFiltersImpl_Vtbl;
pEnumRegFilters->refCount = 1; pEnumRegFilters->refCount = 1;
pEnumRegFilters->uIndex = 0; pEnumRegFilters->uIndex = 0;
pEnumRegFilters->RegFilters = pRegFilters; pEnumRegFilters->RegFilters = pRegFilters;
pEnumRegFilters->size = size; pEnumRegFilters->size = size;
*ppEnum = (IEnumRegFilters *)(&pEnumRegFilters->lpVtbl); *ppEnum = &pEnumRegFilters->IEnumRegFilters_iface;
return S_OK; return S_OK;
} }
@ -114,7 +119,7 @@ static HRESULT WINAPI IEnumRegFiltersImpl_QueryInterface(IEnumRegFilters * iface
static ULONG WINAPI IEnumRegFiltersImpl_AddRef(IEnumRegFilters * iface) static ULONG WINAPI IEnumRegFiltersImpl_AddRef(IEnumRegFilters * iface)
{ {
IEnumRegFiltersImpl *This = (IEnumRegFiltersImpl *)iface; IEnumRegFiltersImpl *This = impl_from_IEnumRegFilters(iface);
ULONG refCount = InterlockedIncrement(&This->refCount); ULONG refCount = InterlockedIncrement(&This->refCount);
TRACE("(%p)\n", iface); TRACE("(%p)\n", iface);
@ -124,7 +129,7 @@ static ULONG WINAPI IEnumRegFiltersImpl_AddRef(IEnumRegFilters * iface)
static ULONG WINAPI IEnumRegFiltersImpl_Release(IEnumRegFilters * iface) static ULONG WINAPI IEnumRegFiltersImpl_Release(IEnumRegFilters * iface)
{ {
IEnumRegFiltersImpl *This = (IEnumRegFiltersImpl *)iface; IEnumRegFiltersImpl *This = impl_from_IEnumRegFilters(iface);
ULONG refCount = InterlockedDecrement(&This->refCount); ULONG refCount = InterlockedDecrement(&This->refCount);
TRACE("(%p)\n", iface); TRACE("(%p)\n", iface);
@ -147,7 +152,7 @@ static ULONG WINAPI IEnumRegFiltersImpl_Release(IEnumRegFilters * iface)
static HRESULT WINAPI IEnumRegFiltersImpl_Next(IEnumRegFilters * iface, ULONG cFilters, REGFILTER ** ppRegFilter, ULONG * pcFetched) static HRESULT WINAPI IEnumRegFiltersImpl_Next(IEnumRegFilters * iface, ULONG cFilters, REGFILTER ** ppRegFilter, ULONG * pcFetched)
{ {
ULONG cFetched; ULONG cFetched;
IEnumRegFiltersImpl *This = (IEnumRegFiltersImpl *)iface; IEnumRegFiltersImpl *This = impl_from_IEnumRegFilters(iface);
unsigned int i; unsigned int i;
cFetched = min(This->size, This->uIndex + cFilters) - This->uIndex; cFetched = min(This->size, This->uIndex + cFilters) - This->uIndex;
@ -193,7 +198,7 @@ static HRESULT WINAPI IEnumRegFiltersImpl_Skip(IEnumRegFilters * iface, ULONG n)
static HRESULT WINAPI IEnumRegFiltersImpl_Reset(IEnumRegFilters * iface) static HRESULT WINAPI IEnumRegFiltersImpl_Reset(IEnumRegFilters * iface)
{ {
IEnumRegFiltersImpl *This = (IEnumRegFiltersImpl *)iface; IEnumRegFiltersImpl *This = impl_from_IEnumRegFilters(iface);
TRACE("(%p)\n", iface); TRACE("(%p)\n", iface);