Commit 84631593 authored by Nikolay Sivov's avatar Nikolay Sivov Committed by Alexandre Julliard

gdiplus: Use ARRAY_SIZE() macro.

parent f732bfc5
......@@ -232,7 +232,7 @@ static const char HatchBrushes[][8] = {
GpStatus get_hatch_data(GpHatchStyle hatchstyle, const char **result)
{
if (hatchstyle < sizeof(HatchBrushes) / sizeof(HatchBrushes[0]))
if (hatchstyle < ARRAY_SIZE(HatchBrushes))
{
*result = HatchBrushes[hatchstyle];
return Ok;
......
......@@ -1367,7 +1367,7 @@ static int match_name_table_language( const tt_name_record *name, LANGID lang )
case TT_PLATFORM_MACINTOSH:
if (!IsValidCodePage( get_mac_code_page( name ))) return 0;
name_lang = GET_BE_WORD(name->language_id);
if (name_lang >= sizeof(mac_langid_table)/sizeof(mac_langid_table[0])) return 0;
if (name_lang >= ARRAY_SIZE(mac_langid_table)) return 0;
name_lang = mac_langid_table[name_lang];
break;
case TT_PLATFORM_APPLE_UNICODE:
......@@ -1377,7 +1377,7 @@ static int match_name_table_language( const tt_name_record *name, LANGID lang )
case TT_APPLE_ID_ISO_10646:
case TT_APPLE_ID_UNICODE_2_0:
name_lang = GET_BE_WORD(name->language_id);
if (name_lang >= sizeof(mac_langid_table)/sizeof(mac_langid_table[0])) return 0;
if (name_lang >= ARRAY_SIZE(mac_langid_table)) return 0;
name_lang = mac_langid_table[name_lang];
break;
default:
......
......@@ -35,6 +35,8 @@
#include "gdiplus.h"
#define ARRAY_SIZE(array) (sizeof(array) / sizeof((array)[0]))
#define GP_DEFAULT_PENSTYLE (PS_GEOMETRIC | PS_SOLID | PS_ENDCAP_FLAT | PS_JOIN_MITER)
#define MAX_ARC_PTS (13)
#define MAX_DASHLEN (16) /* this is a limitation of gdi */
......
......@@ -2554,7 +2554,7 @@ static UINT vt_to_itemtype(UINT vt)
{ VT_BLOB, PropertyTagTypeUndefined }
};
UINT i;
for (i = 0; i < sizeof(vt2type)/sizeof(vt2type[0]); i++)
for (i = 0; i < ARRAY_SIZE(vt2type); i++)
{
if (vt2type[i].vt == vt) return vt2type[i].type;
}
......@@ -3454,10 +3454,10 @@ static void png_metadata_reader(GpBitmap *bitmap, IWICBitmapDecoder *decoder, UI
{
if (name.vt == VT_LPSTR)
{
for (j=0; j<sizeof(keywords)/sizeof(keywords[0]); j++)
for (j = 0; j < ARRAY_SIZE(keywords); j++)
if (!strcmp(keywords[j].name, name.u.pszVal))
break;
if (j < sizeof(keywords)/sizeof(keywords[0]) && !keywords[j].seen)
if (j < ARRAY_SIZE(keywords) && !keywords[j].seen)
{
keywords[j].seen = TRUE;
item = create_prop(keywords[j].propid, &value);
......
......@@ -606,7 +606,7 @@ void METAFILE_Free(GpMetafile *metafile)
if (metafile->record_stream)
IStream_Release(metafile->record_stream);
for (i = 0; i < sizeof(metafile->objtable)/sizeof(metafile->objtable[0]); i++)
for (i = 0; i < ARRAY_SIZE(metafile->objtable); i++)
metafile_free_object_table_entry(metafile, i);
}
......
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