dinput: Avoid ARRAY_SIZE-like macros.
Signed-off-by: Michael Stefaniuc <mstefani@winehq.org> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
2d8edab66d
commit
870a876773
|
@ -25,8 +25,6 @@
|
|||
#include "windef.h"
|
||||
#include "dinput.h"
|
||||
|
||||
#define numObjects(x) (sizeof(x) / sizeof(x[0]))
|
||||
|
||||
static const DIOBJECTDATAFORMAT dfDIJoystick[] = {
|
||||
{ &GUID_XAxis,DIJOFS_X,DIDFT_OPTIONAL|DIDFT_AXIS|DIDFT_ANYINSTANCE,0},
|
||||
{ &GUID_YAxis,DIJOFS_Y,DIDFT_OPTIONAL|DIDFT_AXIS|DIDFT_ANYINSTANCE,0},
|
||||
|
@ -79,7 +77,7 @@ const DIDATAFORMAT c_dfDIJoystick = {
|
|||
sizeof(DIOBJECTDATAFORMAT),
|
||||
DIDF_ABSAXIS,
|
||||
sizeof(DIJOYSTATE),
|
||||
numObjects(dfDIJoystick),
|
||||
ARRAY_SIZE(dfDIJoystick),
|
||||
(LPDIOBJECTDATAFORMAT)dfDIJoystick
|
||||
};
|
||||
|
||||
|
@ -255,7 +253,7 @@ const DIDATAFORMAT c_dfDIJoystick2 = {
|
|||
sizeof(DIOBJECTDATAFORMAT),
|
||||
DIDF_ABSAXIS,
|
||||
sizeof(DIJOYSTATE2),
|
||||
numObjects(dfDIJoystick2),
|
||||
ARRAY_SIZE(dfDIJoystick2),
|
||||
(LPDIOBJECTDATAFORMAT)dfDIJoystick2
|
||||
};
|
||||
|
||||
|
@ -274,7 +272,7 @@ const DIDATAFORMAT c_dfDIMouse = {
|
|||
sizeof(DIOBJECTDATAFORMAT),
|
||||
DIDF_RELAXIS,
|
||||
sizeof(DIMOUSESTATE),
|
||||
numObjects(dfDIMouse),
|
||||
ARRAY_SIZE(dfDIMouse),
|
||||
(LPDIOBJECTDATAFORMAT)dfDIMouse
|
||||
};
|
||||
|
||||
|
@ -297,7 +295,7 @@ const DIDATAFORMAT c_dfDIMouse2 = {
|
|||
sizeof(DIOBJECTDATAFORMAT),
|
||||
DIDF_RELAXIS,
|
||||
sizeof(DIMOUSESTATE2),
|
||||
numObjects(dfDIMouse2),
|
||||
ARRAY_SIZE(dfDIMouse2),
|
||||
(LPDIOBJECTDATAFORMAT)dfDIMouse2
|
||||
};
|
||||
|
||||
|
@ -565,6 +563,6 @@ const DIDATAFORMAT c_dfDIKeyboard = {
|
|||
sizeof(DIOBJECTDATAFORMAT),
|
||||
DIDF_RELAXIS,
|
||||
256,
|
||||
numObjects(dfDIKeyboard),
|
||||
ARRAY_SIZE(dfDIKeyboard),
|
||||
(LPDIOBJECTDATAFORMAT)dfDIKeyboard
|
||||
};
|
||||
|
|
|
@ -92,7 +92,6 @@ static const struct dinput_device *dinput_devices[] =
|
|||
&joystick_linux_device,
|
||||
&joystick_osx_device
|
||||
};
|
||||
#define NB_DINPUT_DEVICES (sizeof(dinput_devices)/sizeof(dinput_devices[0]))
|
||||
|
||||
static HINSTANCE DINPUT_instance = NULL;
|
||||
|
||||
|
@ -409,7 +408,7 @@ static HRESULT WINAPI IDirectInputAImpl_EnumDevices(
|
|||
if (!This->initialized)
|
||||
return DIERR_NOTINITIALIZED;
|
||||
|
||||
for (i = 0; i < NB_DINPUT_DEVICES; i++) {
|
||||
for (i = 0; i < ARRAY_SIZE(dinput_devices); i++) {
|
||||
if (!dinput_devices[i]->enum_deviceA) continue;
|
||||
for (j = 0, r = S_OK; SUCCEEDED(r); j++) {
|
||||
devInstance.dwSize = sizeof(devInstance);
|
||||
|
@ -449,7 +448,7 @@ static HRESULT WINAPI IDirectInputWImpl_EnumDevices(
|
|||
if (!This->initialized)
|
||||
return DIERR_NOTINITIALIZED;
|
||||
|
||||
for (i = 0; i < NB_DINPUT_DEVICES; i++) {
|
||||
for (i = 0; i < ARRAY_SIZE(dinput_devices); i++) {
|
||||
if (!dinput_devices[i]->enum_deviceW) continue;
|
||||
for (j = 0, r = S_OK; SUCCEEDED(r); j++) {
|
||||
devInstance.dwSize = sizeof(devInstance);
|
||||
|
@ -750,7 +749,7 @@ static HRESULT create_device(IDirectInputImpl *This, REFGUID rguid, REFIID riid,
|
|||
return DIERR_NOTINITIALIZED;
|
||||
|
||||
/* Loop on all the devices to see if anyone matches the given GUID */
|
||||
for (i = 0; i < NB_DINPUT_DEVICES; i++)
|
||||
for (i = 0; i < ARRAY_SIZE(dinput_devices); i++)
|
||||
{
|
||||
HRESULT ret;
|
||||
|
||||
|
@ -1006,7 +1005,7 @@ static HRESULT WINAPI IDirectInput8AImpl_EnumDevicesBySemantics(
|
|||
}
|
||||
|
||||
/* Enumerate all the joysticks */
|
||||
for (i = 0; i < NB_DINPUT_DEVICES; i++)
|
||||
for (i = 0; i < ARRAY_SIZE(dinput_devices); i++)
|
||||
{
|
||||
HRESULT enumSuccess;
|
||||
|
||||
|
@ -1107,7 +1106,7 @@ static HRESULT WINAPI IDirectInput8WImpl_EnumDevicesBySemantics(
|
|||
didevi.dwSize = sizeof(didevi);
|
||||
|
||||
/* Enumerate all the joysticks */
|
||||
for (i = 0; i < NB_DINPUT_DEVICES; i++)
|
||||
for (i = 0; i < ARRAY_SIZE(dinput_devices); i++)
|
||||
{
|
||||
HRESULT enumSuccess;
|
||||
|
||||
|
@ -1330,7 +1329,7 @@ static HRESULT WINAPI JoyConfig8Impl_GetConfig(IDirectInputJoyConfig8 *iface, UI
|
|||
#undef X
|
||||
|
||||
/* Enumerate all joysticks in order */
|
||||
for (i = 0; i < NB_DINPUT_DEVICES; i++)
|
||||
for (i = 0; i < ARRAY_SIZE(dinput_devices); i++)
|
||||
{
|
||||
if (!dinput_devices[i]->enum_deviceA) continue;
|
||||
|
||||
|
|
Loading…
Reference in New Issue