From 8e77be63f4d4dd50f04e42fe39079019ecf1d759 Mon Sep 17 00:00:00 2001 From: Michael Stefaniuc Date: Wed, 8 Dec 2010 22:59:41 +0100 Subject: [PATCH] mmdevapi: Use an iface instead of a vtbl pointer in AEVImpl. --- dlls/mmdevapi/audiovolume.c | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) diff --git a/dlls/mmdevapi/audiovolume.c b/dlls/mmdevapi/audiovolume.c index 0a0dbc44e30..881cc419803 100644 --- a/dlls/mmdevapi/audiovolume.c +++ b/dlls/mmdevapi/audiovolume.c @@ -54,10 +54,15 @@ WINE_DEFAULT_DEBUG_CHANNEL(mmdevapi); static const IAudioEndpointVolumeExVtbl AEVImpl_Vtbl; typedef struct AEVImpl { - const IAudioEndpointVolumeExVtbl *lpVtbl; + IAudioEndpointVolumeEx IAudioEndpointVolumeEx_iface; LONG ref; } AEVImpl; +static inline AEVImpl *impl_from_IAudioEndpointVolumeEx(IAudioEndpointVolumeEx *iface) +{ + return CONTAINING_RECORD(iface, AEVImpl, IAudioEndpointVolumeEx_iface); +} + HRESULT AudioEndpointVolume_Create(MMDevice *parent, IAudioEndpointVolume **ppv) { AEVImpl *This; @@ -65,7 +70,7 @@ HRESULT AudioEndpointVolume_Create(MMDevice *parent, IAudioEndpointVolume **ppv) *ppv = (IAudioEndpointVolume*)This; if (!This) return E_OUTOFMEMORY; - This->lpVtbl = &AEVImpl_Vtbl; + This->IAudioEndpointVolumeEx_iface.lpVtbl = &AEVImpl_Vtbl; This->ref = 1; return S_OK; } @@ -77,7 +82,7 @@ static void AudioEndpointVolume_Destroy(AEVImpl *This) static HRESULT WINAPI AEV_QueryInterface(IAudioEndpointVolumeEx *iface, REFIID riid, void **ppv) { - AEVImpl *This = (AEVImpl*)iface; + AEVImpl *This = impl_from_IAudioEndpointVolumeEx(iface); TRACE("(%p)->(%s,%p)\n", This, debugstr_guid(riid), ppv); if (!ppv) return E_POINTER; @@ -95,7 +100,7 @@ static HRESULT WINAPI AEV_QueryInterface(IAudioEndpointVolumeEx *iface, REFIID r static ULONG WINAPI AEV_AddRef(IAudioEndpointVolumeEx *iface) { - AEVImpl *This = (AEVImpl*)iface; + AEVImpl *This = impl_from_IAudioEndpointVolumeEx(iface); ULONG ref = InterlockedIncrement(&This->ref); TRACE("(%p) new ref %u\n", This, ref); return ref; @@ -103,7 +108,7 @@ static ULONG WINAPI AEV_AddRef(IAudioEndpointVolumeEx *iface) static ULONG WINAPI AEV_Release(IAudioEndpointVolumeEx *iface) { - AEVImpl *This = (AEVImpl*)iface; + AEVImpl *This = impl_from_IAudioEndpointVolumeEx(iface); ULONG ref = InterlockedDecrement(&This->ref); TRACE("(%p) new ref %u\n", This, ref); if (!ref)