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:
@@ -32,8 +32,9 @@ SDL_GetPowerInfo_Emscripten(SDL_PowerState *state, int *seconds, int *percent)
|
||||
EmscriptenBatteryEvent batteryState;
|
||||
int haveBattery = 0;
|
||||
|
||||
if (emscripten_get_battery_status(&batteryState) == EMSCRIPTEN_RESULT_NOT_SUPPORTED)
|
||||
if (emscripten_get_battery_status(&batteryState) == EMSCRIPTEN_RESULT_NOT_SUPPORTED) {
|
||||
return SDL_FALSE;
|
||||
}
|
||||
|
||||
haveBattery = batteryState.level != 1.0 || !batteryState.charging || batteryState.chargingTime != 0.0;
|
||||
|
||||
|
||||
@@ -302,11 +302,13 @@ next_string(char **_ptr, char **_str)
|
||||
}
|
||||
|
||||
str = ptr;
|
||||
while ((*ptr != ' ') && (*ptr != '\n') && (*ptr != '\0'))
|
||||
while ((*ptr != ' ') && (*ptr != '\n') && (*ptr != '\0')) {
|
||||
ptr++;
|
||||
}
|
||||
|
||||
if (*ptr != '\0')
|
||||
if (*ptr != '\0') {
|
||||
*(ptr++) = '\0';
|
||||
}
|
||||
|
||||
*_str = str;
|
||||
*_ptr = ptr;
|
||||
@@ -318,7 +320,7 @@ int_string(char *str, int *val)
|
||||
{
|
||||
char *endptr = NULL;
|
||||
*val = (int) SDL_strtol(str, &endptr, 0);
|
||||
return ((*str != '\0') && (*endptr == '\0'));
|
||||
return (*str != '\0') && (*endptr == '\0');
|
||||
}
|
||||
|
||||
/* http://lxr.linux.no/linux+v2.6.29/drivers/char/apm-emulation.c */
|
||||
@@ -438,7 +440,7 @@ SDL_GetPowerInfo_Linux_sys_class_power_supply(SDL_PowerState *state, int *second
|
||||
DIR *dirp;
|
||||
|
||||
dirp = opendir(base);
|
||||
if (!dirp) {
|
||||
if (dirp == NULL) {
|
||||
return SDL_FALSE;
|
||||
}
|
||||
|
||||
@@ -632,9 +634,9 @@ SDL_GetPowerInfo_Linux_org_freedesktop_upower(SDL_PowerState *state, int *second
|
||||
char **paths = NULL;
|
||||
int i, numpaths = 0;
|
||||
|
||||
if (!dbus || !SDL_DBus_CallMethodOnConnection(dbus->system_conn, UPOWER_DBUS_NODE, UPOWER_DBUS_PATH, UPOWER_DBUS_INTERFACE, "EnumerateDevices",
|
||||
DBUS_TYPE_INVALID,
|
||||
DBUS_TYPE_ARRAY, DBUS_TYPE_OBJECT_PATH, &paths, &numpaths, DBUS_TYPE_INVALID)) {
|
||||
if (dbus == NULL || !SDL_DBus_CallMethodOnConnection(dbus->system_conn, UPOWER_DBUS_NODE, UPOWER_DBUS_PATH, UPOWER_DBUS_INTERFACE, "EnumerateDevices",
|
||||
DBUS_TYPE_INVALID,
|
||||
DBUS_TYPE_ARRAY, DBUS_TYPE_OBJECT_PATH, &paths, &numpaths, DBUS_TYPE_INVALID)) {
|
||||
return SDL_FALSE; /* try a different approach than UPower. */
|
||||
}
|
||||
|
||||
|
||||
@@ -33,8 +33,7 @@ SDL_GetPowerInfo_Windows(SDL_PowerState * state, int *seconds, int *percent)
|
||||
SDL_bool need_details = SDL_FALSE;
|
||||
|
||||
/* This API should exist back to Win95. */
|
||||
if (!GetSystemPowerStatus(&status))
|
||||
{
|
||||
if (!GetSystemPowerStatus(&status)) {
|
||||
/* !!! FIXME: push GetLastError() into SDL_GetError() */
|
||||
*state = SDL_POWERSTATE_UNKNOWN;
|
||||
} else if (status.BatteryFlag == 0xFF) { /* unknown state */
|
||||
|
||||
Reference in New Issue
Block a user