Fixed variable names to be consistent across functions

This commit is contained in:
Sam Lantinga 2020-05-29 14:48:05 -07:00
parent 345b4d7e14
commit 2db049473b
1 changed files with 11 additions and 9 deletions

View File

@ -400,8 +400,9 @@ static const char *
WINDOWS_JoystickGetDeviceName(int device_index) WINDOWS_JoystickGetDeviceName(int device_index)
{ {
JoyStick_DeviceData *device = SYS_Joystick; JoyStick_DeviceData *device = SYS_Joystick;
int index;
for (; device_index > 0; device_index--) for (index = device_index; index > 0; index--)
device = device->pNext; device = device->pNext;
return device->joystickname; return device->joystickname;
@ -458,25 +459,26 @@ WINDOWS_JoystickGetDeviceInstanceID(int device_index)
static int static int
WINDOWS_JoystickOpen(SDL_Joystick * joystick, int device_index) 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--) for (index = device_index; index > 0; index--)
joystickdevice = joystickdevice->pNext; device = device->pNext;
/* allocate memory for system specific hardware data */ /* allocate memory for system specific hardware data */
joystick->instance_id = joystickdevice->nInstanceID; joystick->instance_id = device->nInstanceID;
joystick->hwdata = joystick->hwdata =
(struct joystick_hwdata *) SDL_malloc(sizeof(struct joystick_hwdata)); (struct joystick_hwdata *) SDL_malloc(sizeof(struct joystick_hwdata));
if (joystick->hwdata == NULL) { if (joystick->hwdata == NULL) {
return SDL_OutOfMemory(); return SDL_OutOfMemory();
} }
SDL_zerop(joystick->hwdata); SDL_zerop(joystick->hwdata);
joystick->hwdata->guid = joystickdevice->guid; joystick->hwdata->guid = device->guid;
if (joystickdevice->bXInputDevice) { if (device->bXInputDevice) {
return SDL_XINPUT_JoystickOpen(joystick, joystickdevice); return SDL_XINPUT_JoystickOpen(joystick, device);
} else { } else {
return SDL_DINPUT_JoystickOpen(joystick, joystickdevice); return SDL_DINPUT_JoystickOpen(joystick, device);
} }
} }