Skip to content
Permalink
Browse files

Fixed variable names to be consistent across functions

  • Loading branch information
slouken committed May 29, 2020
1 parent 345b4d7 commit 2db049473bf6c873d1620f482223dfa84bb2af1c
Showing with 11 additions and 9 deletions.
  1. +11 −9 src/joystick/windows/SDL_windowsjoystick.c
@@ -400,8 +400,9 @@ static const char *
WINDOWS_JoystickGetDeviceName(int device_index)
{
JoyStick_DeviceData *device = SYS_Joystick;
int index;

for (; device_index > 0; device_index--)
for (index = device_index; index > 0; index--)
device = device->pNext;

return device->joystickname;
@@ -458,25 +459,26 @@ WINDOWS_JoystickGetDeviceInstanceID(int device_index)
static int
WINDOWS_JoystickOpen(SDL_Joystick * joystick, int device_index)
{
JoyStick_DeviceData *joystickdevice = SYS_Joystick;
JoyStick_DeviceData *device = SYS_Joystick;
int index;

for (; device_index > 0; device_index--)
joystickdevice = joystickdevice->pNext;
for (index = device_index; index > 0; index--)
device = device->pNext;

/* allocate memory for system specific hardware data */
joystick->instance_id = joystickdevice->nInstanceID;
joystick->instance_id = device->nInstanceID;
joystick->hwdata =
(struct joystick_hwdata *) SDL_malloc(sizeof(struct joystick_hwdata));
if (joystick->hwdata == NULL) {
return SDL_OutOfMemory();
}
SDL_zerop(joystick->hwdata);
joystick->hwdata->guid = joystickdevice->guid;
joystick->hwdata->guid = device->guid;

if (joystickdevice->bXInputDevice) {
return SDL_XINPUT_JoystickOpen(joystick, joystickdevice);
if (device->bXInputDevice) {
return SDL_XINPUT_JoystickOpen(joystick, device);
} else {
return SDL_DINPUT_JoystickOpen(joystick, joystickdevice);
return SDL_DINPUT_JoystickOpen(joystick, device);
}
}

0 comments on commit 2db0494

Please sign in to comment.