dsound: GetVolume should check error from driver

Dan Kegel dank at kegel.com
Sun Jun 29 20:41:16 CDT 2008

On a few machines,  test_secondary() in dsound/tests/ds3d.c fails
due to garbage on the stack being used in place of volume.
Example reports:
ds3d.c:891: Test failed: The primary volume changed from -27 to -792
ds3d.c:896: Test failed: The primary pan changed from -5594 to -5595

ALSA_CheckSetVolume returns right early because hctl is NULL,
but that error is not propagated through dsound properly.
While we should figure out the alsa part, for now, let's at least
propagate the error, and skip tests that can't be done without
sensing volume.
If this patch is accepted, I'll send a second one to add a
similar skip() to tests/ds3d8.c.

I've also added a test that checks for this problem a bit
more directly, which might help somebody looking into the alsa problem.

This prevents Valgrind errors like:
 Conditional jump or move depends on uninitialised value(s)
    at  DSOUND_AmpFactorToVolPan (mixer.c:66)
    by  PrimaryBufferImpl_GetVolume (primary.c:646)
    by  test_secondary (ds3d.c:864)
    by  dsenum_callback (ds3d.c:1303)
    by  DirectSoundEnumerateA (dsound_main.c:315)
    by  ds3d_tests (ds3d.c:1324)
    by  func_ds3d (ds3d.c:1344)
    by  run_test (test.h:449)
    by  main (test.h:498)
  Uninitialised value was created by a stack allocation
    at  PrimaryBufferImpl_GetVolume (primary.c:627)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: dsound-volume.patch
Type: text/x-diff
Size: 7803 bytes
Desc: not available
Url : http://www.winehq.org/pipermail/wine-patches/attachments/20080629/ac292cc3/attachment.patch 

More information about the wine-patches mailing list