mirror of
https://github.com/libsdl-org/SDL.git
synced 2025-10-06 09:56:26 +00:00
Cleanup add brace (#6545)
* Add braces after if conditions * More add braces after if conditions * Add braces after while() conditions * Fix compilation because of macro being modified * Add braces to for loop * Add braces after if/goto * Move comments up * Remove extra () in the 'return ...;' statements * More remove extra () in the 'return ...;' statements * More remove extra () in the 'return ...;' statements after merge * Fix inconsistent patterns are xxx == NULL vs !xxx * More "{}" for "if() break;" and "if() continue;" * More "{}" after if() short statement * More "{}" after "if () return;" statement * More fix inconsistent patterns are xxx == NULL vs !xxx * Revert some modificaion on SDL_RLEaccel.c * SDL_RLEaccel: no short statement * Cleanup 'if' where the bracket is in a new line * Cleanup 'while' where the bracket is in a new line * Cleanup 'for' where the bracket is in a new line * Cleanup 'else' where the bracket is in a new line
This commit is contained in:
@@ -47,7 +47,7 @@ SDL_XInputUseOldJoystickMapping()
|
||||
#ifdef __WINRT__
|
||||
/* TODO: remove this __WINRT__ block, but only after integrating with UWP/WinRT's HID API */
|
||||
/* FIXME: Why are Win8/10 different here? -flibit */
|
||||
return (NTDDI_VERSION < NTDDI_WIN10);
|
||||
return NTDDI_VERSION < NTDDI_WIN10;
|
||||
#elif defined(__XBOXONE__) || defined(__XBOXSERIES__)
|
||||
return SDL_FALSE;
|
||||
#else
|
||||
@@ -55,7 +55,7 @@ SDL_XInputUseOldJoystickMapping()
|
||||
if (s_XInputUseOldJoystickMapping < 0) {
|
||||
s_XInputUseOldJoystickMapping = SDL_GetHintBoolean(SDL_HINT_XINPUT_USE_OLD_JOYSTICK_MAPPING, SDL_FALSE);
|
||||
}
|
||||
return (s_XInputUseOldJoystickMapping > 0);
|
||||
return s_XInputUseOldJoystickMapping > 0;
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -246,11 +246,13 @@ AddXInputDevice(Uint8 userid, BYTE SubType, JoyStick_DeviceData **pContext)
|
||||
JoyStick_DeviceData *pPrevJoystick = NULL;
|
||||
JoyStick_DeviceData *pNewJoystick = *pContext;
|
||||
|
||||
if (SDL_XInputUseOldJoystickMapping() && SubType != XINPUT_DEVSUBTYPE_GAMEPAD)
|
||||
if (SDL_XInputUseOldJoystickMapping() && SubType != XINPUT_DEVSUBTYPE_GAMEPAD) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (SubType == XINPUT_DEVSUBTYPE_UNKNOWN)
|
||||
if (SubType == XINPUT_DEVSUBTYPE_UNKNOWN) {
|
||||
return;
|
||||
}
|
||||
|
||||
while (pNewJoystick) {
|
||||
if (pNewJoystick->bXInputDevice && (pNewJoystick->XInputUserId == userid) && (pNewJoystick->SubType == SubType)) {
|
||||
@@ -271,7 +273,7 @@ AddXInputDevice(Uint8 userid, BYTE SubType, JoyStick_DeviceData **pContext)
|
||||
}
|
||||
|
||||
pNewJoystick = (JoyStick_DeviceData *)SDL_calloc(1, sizeof(JoyStick_DeviceData));
|
||||
if (!pNewJoystick) {
|
||||
if (pNewJoystick == NULL) {
|
||||
return; /* better luck next time? */
|
||||
}
|
||||
|
||||
@@ -519,8 +521,9 @@ SDL_XINPUT_JoystickUpdate(SDL_Joystick * joystick)
|
||||
XINPUT_STATE_EX XInputState;
|
||||
XINPUT_BATTERY_INFORMATION_EX XBatteryInformation;
|
||||
|
||||
if (!XINPUTGETSTATE)
|
||||
if (!XINPUTGETSTATE) {
|
||||
return;
|
||||
}
|
||||
|
||||
result = XINPUTGETSTATE(joystick->hwdata->userid, &XInputState);
|
||||
if (result == ERROR_DEVICE_NOT_CONNECTED) {
|
||||
|
Reference in New Issue
Block a user