Commit f46c9633 authored by Michael Stefaniuc's avatar Michael Stefaniuc Committed by Alexandre Julliard

d3dx9: Use the available ARRAY_SIZE() macro.

parent b44ac90a
...@@ -2340,7 +2340,7 @@ UINT WINAPI D3DXGetDeclVertexSize(const D3DVERTEXELEMENT9 *decl, DWORD stream_id ...@@ -2340,7 +2340,7 @@ UINT WINAPI D3DXGetDeclVertexSize(const D3DVERTEXELEMENT9 *decl, DWORD stream_id
if (element->Stream != stream_idx) continue; 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); FIXME("Unhandled element type %#x, size will be incorrect.\n", element->Type);
continue; continue;
......
...@@ -53,7 +53,7 @@ static D3DFORMAT wic_guid_to_d3dformat(const GUID *guid) ...@@ -53,7 +53,7 @@ static D3DFORMAT wic_guid_to_d3dformat(const GUID *guid)
{ {
unsigned int i; 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)) if (IsEqualGUID(wic_pixel_formats[i].wic_guid, guid))
return wic_pixel_formats[i].d3dformat; return wic_pixel_formats[i].d3dformat;
...@@ -66,7 +66,7 @@ static const GUID *d3dformat_to_wic_guid(D3DFORMAT format) ...@@ -66,7 +66,7 @@ static const GUID *d3dformat_to_wic_guid(D3DFORMAT format)
{ {
unsigned int i; 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) if (wic_pixel_formats[i].d3dformat == format)
return wic_pixel_formats[i].wic_guid; return wic_pixel_formats[i].wic_guid;
...@@ -164,7 +164,7 @@ static D3DFORMAT dds_fourcc_to_d3dformat(DWORD fourcc) ...@@ -164,7 +164,7 @@ static D3DFORMAT dds_fourcc_to_d3dformat(DWORD fourcc)
D3DFMT_A32B32G32R32F, 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) if (known_fourcc[i] == fourcc)
return fourcc; return fourcc;
...@@ -203,7 +203,7 @@ static D3DFORMAT dds_rgb_to_d3dformat(const struct dds_pixel_format *pixel_forma ...@@ -203,7 +203,7 @@ static D3DFORMAT dds_rgb_to_d3dformat(const struct dds_pixel_format *pixel_forma
{ {
unsigned int i; 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 if (rgb_pixel_formats[i].bpp == pixel_format->bpp
&& rgb_pixel_formats[i].rmask == pixel_format->rmask && 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 ...@@ -297,7 +297,7 @@ static HRESULT d3dformat_to_dds_pixel_format(struct dds_pixel_format *pixel_form
pixel_format->size = sizeof(*pixel_format); 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) if (rgb_pixel_formats[i].format == d3dformat)
{ {
......
...@@ -200,7 +200,7 @@ static D3DFORMAT get_luminance_replacement_format(D3DFORMAT format) ...@@ -200,7 +200,7 @@ static D3DFORMAT get_luminance_replacement_format(D3DFORMAT format)
}; };
unsigned int i; 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) if (format == luminance_replacements[i].luminance_format)
return luminance_replacements[i].replacement_format; return luminance_replacements[i].replacement_format;
return format; return format;
...@@ -557,7 +557,7 @@ static D3DFORMAT get_alpha_replacement_format(D3DFORMAT format) ...@@ -557,7 +557,7 @@ static D3DFORMAT get_alpha_replacement_format(D3DFORMAT format)
}; };
unsigned int i; 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) if (replacement_formats[i].orig_format == format)
return replacement_formats[i].replacement_format; return replacement_formats[i].replacement_format;
return format; return format;
......
...@@ -220,7 +220,7 @@ const struct pixel_format_desc *get_format_info(D3DFORMAT format) ...@@ -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) 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; return NULL;
if(formats[idx].format == D3DFMT_UNKNOWN) if(formats[idx].format == D3DFMT_UNKNOWN)
return NULL; return NULL;
......
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