d3dx9: Use the available ARRAY_SIZE() macro.

Signed-off-by: Michael Stefaniuc <mstefani@winehq.org>
Signed-off-by: Matteo Bruni <mbruni@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Michael Stefaniuc 2018-02-20 23:57:13 +01:00 committed by Alexandre Julliard
parent b44ac90ae7
commit f46c96332b
4 changed files with 9 additions and 9 deletions

View File

@ -2340,7 +2340,7 @@ UINT WINAPI D3DXGetDeclVertexSize(const D3DVERTEXELEMENT9 *decl, DWORD stream_id
if (element->Stream != stream_idx) continue;
if (element->Type >= sizeof(d3dx_decltype_size) / sizeof(*d3dx_decltype_size))
if (element->Type >= ARRAY_SIZE(d3dx_decltype_size))
{
FIXME("Unhandled element type %#x, size will be incorrect.\n", element->Type);
continue;

View File

@ -53,7 +53,7 @@ static D3DFORMAT wic_guid_to_d3dformat(const GUID *guid)
{
unsigned int i;
for (i = 0; i < sizeof(wic_pixel_formats) / sizeof(wic_pixel_formats[0]); i++)
for (i = 0; i < ARRAY_SIZE(wic_pixel_formats); i++)
{
if (IsEqualGUID(wic_pixel_formats[i].wic_guid, guid))
return wic_pixel_formats[i].d3dformat;
@ -66,7 +66,7 @@ static const GUID *d3dformat_to_wic_guid(D3DFORMAT format)
{
unsigned int i;
for (i = 0; i < sizeof(wic_pixel_formats) / sizeof(wic_pixel_formats[0]); i++)
for (i = 0; i < ARRAY_SIZE(wic_pixel_formats); i++)
{
if (wic_pixel_formats[i].d3dformat == format)
return wic_pixel_formats[i].wic_guid;
@ -164,7 +164,7 @@ static D3DFORMAT dds_fourcc_to_d3dformat(DWORD fourcc)
D3DFMT_A32B32G32R32F,
};
for (i = 0; i < sizeof(known_fourcc) / sizeof(known_fourcc[0]); i++)
for (i = 0; i < ARRAY_SIZE(known_fourcc); i++)
{
if (known_fourcc[i] == fourcc)
return fourcc;
@ -203,7 +203,7 @@ static D3DFORMAT dds_rgb_to_d3dformat(const struct dds_pixel_format *pixel_forma
{
unsigned int i;
for (i = 0; i < sizeof(rgb_pixel_formats) / sizeof(rgb_pixel_formats[0]); i++)
for (i = 0; i < ARRAY_SIZE(rgb_pixel_formats); i++)
{
if (rgb_pixel_formats[i].bpp == pixel_format->bpp
&& rgb_pixel_formats[i].rmask == pixel_format->rmask
@ -297,7 +297,7 @@ static HRESULT d3dformat_to_dds_pixel_format(struct dds_pixel_format *pixel_form
pixel_format->size = sizeof(*pixel_format);
for (i = 0; i < sizeof(rgb_pixel_formats) / sizeof(rgb_pixel_formats[0]); i++)
for (i = 0; i < ARRAY_SIZE(rgb_pixel_formats); i++)
{
if (rgb_pixel_formats[i].format == d3dformat)
{

View File

@ -200,7 +200,7 @@ static D3DFORMAT get_luminance_replacement_format(D3DFORMAT format)
};
unsigned int i;
for (i = 0; i < sizeof(luminance_replacements) / sizeof(luminance_replacements[0]); ++i)
for (i = 0; i < ARRAY_SIZE(luminance_replacements); ++i)
if (format == luminance_replacements[i].luminance_format)
return luminance_replacements[i].replacement_format;
return format;
@ -557,7 +557,7 @@ static D3DFORMAT get_alpha_replacement_format(D3DFORMAT format)
};
unsigned int i;
for (i = 0; i < sizeof(replacement_formats) / sizeof(replacement_formats[0]); ++i)
for (i = 0; i < ARRAY_SIZE(replacement_formats); ++i)
if (replacement_formats[i].orig_format == format)
return replacement_formats[i].replacement_format;
return format;

View File

@ -220,7 +220,7 @@ const struct pixel_format_desc *get_format_info(D3DFORMAT format)
const struct pixel_format_desc *get_format_info_idx(int idx)
{
if(idx >= sizeof(formats) / sizeof(formats[0]))
if(idx >= ARRAY_SIZE(formats))
return NULL;
if(formats[idx].format == D3DFMT_UNKNOWN)
return NULL;