d3dx9/tests: 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:
parent
bfb37b2a4c
commit
1a5339346f
|
@ -552,7 +552,7 @@ static void test_ID3DXFont(IDirect3DDevice9 *device)
|
|||
check_release((IUnknown*)font, 0);
|
||||
} else skip("Failed to create a ID3DXFont object\n");
|
||||
|
||||
for(i = 0; i < sizeof(texture_tests) / sizeof(texture_tests[0]); i++) {
|
||||
for(i = 0; i < ARRAY_SIZE(texture_tests); i++) {
|
||||
HDC hdc;
|
||||
DWORD ret;
|
||||
HRESULT hr;
|
||||
|
@ -617,7 +617,7 @@ static void test_D3DXCreateRenderToSurface(IDirect3DDevice9 *device)
|
|||
hr = D3DXCreateRenderToSurface(device, 256, 256, D3DFMT_A8R8G8B8, FALSE, D3DFMT_UNKNOWN, NULL /* out */);
|
||||
ok(hr == D3DERR_INVALIDCALL, "D3DXCreateRenderToSurface returned %#x, expected %#x\n", hr, D3DERR_INVALIDCALL);
|
||||
|
||||
for (i = 0; i < sizeof(tests) / sizeof(tests[0]); i++)
|
||||
for (i = 0; i < ARRAY_SIZE(tests); i++)
|
||||
{
|
||||
hr = D3DXCreateRenderToSurface(device, tests[i].Width, tests[i].Height, tests[i].Format, tests[i].DepthStencil,
|
||||
tests[i].DepthStencilFormat, &render);
|
||||
|
@ -1024,7 +1024,7 @@ static void test_ID3DXRenderToSurface(IDirect3DDevice9 *device)
|
|||
|
||||
check_release((IUnknown *)render, 0);
|
||||
|
||||
for (i = 0; i < sizeof(tests) / sizeof(tests[0]); i++)
|
||||
for (i = 0; i < ARRAY_SIZE(tests); i++)
|
||||
{
|
||||
check_ID3DXRenderToSurface(device, tests[i].Width, tests[i].Height, tests[i].Format, tests[i].DepthStencil, tests[i].DepthStencilFormat, TRUE);
|
||||
check_ID3DXRenderToSurface(device, tests[i].Width, tests[i].Height, tests[i].Format, tests[i].DepthStencil, tests[i].DepthStencilFormat, FALSE);
|
||||
|
@ -1052,7 +1052,7 @@ static void test_D3DXCreateRenderToEnvMap(IDirect3DDevice9 *device)
|
|||
{ { 256, 1, D3DFMT_X8R8G8B8, TRUE, D3DFMT_UNKNOWN }, { 256, 1, D3DFMT_X8R8G8B8, TRUE, D3DFMT_UNKNOWN } }
|
||||
};
|
||||
|
||||
for (i = 0; i < sizeof(tests) / sizeof(tests[0]); i++)
|
||||
for (i = 0; i < ARRAY_SIZE(tests); i++)
|
||||
{
|
||||
const D3DXRTE_DESC *parameters = &tests[i].parameters;
|
||||
const D3DXRTE_DESC *expected = &tests[i].expected_values;
|
||||
|
|
|
@ -991,7 +991,7 @@ struct test_effect_parameter_value_result test_effect_parameter_value_result_spe
|
|||
test_effect_parameter_value_blob_ ## x,\
|
||||
sizeof(test_effect_parameter_value_blob_ ## x),\
|
||||
test_effect_parameter_value_result_ ## x,\
|
||||
sizeof(test_effect_parameter_value_result_ ## x)/sizeof(*test_effect_parameter_value_result_ ## x),\
|
||||
ARRAY_SIZE(test_effect_parameter_value_result_ ## x),\
|
||||
}
|
||||
|
||||
static const struct
|
||||
|
|
|
@ -649,17 +649,17 @@ static void test_constant_table(const char *test_name, const DWORD *ctable_fn,
|
|||
static void test_constant_tables(void)
|
||||
{
|
||||
test_constant_table("test_basic", ctab_basic, ctab_basic_expected,
|
||||
sizeof(ctab_basic_expected)/sizeof(*ctab_basic_expected));
|
||||
ARRAY_SIZE(ctab_basic_expected));
|
||||
test_constant_table("test_matrices", ctab_matrices, ctab_matrices_expected,
|
||||
sizeof(ctab_matrices_expected)/sizeof(*ctab_matrices_expected));
|
||||
ARRAY_SIZE(ctab_matrices_expected));
|
||||
test_constant_table("test_matrices2", ctab_matrices2, ctab_matrices2_expected,
|
||||
sizeof(ctab_matrices2_expected)/sizeof(*ctab_matrices2_expected));
|
||||
ARRAY_SIZE(ctab_matrices2_expected));
|
||||
test_constant_table("test_arrays", ctab_arrays, ctab_arrays_expected,
|
||||
sizeof(ctab_arrays_expected)/sizeof(*ctab_arrays_expected));
|
||||
ARRAY_SIZE(ctab_arrays_expected));
|
||||
test_constant_table("test_default_values", ctab_with_default_values, ctab_with_default_values_expected,
|
||||
sizeof(ctab_with_default_values_expected)/sizeof(*ctab_with_default_values_expected));
|
||||
ARRAY_SIZE(ctab_with_default_values_expected));
|
||||
test_constant_table("test_samplers", ctab_samplers, ctab_samplers_expected,
|
||||
sizeof(ctab_samplers_expected)/sizeof(*ctab_samplers_expected));
|
||||
ARRAY_SIZE(ctab_samplers_expected));
|
||||
}
|
||||
|
||||
static void test_setting_basic_table(IDirect3DDevice9 *device)
|
||||
|
@ -1844,7 +1844,7 @@ static void test_get_shader_constant_variables(void)
|
|||
ctab = ID3DXConstantTable_GetBufferPointer(ctable);
|
||||
ok(ctab[0] == test_get_shader_constant_variables_blob[3], "ID3DXConstantTable_GetBufferPointer failed\n");
|
||||
|
||||
for (i = 0; i < sizeof(test_get_shader_constant_variables_data) / sizeof(*test_get_shader_constant_variables_data); ++i)
|
||||
for (i = 0; i < ARRAY_SIZE(test_get_shader_constant_variables_data); ++i)
|
||||
{
|
||||
const char *fullname = test_get_shader_constant_variables_data[i].fullname;
|
||||
const D3DXCONSTANT_DESC *expected_desc = &test_get_shader_constant_variables_data[i].desc;
|
||||
|
@ -6025,7 +6025,7 @@ static UINT registerset_compare_all(IDirect3DDevice9 *device, BOOL is_vs, D3DXRE
|
|||
D3DXREGISTER_SET regsets[] = {D3DXRS_BOOL, D3DXRS_INT4, D3DXRS_FLOAT4};
|
||||
UINT err = 0, i;
|
||||
|
||||
for (i = 0; i < sizeof(regsets) / sizeof(*regsets); i++)
|
||||
for (i = 0; i < ARRAY_SIZE(regsets); i++)
|
||||
{
|
||||
if (regset == regsets[i])
|
||||
err += registerset_compare(device, is_vs, regset, start, in_count, expected);
|
||||
|
@ -6137,7 +6137,7 @@ static void test_registerset(void)
|
|||
return;
|
||||
}
|
||||
|
||||
for (k = 0; k < sizeof(registerset_data) / sizeof(*registerset_data); ++k)
|
||||
for (k = 0; k < ARRAY_SIZE(registerset_data); ++k)
|
||||
{
|
||||
const char *tablename = registerset_data[k].name;
|
||||
const char *name = registerset_data[k].var;
|
||||
|
@ -6442,7 +6442,7 @@ static void test_registerset_defaults(void)
|
|||
return;
|
||||
}
|
||||
|
||||
for (k = 0; k < sizeof(registerset_defaults_data) / sizeof(*registerset_defaults_data); ++k)
|
||||
for (k = 0; k < ARRAY_SIZE(registerset_defaults_data); ++k)
|
||||
{
|
||||
const char *tablename = registerset_defaults_data[k].name;
|
||||
ID3DXConstantTable *ctable;
|
||||
|
@ -6616,7 +6616,7 @@ static void test_shader_semantics(void)
|
|||
hr = D3DXGetShaderInputSemantics(vs_1_1, semantics, NULL);
|
||||
ok(hr == D3D_OK, "Unexpected hr %#x.\n", hr);
|
||||
|
||||
for (i = 0; i < sizeof(tests) / sizeof(tests[0]); ++i)
|
||||
for (i = 0; i < ARRAY_SIZE(tests); ++i)
|
||||
{
|
||||
const DWORD *shader = tests[i].shader;
|
||||
|
||||
|
|
|
@ -398,7 +398,7 @@ static void test_dds_header_handling(void)
|
|||
return;
|
||||
}
|
||||
|
||||
for (i = 0; i < sizeof(tests) / sizeof(tests[0]); i++)
|
||||
for (i = 0; i < ARRAY_SIZE(tests); i++)
|
||||
{
|
||||
DWORD file_size = sizeof(dds->magic) + sizeof(dds->header) + tests[i].pixel_data_size;
|
||||
assert(file_size <= sizeof(*dds));
|
||||
|
|
Loading…
Reference in New Issue