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
(cherry picked from commit 6a2200823c
to reduce conflicts merging between SDL2 and SDL3)
This commit is contained in:
parent
0739d237ad
commit
fb0ce375f0
386 changed files with 6103 additions and 4637 deletions
|
@ -43,7 +43,7 @@ static recDevice *gpDeviceList = NULL;
|
|||
|
||||
void FreeRumbleEffectData(FFEFFECT *effect)
|
||||
{
|
||||
if (!effect) {
|
||||
if (effect == NULL) {
|
||||
return;
|
||||
}
|
||||
SDL_free(effect->rgdwAxes);
|
||||
|
@ -59,7 +59,7 @@ FFEFFECT *CreateRumbleEffectData(Sint16 magnitude)
|
|||
|
||||
/* Create the effect */
|
||||
effect = (FFEFFECT *)SDL_calloc(1, sizeof(*effect));
|
||||
if (!effect) {
|
||||
if (effect == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
effect->dwSize = sizeof(*effect);
|
||||
|
@ -83,7 +83,7 @@ FFEFFECT *CreateRumbleEffectData(Sint16 magnitude)
|
|||
effect->dwFlags |= FFEFF_CARTESIAN;
|
||||
|
||||
periodic = (FFPERIODIC *)SDL_calloc(1, sizeof(*periodic));
|
||||
if (!periodic) {
|
||||
if (periodic == NULL) {
|
||||
FreeRumbleEffectData(effect);
|
||||
return NULL;
|
||||
}
|
||||
|
@ -101,8 +101,9 @@ static recDevice *GetDeviceForIndex(int device_index)
|
|||
recDevice *device = gpDeviceList;
|
||||
while (device) {
|
||||
if (!device->removed) {
|
||||
if (device_index == 0)
|
||||
if (device_index == 0) {
|
||||
break;
|
||||
}
|
||||
|
||||
--device_index;
|
||||
}
|
||||
|
@ -208,13 +209,10 @@ GetHIDScaledCalibratedState(recDevice * pDevice, recElement * pElement, SInt32 m
|
|||
const float deviceScale = max - min;
|
||||
const float readScale = pElement->maxReport - pElement->minReport;
|
||||
int returnValue = SDL_FALSE;
|
||||
if (GetHIDElementState(pDevice, pElement, pValue))
|
||||
{
|
||||
if (GetHIDElementState(pDevice, pElement, pValue)) {
|
||||
if (readScale == 0) {
|
||||
returnValue = SDL_TRUE; /* no scaling at all */
|
||||
}
|
||||
else
|
||||
{
|
||||
} else {
|
||||
*pValue = ((*pValue - pElement->minReport) * deviceScale / readScale) + min;
|
||||
returnValue = SDL_TRUE;
|
||||
}
|
||||
|
@ -547,7 +545,7 @@ JoystickDeviceWasAddedCallback(void *ctx, IOReturn res, void *sender, IOHIDDevic
|
|||
}
|
||||
|
||||
device = (recDevice *) SDL_calloc(1, sizeof(recDevice));
|
||||
if (!device) {
|
||||
if (device == NULL) {
|
||||
SDL_OutOfMemory();
|
||||
return;
|
||||
}
|
||||
|
@ -580,7 +578,7 @@ JoystickDeviceWasAddedCallback(void *ctx, IOReturn res, void *sender, IOHIDDevic
|
|||
}
|
||||
|
||||
/* Add device to the end of the list */
|
||||
if ( !gpDeviceList ) {
|
||||
if (gpDeviceList == NULL) {
|
||||
gpDeviceList = device;
|
||||
} else {
|
||||
recDevice *curdevice;
|
||||
|
@ -891,7 +889,7 @@ DARWIN_JoystickRumble(SDL_Joystick *joystick, Uint16 low_frequency_rumble, Uint1
|
|||
/* Scale and average the two rumble strengths */
|
||||
Sint16 magnitude = (Sint16)(((low_frequency_rumble / 2) + (high_frequency_rumble / 2)) / 2);
|
||||
|
||||
if (!device) {
|
||||
if (device == NULL) {
|
||||
return SDL_SetError("Rumble failed, device disconnected");
|
||||
}
|
||||
|
||||
|
@ -934,7 +932,7 @@ DARWIN_JoystickGetCapabilities(SDL_Joystick *joystick)
|
|||
recDevice *device = joystick->hwdata;
|
||||
Uint32 result = 0;
|
||||
|
||||
if (!device) {
|
||||
if (device == NULL) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
@ -971,7 +969,7 @@ DARWIN_JoystickUpdate(SDL_Joystick *joystick)
|
|||
SInt32 value, range;
|
||||
int i, goodRead = SDL_FALSE;
|
||||
|
||||
if (!device) {
|
||||
if (device == NULL) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue