From dacdf35cbf580df5091dc229ff49131ccec9e04d Mon Sep 17 00:00:00 2001 From: Chris Robinson Date: Sun, 31 Jul 2011 19:37:45 -0700 Subject: [PATCH] Avoid an upcast --- dsound8.c | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/dsound8.c b/dsound8.c index ce061e8cbf6..f816f26ca78 100644 --- a/dsound8.c +++ b/dsound8.c @@ -61,7 +61,12 @@ static UINT devicelistsize; static const IDirectSound8Vtbl DS8_Vtbl; -HRESULT DSOUND_Create(REFIID riid, LPVOID *ds) +static inline DS8Impl *impl_from_IDirectSound8(IDirectSound8 *iface) +{ + return CONTAINING_RECORD(iface, DS8Impl, IDirectSound8_iface); +} + +HRESULT DSOUND_Create(REFIID riid, void **ds) { HRESULT hr; @@ -69,7 +74,10 @@ HRESULT DSOUND_Create(REFIID riid, LPVOID *ds) return E_NOINTERFACE; hr = DSOUND_Create8(riid, ds); if(hr == S_OK) - ((DS8Impl*)*ds)->is_8 = FALSE; + { + DS8Impl *impl = impl_from_IDirectSound8(*ds); + impl->is_8 = FALSE; + } return hr; } @@ -190,10 +198,6 @@ static void DS8Impl_Destroy(DS8Impl *This) HeapFree(GetProcessHeap(), 0, This); } -static inline DS8Impl *impl_from_IDirectSound8(IDirectSound8 *iface) -{ - return CONTAINING_RECORD(iface, DS8Impl, IDirectSound8_iface); -} static HRESULT WINAPI DS8_QueryInterface(IDirectSound8 *iface, REFIID riid, LPVOID *ppv) { -- 2.11.4.GIT