Remove asserts in IDirectSoundBuffer_Lock()
Francois Gouget
fgouget at codeweavers.com
Fri Aug 6 08:03:23 CDT 2004
I don't think we should use assert to test the parameters given to us by
Windows applications. Case in point, on Windows
IDirectSoundBuffer_Lock() does not care whether it is given two
different pointers or not.
Changelog:
* dlls/dsound/buffer.c
dlls/dsound/primary.c
dlls/dsound/tests/ds3d.c
Francois Gouget <fgouget at codeweavers.com>
Remove the assert()s that checked that IDirectSoundBuffer_Lock() is
given two distinct pointers.
Add test to check the behavior on Windows.
--
Francois Gouget
fgouget at codeweavers.com
-------------- next part --------------
Index: dlls/dsound/buffer.c
===================================================================
RCS file: /var/cvs/wine/dlls/dsound/buffer.c,v
retrieving revision 1.26
diff -u -r1.26 buffer.c
--- dlls/dsound/buffer.c 23 Jul 2004 22:58:59 -0000 1.26
+++ dlls/dsound/buffer.c 6 Aug 2004 09:54:18 -0000
@@ -635,9 +635,6 @@
if (writebytes > This->buflen)
writebytes = This->buflen;
- assert(audiobytes1!=audiobytes2);
- assert(lplpaudioptr1!=lplpaudioptr2);
-
EnterCriticalSection(&(This->lock));
if ((writebytes == This->buflen) &&
Index: dlls/dsound/primary.c
===================================================================
RCS file: /var/cvs/wine/dlls/dsound/primary.c,v
retrieving revision 1.26
diff -u -r1.26 primary.c
--- dlls/dsound/primary.c 23 Jul 2004 19:06:31 -0000 1.26
+++ dlls/dsound/primary.c 6 Aug 2004 09:54:07 -0000
@@ -718,9 +724,6 @@
if (writebytes > dsound->buflen)
writebytes = dsound->buflen;
- assert(audiobytes1!=audiobytes2);
- assert(lplpaudioptr1!=lplpaudioptr2);
-
if (!(dsound->drvdesc.dwFlags & DSDDESC_DONTNEEDPRIMARYLOCK) && dsound->hwbuf) {
HRESULT hres;
hres = IDsDriverBuffer_Lock(dsound->hwbuf,
Index: dlls/dsound/tests/ds3d.c
===================================================================
RCS file: /var/cvs/wine/dlls/dsound/tests/ds3d.c,v
retrieving revision 1.6
diff -u -r1.6 ds3d.c
--- dlls/dsound/tests/ds3d.c 30 Jul 2004 18:42:51 -0000 1.6
+++ dlls/dsound/tests/ds3d.c 6 Aug 2004 10:49:20 -0000
@@ -492,6 +521,15 @@
/* Check the sound duration was within 10% of the expected value */
now=GetTickCount();
ok(fabs(1000*duration-now+start_time)<=100*duration,"The sound played for %ld ms instead of %g ms\n",now-start_time,1000*duration);
+
+ /* Check Lock behavior when given the same pointers twice */
+ rc=IDirectSoundBuffer_Lock(dsbo,0,100,&ptr,&len,&ptr,&len,0);
+ ok(rc==DS_OK && ptr==NULL && len==0,"Lock: 0x%lx\n",rc);
+ if (rc==DS_OK)
+ {
+ rc=IDirectSoundBuffer_Unlock(dsbo,ptr,len,ptr,len);
+ ok(rc==DS_OK,"Unlock: 0x%lx\n",rc);
+ }
free(state.wave);
if (is_primary) {
More information about the wine-patches
mailing list