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

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

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

Michael Stefaniuc-4
Signed-off-by: Michael Stefaniuc <[hidden email]>
---
 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



Reply | Threaded
Open this post in threaded view
|

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

Michael Stefaniuc-4
Sorry about these, generated the patches on a different machine and that
still added [hidden email] to the headers.

bye
        michael

On 05/30/2018 09:15 PM, Michael Stefaniuc wrote:

> Signed-off-by: Michael Stefaniuc <[hidden email]>
> ---
>  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 );
>