Commit 91c3e8eb authored by Michael Stefaniuc's avatar Michael Stefaniuc Committed by Alexandre Julliard

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

parent 741037ca
...@@ -317,8 +317,8 @@ static void test_action_mapping(void) ...@@ -317,8 +317,8 @@ static void test_action_mapping(void)
memset (&af, 0, sizeof(af)); memset (&af, 0, sizeof(af));
af.dwSize = sizeof(af); af.dwSize = sizeof(af);
af.dwActionSize = sizeof(DIACTIONA); af.dwActionSize = sizeof(DIACTIONA);
af.dwDataSize = 4 * sizeof(actionMapping) / sizeof(actionMapping[0]); af.dwDataSize = 4 * ARRAY_SIZE(actionMapping);
af.dwNumActions = sizeof(actionMapping) / sizeof(actionMapping[0]); af.dwNumActions = ARRAY_SIZE(actionMapping);
af.rgoAction = actionMapping; af.rgoAction = actionMapping;
af.guidActionMap = ACTION_MAPPING_GUID; af.guidActionMap = ACTION_MAPPING_GUID;
af.dwGenre = 0x01000000; /* DIVIRTUAL_DRIVING_RACE */ af.dwGenre = 0x01000000; /* DIVIRTUAL_DRIVING_RACE */
...@@ -357,8 +357,8 @@ static void test_action_mapping(void) ...@@ -357,8 +357,8 @@ static void test_action_mapping(void)
hr = IDirectInputDevice8_SetActionMap(data.keyboard, data.lpdiaf, NULL, 0); hr = IDirectInputDevice8_SetActionMap(data.keyboard, data.lpdiaf, NULL, 0);
ok (hr == DI_NOEFFECT, "SetActionMap should have no effect with no actions to map hr=%08x\n", hr); ok (hr == DI_NOEFFECT, "SetActionMap should have no effect with no actions to map hr=%08x\n", hr);
af.dwDataSize = 4 * sizeof(actionMapping) / sizeof(actionMapping[0]); af.dwDataSize = 4 * ARRAY_SIZE(actionMapping);
af.dwNumActions = sizeof(actionMapping) / sizeof(actionMapping[0]); af.dwNumActions = ARRAY_SIZE(actionMapping);
/* test DIDSAM_NOUSER */ /* test DIDSAM_NOUSER */
dps.diph.dwSize = sizeof(dps); dps.diph.dwSize = sizeof(dps);
...@@ -448,8 +448,8 @@ static void test_save_settings(void) ...@@ -448,8 +448,8 @@ static void test_save_settings(void)
memset (&af, 0, sizeof(af)); memset (&af, 0, sizeof(af));
af.dwSize = sizeof(af); af.dwSize = sizeof(af);
af.dwActionSize = sizeof(DIACTIONA); af.dwActionSize = sizeof(DIACTIONA);
af.dwDataSize = 4 * sizeof(actions) / sizeof(actions[0]); af.dwDataSize = 4 * ARRAY_SIZE(actions);
af.dwNumActions = sizeof(actions) / sizeof(actions[0]); af.dwNumActions = ARRAY_SIZE(actions);
af.rgoAction = actions; af.rgoAction = actions;
af.guidActionMap = mapping_guid; af.guidActionMap = mapping_guid;
af.dwGenre = 0x01000000; /* DIVIRTUAL_DRIVING_RACE */ af.dwGenre = 0x01000000; /* DIVIRTUAL_DRIVING_RACE */
......
...@@ -82,7 +82,7 @@ static void test_preinitialization(void) ...@@ -82,7 +82,7 @@ static void test_preinitialization(void)
return; return;
} }
for (i = 0; i < sizeof(create_device_tests)/sizeof(create_device_tests[0]); i++) for (i = 0; i < ARRAY_SIZE(create_device_tests); i++)
{ {
if (create_device_tests[i].pdev) pDID = (void *)0xdeadbeef; if (create_device_tests[i].pdev) pDID = (void *)0xdeadbeef;
hr = IDirectInput8_CreateDevice(pDI, create_device_tests[i].rguid, hr = IDirectInput8_CreateDevice(pDI, create_device_tests[i].rguid,
...@@ -93,7 +93,7 @@ static void test_preinitialization(void) ...@@ -93,7 +93,7 @@ static void test_preinitialization(void)
ok(pDID == NULL, "[%d] Output interface pointer is %p\n", i, pDID); ok(pDID == NULL, "[%d] Output interface pointer is %p\n", i, pDID);
} }
for (i = 0; i < sizeof(enum_devices_tests)/sizeof(enum_devices_tests[0]); i++) for (i = 0; i < ARRAY_SIZE(enum_devices_tests); i++)
{ {
hr = IDirectInput8_EnumDevices(pDI, enum_devices_tests[i].dwDevType, hr = IDirectInput8_EnumDevices(pDI, enum_devices_tests[i].dwDevType,
enum_devices_tests[i].lpCallback, enum_devices_tests[i].lpCallback,
...@@ -186,7 +186,7 @@ static void test_DirectInput8Create(void) ...@@ -186,7 +186,7 @@ static void test_DirectInput8Create(void)
IUnknown *pUnk; IUnknown *pUnk;
HRESULT hr; HRESULT hr;
for (i = 0; i < sizeof(invalid_param_list)/sizeof(invalid_param_list[0]); i++) for (i = 0; i < ARRAY_SIZE(invalid_param_list); i++)
{ {
if (invalid_param_list[i].ppdi) pUnk = (void *)0xdeadbeef; if (invalid_param_list[i].ppdi) pUnk = (void *)0xdeadbeef;
hr = DirectInput8Create(invalid_param_list[i].hinst ? hInstance : NULL, hr = DirectInput8Create(invalid_param_list[i].hinst ? hInstance : NULL,
...@@ -199,7 +199,7 @@ static void test_DirectInput8Create(void) ...@@ -199,7 +199,7 @@ static void test_DirectInput8Create(void)
ok(pUnk == NULL, "[%d] Output interface pointer is %p\n", i, pUnk); ok(pUnk == NULL, "[%d] Output interface pointer is %p\n", i, pUnk);
} }
for (i = 0; i < sizeof(no_interface_list)/sizeof(no_interface_list[0]); i++) for (i = 0; i < ARRAY_SIZE(no_interface_list); i++)
{ {
pUnk = (void *)0xdeadbeef; pUnk = (void *)0xdeadbeef;
hr = DirectInput8Create(hInstance, DIRECTINPUT_VERSION, no_interface_list[i], (void **)&pUnk, NULL); hr = DirectInput8Create(hInstance, DIRECTINPUT_VERSION, no_interface_list[i], (void **)&pUnk, NULL);
...@@ -207,7 +207,7 @@ static void test_DirectInput8Create(void) ...@@ -207,7 +207,7 @@ static void test_DirectInput8Create(void)
ok(pUnk == NULL, "[%d] Output interface pointer is %p\n", i, pUnk); ok(pUnk == NULL, "[%d] Output interface pointer is %p\n", i, pUnk);
} }
for (i = 0; i < sizeof(iid_list)/sizeof(iid_list[0]); i++) for (i = 0; i < ARRAY_SIZE(iid_list); i++)
{ {
pUnk = NULL; pUnk = NULL;
hr = DirectInput8Create(hInstance, DIRECTINPUT_VERSION, iid_list[i], (void **)&pUnk, NULL); hr = DirectInput8Create(hInstance, DIRECTINPUT_VERSION, iid_list[i], (void **)&pUnk, NULL);
...@@ -268,7 +268,7 @@ static void test_QueryInterface(void) ...@@ -268,7 +268,7 @@ static void test_QueryInterface(void)
hr = IDirectInput8_QueryInterface(pDI, &IID_IUnknown, NULL); hr = IDirectInput8_QueryInterface(pDI, &IID_IUnknown, NULL);
ok(hr == E_POINTER, "IDirectInput8_QueryInterface returned 0x%08x\n", hr); ok(hr == E_POINTER, "IDirectInput8_QueryInterface returned 0x%08x\n", hr);
for (i = 0; i < sizeof(iid_list)/sizeof(iid_list[0]); i++) for (i = 0; i < ARRAY_SIZE(iid_list); i++)
{ {
pUnk = NULL; pUnk = NULL;
hr = IDirectInput8_QueryInterface(pDI, iid_list[i], (void **)&pUnk); hr = IDirectInput8_QueryInterface(pDI, iid_list[i], (void **)&pUnk);
...@@ -277,7 +277,7 @@ static void test_QueryInterface(void) ...@@ -277,7 +277,7 @@ static void test_QueryInterface(void)
if (pUnk) if (pUnk)
{ {
int j; int j;
for (j = 0; j < sizeof(iid_list)/sizeof(iid_list[0]); j++) for (j = 0; j < ARRAY_SIZE(iid_list); j++)
{ {
IUnknown *pUnk1 = NULL; IUnknown *pUnk1 = NULL;
hr = IDirectInput8_QueryInterface(pUnk, iid_list[j], (void **)&pUnk1); hr = IDirectInput8_QueryInterface(pUnk, iid_list[j], (void **)&pUnk1);
...@@ -289,7 +289,7 @@ static void test_QueryInterface(void) ...@@ -289,7 +289,7 @@ static void test_QueryInterface(void)
} }
} }
for (i = 0; i < sizeof(no_interface_list)/sizeof(no_interface_list[0]); i++) for (i = 0; i < ARRAY_SIZE(no_interface_list); i++)
{ {
pUnk = (void *)0xdeadbeef; pUnk = (void *)0xdeadbeef;
hr = IDirectInput8_QueryInterface(pDI, no_interface_list[i].riid, (void **)&pUnk); hr = IDirectInput8_QueryInterface(pDI, no_interface_list[i].riid, (void **)&pUnk);
...@@ -527,7 +527,7 @@ static void test_EnumDevicesBySemantics(void) ...@@ -527,7 +527,7 @@ static void test_EnumDevicesBySemantics(void)
memset (&diaf, 0, sizeof(diaf)); memset (&diaf, 0, sizeof(diaf));
diaf.dwSize = sizeof(diaf); diaf.dwSize = sizeof(diaf);
diaf.dwActionSize = sizeof(DIACTIONA); diaf.dwActionSize = sizeof(DIACTIONA);
diaf.dwNumActions = sizeof(actionMapping) / sizeof(actionMapping[0]); diaf.dwNumActions = ARRAY_SIZE(actionMapping);
diaf.dwDataSize = 4 * diaf.dwNumActions; diaf.dwDataSize = 4 * diaf.dwNumActions;
diaf.rgoAction = actionMapping; diaf.rgoAction = actionMapping;
diaf.guidActionMap = ACTION_MAPPING_GUID; diaf.guidActionMap = ACTION_MAPPING_GUID;
......
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