Commit 14e20162 authored by Michael Stefaniuc's avatar Michael Stefaniuc Committed by Alexandre Julliard

gdi32/tests: Use offsetof instead of sizeof on structs with VLA.

parent da425748
......@@ -153,7 +153,8 @@ static void test_logpen(void)
if (pen[i].style == PS_NULL)
{
ok(hpen == GetStockObject(NULL_PEN), "hpen should be a stock NULL_PEN\n");
ok(size == sizeof(EXTLOGPEN), "GetObject returned %d, error %d\n", size, GetLastError());
ok(size == offsetof(EXTLOGPEN, elpStyleEntry[1]), "GetObject returned %d, error %d\n",
size, GetLastError());
ok(elp.elpPenStyle == pen[i].ret_style, "expected %u, got %u\n", pen[i].ret_style, elp.elpPenStyle);
ok(elp.elpWidth == 0, "expected 0, got %u\n", elp.elpWidth);
ok(elp.elpColor == pen[i].ret_color, "expected %08x, got %08x\n", pen[i].ret_color, elp.elpColor);
......@@ -275,7 +276,7 @@ static void test_logpen(void)
memset(&unset_hatch, 0xb0, sizeof(unset_hatch));
SetLastError(0xdeadbeef);
size = GetObject(hpen, sizeof(elp), &elp);
ok(size == sizeof(EXTLOGPEN),
ok(size == offsetof(EXTLOGPEN, elpStyleEntry[1]),
"GetObject returned %d, error %d\n", size, GetLastError());
ok(ext_pen->elpHatch == unset_hatch, "expected 0xb0b0b0b0, got %p\n", (void *)ext_pen->elpHatch);
ok(ext_pen->elpNumEntries == 0xb0b0b0b0, "expected 0xb0b0b0b0, got %x\n", ext_pen->elpNumEntries);
......@@ -385,11 +386,11 @@ test_geometric_pens:
memset(elp_buffer, 0xb0, sizeof(elp_buffer));
SetLastError(0xdeadbeef);
/* buffer is too small for user styles */
size = GetObject(hpen, sizeof(EXTLOGPEN), elp_buffer);
size = GetObject(hpen, offsetof(EXTLOGPEN, elpStyleEntry[1]), elp_buffer);
switch (pen[i].style)
{
case PS_NULL:
ok(size == sizeof(EXTLOGPEN),
ok(size == offsetof(EXTLOGPEN, elpStyleEntry[1]),
"GetObject returned %d, error %d\n", size, GetLastError());
ok(ext_pen->elpHatch == 0, "expected 0, got %p\n", (void *)ext_pen->elpHatch);
ok(ext_pen->elpNumEntries == 0, "expected 0, got %x\n", ext_pen->elpNumEntries);
......@@ -568,7 +569,7 @@ static void test_ps_userstyle(void)
static void test_brush_pens(void)
{
char buffer[sizeof(EXTLOGPEN) + 15 * sizeof(DWORD)];
char buffer[offsetof(EXTLOGPEN, elpStyleEntry[16])];
EXTLOGPEN *elp = (EXTLOGPEN *)buffer;
LOGBRUSH lb;
HPEN pen = 0;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment