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:
Sylvain Becker 2022-11-27 17:38:43 +01:00 committed by GitHub
parent 4958dafdc3
commit 6a2200823c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
387 changed files with 6094 additions and 4633 deletions

View file

@ -389,7 +389,7 @@ HIDAPI_SetupDeviceDriver(SDL_HIDAPI_Device *device, SDL_bool *removed)
for (curr = SDL_HIDAPI_devices; curr && curr != device; curr = curr->next) {
continue;
}
if (!curr) {
if (curr == NULL) {
*removed = SDL_TRUE;
if (dev) {
SDL_hid_close(dev);
@ -397,7 +397,7 @@ HIDAPI_SetupDeviceDriver(SDL_HIDAPI_Device *device, SDL_bool *removed)
return;
}
if (!dev) {
if (dev == NULL) {
SDL_LogDebug(SDL_LOG_CATEGORY_INPUT,
"HIDAPI_SetupDeviceDriver() couldn't open %s: %s\n",
device->path, SDL_GetError());
@ -513,7 +513,7 @@ static SDL_bool
HIDAPI_AddJoystickInstanceToDevice(SDL_HIDAPI_Device *device, SDL_JoystickID joystickID)
{
SDL_JoystickID *joysticks = (SDL_JoystickID *)SDL_realloc(device->joysticks, (device->num_joysticks + 1)*sizeof(*device->joysticks));
if (!joysticks) {
if (joysticks == NULL) {
return SDL_FALSE;
}
@ -583,7 +583,7 @@ HIDAPI_HasConnectedUSBDevice(const char *serial)
{
SDL_HIDAPI_Device *device;
if (!serial) {
if (serial == NULL) {
return SDL_FALSE;
}
@ -608,7 +608,7 @@ HIDAPI_DisconnectBluetoothDevice(const char *serial)
{
SDL_HIDAPI_Device *device;
if (!serial) {
if (serial == NULL) {
return;
}
@ -713,7 +713,7 @@ HIDAPI_ConvertString(const wchar_t *wide_string)
if (wide_string) {
string = SDL_iconv_string("UTF-8", "WCHAR_T", (char*)wide_string, (SDL_wcslen(wide_string)+1)*sizeof(wchar_t));
if (!string) {
if (string == NULL) {
switch (sizeof(wchar_t)) {
case 2:
string = SDL_iconv_string("UTF-8", "UCS-2-INTERNAL", (char*)wide_string, (SDL_wcslen(wide_string)+1)*sizeof(wchar_t));
@ -739,7 +739,7 @@ HIDAPI_AddDevice(const struct SDL_hid_device_info *info, int num_children, SDL_H
}
device = (SDL_HIDAPI_Device *)SDL_calloc(1, sizeof(*device));
if (!device) {
if (device == NULL) {
return NULL;
}
device->path = SDL_strdup(info->path);
@ -903,7 +903,7 @@ HIDAPI_CreateCombinedJoyCons()
if (joycons[0] && joycons[1]) {
SDL_hid_device_info info;
SDL_HIDAPI_Device **children = (SDL_HIDAPI_Device **)SDL_malloc(2 * sizeof(SDL_HIDAPI_Device *));
if (!children) {
if (children == NULL) {
return SDL_FALSE;
}
children[0] = joycons[0];
@ -1295,13 +1295,13 @@ HIDAPI_JoystickOpen(SDL_Joystick *joystick, int device_index)
SDL_HIDAPI_Device *device = HIDAPI_GetDeviceByIndex(device_index, &joystickID);
struct joystick_hwdata *hwdata;
if (!device || !device->driver) {
if (device == NULL || !device->driver) {
/* This should never happen - validated before being called */
return SDL_SetError("Couldn't find HIDAPI device at index %d\n", device_index);
}
hwdata = (struct joystick_hwdata *)SDL_calloc(1, sizeof(*hwdata));
if (!hwdata) {
if (hwdata == NULL) {
return SDL_OutOfMemory();
}
hwdata->device = device;