[PATCH 2/2] winmm/tests: Use the available ARRAY_SIZE() macro

Andrew Eikum aeikum at codeweavers.com
Thu Jun 14 07:17:10 CDT 2018


Signed-off-by: Andrew Eikum <aeikum at codeweavers.com>

On Wed, Jun 13, 2018 at 08:30:27PM +0200, Michael Stefaniuc wrote:
> Signed-off-by: Michael Stefaniuc <mstefani at winehq.org>
> ---
>  dlls/winmm/tests/joystick.c | 4 ++--
>  dlls/winmm/tests/midi.c     | 2 +-
>  dlls/winmm/tests/mmio.c     | 2 +-
>  3 files changed, 4 insertions(+), 4 deletions(-)
> 
> diff --git a/dlls/winmm/tests/joystick.c b/dlls/winmm/tests/joystick.c
> index 5714001315..7531bd6481 100644
> --- a/dlls/winmm/tests/joystick.c
> +++ b/dlls/winmm/tests/joystick.c
> @@ -139,7 +139,7 @@ static void test_api(void)
>      /* Try some unusual period values for joySetCapture and unusual threshold values for joySetThreshold.
>       * Windows XP allows almost all test values, Windows 8 will return error on most test values, Windows
>       * 98 allows anything but cuts the values to their maximum supported values internally. */
> -    for (i = 0; i < sizeof(period) / sizeof(period[0]); i++)
> +    for (i = 0; i < ARRAY_SIZE(period); i++)
>      {
>          ret = joySetCapture(window, joyid, period[i], FALSE);
>          if (win8 && ((1 << i) & period_win8_error))
> @@ -190,7 +190,7 @@ static void test_api(void)
>      ok(ret == JOYERR_NOERROR, "Expected %d, got %d\n", JOYERR_NOERROR, ret);
>  
>      infoex.ex.dwSize = sizeof(infoex.ex);
> -    for (i = 0; i < sizeof(flags) / sizeof(flags[0]); i++)
> +    for (i = 0; i < ARRAY_SIZE(flags); i++)
>      {
>          infoex.ex.dwFlags = flags[i];
>          ret = joyGetPosEx(joyid, &infoex.ex);
> diff --git a/dlls/winmm/tests/midi.c b/dlls/winmm/tests/midi.c
> index fe3cc5c876..3b8bd2287d 100644
> --- a/dlls/winmm/tests/midi.c
> +++ b/dlls/winmm/tests/midi.c
> @@ -549,7 +549,7 @@ static void CALLBACK time_stamp_callback(HMIDIOUT hmo, UINT msg, DWORD_PTR insta
>      struct time_stamp_records *records = (struct time_stamp_records *)instance;
>      switch (msg) {
>      case MM_MOM_POSITIONCB:
> -        if (records->count < sizeof(records->time_stamp)/sizeof(records->time_stamp[0]))
> +        if (records->count < ARRAY_SIZE(records->time_stamp))
>              records->time_stamp[records->count] = GetTickCount();
>          records->count++;
>          break;
> diff --git a/dlls/winmm/tests/mmio.c b/dlls/winmm/tests/mmio.c
> index 48367ee6d9..5501c319c5 100644
> --- a/dlls/winmm/tests/mmio.c
> +++ b/dlls/winmm/tests/mmio.c
> @@ -606,7 +606,7 @@ static LRESULT CALLBACK mmio_test_IOProc(LPSTR lpMMIOInfo, UINT uMessage, LPARAM
>      case MMIOM_OPEN:
>          if (lpInfo->fccIOProc == FOURCC_DOS)
>              lpInfo->fccIOProc = mmioFOURCC('F', 'A', 'I', 'L');
> -        for (i = 0; i < sizeof(lpInfo->adwInfo) / sizeof(*lpInfo->adwInfo); i++)
> +        for (i = 0; i < ARRAY_SIZE(lpInfo->adwInfo); i++)
>              ok(lpInfo->adwInfo[i] == 0, "[%d] Expected 0, got %u\n", i, lpInfo->adwInfo[i]);
>          return MMSYSERR_NOERROR;
>      case MMIOM_CLOSE:
> -- 
> 2.14.4
> 
> 
> 



More information about the wine-devel mailing list