Nikolay Sivov : mmdevapi: Return interface pointers instead of impl pointers.
Alexandre Julliard
julliard at wine.codeweavers.com
Mon Jun 1 07:36:59 CDT 2015
Module: wine
Branch: master
Commit: 336cc787446a7b04f79415aec292a53e2a3844ad
URL: http://source.winehq.org/git/wine.git/?a=commit;h=336cc787446a7b04f79415aec292a53e2a3844ad
Author: Nikolay Sivov <nsivov at codeweavers.com>
Date: Sun May 31 23:12:25 2015 +0300
mmdevapi: Return interface pointers instead of impl pointers.
---
dlls/mmdevapi/audiovolume.c | 31 ++++++++++++++++---------------
dlls/mmdevapi/devenum.c | 10 +++++-----
2 files changed, 21 insertions(+), 20 deletions(-)
diff --git a/dlls/mmdevapi/audiovolume.c b/dlls/mmdevapi/audiovolume.c
index 194cfa3..7dddbdf 100644
--- a/dlls/mmdevapi/audiovolume.c
+++ b/dlls/mmdevapi/audiovolume.c
@@ -40,8 +40,6 @@
WINE_DEFAULT_DEBUG_CHANNEL(mmdevapi);
-static const IAudioEndpointVolumeExVtbl AEVImpl_Vtbl;
-
typedef struct AEVImpl {
IAudioEndpointVolumeEx IAudioEndpointVolumeEx_iface;
LONG ref;
@@ -52,18 +50,6 @@ static inline AEVImpl *impl_from_IAudioEndpointVolumeEx(IAudioEndpointVolumeEx *
return CONTAINING_RECORD(iface, AEVImpl, IAudioEndpointVolumeEx_iface);
}
-HRESULT AudioEndpointVolume_Create(MMDevice *parent, IAudioEndpointVolume **ppv)
-{
- AEVImpl *This;
- This = HeapAlloc(GetProcessHeap(), HEAP_ZERO_MEMORY, sizeof(*This));
- *ppv = (IAudioEndpointVolume*)This;
- if (!This)
- return E_OUTOFMEMORY;
- This->IAudioEndpointVolumeEx_iface.lpVtbl = &AEVImpl_Vtbl;
- This->ref = 1;
- return S_OK;
-}
-
static void AudioEndpointVolume_Destroy(AEVImpl *This)
{
HeapFree(GetProcessHeap(), 0, This);
@@ -79,7 +65,7 @@ static HRESULT WINAPI AEV_QueryInterface(IAudioEndpointVolumeEx *iface, REFIID r
if (IsEqualIID(riid, &IID_IUnknown) ||
IsEqualIID(riid, &IID_IAudioEndpointVolume) ||
IsEqualIID(riid, &IID_IAudioEndpointVolumeEx)) {
- *ppv = This;
+ *ppv = &This->IAudioEndpointVolumeEx_iface;
}
else
return E_NOINTERFACE;
@@ -286,3 +272,18 @@ static const IAudioEndpointVolumeExVtbl AEVImpl_Vtbl = {
AEV_GetVolumeRange,
AEV_GetVolumeRangeChannel
};
+
+HRESULT AudioEndpointVolume_Create(MMDevice *parent, IAudioEndpointVolume **ppv)
+{
+ AEVImpl *This;
+
+ *ppv = NULL;
+ This = HeapAlloc(GetProcessHeap(), 0, sizeof(*This));
+ if (!This)
+ return E_OUTOFMEMORY;
+ This->IAudioEndpointVolumeEx_iface.lpVtbl = &AEVImpl_Vtbl;
+ This->ref = 1;
+
+ *ppv = (IAudioEndpointVolume*)&This->IAudioEndpointVolumeEx_iface;
+ return S_OK;
+}
diff --git a/dlls/mmdevapi/devenum.c b/dlls/mmdevapi/devenum.c
index 1952bda..d50d206 100644
--- a/dlls/mmdevapi/devenum.c
+++ b/dlls/mmdevapi/devenum.c
@@ -551,7 +551,7 @@ static HRESULT WINAPI MMDevice_QueryInterface(IMMDevice *iface, REFIID riid, voi
*ppv = NULL;
if (IsEqualIID(riid, &IID_IUnknown)
|| IsEqualIID(riid, &IID_IMMDevice))
- *ppv = This;
+ *ppv = &This->IMMDevice_iface;
else if (IsEqualIID(riid, &IID_IMMEndpoint))
*ppv = &This->IMMEndpoint_iface;
if (*ppv)
@@ -797,7 +797,7 @@ static HRESULT WINAPI MMDevCol_QueryInterface(IMMDeviceCollection *iface, REFIID
return E_POINTER;
if (IsEqualIID(riid, &IID_IUnknown)
|| IsEqualIID(riid, &IID_IMMDeviceCollection))
- *ppv = This;
+ *ppv = &This->IMMDeviceCollection_iface;
else
*ppv = NULL;
if (!*ppv)
@@ -897,7 +897,7 @@ HRESULT MMDevEnum_Create(REFIID riid, void **ppv)
load_driver_devices(eRender);
load_driver_devices(eCapture);
}
- return IUnknown_QueryInterface((IUnknown*)This, riid, ppv);
+ return IMMDeviceEnumerator_QueryInterface(&This->IMMDeviceEnumerator_iface, riid, ppv);
}
void MMDevEnum_Free(void)
@@ -920,7 +920,7 @@ static HRESULT WINAPI MMDevEnum_QueryInterface(IMMDeviceEnumerator *iface, REFII
return E_POINTER;
if (IsEqualIID(riid, &IID_IUnknown)
|| IsEqualIID(riid, &IID_IMMDeviceEnumerator))
- *ppv = This;
+ *ppv = &This->IMMDeviceEnumerator_iface;
else
*ppv = NULL;
if (!*ppv)
@@ -1345,7 +1345,7 @@ static HRESULT WINAPI MMDevPropStore_QueryInterface(IPropertyStore *iface, REFII
return E_POINTER;
if (IsEqualIID(riid, &IID_IUnknown)
|| IsEqualIID(riid, &IID_IPropertyStore))
- *ppv = This;
+ *ppv = &This->IPropertyStore_iface;
else
*ppv = NULL;
if (!*ppv)
More information about the wine-cvs
mailing list