dxdiag: Use the ARRAY_SIZE() macro.
Signed-off-by: Michael Stefaniuc <mstefani@winehq.org> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
77ad8a477e
commit
e011370f13
|
@ -156,7 +156,7 @@ static BOOL fill_system_information(IDxDiagContainer *container, struct dxdiag_i
|
|||
|
||||
fill_system_property_list(dxdiag_info, property_list);
|
||||
|
||||
for (i = 0; i < sizeof(property_list)/sizeof(property_list[0]); i++)
|
||||
for (i = 0; i < ARRAY_SIZE(property_list); i++)
|
||||
{
|
||||
if (!property_to_string(container, property_list[i].property_name, property_list[i].output))
|
||||
{
|
||||
|
@ -193,7 +193,7 @@ void free_dxdiag_information(struct dxdiag_information *system_info)
|
|||
if (!system_info)
|
||||
return;
|
||||
|
||||
for (i = 0; i < sizeof(filler_list)/sizeof(filler_list[0]); i++)
|
||||
for (i = 0; i < ARRAY_SIZE(filler_list); i++)
|
||||
filler_list[i].free_function(system_info);
|
||||
|
||||
HeapFree(GetProcessHeap(), 0, system_info);
|
||||
|
@ -230,7 +230,7 @@ struct dxdiag_information *collect_dxdiag_information(BOOL whql_check)
|
|||
if (!ret)
|
||||
goto error;
|
||||
|
||||
for (i = 0; i < sizeof(filler_list)/sizeof(filler_list[0]); i++)
|
||||
for (i = 0; i < ARRAY_SIZE(filler_list); i++)
|
||||
{
|
||||
IDxDiagContainer *child;
|
||||
BOOL success;
|
||||
|
|
|
@ -43,8 +43,8 @@ static void usage(void)
|
|||
WCHAR title[MAX_STRING_LEN];
|
||||
WCHAR usage[MAX_STRING_LEN];
|
||||
|
||||
LoadStringW(hInstance, STRING_DXDIAG_TOOL, title, sizeof(title)/sizeof(WCHAR));
|
||||
LoadStringW(hInstance, STRING_USAGE, usage, sizeof(usage)/sizeof(WCHAR));
|
||||
LoadStringW(hInstance, STRING_DXDIAG_TOOL, title, ARRAY_SIZE(title));
|
||||
LoadStringW(hInstance, STRING_USAGE, usage, ARRAY_SIZE(usage));
|
||||
|
||||
MessageBoxW(NULL, usage, title, MB_OK | MB_ICONWARNING);
|
||||
|
||||
|
@ -126,7 +126,7 @@ static BOOL process_command_line(const WCHAR *cmdline, struct command_line_info
|
|||
{
|
||||
info->output_type = OUTPUT_TEXT;
|
||||
return process_file_name(cmdline, OUTPUT_TEXT, info->outfile,
|
||||
sizeof(info->outfile)/sizeof(WCHAR));
|
||||
ARRAY_SIZE(info->outfile));
|
||||
}
|
||||
|
||||
cmdline++;
|
||||
|
@ -137,12 +137,12 @@ static BOOL process_command_line(const WCHAR *cmdline, struct command_line_info
|
|||
case 't':
|
||||
info->output_type = OUTPUT_TEXT;
|
||||
return process_file_name(cmdline + 1, OUTPUT_TEXT, info->outfile,
|
||||
sizeof(info->outfile)/sizeof(WCHAR));
|
||||
ARRAY_SIZE(info->outfile));
|
||||
case 'X':
|
||||
case 'x':
|
||||
info->output_type = OUTPUT_XML;
|
||||
return process_file_name(cmdline + 1, OUTPUT_XML, info->outfile,
|
||||
sizeof(info->outfile)/sizeof(WCHAR));
|
||||
ARRAY_SIZE(info->outfile));
|
||||
case 'W':
|
||||
case 'w':
|
||||
if (strncmpiW(cmdline, whql_colonW, 5))
|
||||
|
|
|
@ -179,7 +179,7 @@ static BOOL output_text_information(struct dxdiag_information *dxdiag_info, cons
|
|||
return FALSE;
|
||||
}
|
||||
|
||||
for (i = 0; i < sizeof(output_table)/sizeof(output_table[0]); i++)
|
||||
for (i = 0; i < ARRAY_SIZE(output_table); i++)
|
||||
{
|
||||
const struct text_information_field *fields = output_table[i].fields;
|
||||
unsigned int j;
|
||||
|
@ -313,7 +313,7 @@ static BOOL output_xml_information(struct dxdiag_information *dxdiag_info, const
|
|||
if (FAILED(hr))
|
||||
goto error;
|
||||
|
||||
for (i = 0; i < sizeof(output_table)/sizeof(output_table[0]); i++)
|
||||
for (i = 0; i < ARRAY_SIZE(output_table); i++)
|
||||
{
|
||||
IXMLDOMElement *info_element = xml_create_element(xmldoc, output_table[i].tag_name);
|
||||
const struct xml_information_field *fields = output_table[i].fields;
|
||||
|
@ -394,14 +394,14 @@ static struct output_backend
|
|||
|
||||
const WCHAR *get_output_extension(enum output_type type)
|
||||
{
|
||||
assert(type > OUTPUT_NONE && type <= sizeof(output_backends)/sizeof(output_backends[0]));
|
||||
assert(type > OUTPUT_NONE && type <= ARRAY_SIZE(output_backends));
|
||||
|
||||
return output_backends[type - 1].filename_ext;
|
||||
}
|
||||
|
||||
BOOL output_dxdiag_information(struct dxdiag_information *dxdiag_info, const WCHAR *filename, enum output_type type)
|
||||
{
|
||||
assert(type > OUTPUT_NONE && type <= sizeof(output_backends)/sizeof(output_backends[0]));
|
||||
assert(type > OUTPUT_NONE && type <= ARRAY_SIZE(output_backends));
|
||||
|
||||
return output_backends[type - 1].output_handler(dxdiag_info, filename);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue