Michael Stefaniuc : winmm/tests: Use the available ARRAY_SIZE() macro.

Alexandre Julliard julliard at winehq.org
Thu Jun 14 16:53:23 CDT 2018


Module: wine
Branch: master
Commit: 3f4906d19dcbcc5abaf7c7fe0417f4e6f46137ce
URL:    https://source.winehq.org/git/wine.git/?a=commit;h=3f4906d19dcbcc5abaf7c7fe0417f4e6f46137ce

Author: Michael Stefaniuc <mstefani at winehq.org>
Date:   Wed Jun 13 20:30:27 2018 +0200

winmm/tests: Use the available ARRAY_SIZE() macro.

Signed-off-by: Michael Stefaniuc <mstefani at winehq.org>
Signed-off-by: Andrew Eikum <aeikum at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard 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 5714001..7531bd6 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 fe3cc5c..3b8bd22 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 48367ee..5501c31 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:




More information about the wine-cvs mailing list