windowscodecs/tests: Use the available ARRAY_SIZE() macro.

Signed-off-by: Michael Stefaniuc <mstefani@winehq.org>
Signed-off-by: Vincent Povirk <vincent@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Michael Stefaniuc 2018-06-08 22:19:01 +02:00 committed by Alexandre Julliard
parent 2c551a9054
commit 6a00b58fcc
5 changed files with 31 additions and 31 deletions

View File

@ -119,7 +119,7 @@ static void test_decoder_info(void)
UINT num_formats, count;
int i, j;
for (i = 0; i < sizeof(decoder_info_tests)/sizeof(decoder_info_tests[0]); i++)
for (i = 0; i < ARRAY_SIZE(decoder_info_tests); i++)
{
struct decoder_info_test *test = &decoder_info_tests[i];
IWICBitmapDecoder *decoder, *decoder2;
@ -149,8 +149,8 @@ static void test_decoder_info(void)
}
IWICBitmapDecoder_Release(decoder);
MultiByteToWideChar(CP_ACP, 0, test->mimetype, -1, mimetypeW, sizeof(mimetypeW)/sizeof(mimetypeW[0]));
MultiByteToWideChar(CP_ACP, 0, test->extensions, -1, extensionsW, sizeof(extensionsW)/sizeof(extensionsW[0]));
MultiByteToWideChar(CP_ACP, 0, test->mimetype, -1, mimetypeW, ARRAY_SIZE(mimetypeW));
MultiByteToWideChar(CP_ACP, 0, test->extensions, -1, extensionsW, ARRAY_SIZE(extensionsW));
hr = get_component_info(test->clsid, &info);
ok(hr == S_OK, "CreateComponentInfo failed, hr=%x\n", hr);
@ -234,8 +234,8 @@ static void test_decoder_info(void)
ok(hr == E_INVALIDARG, "GetPixelFormats failed, hr=%x\n", hr);
count = 0xdeadbeef;
hr = IWICBitmapDecoderInfo_GetPixelFormats(decoder_info, sizeof(pixelformats)/sizeof(pixelformats[0]),
pixelformats, &count);
hr = IWICBitmapDecoderInfo_GetPixelFormats(decoder_info, ARRAY_SIZE(pixelformats),
pixelformats, &count);
ok(hr == S_OK, "GetPixelFormats failed, hr=%x\n", hr);
ok(count == num_formats, "got %d formats, expected %d\n", count, num_formats);

View File

