[PATCH 1/2] oleaut32/tests: Don't take the size of a pointer (Clang).

Charles Davis cdavis5x at gmail.com
Tue Sep 18 00:51:13 CDT 2012


From: Charles Davis <cdavis at mymail.mines.edu>

Contrary to what a novice C programmer might expect, when you declare an
array parameter to a function, what you actually get is a pointer.
Therefore, using sizeof() on the parameter will return the size of a
pointer, and not 8*sizeof(UINT) as was intended here. Since the array was
explicitly declared as being 8 elements long, just use the number 8 in
the for loop instead.
---
 dlls/oleaut32/tests/tmarshal.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/dlls/oleaut32/tests/tmarshal.c b/dlls/oleaut32/tests/tmarshal.c
index be8ef94..ad56123 100644
--- a/dlls/oleaut32/tests/tmarshal.c
+++ b/dlls/oleaut32/tests/tmarshal.c
@@ -596,10 +596,10 @@ static HRESULT WINAPI Widget_VarArg(
 }
 
 
-static BOOL mystruct_uint_ordered(UINT uarr[8])
+static BOOL mystruct_uint_ordered(UINT uarr[])
 {
     int i;
-    for (i = 0; i < sizeof(uarr) / sizeof(uarr[0]); i++)
+    for (i = 0; i < 8; i++)
         if (uarr[i] != i)
             return 0;
 
-- 
1.7.12




More information about the wine-patches mailing list