winmm: Initialize reserved fields of data returned by waveOutGetDevCapsA and waveInGetDevCapsA (Coverity).

Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Nikolay Sivov 2015-11-18 21:37:59 +03:00 committed by Alexandre Julliard
parent bcefe114e8
commit 062bbb91a7
3 changed files with 10 additions and 0 deletions

View File

@ -316,6 +316,7 @@ static void wave_in_test_device(UINT_PTR device)
GetSystemInfo(&sSysInfo);
dwPageSize = sSysInfo.dwPageSize;
memset(&capsA, 0xff, sizeof(capsA));
rc=waveInGetDevCapsA(device,&capsA,sizeof(capsA));
ok(rc==MMSYSERR_NOERROR || rc==MMSYSERR_BADDEVICEID ||
rc==MMSYSERR_NODRIVER,
@ -323,11 +324,14 @@ static void wave_in_test_device(UINT_PTR device)
dev_name(device),wave_in_error(rc));
if (rc==MMSYSERR_BADDEVICEID || rc==MMSYSERR_NODRIVER)
return;
ok(capsA.wReserved1 != 0xffff, "got %u\n", capsA.wReserved1);
memset(&capsW, 0xcc, sizeof(capsW));
rc=waveInGetDevCapsW(device,&capsW,sizeof(capsW));
ok(rc==MMSYSERR_NOERROR || rc==MMSYSERR_NOTSUPPORTED,
"waveInGetDevCapsW(%s): MMSYSERR_NOERROR or MMSYSERR_NOTSUPPORTED "
"expected, got %s\n",dev_name(device),wave_in_error(rc));
ok(capsW.wReserved1 == 0, "got %u\n", capsW.wReserved1);
rc=waveInGetDevCapsA(device,NULL,sizeof(capsA));
ok(rc==MMSYSERR_INVALPARAM,

View File

@ -893,6 +893,7 @@ static void wave_out_test_device(UINT_PTR device)
GetSystemInfo(&sSysInfo);
dwPageSize = sSysInfo.dwPageSize;
memset(&capsA, 0xcc, sizeof(capsA));
rc=waveOutGetDevCapsA(device,&capsA,sizeof(capsA));
ok(rc==MMSYSERR_NOERROR || rc==MMSYSERR_BADDEVICEID ||
rc==MMSYSERR_NODRIVER,
@ -900,11 +901,14 @@ static void wave_out_test_device(UINT_PTR device)
dev_name(device),wave_out_error(rc));
if (rc==MMSYSERR_BADDEVICEID || rc==MMSYSERR_NODRIVER)
return;
ok(capsA.wReserved1 == 0, "got %u\n", capsA.wReserved1);
memset(&capsW, 0xcc, sizeof(capsW));
rc=waveOutGetDevCapsW(device,&capsW,sizeof(capsW));
ok(rc==MMSYSERR_NOERROR || rc==MMSYSERR_NOTSUPPORTED,
"waveOutGetDevCapsW(%s): MMSYSERR_NOERROR or MMSYSERR_NOTSUPPORTED "
"expected, got %s\n",dev_name(device),wave_out_error(rc));
ok(capsW.wReserved1 == 0, "got %u\n", capsW.wReserved1);
rc=waveOutGetDevCapsA(device,0,sizeof(capsA));
ok(rc==MMSYSERR_INVALPARAM,

View File

@ -2629,6 +2629,7 @@ UINT WINAPI waveOutGetDevCapsA(UINT_PTR uDeviceID, LPWAVEOUTCAPSA lpCaps,
wocA.dwFormats = wocW.dwFormats;
wocA.wChannels = wocW.wChannels;
wocA.dwSupport = wocW.dwSupport;
wocA.wReserved1 = 0;
memcpy(lpCaps, &wocA, min(uSize, sizeof(wocA)));
}
return ret;
@ -3354,6 +3355,7 @@ UINT WINAPI waveInGetDevCapsA(UINT_PTR uDeviceID, LPWAVEINCAPSA lpCaps, UINT uSi
sizeof(wicA.szPname), NULL, NULL );
wicA.dwFormats = wicW.dwFormats;
wicA.wChannels = wicW.wChannels;
wicA.wReserved1 = 0;
memcpy(lpCaps, &wicA, min(uSize, sizeof(wicA)));
}
return ret;