[PATCH 1/2] dsound/tests: Avoid ARRAY_SIZE-like macros

Michael Stefaniuc mstefani at winehq.org
Wed Jun 13 13:30:23 CDT 2018


Signed-off-by: Michael Stefaniuc <mstefani 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 a23d1eb6f6..dada067956 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 07c8908add..375abc8761 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 a6e3f12ae3..fabd8a037e 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 8a8f2498d0..04f995e359 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
-- 
2.14.4




More information about the wine-devel mailing list