@ -816,7 +816,7 @@ static void test_metadata_IFD(void)
hr = IWICMetadataReader_GetCount(reader, &count);
ok(hr == S_OK, "GetCount error %#x\n", hr);
ok(count == sizeof(td)/sizeof(td[0]), "unexpected count %u\n", count);
ok(count == ARRAY_SIZE(td), "unexpected count %u\n", count);
compare_metadata(reader, td, count);
@ -832,7 +832,7 @@ static void test_metadata_IFD(void)
load_stream((IUnknown *)reader, IFD_data_swapped, sizeof(IFD_data), persist_options);
hr = IWICMetadataReader_GetCount(reader, &count);
ok(hr == S_OK, "GetCount error %#x\n", hr);
ok(count == sizeof(td)/sizeof(td[0]), "unexpected count %u\n", count);
ok(count == ARRAY_SIZE(td), "unexpected count %u\n", count);
compare_metadata(reader, td, count);
HeapFree(GetProcessHeap(), 0, IFD_data_swapped);
@ -1271,7 +1271,7 @@ static void test_metadata_gif(void)
hr = IWICMetadataReader_GetCount(reader, &count);
ok(hr == S_OK, "GetCount error %#x\n", hr);
ok(count == sizeof(gif_LSD)/sizeof(gif_LSD[0]), "unexpected count %u\n", count);
ok(count == ARRAY_SIZE(gif_LSD), "unexpected count %u\n", count);
compare_metadata(reader, gif_LSD, count);
@ -1320,7 +1320,7 @@ static void test_metadata_gif(void)
hr = IWICMetadataReader_GetCount(reader, &count);
ok(hr == S_OK, "GetCount error %#x\n", hr);
ok(count == sizeof(gif_IMD)/sizeof(gif_IMD[0]), "unexpected count %u\n", count);
ok(count == ARRAY_SIZE(gif_IMD), "unexpected count %u\n", count);
compare_metadata(reader, gif_IMD, count);
@ -1374,7 +1374,7 @@ static void test_metadata_gif(void)
hr = IWICMetadataReader_GetCount(reader, &count);
ok(hr == S_OK, "GetCount error %#x\n", hr);
ok(count == sizeof(animated_gif_LSD)/sizeof(animated_gif_LSD[0]), "unexpected count %u\n", count);
ok(count == ARRAY_SIZE(animated_gif_LSD), "unexpected count %u\n", count);
compare_metadata(reader, animated_gif_LSD, count);
@ -1393,7 +1393,7 @@ static void test_metadata_gif(void)
hr = IWICMetadataReader_GetCount(reader, &count);
ok(hr == S_OK, "GetCount error %#x\n", hr);
ok(count == sizeof(animated_gif_APE)/sizeof(animated_gif_APE[0]), "unexpected count %u\n", count);
ok(count == ARRAY_SIZE(animated_gif_APE), "unexpected count %u\n", count);
compare_metadata(reader, animated_gif_APE, count);
@ -1412,7 +1412,7 @@ static void test_metadata_gif(void)
hr = IWICMetadataReader_GetCount(reader, &count);
ok(hr == S_OK, "GetCount error %#x\n", hr);
ok(count == sizeof(animated_gif_comment_1)/sizeof(animated_gif_comment_1[0]), "unexpected count %u\n", count);
ok(count == ARRAY_SIZE(animated_gif_comment_1), "unexpected count %u\n", count);
compare_metadata(reader, animated_gif_comment_1, count);
@ -1431,7 +1431,7 @@ static void test_metadata_gif(void)
hr = IWICMetadataReader_GetCount(reader, &count);
ok(hr == S_OK, "GetCount error %#x\n", hr);
ok(count == sizeof(animated_gif_plain_1)/sizeof(animated_gif_plain_1[0]), "unexpected count %u\n", count);
ok(count == ARRAY_SIZE(animated_gif_plain_1), "unexpected count %u\n", count);
compare_metadata(reader, animated_gif_plain_1, count);
@ -1480,7 +1480,7 @@ static void test_metadata_gif(void)
hr = IWICMetadataReader_GetCount(reader, &count);
ok(hr == S_OK, "GetCount error %#x\n", hr);
ok(count == sizeof(animated_gif_IMD)/sizeof(animated_gif_IMD[0]), "unexpected count %u\n", count);
ok(count == ARRAY_SIZE(animated_gif_IMD), "unexpected count %u\n", count);
compare_metadata(reader, animated_gif_IMD, count);
@ -1499,7 +1499,7 @@ static void test_metadata_gif(void)
hr = IWICMetadataReader_GetCount(reader, &count);
ok(hr == S_OK, "GetCount error %#x\n", hr);
ok(count == sizeof(animated_gif_comment_2)/sizeof(animated_gif_comment_2[0]), "unexpected count %u\n", count);
ok(count == ARRAY_SIZE(animated_gif_comment_2), "unexpected count %u\n", count);
if (count == 1)
compare_metadata(reader, animated_gif_comment_2, count);
@ -1519,7 +1519,7 @@ static void test_metadata_gif(void)
hr = IWICMetadataReader_GetCount(reader, &count);
ok(hr == S_OK, "GetCount error %#x\n", hr);
ok(count == sizeof(animated_gif_plain_2)/sizeof(animated_gif_plain_2[0]), "unexpected count %u\n", count);
ok(count == ARRAY_SIZE(animated_gif_plain_2), "unexpected count %u\n", count);
compare_metadata(reader, animated_gif_plain_2, count);
@ -1538,7 +1538,7 @@ static void test_metadata_gif(void)
hr = IWICMetadataReader_GetCount(reader, &count);
ok(hr == S_OK, "GetCount error %#x\n", hr);
ok(count == sizeof(animated_gif_GCE)/sizeof(animated_gif_GCE[0]), "unexpected count %u\n", count);
ok(count == ARRAY_SIZE(animated_gif_GCE), "unexpected count %u\n", count);
compare_metadata(reader, animated_gif_GCE, count);
@ -1599,7 +1599,7 @@ static void test_metadata_gif(void)
ok(len == 2, "expected 2, got %u\n", len);
ok(!lstrcmpW(name, rootW), "expected '/', got %s\n", wine_dbgstr_w(name));
for (i = 0; i < sizeof(decoder_data)/sizeof(decoder_data[0]); i++)
for (i = 0; i < ARRAY_SIZE(decoder_data); i++)
{
WCHAR queryW[256];
@ -1622,7 +1622,7 @@ static void test_metadata_gif(void)
ok(len == lstrlenW(queryW) + 1, "expected %u, got %u\n", lstrlenW(queryW) + 1, len);
ok(!lstrcmpW(name, queryW), "expected %s, got %s\n", wine_dbgstr_w(queryW), wine_dbgstr_w(name));
for (j = 0; j < sizeof(decoder_data)/sizeof(decoder_data[0]); j++)
for (j = 0; j < ARRAY_SIZE(decoder_data); j++)
{
MultiByteToWideChar(CP_ACP, 0, decoder_data[j].query, -1, queryW, 256);
@ -1698,7 +1698,7 @@ static void test_metadata_gif(void)
ok(len == 2, "expected 2, got %u\n", len);
ok(!lstrcmpW(name, rootW), "expected '/', got %s\n", wine_dbgstr_w(name));
for (i = 0; i < sizeof(frame_data)/sizeof(frame_data[0]); i++)
for (i = 0; i < ARRAY_SIZE(frame_data); i++)
{
if (winetest_debug > 1)
trace("query: %s\n", frame_data[i].query);
@ -1812,7 +1812,7 @@ static void test_metadata_LSD(void)
{
hr = IWICMetadataReader_GetCount(reader, &count);
ok(hr == S_OK, "GetCount error %#x\n", hr);
ok(count == sizeof(td)/sizeof(td[0]), "unexpected count %u\n", count);
ok(count == ARRAY_SIZE(td), "unexpected count %u\n", count);
compare_metadata(reader, td, count);
@ -1890,7 +1890,7 @@ static void test_metadata_IMD(void)
{
hr = IWICMetadataReader_GetCount(reader, &count);
ok(hr == S_OK, "GetCount error %#x\n", hr);
ok(count == sizeof(td)/sizeof(td[0]), "unexpected count %u\n", count);
ok(count == ARRAY_SIZE(td), "unexpected count %u\n", count);
compare_metadata(reader, td, count);
@ -1965,7 +1965,7 @@ static void test_metadata_GCE(void)
{
hr = IWICMetadataReader_GetCount(reader, &count);
ok(hr == S_OK, "GetCount error %#x\n", hr);
ok(count == sizeof(td)/sizeof(td[0]), "unexpected count %u\n", count);
ok(count == ARRAY_SIZE(td), "unexpected count %u\n", count);
compare_metadata(reader, td, count);
@ -2038,7 +2038,7 @@ static void test_metadata_APE(void)
{
hr = IWICMetadataReader_GetCount(reader, &count);
ok(hr == S_OK, "GetCount error %#x\n", hr);
ok(count == sizeof(td)/sizeof(td[0]), "unexpected count %u\n", count);
ok(count == ARRAY_SIZE(td), "unexpected count %u\n", count);
compare_metadata(reader, td, count);
@ -2122,7 +2122,7 @@ static void test_metadata_GIF_comment(void)
{
hr = IWICMetadataReader_GetCount(reader, &count);
ok(hr == S_OK, "GetCount error %#x\n", hr);
ok(count == sizeof(td)/sizeof(td[0]), "unexpected count %u\n", count);
ok(count == ARRAY_SIZE(td), "unexpected count %u\n", count);
compare_metadata(reader, td, count);
@ -2425,9 +2425,9 @@ static void test_WICMapSchemaToName(void)
return;
}
for (i = 0; i < sizeof(guid_list)/sizeof(guid_list[0]); i++)
for (i = 0; i < ARRAY_SIZE(guid_list); i++)
{
for (j = 0; j < sizeof(schema_list)/sizeof(schema_list[0]); j++)
for (j = 0; j < ARRAY_SIZE(schema_list); j++)
{
hr = WICMapSchemaToName(guid_list[i], schema_list[j], 0, NULL, &len);
if (IsEqualGUID(guid_list[i], &GUID_MetadataFormatXMP) ||
@ -2959,7 +2959,7 @@ static void test_queryreader(void)
hr = IWICComponentFactory_CreateQueryReaderFromBlockReader(factory, &mdbr, &reader);
ok(hr == S_OK, "CreateQueryReaderFromBlockReader error %#x\n", hr);
for (i = 0; i < sizeof(test_data)/sizeof(test_data[0]); i++)
for (i = 0; i < ARRAY_SIZE(test_data); i++)
{
current_metadata = test_data[i].data;

View File

@ -473,7 +473,7 @@ static void test_predefined_palette(void)
ok(hr == E_INVALIDARG, "expected E_INVALIDARG, got %#x\n", hr);
IWICPalette_Release(palette);
for (i = 0; i < sizeof(td)/sizeof(td[0]); i++)
for (i = 0; i < ARRAY_SIZE(td); i++)
{
hr = IWICImagingFactory_CreatePalette(factory, &palette);
ok(hr == S_OK, "%u: CreatePalette error %#x\n", i, hr);

View File

@ -717,7 +717,7 @@ static void test_color_formats(void)
* with tEXt id.
*/
for (i = 0; i < sizeof(td)/sizeof(td[0]); i++)
for (i = 0; i < ARRAY_SIZE(td); i++)
{
/* with the tRNS and PLTE chunks */
memcpy(buf, png_1x1_data, sizeof(png_1x1_data));

View File

@ -454,7 +454,7 @@ static void test_tiff_resolution(void)
double dpi_x, dpi_y;
int i;
for (i = 0; i < sizeof(tiff_resolution_test_data)/sizeof(tiff_resolution_test_data[0]); i++)
for (i = 0; i < ARRAY_SIZE(tiff_resolution_test_data); i++)
{
const struct tiff_resolution_test_data *test_data = &tiff_resolution_test_data[i];
tiff_resolution_image_data.resx = test_data->resx;