dsound mode reference counting cleanup

Robert Reif reif at earthlink.net
Fri Sep 17 07:06:08 CDT 2004


Cleanup reference counting.
AddRef and Release return ULONG.
-------------- next part --------------
Index: dlls/dsound/buffer.c
===================================================================
RCS file: /home/wine/wine/dlls/dsound/buffer.c,v
retrieving revision 1.38
diff -u -r1.38 buffer.c
--- dlls/dsound/buffer.c	16 Sep 2004 19:08:04 -0000	1.38
+++ dlls/dsound/buffer.c	17 Sep 2004 12:00:42 -0000
@@ -68,17 +68,16 @@
 	return IDirectSoundBuffer_QueryInterface((LPDIRECTSOUNDBUFFER)This->dsb, riid, ppobj);
 }
 
-static ULONG WINAPI IDirectSoundNotifyImpl_AddRef(LPDIRECTSOUNDNOTIFY iface) {
+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));
 }
 
 static ULONG WINAPI IDirectSoundNotifyImpl_Release(LPDIRECTSOUNDNOTIFY iface) {
 	IDirectSoundNotifyImpl *This = (IDirectSoundNotifyImpl *)iface;
-	DWORD ref;
+	ULONG ref;
 
 	TRACE("(%p) ref was %ld, thread is %04lx\n",This, This->ref, GetCurrentThreadId());
 
@@ -367,28 +366,23 @@
 	return hres;
 }
 
