From f8833daef10c697d1f15ee83bab20bb84f3b3131 Mon Sep 17 00:00:00 2001 From: Robert Reif Date: Fri, 11 Feb 2005 11:49:05 +0000 Subject: [PATCH] Removed printing of thread id for AddRef and Release because WINEDEBUG=+tid gives the same result. General consistency cleanup. --- dlls/dsound/buffer.c | 90 +++++++++++++++++++------------------- dlls/dsound/capture.c | 76 ++++++++++++++++---------------- dlls/dsound/dsound.c | 107 ++++++++++++++++++++++------------------------ dlls/dsound/dsound_main.c | 47 +++++++++++--------- dlls/dsound/primary.c | 34 +++++++-------- dlls/dsound/propset.c | 36 ++++++++-------- dlls/dsound/sound3d.c | 62 +++++++++++++-------------- 7 files changed, 223 insertions(+), 229 deletions(-) diff --git a/dlls/dsound/buffer.c b/dlls/dsound/buffer.c index 140d02b1596..3a695ca8e72 100644 --- a/dlls/dsound/buffer.c +++ b/dlls/dsound/buffer.c @@ -54,25 +54,25 @@ static HRESULT WINAPI IDirectSoundNotifyImpl_QueryInterface( static ULONG WINAPI IDirectSoundNotifyImpl_AddRef(LPDIRECTSOUNDNOTIFY iface) { - IDirectSoundNotifyImpl *This = (IDirectSoundNotifyImpl *)iface; - TRACE("(%p) ref was %ld, thread is %04lx\n",This, This->ref, GetCurrentThreadId()); - return InterlockedIncrement(&(This->ref)); + IDirectSoundNotifyImpl *This = (IDirectSoundNotifyImpl *)iface; + ULONG ref = InterlockedIncrement(&(This->ref)); + TRACE("(%p) ref was %ld\n", This, ref - 1); + return ref; } -static ULONG WINAPI IDirectSoundNotifyImpl_Release(LPDIRECTSOUNDNOTIFY iface) { - IDirectSoundNotifyImpl *This = (IDirectSoundNotifyImpl *)iface; - ULONG ref; - - TRACE("(%p) ref was %ld, thread is %04lx\n",This, This->ref, GetCurrentThreadId()); - - ref = InterlockedDecrement(&(This->ref)); - if (ref == 0) { - IDirectSoundBuffer_Release((LPDIRECTSOUNDBUFFER)This->dsb); - This->dsb->notify = NULL; - HeapFree(GetProcessHeap(),0,This); - TRACE("(%p) released\n",This); - } - return ref; +static ULONG WINAPI IDirectSoundNotifyImpl_Release(LPDIRECTSOUNDNOTIFY iface) +{ + IDirectSoundNotifyImpl *This = (IDirectSoundNotifyImpl *)iface; + ULONG ref = InterlockedDecrement(&(This->ref)); + TRACE("(%p) ref was %ld\n", This, ref + 1); + + if (!ref) { + IDirectSoundBuffer_Release((LPDIRECTSOUNDBUFFER)This->dsb); + This->dsb->notify = NULL; + HeapFree(GetProcessHeap(), 0, This); + TRACE("(%p) released\n", This); + } + return ref; } static HRESULT WINAPI IDirectSoundNotifyImpl_SetNotificationPositions( @@ -350,22 +350,19 @@ static HRESULT WINAPI IDirectSoundBufferImpl_Stop(LPDIRECTSOUNDBUFFER8 iface) static ULONG WINAPI IDirectSoundBufferImpl_AddRef(LPDIRECTSOUNDBUFFER8 iface) { - IDirectSoundBufferImpl *This = (IDirectSoundBufferImpl *)iface; - TRACE("(%p) ref was %ld, thread is %04lx\n",This, This->ref, GetCurrentThreadId()); - return InterlockedIncrement(&(This->ref)); + IDirectSoundBufferImpl *This = (IDirectSoundBufferImpl *)iface; + ULONG ref = InterlockedIncrement(&(This->ref)); + TRACE("(%p) ref was %ld\n", This, ref - 1); + return ref; } static ULONG WINAPI IDirectSoundBufferImpl_Release(LPDIRECTSOUNDBUFFER8 iface) { - IDirectSoundBufferImpl *This = (IDirectSoundBufferImpl *)iface; - ULONG ref; - - TRACE("(%p) ref was %ld, thread is %04lx\n",This, This->ref, GetCurrentThreadId()); - - ref = InterlockedDecrement(&(This->ref)); - if (ref) - return ref; + IDirectSoundBufferImpl *This = (IDirectSoundBufferImpl *)iface; + ULONG ref = InterlockedDecrement(&(This->ref)); + TRACE("(%p) ref was %ld\n", This, ref + 1); + if (!ref) { DSOUND_RemoveBuffer(This->dsound, This); This->lock.DebugInfo->Spare[1] = 0; @@ -390,10 +387,11 @@ static ULONG WINAPI IDirectSoundBufferImpl_Release(LPDIRECTSOUNDBUFFER8 iface) HeapFree(GetProcessHeap(), 0, This->notifies); HeapFree(GetProcessHeap(), 0, This->pwfx); - HeapFree(GetProcessHeap(),0,This); + HeapFree(GetProcessHeap(), 0, This); - TRACE("(%p) released\n",This); - return 0; + TRACE("(%p) released\n", This); + } + return ref; } DWORD DSOUND_CalcPlayPosition(IDirectSoundBufferImpl *This, @@ -1246,25 +1244,25 @@ static HRESULT WINAPI SecondaryBufferImpl_QueryInterface( static ULONG WINAPI SecondaryBufferImpl_AddRef(LPDIRECTSOUNDBUFFER8 iface) { - IDirectSoundBufferImpl *This = (IDirectSoundBufferImpl *)iface; - TRACE("(%p) ref was %ld, thread is %04lx\n",This, This->ref, GetCurrentThreadId()); - return InterlockedIncrement(&(This->ref)); + IDirectSoundBufferImpl *This = (IDirectSoundBufferImpl *)iface; + ULONG ref = InterlockedIncrement(&(This->ref)); + TRACE("(%p) ref was %ld\n", This, ref - 1); + return ref; } static ULONG WINAPI SecondaryBufferImpl_Release(LPDIRECTSOUNDBUFFER8 iface) { - IDirectSoundBufferImpl *This = (IDirectSoundBufferImpl *)iface; - ULONG ref; - TRACE("(%p) ref was %ld, thread is %04lx\n",This, This->ref, GetCurrentThreadId()); - - ref = InterlockedDecrement(&(This->ref)); - if (!ref) { - This->dsb->dsb = NULL; - IDirectSoundBuffer_Release((LPDIRECTSOUNDBUFFER8)This->dsb); - HeapFree(GetProcessHeap(),0,This); - TRACE("(%p) released\n",This); - } - return ref; + IDirectSoundBufferImpl *This = (IDirectSoundBufferImpl *)iface; + ULONG ref = InterlockedDecrement(&(This->ref)); + TRACE("(%p) ref was %ld\n", This, ref + 1); + + if (!ref) { + This->dsb->dsb = NULL; + IDirectSoundBuffer_Release((LPDIRECTSOUNDBUFFER8)This->dsb); + HeapFree(GetProcessHeap(), 0, This); + TRACE("(%p) released\n", This); + } + return ref; } static HRESULT WINAPI SecondaryBufferImpl_GetCaps( diff --git a/dlls/dsound/capture.c b/dlls/dsound/capture.c index 614b676ac13..077ed45b7bd 100644 --- a/dlls/dsound/capture.c +++ b/dlls/dsound/capture.c @@ -363,19 +363,19 @@ static ULONG WINAPI IDirectSoundCaptureImpl_AddRef( LPDIRECTSOUNDCAPTURE iface ) { IDirectSoundCaptureImpl *This = (IDirectSoundCaptureImpl *)iface; - TRACE("(%p) ref was %ld, thread is %04lx\n",This, This->ref, GetCurrentThreadId()); - return InterlockedIncrement(&(This->ref)); + ULONG ref = InterlockedIncrement(&(This->ref)); + TRACE("(%p) ref was %ld\n", This, ref - 1); + return ref; } static ULONG WINAPI IDirectSoundCaptureImpl_Release( LPDIRECTSOUNDCAPTURE iface ) { - ULONG uRef; IDirectSoundCaptureImpl *This = (IDirectSoundCaptureImpl *)iface; - TRACE("(%p) ref was %ld, thread is %04lx\n",This, This->ref, GetCurrentThreadId()); + ULONG ref = InterlockedDecrement(&(This->ref)); + TRACE("(%p) ref was %ld\n", This, ref + 1); - uRef = InterlockedDecrement(&(This->ref)); - if ( uRef == 0 ) { + if (!ref) { TRACE("deleting object\n"); if (This->capture_buffer) IDirectSoundCaptureBufferImpl_Release( @@ -391,10 +391,9 @@ IDirectSoundCaptureImpl_Release( LPDIRECTSOUNDCAPTURE iface ) DeleteCriticalSection( &(This->lock) ); HeapFree( GetProcessHeap(), 0, This ); dsound_capture = NULL; - TRACE("(%p) released\n",This); + TRACE("(%p) released\n", This); } - - return uRef; + return ref; } static HRESULT WINAPI @@ -788,25 +787,24 @@ static HRESULT WINAPI IDirectSoundCaptureNotifyImpl_QueryInterface( static ULONG WINAPI IDirectSoundCaptureNotifyImpl_AddRef(LPDIRECTSOUNDNOTIFY iface) { IDirectSoundCaptureNotifyImpl *This = (IDirectSoundCaptureNotifyImpl *)iface; - TRACE("(%p) ref was %ld, thread is %04lx\n",This, This->ref, GetCurrentThreadId()); - return InterlockedIncrement(&(This->ref)); + ULONG ref = InterlockedIncrement(&(This->ref)); + TRACE("(%p) ref was %ld\n", This, ref - 1); + return ref; } static ULONG WINAPI IDirectSoundCaptureNotifyImpl_Release(LPDIRECTSOUNDNOTIFY iface) { IDirectSoundCaptureNotifyImpl *This = (IDirectSoundCaptureNotifyImpl *)iface; - ULONG ref; + ULONG ref = InterlockedDecrement(&(This->ref)); + TRACE("(%p) ref was %ld\n", This, ref + 1); - TRACE("(%p) ref was %ld, thread is %04lx\n",This, This->ref, GetCurrentThreadId()); - - ref = InterlockedDecrement(&(This->ref)); - if (ref == 0) { + if (!ref) { if (This->dscb->hwnotify) IDsDriverNotify_Release(This->dscb->hwnotify); This->dscb->notify=NULL; IDirectSoundCaptureBuffer_Release((LPDIRECTSOUNDCAPTUREBUFFER)This->dscb); HeapFree(GetProcessHeap(),0,This); - TRACE("(%p) released\n",This); + TRACE("(%p) released\n", This); } return ref; } @@ -952,19 +950,19 @@ static ULONG WINAPI IDirectSoundCaptureBufferImpl_AddRef( LPDIRECTSOUNDCAPTUREBUFFER8 iface ) { IDirectSoundCaptureBufferImpl *This = (IDirectSoundCaptureBufferImpl *)iface; - TRACE("(%p) ref was %ld, thread is %04lx\n",This, This->ref, GetCurrentThreadId()); - return InterlockedIncrement(&(This->ref)); + ULONG ref = InterlockedIncrement(&(This->ref)); + TRACE("(%p) ref was %ld\n", This, ref - 1); + return ref; } static ULONG WINAPI IDirectSoundCaptureBufferImpl_Release( LPDIRECTSOUNDCAPTUREBUFFER8 iface ) { - ULONG uRef; IDirectSoundCaptureBufferImpl *This = (IDirectSoundCaptureBufferImpl *)iface; - TRACE("(%p) ref was %ld, thread is %04lx\n",This, This->ref, GetCurrentThreadId()); + ULONG ref = InterlockedDecrement(&(This->ref)); + TRACE("(%p) ref was %ld\n", This, ref + 1); - uRef = InterlockedDecrement(&(This->ref)); - if ( uRef == 0 ) { + if (!ref) { TRACE("deleting object\n"); if (This->dsound->state == STATE_CAPTURING) This->dsound->state = STATE_STOPPING; @@ -993,10 +991,9 @@ IDirectSoundCaptureBufferImpl_Release( LPDIRECTSOUNDCAPTUREBUFFER8 iface ) HeapFree(GetProcessHeap(), 0, This->notifies); HeapFree( GetProcessHeap(), 0, This ); - TRACE("(%p) released\n",This); + TRACE("(%p) released\n", This); } - - return uRef; + return ref; } static HRESULT WINAPI @@ -1578,17 +1575,19 @@ static ULONG WINAPI DSCCF_AddRef(LPCLASSFACTORY iface) { IClassFactoryImpl *This = (IClassFactoryImpl *)iface; - TRACE("(%p) ref was %ld\n", This, This->ref); - return InterlockedIncrement(&(This->ref)); + ULONG ref = InterlockedIncrement(&(This->ref)); + TRACE("(%p) ref was %ld\n", This, ref - 1); + return ref; } static ULONG WINAPI DSCCF_Release(LPCLASSFACTORY iface) { IClassFactoryImpl *This = (IClassFactoryImpl *)iface; + ULONG ref = InterlockedDecrement(&(This->ref)); + TRACE("(%p) ref was %ld\n", This, ref + 1); /* static class, won't be freed */ - TRACE("(%p) ref was %ld\n", This, This->ref); - return InterlockedDecrement(&(This->ref)); + return ref; } static HRESULT WINAPI @@ -1729,26 +1728,25 @@ static ULONG WINAPI IDirectSoundFullDuplexImpl_AddRef( LPDIRECTSOUNDFULLDUPLEX iface ) { IDirectSoundFullDuplexImpl *This = (IDirectSoundFullDuplexImpl *)iface; - TRACE("(%p) ref was %ld, thread is %04lx\n",This, This->ref, GetCurrentThreadId()); - return InterlockedIncrement(&(This->ref)); + ULONG ref = InterlockedIncrement(&(This->ref)); + TRACE("(%p) ref was %ld\n", This, ref - 1); + return ref; } static ULONG WINAPI IDirectSoundFullDuplexImpl_Release( LPDIRECTSOUNDFULLDUPLEX iface ) { - ULONG uRef; IDirectSoundFullDuplexImpl *This = (IDirectSoundFullDuplexImpl *)iface; - TRACE("(%p) ref was %ld, thread is %04lx\n",This, This->ref, GetCurrentThreadId()); + ULONG ref = InterlockedDecrement(&(This->ref)); + TRACE("(%p) ref was %ld\n", This, ref - 1); - uRef = InterlockedDecrement(&(This->ref)); - if ( uRef == 0 ) { + if (!ref) { This->lock.DebugInfo->Spare[1] = 0; DeleteCriticalSection( &(This->lock) ); HeapFree( GetProcessHeap(), 0, This ); - TRACE("(%p) released\n",This); + TRACE("(%p) released\n", This); } - - return uRef; + return ref; } static HRESULT WINAPI diff --git a/dlls/dsound/dsound.c b/dlls/dsound/dsound.c index a1af97d02b0..ef94c7c53f3 100644 --- a/dlls/dsound/dsound.c +++ b/dlls/dsound/dsound.c @@ -230,21 +230,19 @@ static ULONG WINAPI IDirectSoundImpl_AddRef( LPDIRECTSOUND8 iface) { IDirectSoundImpl *This = (IDirectSoundImpl *)iface; - TRACE("(%p) ref was %ld, thread is %04lx\n", This, This->ref, GetCurrentThreadId()); - - return InterlockedIncrement(&(This->ref)); + ULONG ref = InterlockedIncrement(&(This->ref)); + TRACE("(%p) ref was %ld\n", This, ref - 1); + return ref; } static ULONG WINAPI IDirectSoundImpl_Release( LPDIRECTSOUND8 iface) { IDirectSoundImpl *This = (IDirectSoundImpl *)iface; - ULONG ref; - TRACE("(%p) ref was %ld, thread is %04lx\n", - This, This->ref, GetCurrentThreadId()); + ULONG ref = InterlockedDecrement(&(This->ref)); + TRACE("(%p) ref was %ld\n", This, ref + 1); - ref = InterlockedDecrement(&(This->ref)); - if (ref == 0) { + if (!ref) { HRESULT hres; INT i; @@ -291,9 +289,8 @@ static ULONG WINAPI IDirectSoundImpl_Release( DeleteCriticalSection(&This->mixlock); HeapFree(GetProcessHeap(),0,This); dsound = NULL; - TRACE("(%p) released\n",This); + TRACE("(%p) released\n", This); } - return ref; } @@ -971,23 +968,23 @@ static ULONG WINAPI IDirectSound_IUnknown_AddRef( LPUNKNOWN iface) { IDirectSound_IUnknown *This = (IDirectSound_IUnknown *)iface; - TRACE("(%p) ref was %ld, thread is %04lx\n", This, This->ref, GetCurrentThreadId()); - return InterlockedIncrement(&(This->ref)); + ULONG ref = InterlockedIncrement(&(This->ref)); + TRACE("(%p) ref was %ld\n", This, ref - 1); + return ref; } static ULONG WINAPI IDirectSound_IUnknown_Release( LPUNKNOWN iface) { IDirectSound_IUnknown *This = (IDirectSound_IUnknown *)iface; - ULONG ulReturn; - TRACE("(%p) ref was %ld, thread is %04lx\n", This, This->ref, GetCurrentThreadId()); - ulReturn = InterlockedDecrement(&(This->ref)); - if (ulReturn == 0) { + ULONG ref = InterlockedDecrement(&(This->ref)); + TRACE("(%p) ref was %ld\n", This, ref + 1); + if (!ref) { IDirectSoundImpl_Release(This->pds); - HeapFree(GetProcessHeap(),0,This); - TRACE("(%p) released\n",This); + HeapFree(GetProcessHeap(), 0, This); + TRACE("(%p) released\n", This); } - return ulReturn; + return ref; } static IUnknownVtbl DirectSound_Unknown_Vtbl = @@ -1049,23 +1046,23 @@ static ULONG WINAPI IDirectSound_IDirectSound_AddRef( LPDIRECTSOUND iface) { IDirectSound_IDirectSound *This = (IDirectSound_IDirectSound *)iface; - TRACE("(%p) ref was %ld, thread is %04lx\n", This, This->ref, GetCurrentThreadId()); - return InterlockedIncrement(&(This->ref)); + ULONG ref = InterlockedIncrement(&(This->ref)); + TRACE("(%p) ref was %ld\n", This, ref - 1); + return ref; } static ULONG WINAPI IDirectSound_IDirectSound_Release( LPDIRECTSOUND iface) { IDirectSound_IDirectSound *This = (IDirectSound_IDirectSound *)iface; - ULONG ulReturn; - TRACE("(%p) ref was %ld, thread is %04lx\n", This, This->ref, GetCurrentThreadId()); - ulReturn = InterlockedDecrement(&This->ref); - if (ulReturn == 0) { + ULONG ref = InterlockedDecrement(&(This->ref)); + TRACE("(%p) ref was %ld\n", This, ref + 1); + if (!ref) { IDirectSoundImpl_Release(This->pds); - HeapFree(GetProcessHeap(),0,This); - TRACE("(%p) released\n",This); + HeapFree(GetProcessHeap(), 0, This); + TRACE("(%p) released\n", This); } - return ulReturn; + return ref; } static HRESULT WINAPI IDirectSound_IDirectSound_CreateSoundBuffer( @@ -1210,23 +1207,23 @@ static ULONG WINAPI IDirectSound8_IUnknown_AddRef( LPUNKNOWN iface) { IDirectSound_IUnknown *This = (IDirectSound_IUnknown *)iface; - TRACE("(%p) ref was %ld, thread is %04lx\n", This, This->ref, GetCurrentThreadId()); - return InterlockedIncrement(&(This->ref)); + ULONG ref = InterlockedIncrement(&(This->ref)); + TRACE("(%p) ref was %ld\n", This, ref - 1); + return ref; } static ULONG WINAPI IDirectSound8_IUnknown_Release( LPUNKNOWN iface) { IDirectSound_IUnknown *This = (IDirectSound_IUnknown *)iface; - ULONG ulReturn; - TRACE("(%p) ref was %ld, thread is %04lx\n", This, This->ref, GetCurrentThreadId()); - ulReturn = InterlockedDecrement(&(This->ref)); - if (ulReturn == 0) { + ULONG ref = InterlockedDecrement(&(This->ref)); + TRACE("(%p) ref was %ld\n", This, ref + 1); + if (!ref) { IDirectSoundImpl_Release(This->pds); - HeapFree(GetProcessHeap(),0,This); - TRACE("(%p) released\n",This); + HeapFree(GetProcessHeap(), 0, This); + TRACE("(%p) released\n", This); } - return ulReturn; + return ref; } static IUnknownVtbl DirectSound8_Unknown_Vtbl = @@ -1288,23 +1285,23 @@ static ULONG WINAPI IDirectSound8_IDirectSound_AddRef( LPDIRECTSOUND iface) { IDirectSound8_IDirectSound *This = (IDirectSound8_IDirectSound *)iface; - TRACE("(%p) ref was %ld, thread is %04lx\n", This, This->ref, GetCurrentThreadId()); - return InterlockedIncrement(&(This->ref)); + ULONG ref = InterlockedIncrement(&(This->ref)); + TRACE("(%p) ref was %ld\n", This, ref - 1); + return ref; } static ULONG WINAPI IDirectSound8_IDirectSound_Release( LPDIRECTSOUND iface) { IDirectSound8_IDirectSound *This = (IDirectSound8_IDirectSound *)iface; - ULONG ulReturn; - TRACE("(%p) ref was %ld, thread is %04lx\n", This, This->ref, GetCurrentThreadId()); - ulReturn = InterlockedDecrement(&(This->ref)); - if (ulReturn == 0) { + ULONG ref = InterlockedDecrement(&(This->ref)); + TRACE("(%p) ref was %ld\n", This, ref + 1); + if (!ref) { IDirectSoundImpl_Release(This->pds); - HeapFree(GetProcessHeap(),0,This); - TRACE("(%p) released\n",This); + HeapFree(GetProcessHeap(), 0, This); + TRACE("(%p) released\n", This); } - return ulReturn; + return ref; } static HRESULT WINAPI IDirectSound8_IDirectSound_CreateSoundBuffer( @@ -1449,23 +1446,23 @@ static ULONG WINAPI IDirectSound8_IDirectSound8_AddRef( LPDIRECTSOUND8 iface) { IDirectSound8_IDirectSound8 *This = (IDirectSound8_IDirectSound8 *)iface; - TRACE("(%p) ref was %ld, thread is %04lx\n", This, This->ref, GetCurrentThreadId()); - return InterlockedIncrement(&(This->ref)); + ULONG ref = InterlockedIncrement(&(This->ref)); + TRACE("(%p) ref was %ld\n", This, ref - 1); + return ref; } static ULONG WINAPI IDirectSound8_IDirectSound8_Release( LPDIRECTSOUND8 iface) { IDirectSound8_IDirectSound8 *This = (IDirectSound8_IDirectSound8 *)iface; - ULONG ulReturn; - TRACE("(%p) ref was %ld, thread is %04lx\n", This, This->ref, GetCurrentThreadId()); - ulReturn = InterlockedDecrement(&(This->ref)); - if (ulReturn == 0) { + ULONG ref = InterlockedDecrement(&(This->ref)); + TRACE("(%p) ref was %ld\n", This, ref + 1); + if (!ref) { IDirectSoundImpl_Release(This->pds); - HeapFree(GetProcessHeap(),0,This); - TRACE("(%p) released\n",This); + HeapFree(GetProcessHeap(), 0, This); + TRACE("(%p) released\n", This); } - return ulReturn; + return ref; } static HRESULT WINAPI IDirectSound8_IDirectSound8_CreateSoundBuffer( diff --git a/dlls/dsound/dsound_main.c b/dlls/dsound/dsound_main.c index 5d0193ae3ad..d6d1047806f 100644 --- a/dlls/dsound/dsound_main.c +++ b/dlls/dsound/dsound_main.c @@ -427,18 +427,21 @@ DSCF_QueryInterface(LPCLASSFACTORY iface,REFIID riid,LPVOID *ppobj) { return E_NOINTERFACE; } -static ULONG WINAPI -DSCF_AddRef(LPCLASSFACTORY iface) { - IClassFactoryImpl *This = (IClassFactoryImpl *)iface; - TRACE("(%p) ref was %ld\n", This, This->ref); - return InterlockedIncrement(&(This->ref)); +static ULONG WINAPI DSCF_AddRef(LPCLASSFACTORY iface) +{ + IClassFactoryImpl *This = (IClassFactoryImpl *)iface; + ULONG ref = InterlockedIncrement(&(This->ref)); + TRACE("(%p) ref was %ld\n", This, ref - 1); + return ref; } -static ULONG WINAPI DSCF_Release(LPCLASSFACTORY iface) { - IClassFactoryImpl *This = (IClassFactoryImpl *)iface; - /* static class, won't be freed */ - TRACE("(%p) ref was %ld\n", This, This->ref); - return InterlockedDecrement(&(This->ref)); +static ULONG WINAPI DSCF_Release(LPCLASSFACTORY iface) +{ + IClassFactoryImpl *This = (IClassFactoryImpl *)iface; + ULONG ref = InterlockedDecrement(&(This->ref)); + TRACE("(%p) ref was %ld\n", This, ref + 1); + /* static class, won't be freed */ + return ref; } static HRESULT WINAPI DSCF_CreateInstance( @@ -495,19 +498,21 @@ DSPCF_QueryInterface(LPCLASSFACTORY iface,REFIID riid,LPVOID *ppobj) { return E_NOINTERFACE; } -static ULONG WINAPI -DSPCF_AddRef(LPCLASSFACTORY iface) { - IClassFactoryImpl *This = (IClassFactoryImpl *)iface; - TRACE("(%p) ref was %ld\n", This, This->ref); - return InterlockedIncrement(&(This->ref)); +static ULONG WINAPI DSPCF_AddRef(LPCLASSFACTORY iface) +{ + IClassFactoryImpl *This = (IClassFactoryImpl *)iface; + ULONG ref = InterlockedIncrement(&(This->ref)); + TRACE("(%p) ref was %ld\n", This, ref - 1); + return ref; } -static ULONG WINAPI -DSPCF_Release(LPCLASSFACTORY iface) { - IClassFactoryImpl *This = (IClassFactoryImpl *)iface; - /* static class, won't be freed */ - TRACE("(%p) ref was %ld\n", This, This->ref); - return InterlockedDecrement(&(This->ref)); +static ULONG WINAPI DSPCF_Release(LPCLASSFACTORY iface) +{ + IClassFactoryImpl *This = (IClassFactoryImpl *)iface; + ULONG ref = InterlockedDecrement(&(This->ref)); + TRACE("(%p) ref was %ld\n", This, ref + 1); + /* static class, won't be freed */ + return ref; } static HRESULT WINAPI diff --git a/dlls/dsound/primary.c b/dlls/dsound/primary.c index dfdf635f43d..f46fd72b143 100644 --- a/dlls/dsound/primary.c +++ b/dlls/dsound/primary.c @@ -562,26 +562,26 @@ static HRESULT WINAPI PrimaryBufferImpl_Stop(LPDIRECTSOUNDBUFFER8 iface) return DS_OK; } -static ULONG WINAPI PrimaryBufferImpl_AddRef(LPDIRECTSOUNDBUFFER8 iface) { - PrimaryBufferImpl *This = (PrimaryBufferImpl *)iface; - TRACE("(%p) ref was %ld, thread is %04lx\n",This, This->ref, GetCurrentThreadId()); - return InterlockedIncrement(&(This->ref)); +static ULONG WINAPI PrimaryBufferImpl_AddRef(LPDIRECTSOUNDBUFFER8 iface) +{ + PrimaryBufferImpl *This = (PrimaryBufferImpl *)iface; + ULONG ref = InterlockedIncrement(&(This->ref)); + TRACE("(%p) ref was %ld\n", This, ref - 1); + return ref; } -static ULONG WINAPI PrimaryBufferImpl_Release(LPDIRECTSOUNDBUFFER8 iface) { - PrimaryBufferImpl *This = (PrimaryBufferImpl *)iface; - DWORD ref; - - TRACE("(%p) ref was %ld, thread is %04lx\n",This, This->ref, GetCurrentThreadId()); - ref = InterlockedDecrement(&(This->ref)); - - if (ref == 0) { - This->dsound->primary = NULL; - HeapFree(GetProcessHeap(),0,This); - TRACE("(%p) released\n",This); - } +static ULONG WINAPI PrimaryBufferImpl_Release(LPDIRECTSOUNDBUFFER8 iface) +{ + PrimaryBufferImpl *This = (PrimaryBufferImpl *)iface; + DWORD ref = InterlockedDecrement(&(This->ref)); + TRACE("(%p) ref was %ld\n", This, ref + 1); - return ref; + if (!ref) { + This->dsound->primary = NULL; + HeapFree(GetProcessHeap(), 0, This); + TRACE("(%p) released\n", This); + } + return ref; } static HRESULT WINAPI PrimaryBufferImpl_GetCurrentPosition( diff --git a/dlls/dsound/propset.c b/dlls/dsound/propset.c index cbab460e4e4..eda8173cfac 100644 --- a/dlls/dsound/propset.c +++ b/dlls/dsound/propset.c @@ -64,24 +64,24 @@ static HRESULT WINAPI IKsBufferPropertySetImpl_QueryInterface( static ULONG WINAPI IKsBufferPropertySetImpl_AddRef(LPKSPROPERTYSET iface) { IKsBufferPropertySetImpl *This = (IKsBufferPropertySetImpl *)iface; - TRACE("(%p) ref was %ld\n", This, This->ref); - return InterlockedIncrement(&(This->ref)); + ULONG ref = InterlockedIncrement(&(This->ref)); + TRACE("(%p) ref was %ld\n", This, ref - 1); + return ref; } static ULONG WINAPI IKsBufferPropertySetImpl_Release(LPKSPROPERTYSET iface) { IKsBufferPropertySetImpl *This = (IKsBufferPropertySetImpl *)iface; - ULONG ulReturn; + ULONG ref = InterlockedDecrement(&(This->ref)); + TRACE("(%p) ref was %ld\n", This, ref + 1); - TRACE("(%p) ref was %ld\n", This, This->ref); - ulReturn = InterlockedDecrement(&(This->ref)); - if (!ulReturn) { + if (!ref) { This->dsb->iks = 0; IDirectSoundBuffer_Release((LPDIRECTSOUND3DBUFFER)This->dsb); - HeapFree(GetProcessHeap(),0,This); - TRACE("(%p) released\n",This); + HeapFree(GetProcessHeap(), 0, This); + TRACE("(%p) released\n", This); } - return ulReturn; + return ref; } static HRESULT WINAPI IKsBufferPropertySetImpl_Get( @@ -248,22 +248,22 @@ static HRESULT WINAPI IKsPrivatePropertySetImpl_QueryInterface( static ULONG WINAPI IKsPrivatePropertySetImpl_AddRef(LPKSPROPERTYSET iface) { IKsPrivatePropertySetImpl *This = (IKsPrivatePropertySetImpl *)iface; - TRACE("(%p) ref was %ld\n", This, This->ref); - return InterlockedIncrement(&(This->ref)); + ULONG ref = InterlockedIncrement(&(This->ref)); + TRACE("(%p) ref was %ld\n", This, ref - 1); + return ref; } static ULONG WINAPI IKsPrivatePropertySetImpl_Release(LPKSPROPERTYSET iface) { IKsPrivatePropertySetImpl *This = (IKsPrivatePropertySetImpl *)iface; - ULONG ulReturn; + ULONG ref = InterlockedDecrement(&(This->ref)); + TRACE("(%p) ref was %ld\n", This, ref + 1); - TRACE("(%p) ref was %ld\n", This, This->ref); - ulReturn = InterlockedDecrement(&(This->ref)); - if (ulReturn == 0) { - HeapFree(GetProcessHeap(),0,This); - TRACE("(%p) released\n",This); + if (!ref) { + HeapFree(GetProcessHeap(), 0, This); + TRACE("(%p) released\n", This); } - return ulReturn; + return ref; } static HRESULT WINAPI DSPROPERTY_WaveDeviceMappingA( diff --git a/dlls/dsound/sound3d.c b/dlls/dsound/sound3d.c index 969bc94e9f0..f96b4ac37a4 100644 --- a/dlls/dsound/sound3d.c +++ b/dlls/dsound/sound3d.c @@ -364,26 +364,25 @@ static HRESULT WINAPI IDirectSound3DBufferImpl_QueryInterface( static ULONG WINAPI IDirectSound3DBufferImpl_AddRef(LPDIRECTSOUND3DBUFFER iface) { - IDirectSound3DBufferImpl *This = (IDirectSound3DBufferImpl *)iface; - TRACE("(%p) ref was %ld, thread is %04lx\n",This, This->ref, GetCurrentThreadId()); - return InterlockedIncrement(&(This->ref)); + IDirectSound3DBufferImpl *This = (IDirectSound3DBufferImpl *)iface; + ULONG ref = InterlockedIncrement(&(This->ref)); + TRACE("(%p) ref was %ld\n", This, ref - 1); + return ref; } static ULONG WINAPI IDirectSound3DBufferImpl_Release(LPDIRECTSOUND3DBUFFER iface) { - IDirectSound3DBufferImpl *This = (IDirectSound3DBufferImpl *)iface; - ULONG ulReturn; - - TRACE("(%p) ref was %ld, thread is %04lx\n",This, This->ref, GetCurrentThreadId()); - ulReturn = InterlockedDecrement(&(This->ref)); - if (!ulReturn) { - This->dsb->ds3db = NULL; - IDirectSoundBuffer_Release((LPDIRECTSOUNDBUFFER8)This->dsb); - HeapFree(GetProcessHeap(),0,This); - TRACE("(%p) released\n",This); - } - - return ulReturn; + IDirectSound3DBufferImpl *This = (IDirectSound3DBufferImpl *)iface; + ULONG ref = InterlockedDecrement(&(This->ref)); + TRACE("(%p) ref was %ld\n", This, ref + 1); + + if (!ref) { + This->dsb->ds3db = NULL; + IDirectSoundBuffer_Release((LPDIRECTSOUNDBUFFER8)This->dsb); + HeapFree(GetProcessHeap(), 0, This); + TRACE("(%p) released\n", This); + } + return ref; } /* IDirectSound3DBuffer methods */ @@ -801,27 +800,24 @@ static HRESULT WINAPI IDirectSound3DListenerImpl_QueryInterface( static ULONG WINAPI IDirectSound3DListenerImpl_AddRef(LPDIRECTSOUND3DLISTENER iface) { - IDirectSound3DListenerImpl *This = (IDirectSound3DListenerImpl *)iface; - TRACE("(%p) ref was %ld, thread is %04lx\n",This, This->ref, GetCurrentThreadId()); - return InterlockedIncrement(&(This->ref)); + IDirectSound3DListenerImpl *This = (IDirectSound3DListenerImpl *)iface; + ULONG ref = InterlockedIncrement(&(This->ref)); + TRACE("(%p) ref was %ld\n", This, ref - 1); + return ref; } static ULONG WINAPI IDirectSound3DListenerImpl_Release(LPDIRECTSOUND3DLISTENER iface) { - IDirectSound3DListenerImpl *This = (IDirectSound3DListenerImpl *)iface; - ULONG ulReturn; - - TRACE("(%p) ref was %ld, thread is %04lx\n",This, This->ref, GetCurrentThreadId()); - ulReturn = InterlockedDecrement(&(This->ref)); - - /* Free all resources */ - if( ulReturn == 0 ) { - This->dsound->listener = 0; - HeapFree(GetProcessHeap(),0,This); - TRACE("(%p) released\n",This); - } - - return ulReturn; + IDirectSound3DListenerImpl *This = (IDirectSound3DListenerImpl *)iface; + ULONG ref = InterlockedDecrement(&(This->ref)); + TRACE("(%p) ref was %ld\n", This, ref + 1); + + if (!ref) { + This->dsound->listener = 0; + HeapFree(GetProcessHeap(), 0, This); + TRACE("(%p) released\n", This); + } + return ref; } /* IDirectSound3DListener methods */ -- 2.11.4.GIT