Michael Stefaniuc : mmdevapi: Use an iface instead of a vtbl pointer in AEVImpl.
Alexandre Julliard
julliard at winehq.org
Thu Dec 9 12:26:25 CST 2010
Module: wine
Branch: master
Commit: 8e77be63f4d4dd50f04e42fe39079019ecf1d759
URL: http://source.winehq.org/git/wine.git/?a=commit;h=8e77be63f4d4dd50f04e42fe39079019ecf1d759
Author: Michael Stefaniuc <mstefani at redhat.de>
Date: Wed Dec 8 22:59:41 2010 +0100
mmdevapi: Use an iface instead of a vtbl pointer in AEVImpl.
---
dlls/mmdevapi/audiovolume.c | 15 ++++++++++-----
1 files changed, 10 insertions(+), 5 deletions(-)
diff --git a/dlls/mmdevapi/audiovolume.c b/dlls/mmdevapi/audiovolume.c
index 0a0dbc4..881cc41 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)
More information about the wine-cvs
mailing list