[PATCH 1/3] gdi32/tests: Use the standard way of allocating a struct with VLA on the stack.
Michael Stefaniuc
mstefani at redhat.de
Mon Aug 19 04:44:18 CDT 2013
Avoids a -Waggressive-loop-optimizations warning on gcc >= 4.8
---
dlls/gdi32/tests/pen.c | 12 ++++--------
1 file changed, 4 insertions(+), 8 deletions(-)
diff --git a/dlls/gdi32/tests/pen.c b/dlls/gdi32/tests/pen.c
index ed7927a..bbbb439 100644
--- a/dlls/gdi32/tests/pen.c
+++ b/dlls/gdi32/tests/pen.c
@@ -511,12 +511,8 @@ static void test_ps_userstyle(void)
LOGBRUSH lb;
HPEN pen;
INT size, i;
-
- struct
- {
- EXTLOGPEN elp;
- DWORD style_data[15];
- } ext_pen;
+ char buffer[offsetof(EXTLOGPEN, elpStyleEntry[16])];
+ EXTLOGPEN *ext_pen = (EXTLOGPEN *)buffer;
lb.lbColor = 0x00ff0000;
lb.lbStyle = BS_SOLID;
@@ -561,11 +557,11 @@ static void test_ps_userstyle(void)
pen = ExtCreatePen(PS_GEOMETRIC | PS_USERSTYLE, 50, &lb, 16, style);
ok(pen != 0, "ExtCreatePen should not fail\n");
- size = GetObject(pen, sizeof(ext_pen), &ext_pen);
+ size = GetObject(pen, sizeof(buffer), ext_pen);
expect(FIELD_OFFSET(EXTLOGPEN,elpStyleEntry[16]), size);
for(i = 0; i < 16; i++)
- expect(style[i], ext_pen.elp.elpStyleEntry[i]);
+ expect(style[i], ext_pen->elpStyleEntry[i]);
DeleteObject(pen);
}
--
1.8.3.1
More information about the wine-patches
mailing list