mirror of
https://github.com/libsdl-org/SDL.git
synced 2025-06-03 10:27:40 +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:
parent
4958dafdc3
commit
6a2200823c
387 changed files with 6094 additions and 4633 deletions
|
@ -254,8 +254,9 @@ static void RAWINPUT_FillMatchState(WindowsMatchState *state, Uint64 match_state
|
|||
((match_state & (1<<SDL_CONTROLLER_BUTTON_DPAD_RIGHT)) ? XINPUT_GAMEPAD_DPAD_RIGHT : 0);
|
||||
*/
|
||||
|
||||
if (state->xinput_buttons)
|
||||
if (state->xinput_buttons) {
|
||||
state->any_data = SDL_TRUE;
|
||||
}
|
||||
#endif
|
||||
|
||||
#ifdef SDL_JOYSTICK_RAWINPUT_WGI
|
||||
|
@ -292,8 +293,9 @@ static void RAWINPUT_FillMatchState(WindowsMatchState *state, Uint64 match_state
|
|||
((match_state & (1<<SDL_CONTROLLER_BUTTON_DPAD_LEFT)) ? GamepadButtons_DPadLeft : 0) |
|
||||
((match_state & (1<<SDL_CONTROLLER_BUTTON_DPAD_RIGHT)) ? GamepadButtons_DPadRight : 0); */
|
||||
|
||||
if (state->wgi_buttons)
|
||||
if (state->wgi_buttons) {
|
||||
state->any_data = SDL_TRUE;
|
||||
}
|
||||
#endif
|
||||
|
||||
}
|
||||
|
@ -467,11 +469,13 @@ static void
|
|||
RAWINPUT_UpdateWindowsGamingInput()
|
||||
{
|
||||
int ii;
|
||||
if (!wgi_state.gamepad_statics)
|
||||
if (!wgi_state.gamepad_statics) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!wgi_state.dirty)
|
||||
if (!wgi_state.dirty) {
|
||||
return;
|
||||
}
|
||||
|
||||
wgi_state.dirty = SDL_FALSE;
|
||||
|
||||
|
@ -515,7 +519,7 @@ RAWINPUT_UpdateWindowsGamingInput()
|
|||
return;
|
||||
}
|
||||
gamepad_state = SDL_calloc(1, sizeof(*gamepad_state));
|
||||
if (!gamepad_state) {
|
||||
if (gamepad_state == NULL) {
|
||||
SDL_OutOfMemory();
|
||||
return;
|
||||
}
|
||||
|
@ -698,8 +702,9 @@ RAWINPUT_DeviceFromHandle(HANDLE hDevice)
|
|||
SDL_RAWINPUT_Device *curr;
|
||||
|
||||
for (curr = SDL_RAWINPUT_devices; curr; curr = curr->next) {
|
||||
if (curr->hDevice == hDevice)
|
||||
if (curr->hDevice == hDevice) {
|
||||
return curr;
|
||||
}
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
@ -707,7 +712,7 @@ RAWINPUT_DeviceFromHandle(HANDLE hDevice)
|
|||
static void
|
||||
RAWINPUT_AddDevice(HANDLE hDevice)
|
||||
{
|
||||
#define CHECK(expression) { if(!(expression)) goto err; }
|
||||
#define CHECK(expression) { if (!(expression)) goto err; }
|
||||
SDL_RAWINPUT_Device *device = NULL;
|
||||
SDL_RAWINPUT_Device *curr, *last;
|
||||
RID_DEVICE_INFO rdi;
|
||||
|
@ -1072,7 +1077,7 @@ RAWINPUT_JoystickOpen(SDL_Joystick *joystick, int device_index)
|
|||
ULONG i;
|
||||
|
||||
ctx = (RAWINPUT_DeviceContext *)SDL_calloc(1, sizeof(RAWINPUT_DeviceContext));
|
||||
if (!ctx) {
|
||||
if (ctx == NULL) {
|
||||
return SDL_OutOfMemory();
|
||||
}
|
||||
joystick->hwdata = ctx;
|
||||
|
@ -1085,7 +1090,7 @@ RAWINPUT_JoystickOpen(SDL_Joystick *joystick, int device_index)
|
|||
#ifdef SDL_JOYSTICK_RAWINPUT_XINPUT
|
||||
xinput_device_change = SDL_TRUE;
|
||||
ctx->xinput_enabled = SDL_GetHintBoolean(SDL_HINT_JOYSTICK_RAWINPUT_CORRELATE_XINPUT, SDL_TRUE);
|
||||
if (ctx->xinput_enabled && (WIN_LoadXInputDLL() < 0 || !XINPUTGETSTATE)) {
|
||||
if (ctx->xinput_enabled && (WIN_LoadXInputDLL() < 0 || XINPUTGETSTATE == NULL)) {
|
||||
ctx->xinput_enabled = SDL_FALSE;
|
||||
}
|
||||
ctx->xinput_slot = XUSER_INDEX_ANY;
|
||||
|
@ -1281,7 +1286,7 @@ RAWINPUT_JoystickRumble(SDL_Joystick *joystick, Uint16 low_frequency_rumble, Uin
|
|||
if (!rumbled && ctx->xinput_correlated) {
|
||||
XINPUT_VIBRATION XVibration;
|
||||
|
||||
if (!XINPUTSETSTATE) {
|
||||
if (XINPUTSETSTATE == NULL) {
|
||||
return SDL_Unsupported();
|
||||
}
|
||||
|
||||
|
@ -1634,10 +1639,12 @@ RAWINPUT_UpdateOtherAPIs(SDL_Joystick *joystick)
|
|||
correlated = SDL_TRUE;
|
||||
RAWINPUT_MarkWindowsGamingInputSlotUsed(ctx->wgi_slot, ctx);
|
||||
/* If the generalized Guide button was using us, it doesn't need to anymore */
|
||||
if (guide_button_candidate.joystick == joystick)
|
||||
if (guide_button_candidate.joystick == joystick) {
|
||||
guide_button_candidate.joystick = NULL;
|
||||
if (guide_button_candidate.last_joystick == joystick)
|
||||
}
|
||||
if (guide_button_candidate.last_joystick == joystick) {
|
||||
guide_button_candidate.last_joystick = NULL;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
/* someone else also possibly correlated to this device, start over */
|
||||
|
@ -1728,10 +1735,12 @@ RAWINPUT_UpdateOtherAPIs(SDL_Joystick *joystick)
|
|||
correlated = SDL_TRUE;
|
||||
RAWINPUT_MarkXInputSlotUsed(ctx->xinput_slot);
|
||||
/* If the generalized Guide button was using us, it doesn't need to anymore */
|
||||
if (guide_button_candidate.joystick == joystick)
|
||||
if (guide_button_candidate.joystick == joystick) {
|
||||
guide_button_candidate.joystick = NULL;
|
||||
if (guide_button_candidate.last_joystick == joystick)
|
||||
}
|
||||
if (guide_button_candidate.last_joystick == joystick) {
|
||||
guide_button_candidate.last_joystick = NULL;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
/* someone else also possibly correlated to this device, start over */
|
||||
|
@ -1843,10 +1852,12 @@ RAWINPUT_JoystickClose(SDL_Joystick *joystick)
|
|||
RAWINPUT_DeviceContext *ctx = joystick->hwdata;
|
||||
|
||||
#ifdef SDL_JOYSTICK_RAWINPUT_MATCHING
|
||||
if (guide_button_candidate.joystick == joystick)
|
||||
if (guide_button_candidate.joystick == joystick) {
|
||||
guide_button_candidate.joystick = NULL;
|
||||
if (guide_button_candidate.last_joystick == joystick)
|
||||
}
|
||||
if (guide_button_candidate.last_joystick == joystick) {
|
||||
guide_button_candidate.last_joystick = NULL;
|
||||
}
|
||||
#endif
|
||||
|
||||
if (ctx) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue