[PATCH 01/17] wbemprox/tests: Use the available ARRAY_SIZE() macro

Michael Stefaniuc mstefani at winehq.org
Wed May 30 14:15:33 CDT 2018


Signed-off-by: Michael Stefaniuc <mstefani at winehq.org>
---
 dlls/wbemprox/tests/query.c    | 10 +++++-----
 dlls/wbemprox/tests/services.c |  2 +-
 2 files changed, 6 insertions(+), 6 deletions(-)

diff --git a/dlls/wbemprox/tests/query.c b/dlls/wbemprox/tests/query.c
index d95fdd970b..cb911d7927 100644
--- a/dlls/wbemprox/tests/query.c
+++ b/dlls/wbemprox/tests/query.c
@@ -141,7 +141,7 @@ static void test_select( IWbemServices *services )
     hr = IWbemServices_ExecQuery( services, wql, query, 0, NULL, &result );
     ok( hr == WBEM_E_INVALID_PARAMETER, "query failed %08x\n", hr );
 
-    for (i = 0; i < sizeof(test)/sizeof(test[0]); i++)
+    for (i = 0; i < ARRAY_SIZE( test ); i++)
     {
         hr = exec_query( services, test[i], &result );
         ok( hr == S_OK, "query %u failed: %08x\n", i, hr );
@@ -168,7 +168,7 @@ static void test_associators( IWbemServices *services )
     IEnumWbemClassObject *result;
     UINT i;
 
-    for (i = 0; i < sizeof(test)/sizeof(test[0]); i++)
+    for (i = 0; i < ARRAY_SIZE( test ); i++)
     {
         hr = exec_query( services, test[i], &result );
         todo_wine ok( hr == S_OK, "query %u failed: %08x\n", i, hr );
@@ -433,7 +433,7 @@ static void test_Win32_Process( IWbemServices *services )
 
     out = NULL;
     method = SysAllocString( getownerW );
-    class = SysAllocStringLen( NULL, sizeof(fmtW)/sizeof(fmtW[0]) + 10 );
+    class = SysAllocStringLen( NULL, ARRAY_SIZE( fmtW ) + 10 );
     wsprintfW( class, fmtW, GetCurrentProcessId() );
     hr = IWbemServices_ExecMethod( services, class, method, 0, NULL, NULL, &out, NULL );
     ok( hr == S_OK, "failed to execute method %08x\n", hr );
@@ -524,13 +524,13 @@ static void test_Win32_ComputerSystem( IWbemServices *services )
     WCHAR username[128];
     DWORD len, count;
 
-    len = sizeof(compname) / sizeof(compname[0]);
+    len = ARRAY_SIZE( compname );
     if (!GetComputerNameW( compname, &len ))
         compname[0] = 0;
 
     lstrcpyW( username, compname );
     lstrcatW( username, backslashW );
-    len = sizeof(username) / sizeof(username[0]) - lstrlenW( username );
+    len = ARRAY_SIZE( username ) - lstrlenW( username );
     if (!GetUserNameW( username + lstrlenW( username ), &len ))
         username[0] = 0;
 
diff --git a/dlls/wbemprox/tests/services.c b/dlls/wbemprox/tests/services.c
index a6774751f3..da10e72fe1 100644
--- a/dlls/wbemprox/tests/services.c
+++ b/dlls/wbemprox/tests/services.c
@@ -164,7 +164,7 @@ static void test_IWbemLocator(void)
     }
     ok( hr == S_OK, "failed to create IWbemLocator interface %08x\n", hr );
 
-    for (i = 0; i < sizeof(test) / sizeof(test[0]); i++)
+    for (i = 0; i < ARRAY_SIZE( test ); i++)
     {
         resource = SysAllocString( test[i].path );
         hr = IWbemLocator_ConnectServer( locator, resource, NULL, NULL, NULL, 0, NULL, NULL, &services );
-- 
2.14.3




More information about the wine-devel mailing list