From 0c488e76b168b82c069f459e75afd26e6558070e Mon Sep 17 00:00:00 2001 From: Robert Reif Date: Thu, 27 Oct 2005 10:18:51 +0000 Subject: [PATCH] Remove unused variable from IDirectSoundFullDuplexImpl. Move DirectSoundFullDuplexCreate to get rid of forward declarations. --- dlls/dsound/dsound_private.h | 1 - dlls/dsound/duplex.c | 148 +++++++++++++++-------------------- 2 files changed, 65 insertions(+), 84 deletions(-) diff --git a/dlls/dsound/dsound_private.h b/dlls/dsound/dsound_private.h index 944335dd174..2ccf7fcd4d1 100644 --- a/dlls/dsound/dsound_private.h +++ b/dlls/dsound/dsound_private.h @@ -357,7 +357,6 @@ struct IDirectSoundFullDuplexImpl LONG ref; /* IDirectSoundFullDuplexImpl fields */ - CRITICAL_SECTION lock; }; /***************************************************************************** diff --git a/dlls/dsound/duplex.c b/dlls/dsound/duplex.c index fccd72893a4..424d14e51f2 100644 --- a/dlls/dsound/duplex.c +++ b/dlls/dsound/duplex.c @@ -43,7 +43,49 @@ WINE_DEFAULT_DEBUG_CHANNEL(dsound); -static HRESULT WINAPI IDirectSoundFullDuplexImpl_Initialize( +static HRESULT WINAPI +IDirectSoundFullDuplexImpl_QueryInterface( + LPDIRECTSOUNDFULLDUPLEX iface, + REFIID riid, + LPVOID* ppobj ) +{ + IDirectSoundFullDuplexImpl *This = (IDirectSoundFullDuplexImpl *)iface; + TRACE( "(%p,%s,%p)\n", This, debugstr_guid(riid), ppobj ); + + if (ppobj == NULL) { + WARN("invalid parameter\n"); + return E_INVALIDARG; + } + + *ppobj = NULL; + return E_NOINTERFACE; +} + +static ULONG WINAPI +IDirectSoundFullDuplexImpl_AddRef( LPDIRECTSOUNDFULLDUPLEX iface ) +{ + IDirectSoundFullDuplexImpl *This = (IDirectSoundFullDuplexImpl *)iface; + ULONG ref = InterlockedIncrement(&(This->ref)); + TRACE("(%p) ref was %ld\n", This, ref - 1); + return ref; +} + +static ULONG WINAPI +IDirectSoundFullDuplexImpl_Release( LPDIRECTSOUNDFULLDUPLEX iface ) +{ + IDirectSoundFullDuplexImpl *This = (IDirectSoundFullDuplexImpl *)iface; + ULONG ref = InterlockedDecrement(&(This->ref)); + TRACE("(%p) ref was %ld\n", This, ref - 1); + + if (!ref) { + HeapFree( GetProcessHeap(), 0, This ); + TRACE("(%p) released\n", This); + } + return ref; +} + +static HRESULT WINAPI +IDirectSoundFullDuplexImpl_Initialize( LPDIRECTSOUNDFULLDUPLEX iface, LPCGUID pCaptureGuid, LPCGUID pRendererGuid, @@ -52,9 +94,29 @@ static HRESULT WINAPI IDirectSoundFullDuplexImpl_Initialize( HWND hWnd, DWORD dwLevel, LPLPDIRECTSOUNDCAPTUREBUFFER8 lplpDirectSoundCaptureBuffer8, - LPLPDIRECTSOUNDBUFFER8 lplpDirectSoundBuffer8 ); + LPLPDIRECTSOUNDBUFFER8 lplpDirectSoundBuffer8 ) +{ + IDirectSoundFullDuplexImpl *This = (IDirectSoundFullDuplexImpl *)iface; + IDirectSoundCaptureBufferImpl** ippdscb=(IDirectSoundCaptureBufferImpl**)lplpDirectSoundCaptureBuffer8; + IDirectSoundBufferImpl** ippdsc=(IDirectSoundBufferImpl**)lplpDirectSoundBuffer8; -static const IDirectSoundFullDuplexVtbl dsfdvt; + FIXME( "(%p,%s,%s,%p,%p,%p,%lx,%p,%p) stub!\n", This, debugstr_guid(pCaptureGuid), + debugstr_guid(pRendererGuid), lpDscBufferDesc, lpDsBufferDesc, hWnd, dwLevel, + ippdscb, ippdsc); + + return E_FAIL; +} + +static const IDirectSoundFullDuplexVtbl dsfdvt = +{ + /* IUnknown methods */ + IDirectSoundFullDuplexImpl_QueryInterface, + IDirectSoundFullDuplexImpl_AddRef, + IDirectSoundFullDuplexImpl_Release, + + /* IDirectSoundFullDuplex methods */ + IDirectSoundFullDuplexImpl_Initialize +}; /*************************************************************************** * DirectSoundFullDuplexCreate [DSOUND.10] @@ -114,9 +176,6 @@ DirectSoundFullDuplexCreate( This->ref = 1; This->lpVtbl = &dsfdvt; - InitializeCriticalSection( &(This->lock) ); - This->lock.DebugInfo->Spare[0] = (DWORD_PTR)"DSDUPLEX_lock"; - hres = IDirectSoundFullDuplexImpl_Initialize( (LPDIRECTSOUNDFULLDUPLEX)This, pcGuidCaptureDevice, pcGuidRenderDevice, pcDSCBufferDesc, pcDSBufferDesc, @@ -127,83 +186,6 @@ DirectSoundFullDuplexCreate( } } -static HRESULT WINAPI -IDirectSoundFullDuplexImpl_QueryInterface( - LPDIRECTSOUNDFULLDUPLEX iface, - REFIID riid, - LPVOID* ppobj ) -{ - IDirectSoundFullDuplexImpl *This = (IDirectSoundFullDuplexImpl *)iface; - TRACE( "(%p,%s,%p)\n", This, debugstr_guid(riid), ppobj ); - - if (ppobj == NULL) { - WARN("invalid parameter\n"); - return E_INVALIDARG; - } - - *ppobj = NULL; - return E_NOINTERFACE; -} - -static ULONG WINAPI -IDirectSoundFullDuplexImpl_AddRef( LPDIRECTSOUNDFULLDUPLEX iface ) -{ - IDirectSoundFullDuplexImpl *This = (IDirectSoundFullDuplexImpl *)iface; - ULONG ref = InterlockedIncrement(&(This->ref)); - TRACE("(%p) ref was %ld\n", This, ref - 1); - return ref; -} - -static ULONG WINAPI -IDirectSoundFullDuplexImpl_Release( LPDIRECTSOUNDFULLDUPLEX iface ) -{ - IDirectSoundFullDuplexImpl *This = (IDirectSoundFullDuplexImpl *)iface; - ULONG ref = InterlockedDecrement(&(This->ref)); - TRACE("(%p) ref was %ld\n", This, ref - 1); - - if (!ref) { - This->lock.DebugInfo->Spare[0] = 0; - DeleteCriticalSection( &(This->lock) ); - HeapFree( GetProcessHeap(), 0, This ); - TRACE("(%p) released\n", This); - } - return ref; -} - -static HRESULT WINAPI -IDirectSoundFullDuplexImpl_Initialize( - LPDIRECTSOUNDFULLDUPLEX iface, - LPCGUID pCaptureGuid, - LPCGUID pRendererGuid, - LPCDSCBUFFERDESC lpDscBufferDesc, - LPCDSBUFFERDESC lpDsBufferDesc, - HWND hWnd, - DWORD dwLevel, - LPLPDIRECTSOUNDCAPTUREBUFFER8 lplpDirectSoundCaptureBuffer8, - LPLPDIRECTSOUNDBUFFER8 lplpDirectSoundBuffer8 ) -{ - IDirectSoundFullDuplexImpl *This = (IDirectSoundFullDuplexImpl *)iface; - IDirectSoundCaptureBufferImpl** ippdscb=(IDirectSoundCaptureBufferImpl**)lplpDirectSoundCaptureBuffer8; - IDirectSoundBufferImpl** ippdsc=(IDirectSoundBufferImpl**)lplpDirectSoundBuffer8; - - FIXME( "(%p,%s,%s,%p,%p,%p,%lx,%p,%p) stub!\n", This, debugstr_guid(pCaptureGuid), - debugstr_guid(pRendererGuid), lpDscBufferDesc, lpDsBufferDesc, hWnd, dwLevel, - ippdscb, ippdsc); - - return E_FAIL; -} - -static const IDirectSoundFullDuplexVtbl dsfdvt = -{ - /* IUnknown methods */ - IDirectSoundFullDuplexImpl_QueryInterface, - IDirectSoundFullDuplexImpl_AddRef, - IDirectSoundFullDuplexImpl_Release, - - /* IDirectSoundFullDuplex methods */ - IDirectSoundFullDuplexImpl_Initialize -}; - /******************************************************************************* * DirectSoundFullDuplex ClassFactory */