-static DWORD WINAPI IDirectSoundBufferImpl_AddRef(LPDIRECTSOUNDBUFFER8 iface) {
+static ULONG WINAPI IDirectSoundBufferImpl_AddRef(LPDIRECTSOUNDBUFFER8 iface)
+{
 	IDirectSoundBufferImpl *This = (IDirectSoundBufferImpl *)iface;
-	DWORD ref;
-
 	TRACE("(%p) ref was %ld, thread is %04lx\n",This, This->ref, GetCurrentThreadId());
-
-	ref = InterlockedIncrement(&(This->ref));
-	if (!ref) {
-		FIXME("thread-safety alert! AddRef-ing with a zero refcount!\n");
-	}
-	return ref;
+	return InterlockedIncrement(&(This->ref));
 }
 
-static DWORD WINAPI IDirectSoundBufferImpl_Release(LPDIRECTSOUNDBUFFER8 iface)
+static ULONG WINAPI IDirectSoundBufferImpl_Release(LPDIRECTSOUNDBUFFER8 iface)
 {
 	IDirectSoundBufferImpl *This = (IDirectSoundBufferImpl *)iface;
-	DWORD ref;
+	ULONG ref;
 
 	TRACE("(%p) ref was %ld, thread is %04lx\n",This, This->ref, GetCurrentThreadId());
 
 	ref = InterlockedDecrement(&(This->ref));
-	if (ref) return ref;
+	if (ref)
+		return ref;
 
 	DSOUND_RemoveBuffer(This->dsound, This);
 
@@ -1285,23 +1279,17 @@
 	return IDirectSoundBufferImpl_QueryInterface((LPDIRECTSOUNDBUFFER8)This->dsb,riid,ppobj);
 }
 
-static DWORD WINAPI SecondaryBufferImpl_AddRef(LPDIRECTSOUNDBUFFER8 iface)
+static ULONG WINAPI SecondaryBufferImpl_AddRef(LPDIRECTSOUNDBUFFER8 iface)
 {
 	IDirectSoundBufferImpl *This = (IDirectSoundBufferImpl *)iface;
-	DWORD ref;
 	TRACE("(%p) ref was %ld, thread is %04lx\n",This, This->ref, GetCurrentThreadId());
-
-	ref = InterlockedIncrement(&(This->ref));
-	if (!ref) {
-		FIXME("thread-safety alert! AddRef-ing with a zero refcount!\n");
-	}
-	return ref;
+	return InterlockedIncrement(&(This->ref));
 }
 
-static DWORD WINAPI SecondaryBufferImpl_Release(LPDIRECTSOUNDBUFFER8 iface)
+static ULONG WINAPI SecondaryBufferImpl_Release(LPDIRECTSOUNDBUFFER8 iface)
 {
 	IDirectSoundBufferImpl *This = (IDirectSoundBufferImpl *)iface;
-	DWORD ref;
+	ULONG ref;
 	TRACE("(%p) ref was %ld, thread is %04lx\n",This, This->ref, GetCurrentThreadId());
 
 	ref = InterlockedDecrement(&(This->ref));
Index: dlls/dsound/capture.c
===================================================================
RCS file: /home/wine/wine/dlls/dsound/capture.c,v
retrieving revision 1.34
diff -u -r1.34 capture.c
--- dlls/dsound/capture.c	16 Sep 2004 19:08:04 -0000	1.34
+++ dlls/dsound/capture.c	17 Sep 2004 12:00:43 -0000
@@ -780,7 +780,7 @@
 static ULONG WINAPI IDirectSoundCaptureNotifyImpl_Release(LPDIRECTSOUNDNOTIFY iface)
 {
     IDirectSoundCaptureNotifyImpl *This = (IDirectSoundCaptureNotifyImpl *)iface;
-    DWORD ref;
+    ULONG ref;
 
     TRACE("(%p) ref was %ld, thread is %04lx\n",This, This->ref, GetCurrentThreadId());
 
Index: dlls/dsound/primary.c
===================================================================
RCS file: /home/wine/wine/dlls/dsound/primary.c,v
retrieving revision 1.35
diff -u -r1.35 primary.c
--- dlls/dsound/primary.c	16 Sep 2004 19:08:04 -0000	1.35
+++ dlls/dsound/primary.c	17 Sep 2004 12:00:44 -0000
@@ -578,13 +578,13 @@
 	return DS_OK;
 }
 
-static DWORD WINAPI PrimaryBufferImpl_AddRef(LPDIRECTSOUNDBUFFER8 iface) {
+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 DWORD WINAPI PrimaryBufferImpl_Release(LPDIRECTSOUNDBUFFER8 iface) {
+static ULONG WINAPI PrimaryBufferImpl_Release(LPDIRECTSOUNDBUFFER8 iface) {
 	PrimaryBufferImpl *This = (PrimaryBufferImpl *)iface;
 	DWORD ref;
 
Index: dlls/dsound/propset.c
===================================================================
RCS file: /home/wine/wine/dlls/dsound/propset.c,v
retrieving revision 1.25
diff -u -r1.25 propset.c
--- dlls/dsound/propset.c	16 Sep 2004 19:08:04 -0000	1.25
+++ dlls/dsound/propset.c	17 Sep 2004 12:00:45 -0000
@@ -246,7 +246,6 @@
 static ULONG WINAPI IKsPrivatePropertySetImpl_AddRef(LPKSPROPERTYSET iface)
 {
     IKsPrivatePropertySetImpl *This = (IKsPrivatePropertySetImpl *)iface;
-
     TRACE("(%p) ref was %ld\n", This, This->ref);
     return InterlockedIncrement(&(This->ref));
 }
Index: dlls/dsound/sound3d.c
===================================================================
RCS file: /home/wine/wine/dlls/dsound/sound3d.c,v
retrieving revision 1.35
diff -u -r1.35 sound3d.c
--- dlls/dsound/sound3d.c	16 Sep 2004 19:08:04 -0000	1.35
+++ dlls/dsound/sound3d.c	17 Sep 2004 12:00:46 -0000
@@ -379,14 +379,8 @@
 static ULONG WINAPI IDirectSound3DBufferImpl_AddRef(LPDIRECTSOUND3DBUFFER iface)
 {
 	IDirectSound3DBufferImpl *This = (IDirectSound3DBufferImpl *)iface;
-	ULONG ref;
-
 	TRACE("(%p) ref was %ld, thread is %04lx\n",This, This->ref, GetCurrentThreadId());
-	ref = InterlockedIncrement(&(This->ref));
-	if (!ref) {
-		FIXME("thread-safety alert! AddRef-ing with a zero refcount!\n");
-	}
-	return ref;
+	return InterlockedIncrement(&(This->ref));
 }
 
 static ULONG WINAPI IDirectSound3DBufferImpl_Release(LPDIRECTSOUND3DBUFFER iface)
@@ -822,16 +816,8 @@
 static ULONG WINAPI IDirectSound3DListenerImpl_AddRef(LPDIRECTSOUND3DLISTENER iface)
 {
 	IDirectSound3DListenerImpl *This = (IDirectSound3DListenerImpl *)iface;
-	ULONG ref;
 	TRACE("(%p) ref was %ld, thread is %04lx\n",This, This->ref, GetCurrentThreadId());
-
-	ref = InterlockedIncrement(&(This->ref));
-
-	if (!ref) {
-		FIXME("thread-safety alert! AddRef-ing with a zero refcount!\n");
-	}
-
-	return ref;
+	return InterlockedIncrement(&(This->ref));
 }
 
 static ULONG WINAPI IDirectSound3DListenerImpl_Release(LPDIRECTSOUND3DLISTENER iface)


More information about the wine-patches mailing list