Signed-off-by: Michael Stefaniuc <mstefani(a)winehq.org>
---
dlls/gdi32/tests/bitmap.c | 10 ++++-----
dlls/gdi32/tests/brush.c | 2 +-
dlls/gdi32/tests/dc.c | 6 +++---
dlls/gdi32/tests/dib.c | 38 ++++++++++++++++-----------------
dlls/gdi32/tests/font.c | 52 ++++++++++++++++++++++-----------------------
dlls/gdi32/tests/gdiobj.c | 2 +-
dlls/gdi32/tests/icm.c | 2 +-
dlls/gdi32/tests/metafile.c | 7 +++---
dlls/gdi32/tests/path.c | 14 ++++++------
dlls/gdi32/tests/pen.c | 2 +-
10 files changed, 67 insertions(+), 68 deletions(-)
diff --git a/dlls/gdi32/tests/bitmap.c b/dlls/gdi32/tests/bitmap.c
index a4002c83b5..4748691791 100644
--- a/dlls/gdi32/tests/bitmap.c
+++ b/dlls/gdi32/tests/bitmap.c
@@ -84,7 +84,7 @@ static void test_bitmap_info(HBITMAP hbm, INT expected_depth, const BITMAPINFOHE
SetLastError(0xdeadbeef);
test_size[0] = bm.bmWidthBytes * bm.bmHeight;
/* NULL output buffer with different count values */
- for (i = 0; i < sizeof(test_size) / sizeof(test_size[0]); i++)
+ for (i = 0; i < ARRAY_SIZE(test_size); i++)
{
ret = GetBitmapBits(hbm, test_size[i], NULL);
ok(ret == bm.bmWidthBytes * bm.bmHeight, "%d != %d\n", ret, bm.bmWidthBytes * bm.bmHeight);
@@ -94,7 +94,7 @@ static void test_bitmap_info(HBITMAP hbm, INT expected_depth, const BITMAPINFOHE
memset(buf_cmp, 0, bm.bmWidthBytes * bm.bmHeight);
/* Correct output buffer with different count values */
- for (i = 0; i < sizeof(test_size) / sizeof(test_size[0]); i++)
+ for (i = 0; i < ARRAY_SIZE(test_size); i++)
{
int expect = i == 1 ? 0 : bm.bmWidthBytes * bm.bmHeight;
memset(buf, 0xAA, sizeof(buf));
@@ -1745,7 +1745,7 @@ static void test_mono_bitmap(void)
SelectObject( hdc, hbmp );
- for (col = 0; col < sizeof(colors) / sizeof(colors[0]); col++)
+ for (col = 0; col < ARRAY_SIZE(colors); col++)
{
SetTextColor( hdc, colors[col][0] );
SetBkColor( hdc, colors[col][1] );
@@ -2690,7 +2690,7 @@ static void test_select_object(void)
DeleteObject(hbm);
- for(i = 0; i < sizeof(depths)/sizeof(depths[0]); i++) {
+ for(i = 0; i < ARRAY_SIZE(depths); i++) {
/* test a color bitmap to dc bpp matching */
planes = GetDeviceCaps(hdc, PLANES);
bpp = GetDeviceCaps(hdc, BITSPIXEL);
@@ -5710,7 +5710,7 @@ static void test_D3DKMTCreateDCFromMemory( void )
status = pD3DKMTCreateDCFromMemory( NULL );
ok(status == STATUS_INVALID_PARAMETER, "Got unexpected status %#x.\n", status);
- for (i = 0; i < sizeof(test_data) / sizeof(*test_data); ++i)
+ for (i = 0; i < ARRAY_SIZE(test_data); ++i)
{
memset( data, 0xaa, sizeof(data) );
diff --git a/dlls/gdi32/tests/brush.c b/dlls/gdi32/tests/brush.c
index 1a10429c05..a3ebb91e1e 100644
--- a/dlls/gdi32/tests/brush.c
+++ b/dlls/gdi32/tests/brush.c
@@ -48,7 +48,7 @@ static void test_solidbrush(void)
size_t i;
INT ret;
- for(i=0; i<sizeof(stock)/sizeof(stock[0]); i++) {
+ for(i = 0; i < ARRAY_SIZE(stock); i++) {
solidBrush = CreateSolidBrush(stock[i].color);
if(stock[i].stockobj != -1) {
diff --git a/dlls/gdi32/tests/dc.c b/dlls/gdi32/tests/dc.c
index 3c1fa603a6..5ad3b31483 100644
--- a/dlls/gdi32/tests/dc.c
+++ b/dlls/gdi32/tests/dc.c
@@ -361,7 +361,7 @@ static void test_device_caps( HDC hdc, HDC ref_dc, const char *descr, int scale
if (GetObjectType( hdc ) == OBJ_METADC)
{
- for (i = 0; i < sizeof(caps)/sizeof(caps[0]); i++)
+ for (i = 0; i < ARRAY_SIZE(caps); i++)
ok( GetDeviceCaps( hdc, caps[i] ) == (caps[i] == TECHNOLOGY ? DT_METAFILE : 0),
"wrong caps on %s for %u: %u\n", descr, caps[i],
GetDeviceCaps( hdc, caps[i] ) );
@@ -384,7 +384,7 @@ static void test_device_caps( HDC hdc, HDC ref_dc, const char *descr, int scale
}
else
{
- for (i = 0; i < sizeof(caps)/sizeof(caps[0]); i++)
+ for (i = 0; i < ARRAY_SIZE(caps); i++)
{
INT precision = 0;
INT hdc_caps = GetDeviceCaps( hdc, caps[i] );
@@ -506,7 +506,7 @@ static void test_device_caps( HDC hdc, HDC ref_dc, const char *descr, int scale
dib = CreateDIBSection( ref_dc, info, DIB_RGB_COLORS, NULL, NULL, 0 );
old = SelectObject( hdc, dib );
- for (i = 0; i < sizeof(caps)/sizeof(caps[0]); i++)
+ for (i = 0; i < ARRAY_SIZE(caps); i++)
ok( GetDeviceCaps( hdc, caps[i] ) == GetDeviceCaps( ref_dc, caps[i] ),
"mismatched caps on %s and DIB for %u: %u/%u\n", descr, caps[i],
GetDeviceCaps( hdc, caps[i] ), GetDeviceCaps( ref_dc, caps[i] ) );
diff --git a/dlls/gdi32/tests/dib.c b/dlls/gdi32/tests/dib.c
index e3f188749d..d16cb0df5c 100644
--- a/dlls/gdi32/tests/dib.c
+++ b/dlls/gdi32/tests/dib.c
@@ -1559,7 +1559,7 @@ static const POINT polypoly_lines[] =
static const DWORD polypoly_counts[] =
{
- sizeof(polypoly_lines)/sizeof(polypoly_lines[0])
+ ARRAY_SIZE(polypoly_lines)
};
static const RECT patblt_clips[] =
@@ -1816,7 +1816,7 @@ static void draw_graphics(HDC hdc, const BITMAPINFO *bmi, BYTE *bits)
}
compare_hash(hdc, bmi, bits, "diagonal solid lines");
- for(i = 0; i < sizeof(bias_check) / sizeof(bias_check[0]); i++)
+ for(i = 0; i < ARRAY_SIZE(bias_check); i++)
{
MoveToEx(hdc, bias_check[i].left, bias_check[i].top, NULL);
LineTo(hdc, bias_check[i].right, bias_check[i].bottom);
@@ -1851,21 +1851,21 @@ static void draw_graphics(HDC hdc, const BITMAPINFO *bmi, BYTE *bits)
ExtSelectClipRgn(hdc, hrgn, RGN_COPY);
DeleteObject(hrgn2);
- for(i = 0; i < sizeof(hline_clips)/sizeof(hline_clips[0]); i++)
+ for(i = 0; i < ARRAY_SIZE(hline_clips); i++)
{
MoveToEx(hdc, hline_clips[i].left, hline_clips[i].top, NULL);
LineTo(hdc, hline_clips[i].right, hline_clips[i].bottom);
}
compare_hash(hdc, bmi, bits, "clipped solid hlines");
- for(i = 0; i < sizeof(vline_clips)/sizeof(vline_clips[0]); i++)
+ for(i = 0; i < ARRAY_SIZE(vline_clips); i++)
{
MoveToEx(hdc, vline_clips[i].left, vline_clips[i].top, NULL);
LineTo(hdc, vline_clips[i].right, vline_clips[i].bottom);
}
compare_hash(hdc, bmi, bits, "clipped solid vlines");
- for(i = 0; i < sizeof(line_clips)/sizeof(line_clips[0]); i++)
+ for(i = 0; i < ARRAY_SIZE(line_clips); i++)
{
MoveToEx(hdc, line_clips[i].left, line_clips[i].top, NULL);
LineTo(hdc, line_clips[i].right, line_clips[i].bottom);
@@ -1873,7 +1873,7 @@ static void draw_graphics(HDC hdc, const BITMAPINFO *bmi, BYTE *bits)
compare_hash(hdc, bmi, bits, "clipped solid diagonal lines");
/* clipped PatBlt */
- for(i = 0; i < sizeof(patblt_clips) / sizeof(patblt_clips[0]); i++)
+ for(i = 0; i < ARRAY_SIZE(patblt_clips); i++)
{
PatBlt(hdc, patblt_clips[i].left, patblt_clips[i].top,
patblt_clips[i].right - patblt_clips[i].left,
@@ -1887,35 +1887,35 @@ static void draw_graphics(HDC hdc, const BITMAPINFO *bmi, BYTE *bits)
SetBkMode(hdc, TRANSPARENT);
SetBkColor(hdc, RGB(0, 0xff, 0));
- for(i = 0; i < sizeof(hline_clips)/sizeof(hline_clips[0]); i++)
+ for(i = 0; i < ARRAY_SIZE(hline_clips); i++)
{
MoveToEx(hdc, hline_clips[i].left, hline_clips[i].top, NULL);
LineTo(hdc, hline_clips[i].right, hline_clips[i].bottom);
}
compare_hash(hdc, bmi, bits, "clipped dashed hlines");
- for(i = 0; i < sizeof(hline_clips)/sizeof(hline_clips[0]); i++)
+ for(i = 0; i < ARRAY_SIZE(hline_clips); i++)
{
MoveToEx(hdc, hline_clips[i].right - 1, hline_clips[i].bottom, NULL);
LineTo(hdc, hline_clips[i].left - 1, hline_clips[i].top);
}
compare_hash(hdc, bmi, bits, "clipped dashed hlines r -> l");
- for(i = 0; i < sizeof(vline_clips)/sizeof(vline_clips[0]); i++)
+ for(i = 0; i < ARRAY_SIZE(vline_clips); i++)
{
MoveToEx(hdc, vline_clips[i].left, vline_clips[i].top, NULL);
LineTo(hdc, vline_clips[i].right, vline_clips[i].bottom);
}
compare_hash(hdc, bmi, bits, "clipped dashed vlines");
- for(i = 0; i < sizeof(vline_clips)/sizeof(vline_clips[0]); i++)
+ for(i = 0; i < ARRAY_SIZE(vline_clips); i++)
{
MoveToEx(hdc, vline_clips[i].right, vline_clips[i].bottom - 1, NULL);
LineTo(hdc, vline_clips[i].left, vline_clips[i].top - 1);
}
compare_hash(hdc, bmi, bits, "clipped dashed vlines b -> t");
- for(i = 0; i < sizeof(line_clips)/sizeof(line_clips[0]); i++)
+ for(i = 0; i < ARRAY_SIZE(line_clips); i++)
{
MoveToEx(hdc, line_clips[i].left, line_clips[i].top, NULL);
LineTo(hdc, line_clips[i].right, line_clips[i].bottom);
@@ -1924,7 +1924,7 @@ static void draw_graphics(HDC hdc, const BITMAPINFO *bmi, BYTE *bits)
SetBkMode(hdc, OPAQUE);
- for(i = 0; i < sizeof(line_clips)/sizeof(line_clips[0]); i++)
+ for(i = 0; i < ARRAY_SIZE(line_clips); i++)
{
MoveToEx(hdc, line_clips[i].left, line_clips[i].top, NULL);
LineTo(hdc, line_clips[i].right, line_clips[i].bottom);
@@ -2163,13 +2163,13 @@ static void draw_graphics(HDC hdc, const BITMAPINFO *bmi, BYTE *bits)
SelectObject(hdc, solid_pen);
SelectObject(hdc, solid_brush);
- for(i = 0; i < sizeof(rectangles)/sizeof(rectangles[0]); i++)
+ for(i = 0; i < ARRAY_SIZE(rectangles); i++)
{
Rectangle(hdc, rectangles[i].left, rectangles[i].top, rectangles[i].right, rectangles[i].bottom);
}
SelectObject(hdc, dashed_pen);
- for(i = 0; i < sizeof(rectangles)/sizeof(rectangles[0]); i++)
+ for(i = 0; i < ARRAY_SIZE(rectangles); i++)
{
Rectangle(hdc, rectangles[i].left, rectangles[i].top + 150, rectangles[i].right, rectangles[i].bottom + 150);
}
@@ -2775,7 +2775,7 @@ static void draw_graphics(HDC hdc, const BITMAPINFO *bmi, BYTE *bits)
wide_pen = CreatePen( PS_SOLID, 7, RGB( 0xff, 0, 0 ) );
SelectObject( hdc, wide_pen );
- for (i = 0; i < sizeof( wide_lines ) / sizeof( wide_lines[0] ); i++)
+ for (i = 0; i < ARRAY_SIZE(wide_lines); i++)
{
MoveToEx( hdc, wide_lines[i].left, wide_lines[i].top, NULL );
LineTo( hdc, wide_lines[i].right, wide_lines[i].bottom );
@@ -2794,7 +2794,7 @@ static void draw_graphics(HDC hdc, const BITMAPINFO *bmi, BYTE *bits)
9, &log_brush, 0, NULL );
SelectObject( hdc, wide_pen );
SetBrushOrgEx( hdc, 3, 3, NULL );
- Polyline( hdc, poly_lines, sizeof(poly_lines) / sizeof(poly_lines[0]) );
+ Polyline( hdc, poly_lines, ARRAY_SIZE( poly_lines ));
compare_hash_broken_todo( hdc, bmi, bits, "wide pen - flat caps, mitred", is_ddb, is_ddb );
SetBrushOrgEx( hdc, 0, 0, NULL );
@@ -2805,7 +2805,7 @@ static void draw_graphics(HDC hdc, const BITMAPINFO *bmi, BYTE *bits)
16, &log_brush, 0, NULL );
SelectObject( hdc, wide_pen );
- Polyline( hdc, poly_lines, sizeof(poly_lines) / sizeof(poly_lines[0]) );
+ Polyline( hdc, poly_lines, ARRAY_SIZE( poly_lines ));
compare_hash_broken_todo( hdc, bmi, bits, "wide pen - square caps, bevelled", is_ddb, is_ddb );
SelectObject( hdc, orig_pen );
@@ -2815,7 +2815,7 @@ static void draw_graphics(HDC hdc, const BITMAPINFO *bmi, BYTE *bits)
9, &log_brush, 0, NULL );
SelectObject( hdc, wide_pen );
- PolyPolyline( hdc, polypoly_lines, polypoly_counts, sizeof(polypoly_counts)/sizeof(polypoly_counts[0]) );
+ PolyPolyline( hdc, polypoly_lines, polypoly_counts, ARRAY_SIZE( polypoly_counts ));
compare_hash_broken_todo( hdc, bmi, bits, "wide pen - empty segments", is_ddb, is_ddb );
SelectObject( hdc, orig_pen );
@@ -2833,7 +2833,7 @@ static void draw_graphics(HDC hdc, const BITMAPINFO *bmi, BYTE *bits)
12, &log_brush, 0, NULL );
ok( wide_pen != 0, "failed to create pen\n" );
SelectObject( hdc, wide_pen );
- Polyline( hdc, poly_lines, sizeof(poly_lines) / sizeof(poly_lines[0]) );
+ Polyline( hdc, poly_lines, ARRAY_SIZE( poly_lines ));
for (i = 1; i < 20; i++)
{
diff --git a/dlls/gdi32/tests/font.c b/dlls/gdi32/tests/font.c
index 6243a6d339..8f5454b918 100644
--- a/dlls/gdi32/tests/font.c
+++ b/dlls/gdi32/tests/font.c
@@ -937,7 +937,7 @@ static void test_bitmap_font_metrics(void)
screen_log_pixels = GetDeviceCaps(hdc, LOGPIXELSY);
diff = 32768;
font_res = 0;
- for (i = 0; i < sizeof(font_log_pixels)/sizeof(font_log_pixels[0]); i++)
+ for (i = 0; i < ARRAY_SIZE(font_log_pixels); i++)
{
int new_diff = abs(font_log_pixels[i] - screen_log_pixels);
if (new_diff < diff)
@@ -948,7 +948,7 @@ static void test_bitmap_font_metrics(void)
}
trace("best font resolution is %d\n", font_res);
- for (i = 0; i < sizeof(fd)/sizeof(fd[0]); i++)
+ for (i = 0; i < ARRAY_SIZE(fd); i++)
{
int bit, height;
@@ -1190,7 +1190,7 @@ static void test_GetCharABCWidths(void)
UINT cs;
UINT a;
UINT w;
- BOOL r[sizeof range / sizeof range[0]];
+ BOOL r[ARRAY_SIZE(range)];
} c[] =
{
{ANSI_CHARSET, 0x30, 0x30,
@@ -1253,7 +1253,7 @@ static void test_GetCharABCWidths(void)
hfont = SelectObject(hdc, hfont);
DeleteObject(hfont);
- for (i = 0; i < sizeof c / sizeof c[0]; ++i)
+ for (i = 0; i < ARRAY_SIZE(c); ++i)
{
ABC a[2], w[2];
ABC full[256];
@@ -1285,7 +1285,7 @@ static void test_GetCharABCWidths(void)
ok(memcmp(&a[0], &full[code], sizeof(ABC)) == 0,
"GetCharABCWidthsA info should match. codepage = %u\n", c[i].cs);
- for (j = 0; j < sizeof range / sizeof range[0]; ++j)
+ for (j = 0; j < ARRAY_SIZE(range); ++j)
{
memset(full, 0xdd, sizeof full);
ret = pGetCharABCWidthsA(hdc, range[j].first, range[j].last, full);
@@ -1774,7 +1774,7 @@ static void test_GetKerningPairs(void)
return;
}
- for (i = 0; i < sizeof(kd)/sizeof(kd[0]); i++)
+ for (i = 0; i < ARRAY_SIZE(kd); i++)
{
OUTLINETEXTMETRICW otm;
UINT uiRet;
@@ -2095,7 +2095,7 @@ static void test_height_selection_vdmx( HDC hdc )
return;
}
- for (i = 0; i < sizeof(data) / sizeof(data[0]); i++)
+ for (i = 0; i < ARRAY_SIZE(data); i++)
{
res = get_res_data( "wine_vdmx.ttf", &size );
@@ -2356,7 +2356,7 @@ static void testJustification(HDC hdc, PCSTR str, RECT *clientArea)
{
SetTextJustification(hdc, areaWidth - size.cx, breakCount);
GetTextExtentPoint32A(hdc, pFirstChar, pLastChar - pFirstChar, &size);
- if (size.cx != areaWidth && nErrors < sizeof(error)/sizeof(error[0]) - 1)
+ if (size.cx != areaWidth && nErrors < ARRAY_SIZE(error) - 1)
{
error[nErrors].start = pFirstChar;
error[nErrors].len = pLastChar - pFirstChar;
@@ -2613,7 +2613,7 @@ static void test_font_charset(void)
return;
}
- for (i = 0; i < sizeof(cd)/sizeof(cd[0]); i++)
+ for (i = 0; i < ARRAY_SIZE(cd); i++)
{
if (cd[i].charset == SYMBOL_CHARSET)
{
@@ -2687,7 +2687,7 @@ static void test_GdiGetCodePage(void)
acp = GetACP();
- for (i = 0; i < sizeof(matching_data) / sizeof(struct _matching_data); i++)
+ for (i = 0; i < ARRAY_SIZE(matching_data); i++)
{
/* only test data matched current locale codepage */
if (matching_data[i].current_codepage != acp)
@@ -3700,7 +3700,7 @@ static int match_name_table_language( const sfnt_name *name, LANGID lang )
break;
case TT_PLATFORM_MACINTOSH:
if (!IsValidCodePage( get_mac_code_page( name ))) return 0;
- if (GET_BE_WORD(name->language_id) >= sizeof(mac_langid_table)/sizeof(mac_langid_table[0])) return 0;
+ if (GET_BE_WORD(name->language_id) >= ARRAY_SIZE(mac_langid_table)) return 0;
name_lang = mac_langid_table[GET_BE_WORD(name->language_id)];
break;
case TT_PLATFORM_APPLE_UNICODE:
@@ -3710,7 +3710,7 @@ static int match_name_table_language( const sfnt_name *name, LANGID lang )
case TT_APPLE_ID_DEFAULT:
case TT_APPLE_ID_ISO_10646:
case TT_APPLE_ID_UNICODE_2_0:
- if (GET_BE_WORD(name->language_id) >= sizeof(mac_langid_table)/sizeof(mac_langid_table[0])) return 0;
+ if (GET_BE_WORD(name->language_id) >= ARRAY_SIZE(mac_langid_table)) return 0;
name_lang = mac_langid_table[GET_BE_WORD(name->language_id)];
break;
default:
@@ -4105,7 +4105,7 @@ static void test_nonexistent_font(void)
hdc = CreateCompatibleDC(0);
- for (i = 0; i < sizeof(shell_subst)/sizeof(shell_subst[0]); i++)
+ for (i = 0; i < ARRAY_SIZE(shell_subst); i++)
{
ret = is_font_installed(shell_subst[i].name);
ok(ret || broken(!ret) /* win2000 */, "%s should be enumerated\n", shell_subst[i].name);
@@ -4201,7 +4201,7 @@ todo_wine /* Wine uses Arial for all substitutions */
ok(cs == ANSI_CHARSET, "expected ANSI_CHARSET, got %d\n", cs);
DeleteObject(SelectObject(hdc, hfont));
- for (i = 0; i < sizeof(font_subst)/sizeof(font_subst[0]); i++)
+ for (i = 0; i < ARRAY_SIZE(font_subst); i++)
{
ret = is_font_installed(font_subst[i].name);
todo_wine
@@ -4487,8 +4487,8 @@ static void test_GetTextFace(void)
dc = GetDC(NULL);
g = SelectObject(dc, f);
- n = GetTextFaceW(dc, sizeof bufW / sizeof bufW[0], bufW);
- ok(n == sizeof faceW / sizeof faceW[0], "GetTextFaceW returned %d\n", n);
+ n = GetTextFaceW(dc, ARRAY_SIZE(bufW), bufW);
+ ok(n == ARRAY_SIZE(faceW), "GetTextFaceW returned %d\n", n);
ok(lstrcmpW(faceW, bufW) == 0, "GetTextFaceW\n");
/* Play with the count arg. */
@@ -4508,7 +4508,7 @@ static void test_GetTextFace(void)
ok(bufW[0] == faceW[0] && bufW[1] == '\0', "GetTextFaceW didn't copy\n");
n = GetTextFaceW(dc, 0, NULL);
- ok(n == sizeof faceW / sizeof faceW[0], "GetTextFaceW returned %d\n", n);
+ ok(n == ARRAY_SIZE(faceW), "GetTextFaceW returned %d\n", n);
DeleteObject(SelectObject(dc, g));
ReleaseDC(NULL, dc);
@@ -4719,7 +4719,7 @@ static void test_GetGlyphOutline(void)
if (GetLastError() != ERROR_CALL_NOT_IMPLEMENTED)
ok(ret == GDI_ERROR, "GetGlyphOutlineW should return an error when the buffer size is too small.\n");
- for (i = 0; i < sizeof(fmt) / sizeof(fmt[0]); ++i)
+ for (i = 0; i < ARRAY_SIZE(fmt); ++i)
{
DWORD dummy;
@@ -4785,7 +4785,7 @@ static void test_GetGlyphOutline(void)
SelectObject(hdc, old_hfont);
DeleteObject(hfont);
- for (i = 0; i < sizeof c / sizeof c[0]; ++i)
+ for (i = 0; i < ARRAY_SIZE(c); ++i)
{
static const MAT2 rotate_mat = {{0, 0}, {0, -1}, {0, 1}, {0, 0}};
TEXTMETRICA tm;
@@ -4955,7 +4955,7 @@ static void test_CreateFontIndirect(void)
lf.lfItalic = FALSE;
lf.lfWeight = FW_DONTCARE;
- for (i = 0; i < sizeof(TestName)/sizeof(TestName[0]); i++)
+ for (i = 0; i < ARRAY_SIZE(TestName); i++)
{
lstrcpyA(lf.lfFaceName, TestName[i]);
hfont = CreateFontIndirectA(&lf);
@@ -5409,7 +5409,7 @@ static void test_fullname(void)
lf.lfItalic = FALSE;
lf.lfWeight = FW_DONTCARE;
- for (i = 0; i < sizeof(TestName) / sizeof(TestName[0]); i++)
+ for (i = 0; i < ARRAY_SIZE(TestName); i++)
{
if (!is_font_installed_fullname("Lucida Sans", TestName[i]))
{
@@ -6058,7 +6058,7 @@ static void test_vertical_font(void)
ok(hgi != vgi, "same glyph h:%u v:%u\n", hgi, vgi);
- for (i = 0; i < sizeof(face_list)/sizeof(face_list[0]); i++) {
+ for (i = 0; i < ARRAY_SIZE(face_list); i++) {
const char* face = face_list[i];
if (!is_truetype_font_installed(face)) {
skip("%s is not installed\n", face);
@@ -6092,7 +6092,7 @@ static void test_east_asian_font_selection(void)
hdc = GetDC(NULL);
- for (i = 0; i < sizeof(charset)/sizeof(charset[0]); i++)
+ for (i = 0; i < ARRAY_SIZE(charset); i++)
{
LOGFONTA lf;
HFONT hfont;
@@ -6214,7 +6214,7 @@ static void test_stock_fonts(void)
};
int i, j;
- for (i = 0; i < sizeof(font)/sizeof(font[0]); i++)
+ for (i = 0; i < ARRAY_SIZE(font); i++)
{
HFONT hfont;
LOGFONTA lf;
@@ -6314,7 +6314,7 @@ static void test_max_height(void)
DeleteObject(SelectObject(hdc, hfont_old));
/* test an invalid value */
- for (i = 0; i < sizeof(invalid_height)/sizeof(invalid_height[0]); i++) {
+ for (i = 0; i < ARRAY_SIZE(invalid_height); i++) {
lf.lfHeight = invalid_height[i];
hfont = CreateFontIndirectA(&lf);
hfont_old = SelectObject(hdc, hfont);
@@ -6638,7 +6638,7 @@ static void test_bitmap_font_glyph_index(void)
bmi.bmiHeader.biHeight = 32;
bmi.bmiHeader.biCompression = BI_RGB;
- for (i = 0; i < sizeof(bitmap_font_list)/sizeof(bitmap_font_list[0]); i++) {
+ for (i = 0; i < ARRAY_SIZE(bitmap_font_list); i++) {
memset(&lf, 0, sizeof(lf));
lf.lfCharSet = bitmap_font_list[i].charset;
strcpy(lf.lfFaceName, bitmap_font_list[i].face);
diff --git a/dlls/gdi32/tests/gdiobj.c b/dlls/gdi32/tests/gdiobj.c
index 65374ea85d..8f3d01c27d 100644
--- a/dlls/gdi32/tests/gdiobj.c
+++ b/dlls/gdi32/tests/gdiobj.c
@@ -345,7 +345,7 @@ static void test_handles_on_win64(void)
if (sizeof(void*) != 8)
return;
- for (i = 0; i < sizeof(cases)/sizeof(cases[0]); i++)
+ for (i = 0; i < ARRAY_SIZE(cases); i++)
{
hrgn = CreateRectRgn(10, 10, 20, 20);
hrgn_test = (HRGN)(ULONG_PTR)((ULONG_PTR)hrgn | ((ULONGLONG)cases[i].high << 32) | cases[i].low);
diff --git a/dlls/gdi32/tests/icm.c b/dlls/gdi32/tests/icm.c
index 620809018a..340ebeef55 100644
--- a/dlls/gdi32/tests/icm.c
+++ b/dlls/gdi32/tests/icm.c
@@ -278,7 +278,7 @@ static void test_SetICMProfileW( HDC dc )
return;
}
- len = sizeof(profile)/sizeof(profile[0]);
+ len = ARRAY_SIZE(profile);
ret = GetICMProfileW( dc, &len, profile );
ok(ret, "GetICMProfileW failed %u\n", GetLastError());
diff --git a/dlls/gdi32/tests/metafile.c b/dlls/gdi32/tests/metafile.c
index 780b65f1b6..230d1e6d84 100644
--- a/dlls/gdi32/tests/metafile.c
+++ b/dlls/gdi32/tests/metafile.c
@@ -183,7 +183,7 @@ static void test_ExtTextOut(void)
static const RECT rc = { 0, 0, 100, 100 };
BOOL ret;
- assert(sizeof(dx)/sizeof(dx[0]) >= lstrlenA(text));
+ assert(ARRAY_SIZE(dx) >= lstrlenA(text));
/* Win9x doesn't play EMFs on invisible windows */
hwnd = CreateWindowExA(0, "static", NULL, WS_POPUP | WS_VISIBLE,
@@ -3895,8 +3895,7 @@ static void test_emf_GradientFill(void)
* written to the EMF, but is not considered in the bounds
* calculation.
*/
- ret = GdiGradientFill( mf, v, sizeof(v) / sizeof(v[0]), tri, sizeof(tri) / sizeof(tri[0]),
- GRADIENT_FILL_TRIANGLE );
+ ret = GdiGradientFill( mf, v, ARRAY_SIZE(v), tri, ARRAY_SIZE(tri), GRADIENT_FILL_TRIANGLE );
ok( ret, "GradientFill\n" );
hemf = CloseEnhMetaFile( mf );
@@ -4117,7 +4116,7 @@ static void test_emf_WorldTransform(void)
{ "manual modify", TRUE, FALSE }
};
- for(i = 0; i < sizeof(test_data) / sizeof(*test_data); ++i)
+ for(i = 0; i < ARRAY_SIZE(test_data); ++i)
{
hdcMetafile = CreateEnhMetaFileA(GetDC(0), NULL, NULL, NULL);
ok(hdcMetafile != 0, "CreateEnhMetaFileA error %d\n", GetLastError());
diff --git a/dlls/gdi32/tests/path.c b/dlls/gdi32/tests/path.c
index 48ef4f016a..80145fc6b2 100644
--- a/dlls/gdi32/tests/path.c
+++ b/dlls/gdi32/tests/path.c
@@ -495,7 +495,7 @@ static void test_arcto(void)
CloseFigure(hdc);
EndPath(hdc);
- ok_path(hdc, "arcto_path", arcto_path, sizeof(arcto_path)/sizeof(path_test_t));
+ ok_path(hdc, "arcto_path", arcto_path, ARRAY_SIZE(arcto_path));
done:
ReleaseDC(0, hdc);
}
@@ -540,7 +540,7 @@ static void test_anglearc(void)
CloseFigure(hdc);
EndPath(hdc);
- ok_path(hdc, "anglearc_path", anglearc_path, sizeof(anglearc_path)/sizeof(path_test_t));
+ ok_path(hdc, "anglearc_path", anglearc_path, ARRAY_SIZE(anglearc_path));
done:
ReleaseDC(0, hdc);
}
@@ -681,7 +681,7 @@ static void test_polydraw(void)
ok( pos.x == 80 && pos.y == 80, "wrong pos %d,%d\n", pos.x, pos.y );
EndPath(hdc);
- ok_path(hdc, "polydraw_path", polydraw_path, sizeof(polydraw_path)/sizeof(path_test_t));
+ ok_path(hdc, "polydraw_path", polydraw_path, ARRAY_SIZE(polydraw_path));
GetCurrentPositionEx( hdc, &pos );
ok( pos.x == 80 && pos.y == 80, "wrong pos %d,%d\n", pos.x, pos.y );
done:
@@ -966,7 +966,7 @@ static void test_rectangle(void)
SetArcDirection( hdc, AD_COUNTERCLOCKWISE );
EndPath( hdc );
SetMapMode( hdc, MM_TEXT );
- ok_path( hdc, "rectangle_path", rectangle_path, sizeof(rectangle_path)/sizeof(path_test_t) );
+ ok_path( hdc, "rectangle_path", rectangle_path, ARRAY_SIZE(rectangle_path) );
ReleaseDC( 0, hdc );
}
@@ -1327,7 +1327,7 @@ static void test_roundrect(void)
SetArcDirection( hdc, AD_COUNTERCLOCKWISE );
EndPath( hdc );
SetMapMode( hdc, MM_TEXT );
- ok_path( hdc, "roundrect_path", roundrect_path, sizeof(roundrect_path)/sizeof(path_test_t) );
+ ok_path( hdc, "roundrect_path", roundrect_path, ARRAY_SIZE(roundrect_path) );
ReleaseDC( 0, hdc );
}
@@ -1707,7 +1707,7 @@ static void test_ellipse(void)
SetArcDirection( hdc, AD_COUNTERCLOCKWISE );
EndPath( hdc );
SetMapMode( hdc, MM_TEXT );
- ok_path( hdc, "ellipse_path", ellipse_path, sizeof(ellipse_path)/sizeof(path_test_t) );
+ ok_path( hdc, "ellipse_path", ellipse_path, ARRAY_SIZE(ellipse_path) );
}
static const path_test_t all_funcs_path[] =
@@ -1890,7 +1890,7 @@ static void test_all_functions(void)
LineTo( hdc, 150, 150 );
/* FIXME: ExtTextOut */
EndPath( hdc );
- ok_path( hdc, "all_funcs_path", all_funcs_path, sizeof(all_funcs_path)/sizeof(path_test_t) );
+ ok_path( hdc, "all_funcs_path", all_funcs_path, ARRAY_SIZE(all_funcs_path) );
ReleaseDC( 0, hdc );
}
diff --git a/dlls/gdi32/tests/pen.c b/dlls/gdi32/tests/pen.c
index 43f00d8f50..badc585f57 100644
--- a/dlls/gdi32/tests/pen.c
+++ b/dlls/gdi32/tests/pen.c
@@ -72,7 +72,7 @@ static void test_logpen(void)
EXTLOGPEN *ext_pen = (EXTLOGPEN *)elp_buffer;
DWORD *ext_style = ext_pen->elpStyleEntry;
- for (i = 0; i < sizeof(pen)/sizeof(pen[0]); i++)
+ for (i = 0; i < ARRAY_SIZE(pen); i++)
{
trace("%d: testing style %u\n", i, pen[i].style);
--
2.14.4