[PATCH] msi/tests: Avoid ARRAY_SIZE-like macros

Michael Stefaniuc mstefani at winehq.org
Tue Jun 12 16:25:45 CDT 2018


Signed-off-by: Michael Stefaniuc <mstefani at winehq.org>
---
 dlls/msi/tests/db.c      |  4 +---
 dlls/msi/tests/install.c |  4 +---
 dlls/msi/tests/patch.c   | 12 +++---------
 3 files changed, 5 insertions(+), 15 deletions(-)

diff --git a/dlls/msi/tests/db.c b/dlls/msi/tests/db.c
index 477ab0ad39..ff54a95ab1 100644
--- a/dlls/msi/tests/db.c
+++ b/dlls/msi/tests/db.c
@@ -3033,8 +3033,6 @@ static const struct {
     { name9, data9, sizeof data9 },
 };
 
-#define NUM_TRANSFORM_TABLES (sizeof table_transform_data/sizeof table_transform_data[0])
-
 static void generate_transform_manual(void)
 {
     IStorage *stg = NULL;
@@ -3056,7 +3054,7 @@ static void generate_transform_manual(void)
     r = IStorage_SetClass( stg, &CLSID_MsiTransform );
     ok(r == S_OK, "failed to set storage type\n");
 
-    for (i=0; i<NUM_TRANSFORM_TABLES; i++)
+    for (i=0; i<ARRAY_SIZE(table_transform_data); i++)
     {
         r = IStorage_CreateStream( stg, table_transform_data[i].name,
                             STGM_WRITE | STGM_SHARE_EXCLUSIVE, 0, 0, &stm );
diff --git a/dlls/msi/tests/install.c b/dlls/msi/tests/install.c
index 3eb6c80422..951f0e7222 100644
--- a/dlls/msi/tests/install.c
+++ b/dlls/msi/tests/install.c
@@ -3671,8 +3671,6 @@ static const struct {
     { name3, data3, sizeof data3 },
 };
 
-#define NUM_TRANSFORM_TABLES (sizeof table_transform_data/sizeof table_transform_data[0])
-
 static void generate_transform_manual(void)
 {
     IStorage *stg = NULL;
@@ -3694,7 +3692,7 @@ static void generate_transform_manual(void)
     r = IStorage_SetClass(stg, &CLSID_MsiTransform);
     ok(r == S_OK, "failed to set storage type\n");
 
-    for (i=0; i<NUM_TRANSFORM_TABLES; i++)
+    for (i=0; i<ARRAY_SIZE(table_transform_data); i++)
     {
         r = IStorage_CreateStream(stg, table_transform_data[i].name,
                             STGM_WRITE | STGM_SHARE_EXCLUSIVE, 0, 0, &stm);
diff --git a/dlls/msi/tests/patch.c b/dlls/msi/tests/patch.c
index b6e990b461..a09084002e 100644
--- a/dlls/msi/tests/patch.c
+++ b/dlls/msi/tests/patch.c
@@ -446,8 +446,6 @@ static const struct table_data table_patch_data[] = {
     { p_name6, p_data6, sizeof p_data6 }
 };
 
-#define NUM_PATCH_TABLES (sizeof table_patch_data/sizeof table_patch_data[0])
-
 static const WCHAR t1_name0[] = { 0x4840, 0x430f, 0x422f, 0 }; /* File */
 static const WCHAR t1_name1[] = { 0x4840, 0x3f3f, 0x4577, 0x446c, 0x3b6a, 0x45e4, 0x4824, 0 }; /* _StringData */
 static const WCHAR t1_name2[] = { 0x4840, 0x3f3f, 0x4577, 0x446c, 0x3e6a, 0x44b2, 0x482f, 0 }; /* _StringPool */
@@ -519,8 +517,6 @@ static const struct table_data table_transform1_data[] = {
     { t1_name3, t1_data3, sizeof t1_data3 }
 };
 
-#define NUM_TRANSFORM1_TABLES (sizeof table_transform1_data/sizeof table_transform1_data[0])
-
 static const WCHAR t2_name0[] = { 0x4840, 0x430f, 0x422f, 0 }; /* File */
 static const WCHAR t2_name1[] = { 0x4840, 0x4216, 0x4327, 0x4824, 0 }; /* Media */
 static const WCHAR t2_name2[] = { 0x4840, 0x3b3f, 0x43f2, 0x4438, 0x45b1, 0 }; /* _Columns */
@@ -644,8 +640,6 @@ static const struct table_data table_transform2_data[] = {
     { t2_name9, t2_data9, sizeof t2_data9 }
 };
 
-#define NUM_TRANSFORM2_TABLES (sizeof table_transform2_data/sizeof table_transform2_data[0])
-
 static void write_tables( IStorage *stg, const struct table_data *tables, UINT num_tables )
 {
     IStream *stm;
@@ -692,7 +686,7 @@ static void create_patch( const char *filename )
     r = IStorage_SetClass( stg, &CLSID_MsiPatch );
     ok( r == S_OK, "failed to set storage type 0x%08x\n", r );
 
-    write_tables( stg, table_patch_data, NUM_PATCH_TABLES );
+    write_tables( stg, table_patch_data, ARRAY_SIZE( table_patch_data ));
 
     r = IStorage_CreateStorage( stg, p_name7, mode, 0, 0, &stg1 );
     ok( r == S_OK, "failed to create substorage 0x%08x\n", r );
@@ -700,7 +694,7 @@ static void create_patch( const char *filename )
     r = IStorage_SetClass( stg1, &CLSID_MsiTransform );
     ok( r == S_OK, "failed to set storage type 0x%08x\n", r );
 
-    write_tables( stg1, table_transform1_data, NUM_TRANSFORM1_TABLES );
+    write_tables( stg1, table_transform1_data, ARRAY_SIZE( table_transform1_data ));
     IStorage_Release( stg1 );
 
     r = IStorage_CreateStorage( stg, p_name8, mode, 0, 0, &stg2 );
@@ -709,7 +703,7 @@ static void create_patch( const char *filename )
     r = IStorage_SetClass( stg2, &CLSID_MsiTransform );
     ok( r == S_OK, "failed to set storage type 0x%08x\n", r );
 
-    write_tables( stg2, table_transform2_data, NUM_TRANSFORM2_TABLES );
+    write_tables( stg2, table_transform2_data, ARRAY_SIZE( table_transform2_data ));
     IStorage_Release( stg2 );
     IStorage_Release( stg );
 }
-- 
2.14.4




More information about the wine-devel mailing list