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

Michael Stefaniuc mstefani at winehq.org
Wed Dec 27 17:50:31 CST 2017


Signed-off-by: Michael Stefaniuc <mstefani at winehq.org>
---
 dlls/d3dx9_36/tests/effect.c | 6 +++---
 dlls/d3dx9_36/tests/mesh.c   | 8 ++++----
 2 files changed, 7 insertions(+), 7 deletions(-)

diff --git a/dlls/d3dx9_36/tests/effect.c b/dlls/d3dx9_36/tests/effect.c
index 96b21f0..d65f072 100644
--- a/dlls/d3dx9_36/tests/effect.c
+++ b/dlls/d3dx9_36/tests/effect.c
@@ -1325,7 +1325,7 @@ static void test_effect_parameter_value_GetMatrix(const struct test_effect_param
         ok(hr == D3DERR_INVALIDCALL, "%u - %s: GetMatrix failed, got %#x, expected %#x\n",
                 i, res_full_name, hr, D3DERR_INVALIDCALL);
 
-        for (l = 0; l < sizeof(fvalue) / sizeof(*fvalue); ++l) if (fvalue[l] != *(FLOAT *)&cmp) ++err;
+        for (l = 0; l < ARRAY_SIZE(fvalue); ++l) if (fvalue[l] != *(FLOAT *)&cmp) ++err;
     }
     ok(!err, "%u - %s: GetMatrix failed with %u errors\n", i, res_full_name, err);
 }
@@ -1498,7 +1498,7 @@ static void test_effect_parameter_value_GetMatrixTranspose(const struct test_eff
         ok(hr == D3DERR_INVALIDCALL, "%u - %s: GetMatrixTranspose failed, got %#x, expected %#x\n",
                 i, res_full_name, hr, D3DERR_INVALIDCALL);
 
-        for (l = 0; l < sizeof(fvalue) / sizeof(*fvalue); ++l) if (fvalue[l] != *(FLOAT *)&cmp) ++err;
+        for (l = 0; l < ARRAY_SIZE(fvalue); ++l) if (fvalue[l] != *(FLOAT *)&cmp) ++err;
     }
     ok(!err, "%u - %s: GetMatrixTranspose failed with %u errors\n", i, res_full_name, err);
 }
@@ -1675,7 +1675,7 @@ static void test_effect_parameter_value_ResetValue(const struct test_effect_para
 static void test_effect_parameter_value(IDirect3DDevice9 *device)
 {
     UINT i;
-    UINT effect_count = sizeof(test_effect_parameter_value_data) / sizeof(*test_effect_parameter_value_data);
+    UINT effect_count = ARRAY_SIZE(test_effect_parameter_value_data);
 
     for (i = 0; i < effect_count; ++i)
     {
diff --git a/dlls/d3dx9_36/tests/mesh.c b/dlls/d3dx9_36/tests/mesh.c
index d0b1adb..a92b7ea 100644
--- a/dlls/d3dx9_36/tests/mesh.c
+++ b/dlls/d3dx9_36/tests/mesh.c
@@ -818,7 +818,7 @@ static void test_fvf_decl_conversion(void)
     };
     unsigned int i;
 
-    for (i = 0; i < sizeof(test_data) / sizeof(*test_data); ++i)
+    for (i = 0; i < ARRAY_SIZE(test_data); ++i)
     {
         test_decl_to_fvf(test_data[i].decl, test_data[i].fvf, D3D_OK, __LINE__, i);
         test_fvf_to_decl(test_data[i].fvf, test_data[i].decl, D3D_OK, __LINE__, i);
@@ -1268,7 +1268,7 @@ static void D3DXCreateMeshTest(void)
 
         if (hr == D3D_OK)
         {
-            size = sizeof(decl1) / sizeof(decl1[0]);
+            size = ARRAY_SIZE(decl1);
             for (i = 0; i < size - 1; i++)
             {
                 ok(test_decl[i].Stream == decl1[i].Stream, "Returned stream %d, expected %d\n", test_decl[i].Stream, decl1[i].Stream);
@@ -1329,7 +1329,7 @@ static void D3DXCreateMeshTest(void)
 
         if (hr == D3D_OK)
         {
-            size = sizeof(decl2) / sizeof(decl2[0]);
+            size = ARRAY_SIZE(decl2);
             for (i = 0; i < size - 1; i++)
             {
                 ok(test_decl[i].Stream == decl2[i].Stream, "Returned stream %d, expected %d\n", test_decl[i].Stream, decl2[i].Stream);
@@ -1453,7 +1453,7 @@ static void D3DXCreateMeshFVFTest(void)
 
         if (hr == D3D_OK)
         {
-            size = sizeof(decl) / sizeof(decl[0]);
+            size = ARRAY_SIZE(decl);
             for (i = 0; i < size - 1; i++)
             {
                 ok(test_decl[i].Stream == decl[i].Stream, "Returned stream %d, expected %d\n", test_decl[i].Stream, decl[i].Stream);
-- 
2.9.5




More information about the wine-devel mailing list