gdiplus: Use ARRAY_SIZE() macro.
Signed-off-by: Nikolay Sivov <nsivov@codeweavers.com> Signed-off-by: Vincent Povirk <vincent@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
f732bfc50e
commit
8463159344
@ -232,7 +232,7 @@ static const char HatchBrushes[][8] = {
|
|||||||
|
|
||||||
GpStatus get_hatch_data(GpHatchStyle hatchstyle, const char **result)
|
GpStatus get_hatch_data(GpHatchStyle hatchstyle, const char **result)
|
||||||
{
|
{
|
||||||
if (hatchstyle < sizeof(HatchBrushes) / sizeof(HatchBrushes[0]))
|
if (hatchstyle < ARRAY_SIZE(HatchBrushes))
|
||||||
{
|
{
|
||||||
*result = HatchBrushes[hatchstyle];
|
*result = HatchBrushes[hatchstyle];
|
||||||
return Ok;
|
return Ok;
|
||||||
|
@ -1367,7 +1367,7 @@ static int match_name_table_language( const tt_name_record *name, LANGID lang )
|
|||||||
case TT_PLATFORM_MACINTOSH:
|
case TT_PLATFORM_MACINTOSH:
|
||||||
if (!IsValidCodePage( get_mac_code_page( name ))) return 0;
|
if (!IsValidCodePage( get_mac_code_page( name ))) return 0;
|
||||||
name_lang = GET_BE_WORD(name->language_id);
|
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];
|
name_lang = mac_langid_table[name_lang];
|
||||||
break;
|
break;
|
||||||
case TT_PLATFORM_APPLE_UNICODE:
|
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_ISO_10646:
|
||||||
case TT_APPLE_ID_UNICODE_2_0:
|
case TT_APPLE_ID_UNICODE_2_0:
|
||||||
name_lang = GET_BE_WORD(name->language_id);
|
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];
|
name_lang = mac_langid_table[name_lang];
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
@ -35,6 +35,8 @@
|
|||||||
|
|
||||||
#include "gdiplus.h"
|
#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 GP_DEFAULT_PENSTYLE (PS_GEOMETRIC | PS_SOLID | PS_ENDCAP_FLAT | PS_JOIN_MITER)
|
||||||
#define MAX_ARC_PTS (13)
|
#define MAX_ARC_PTS (13)
|
||||||
#define MAX_DASHLEN (16) /* this is a limitation of gdi */
|
#define MAX_DASHLEN (16) /* this is a limitation of gdi */
|
||||||
|
@ -2554,7 +2554,7 @@ static UINT vt_to_itemtype(UINT vt)
|
|||||||
{ VT_BLOB, PropertyTagTypeUndefined }
|
{ VT_BLOB, PropertyTagTypeUndefined }
|
||||||
};
|
};
|
||||||
UINT i;
|
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;
|
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)
|
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))
|
if (!strcmp(keywords[j].name, name.u.pszVal))
|
||||||
break;
|
break;
|
||||||
if (j < sizeof(keywords)/sizeof(keywords[0]) && !keywords[j].seen)
|
if (j < ARRAY_SIZE(keywords) && !keywords[j].seen)
|
||||||
{
|
{
|
||||||
keywords[j].seen = TRUE;
|
keywords[j].seen = TRUE;
|
||||||
item = create_prop(keywords[j].propid, &value);
|
item = create_prop(keywords[j].propid, &value);
|
||||||
|
@ -606,7 +606,7 @@ void METAFILE_Free(GpMetafile *metafile)
|
|||||||
if (metafile->record_stream)
|
if (metafile->record_stream)
|
||||||
IStream_Release(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);
|
metafile_free_object_table_entry(metafile, i);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user