[PATCH 2/2] dsound/tests: Use the available ARRAY_SIZE() macro
Andrew Eikum
aeikum at codeweavers.com
Thu Jun 14 07:17:33 CDT 2018
Signed-off-by: Andrew Eikum <aeikum at codeweavers.com>
On Wed, Jun 13, 2018 at 08:30:24PM +0200, Michael Stefaniuc wrote:
> Signed-off-by: Michael Stefaniuc <mstefani at winehq.org>
> ---
> dlls/dsound/tests/ds3d.c | 2 +-
> dlls/dsound/tests/dsound.c | 15 ++++++---------
> 2 files changed, 7 insertions(+), 10 deletions(-)
>
> diff --git a/dlls/dsound/tests/ds3d.c b/dlls/dsound/tests/ds3d.c
> index d4356c2b6c..1b44afff8d 100644
> --- a/dlls/dsound/tests/ds3d.c
> +++ b/dlls/dsound/tests/ds3d.c
> @@ -139,7 +139,7 @@ const char * getDSBCAPS(DWORD xmask) {
>
> buffer[0] = 0;
>
> - for (i=0;i<sizeof(flags)/sizeof(flags[0]);i++) {
> + for (i = 0; i < ARRAY_SIZE(flags); i++) {
> if ((flags[i].mask & xmask) == flags[i].mask) {
> if (first)
> first = FALSE;
> diff --git a/dlls/dsound/tests/dsound.c b/dlls/dsound/tests/dsound.c
> index 375abc8761..0807d43788 100644
> --- a/dlls/dsound/tests/dsound.c
> +++ b/dlls/dsound/tests/dsound.c
> @@ -1004,8 +1004,8 @@ static HRESULT test_frequency(LPGUID lpGuid)
> if (rc!=DS_OK)
> goto EXIT1;
>
> - for (f=0;f<sizeof(fmts)/sizeof(fmts[0]);f++) {
> - for (r=0;r<sizeof(rates)/sizeof(rates[0]);r++) {
> + for (f = 0; f < ARRAY_SIZE(fmts); f++) {
> + for (r = 0; r < ARRAY_SIZE(rates); r++) {
> init_format(&wfx,WAVE_FORMAT_PCM,11025,fmts[f].bits,
> fmts[f].channels);
> secondary=NULL;
> @@ -1135,7 +1135,7 @@ static HRESULT test_duplicate(LPGUID lpGuid)
> int i;
>
> /* Prepare notify events */
> - for (i=0;i<sizeof(event)/sizeof(event[0]);i++) {
> + for (i = 0; i < ARRAY_SIZE(event); i++) {
> event[i] = CreateEventW(NULL, FALSE, FALSE, NULL);
> }
>
> @@ -1174,8 +1174,7 @@ static HRESULT test_duplicate(LPGUID lpGuid)
> "IDirectSound_DuplicateSoundBuffer failed %08x\n",rc);
>
> trace("testing duplicated buffer without notifications.\n");
> - test_notify(duplicated,sizeof(event)/sizeof(event[0]),
> - event,WAIT_TIMEOUT);
> + test_notify(duplicated, ARRAY_SIZE(event), event, WAIT_TIMEOUT);
>
> rc=IDirectSoundBuffer_QueryInterface(duplicated,
> &IID_IDirectSoundNotify,
> @@ -1192,8 +1191,7 @@ static HRESULT test_duplicate(LPGUID lpGuid)
> "failed %08x\n",rc);
>
> trace("testing duplicated buffer with a notification.\n");
> - test_notify(duplicated,sizeof(event)/sizeof(event[0]),
> - event,WAIT_OBJECT_0+1);
> + test_notify(duplicated, ARRAY_SIZE(event), event, WAIT_OBJECT_0 + 1);
>
> ref=IDirectSoundNotify_Release(dup_notify);
> ok(ref==0,"IDirectSoundNotify_Release() has %d references, "
> @@ -1204,8 +1202,7 @@ static HRESULT test_duplicate(LPGUID lpGuid)
> "should have 0\n",ref);
>
> trace("testing original buffer with a notification.\n");
> - test_notify(original,sizeof(event)/sizeof(event[0]),
> - event,WAIT_OBJECT_0);
> + test_notify(original, ARRAY_SIZE(event), event, WAIT_OBJECT_0);
>
> ref=IDirectSoundBuffer_Release(duplicated);
> ok(ref==0,"IDirectSoundBuffer_Release() has %d references, "
> --
> 2.14.4
>
>
>
More information about the wine-devel
mailing list