mirror of
https://github.com/libsdl-org/SDL.git
synced 2025-05-28 07:29:09 +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
|
@ -37,8 +37,9 @@ VIRTUAL_HWDataForIndex(int device_index)
|
|||
{
|
||||
joystick_hwdata *vjoy = g_VJoys;
|
||||
while (vjoy) {
|
||||
if (device_index == 0)
|
||||
if (device_index == 0) {
|
||||
break;
|
||||
}
|
||||
--device_index;
|
||||
vjoy = vjoy->next;
|
||||
}
|
||||
|
@ -52,7 +53,7 @@ VIRTUAL_FreeHWData(joystick_hwdata *hwdata)
|
|||
joystick_hwdata * cur = g_VJoys;
|
||||
joystick_hwdata * prev = NULL;
|
||||
|
||||
if (!hwdata) {
|
||||
if (hwdata == NULL) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -103,7 +104,7 @@ SDL_JoystickAttachVirtualInner(const SDL_VirtualJoystickDesc *desc)
|
|||
int axis_triggerleft = -1;
|
||||
int axis_triggerright = -1;
|
||||
|
||||
if (!desc) {
|
||||
if (desc == NULL) {
|
||||
return SDL_InvalidParamError("desc");
|
||||
}
|
||||
if (desc->version != SDL_VIRTUAL_JOYSTICK_DESC_VERSION) {
|
||||
|
@ -112,7 +113,7 @@ SDL_JoystickAttachVirtualInner(const SDL_VirtualJoystickDesc *desc)
|
|||
}
|
||||
|
||||
hwdata = SDL_calloc(1, sizeof(joystick_hwdata));
|
||||
if (!hwdata) {
|
||||
if (hwdata == NULL) {
|
||||
VIRTUAL_FreeHWData(hwdata);
|
||||
return SDL_OutOfMemory();
|
||||
}
|
||||
|
@ -252,7 +253,7 @@ SDL_JoystickDetachVirtualInner(int device_index)
|
|||
{
|
||||
SDL_JoystickID instance_id;
|
||||
joystick_hwdata *hwdata = VIRTUAL_HWDataForIndex(device_index);
|
||||
if (!hwdata) {
|
||||
if (hwdata == NULL) {
|
||||
return SDL_SetError("Virtual joystick data not found");
|
||||
}
|
||||
instance_id = hwdata->instance_id;
|
||||
|
@ -269,7 +270,7 @@ SDL_JoystickSetVirtualAxisInner(SDL_Joystick *joystick, int axis, Sint16 value)
|
|||
|
||||
SDL_LockJoysticks();
|
||||
|
||||
if (!joystick || !joystick->hwdata) {
|
||||
if (joystick == NULL || !joystick->hwdata) {
|
||||
SDL_UnlockJoysticks();
|
||||
return SDL_SetError("Invalid joystick");
|
||||
}
|
||||
|
@ -294,7 +295,7 @@ SDL_JoystickSetVirtualButtonInner(SDL_Joystick *joystick, int button, Uint8 valu
|
|||
|
||||
SDL_LockJoysticks();
|
||||
|
||||
if (!joystick || !joystick->hwdata) {
|
||||
if (joystick == NULL || !joystick->hwdata) {
|
||||
SDL_UnlockJoysticks();
|
||||
return SDL_SetError("Invalid joystick");
|
||||
}
|
||||
|
@ -319,7 +320,7 @@ SDL_JoystickSetVirtualHatInner(SDL_Joystick *joystick, int hat, Uint8 value)
|
|||
|
||||
SDL_LockJoysticks();
|
||||
|
||||
if (!joystick || !joystick->hwdata) {
|
||||
if (joystick == NULL || !joystick->hwdata) {
|
||||
SDL_UnlockJoysticks();
|
||||
return SDL_SetError("Invalid joystick");
|
||||
}
|
||||
|
@ -367,7 +368,7 @@ static const char *
|
|||
VIRTUAL_JoystickGetDeviceName(int device_index)
|
||||
{
|
||||
joystick_hwdata *hwdata = VIRTUAL_HWDataForIndex(device_index);
|
||||
if (!hwdata) {
|
||||
if (hwdata == NULL) {
|
||||
return NULL;
|
||||
}
|
||||
return hwdata->name;
|
||||
|
@ -403,7 +404,7 @@ static SDL_JoystickGUID
|
|||
VIRTUAL_JoystickGetDeviceGUID(int device_index)
|
||||
{
|
||||
joystick_hwdata *hwdata = VIRTUAL_HWDataForIndex(device_index);
|
||||
if (!hwdata) {
|
||||
if (hwdata == NULL) {
|
||||
SDL_JoystickGUID guid;
|
||||
SDL_zero(guid);
|
||||
return guid;
|
||||
|
@ -416,7 +417,7 @@ static SDL_JoystickID
|
|||
VIRTUAL_JoystickGetDeviceInstanceID(int device_index)
|
||||
{
|
||||
joystick_hwdata *hwdata = VIRTUAL_HWDataForIndex(device_index);
|
||||
if (!hwdata) {
|
||||
if (hwdata == NULL) {
|
||||
return -1;
|
||||
}
|
||||
return hwdata->instance_id;
|
||||
|
@ -427,7 +428,7 @@ static int
|
|||
VIRTUAL_JoystickOpen(SDL_Joystick *joystick, int device_index)
|
||||
{
|
||||
joystick_hwdata *hwdata = VIRTUAL_HWDataForIndex(device_index);
|
||||
if (!hwdata) {
|
||||
if (hwdata == NULL) {
|
||||
return SDL_SetError("No such device");
|
||||
}
|
||||
joystick->instance_id = hwdata->instance_id;
|
||||
|
@ -551,7 +552,7 @@ VIRTUAL_JoystickUpdate(SDL_Joystick *joystick)
|
|||
joystick_hwdata *hwdata;
|
||||
int i;
|
||||
|
||||
if (!joystick) {
|
||||
if (joystick == NULL) {
|
||||
return;
|
||||
}
|
||||
if (!joystick->hwdata) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue