Michael Stefaniuc : dsound/tests: Avoid ARRAY_SIZE-like macros.

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


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

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

dsound/tests: Avoid ARRAY_SIZE-like macros.

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/dsound/tests/capture.c     | 2 +-
 dlls/dsound/tests/dsound.c      | 8 ++++----
 dlls/dsound/tests/dsound8.c     | 8 ++++----
 dlls/dsound/tests/dsound_test.h | 2 --
 4 files changed, 9 insertions(+), 11 deletions(-)

diff --git a/dlls/dsound/tests/capture.c b/dlls/dsound/tests/capture.c
index a23d1eb..dada067 100644
--- a/dlls/dsound/tests/capture.c
+++ b/dlls/dsound/tests/capture.c
@@ -549,7 +549,7 @@ static BOOL WINAPI dscenum_callback(LPGUID lpGuid, LPCSTR lpcstrDescription,
            "should have 0\n",ref);
     }
 
-    for (f=0;f<NB_FORMATS;f++) {
+    for (f = 0; f < ARRAY_SIZE(formats); f++) {
 	dscbo=NULL;
 	init_format(&wfx,WAVE_FORMAT_PCM,formats[f][0],formats[f][1],
                     formats[f][2]);
diff --git a/dlls/dsound/tests/dsound.c b/dlls/dsound/tests/dsound.c
index 07c8908..375abc8 100644
--- a/dlls/dsound/tests/dsound.c
+++ b/dlls/dsound/tests/dsound.c
@@ -571,8 +571,8 @@ static HRESULT test_primary_secondary(LPGUID lpGuid)
        "IDirectSound_CreateSoundBuffer() failed to create a primary buffer %08x\n",rc);
 
     if (rc==DS_OK && primary!=NULL) {
-        for (f=0;f<NB_FORMATS;f++) {
-          for (tag=0;tag<NB_TAGS;tag++) {
+        for (f = 0; f < ARRAY_SIZE(formats); f++) {
+          for (tag = 0; tag < ARRAY_SIZE(format_tags); tag++) {
             /* if float, we only want to test 32-bit */
             if ((format_tags[tag] == WAVE_FORMAT_IEEE_FLOAT) && (formats[f][1] != 32))
                 continue;
@@ -718,8 +718,8 @@ static HRESULT test_secondary(LPGUID lpGuid)
         if (rc!=DS_OK)
             goto EXIT1;
 
-        for (f=0;f<NB_FORMATS;f++) {
-          for (tag=0;tag<NB_TAGS;tag++) {
+        for (f = 0; f < ARRAY_SIZE(formats); f++) {
+          for (tag = 0; tag < ARRAY_SIZE(format_tags); tag++) {
             WAVEFORMATEXTENSIBLE wfxe;
 
             /* if float, we only want to test 32-bit */
diff --git a/dlls/dsound/tests/dsound8.c b/dlls/dsound/tests/dsound8.c
index a6e3f12..fabd8a0 100644
--- a/dlls/dsound/tests/dsound8.c
+++ b/dlls/dsound/tests/dsound8.c
@@ -581,8 +581,8 @@ static HRESULT test_primary_secondary8(LPGUID lpGuid)
        "%08x\n",rc);
 
     if (rc==DS_OK && primary!=NULL) {
-        for (f=0;f<NB_FORMATS;f++) {
-          for (tag=0;tag<NB_TAGS;tag++) {
+        for (f = 0; f < ARRAY_SIZE(formats); f++) {
+          for (tag = 0; tag < ARRAY_SIZE(format_tags); tag++) {
             /* if float, we only want to test 32-bit */
             if ((format_tags[tag] == WAVE_FORMAT_IEEE_FLOAT) && (formats[f][1] != 32))
                 continue;
@@ -727,8 +727,8 @@ static HRESULT test_secondary8(LPGUID lpGuid)
         if (rc!=DS_OK)
             goto EXIT1;
 
-        for (f=0;f<NB_FORMATS;f++) {
-          for (tag=0;tag<NB_TAGS;tag++) {
+        for (f = 0; f < ARRAY_SIZE(formats); f++) {
+          for (tag = 0; tag < ARRAY_SIZE(format_tags); tag++) {
             WAVEFORMATEXTENSIBLE wfxe;
 
             /* if float, we only want to test 32-bit */
diff --git a/dlls/dsound/tests/dsound_test.h b/dlls/dsound/tests/dsound_test.h
index 8a8f249..04f995e 100644
--- a/dlls/dsound/tests/dsound_test.h
+++ b/dlls/dsound/tests/dsound_test.h
@@ -71,10 +71,8 @@ static const unsigned int formats[][4]={
     {96000, 32, 1, 0 },
     {96000, 32, 2, 0 }
 };
-#define NB_FORMATS (sizeof(formats)/sizeof(*formats))
 
 static const unsigned int format_tags[] = {WAVE_FORMAT_PCM, WAVE_FORMAT_IEEE_FLOAT};
-#define NB_TAGS (sizeof(format_tags)/sizeof(*format_tags))
 
 /* The time slice determines how often we will service the buffer */
 #define TIME_SLICE     31




More information about the wine-cvs mailing list