mirror of
https://github.com/libsdl-org/SDL.git
synced 2025-10-10 11:56:26 +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:
@@ -320,8 +320,9 @@ CreateHwData(const char *path)
|
||||
hw->type = BSDJOY_UHID;
|
||||
{
|
||||
int ax;
|
||||
for (ax = 0; ax < JOYAXE_count; ax++)
|
||||
for (ax = 0; ax < JOYAXE_count; ax++) {
|
||||
hw->axis_map[ax] = -1;
|
||||
}
|
||||
}
|
||||
hw->repdesc = hid_get_report_desc(fd);
|
||||
if (hw->repdesc == NULL) {
|
||||
@@ -355,8 +356,9 @@ CreateHwData(const char *path)
|
||||
SDL_SetError("%s: Cannot start HID parser", path);
|
||||
goto usberr;
|
||||
}
|
||||
for (i = 0; i < JOYAXE_count; i++)
|
||||
for (i = 0; i < JOYAXE_count; i++) {
|
||||
hw->axis_map[i] = -1;
|
||||
}
|
||||
|
||||
while (hid_get_item(hdata, &hitem) > 0) {
|
||||
switch (hitem.kind) {
|
||||
@@ -394,9 +396,11 @@ CreateHwData(const char *path)
|
||||
}
|
||||
}
|
||||
hid_end_parse(hdata);
|
||||
for (i = 0; i < JOYAXE_count; i++)
|
||||
if (hw->axis_map[i] > 0)
|
||||
for (i = 0; i < JOYAXE_count; i++) {
|
||||
if (hw->axis_map[i] > 0) {
|
||||
hw->axis_map[i] = hw->naxes++;
|
||||
}
|
||||
}
|
||||
|
||||
if (hw->naxes == 0 && hw->nbuttons == 0 && hw->nhats == 0) {
|
||||
SDL_SetError("%s: Not a joystick, ignoring", path);
|
||||
@@ -446,7 +450,7 @@ MaybeAddDevice(const char *path)
|
||||
}
|
||||
|
||||
hw = CreateHwData(path);
|
||||
if (!hw) {
|
||||
if (hw == NULL) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
@@ -476,7 +480,7 @@ MaybeAddDevice(const char *path)
|
||||
}
|
||||
#endif /* USB_GET_DEVICEINFO */
|
||||
}
|
||||
if (!name) {
|
||||
if (name == NULL) {
|
||||
name = SDL_strdup(path);
|
||||
guid = SDL_CreateJoystickGUIDForName(name);
|
||||
}
|
||||
@@ -633,7 +637,7 @@ BSD_JoystickOpen(SDL_Joystick *joy, int device_index)
|
||||
}
|
||||
|
||||
hw = CreateHwData(item->path);
|
||||
if (!hw) {
|
||||
if (hw == NULL) {
|
||||
return -1;
|
||||
}
|
||||
|
||||
@@ -738,16 +742,13 @@ BSD_JoystickUpdate(SDL_Joystick *joy)
|
||||
else if (usage == HUG_DPAD_UP) {
|
||||
dpad[0] = (Sint32) hid_get_data(REP_BUF_DATA(rep), &hitem);
|
||||
SDL_PrivateJoystickHat(joy, 0, dpad_to_sdl(dpad));
|
||||
}
|
||||
else if (usage == HUG_DPAD_DOWN) {
|
||||
} else if (usage == HUG_DPAD_DOWN) {
|
||||
dpad[1] = (Sint32) hid_get_data(REP_BUF_DATA(rep), &hitem);
|
||||
SDL_PrivateJoystickHat(joy, 0, dpad_to_sdl(dpad));
|
||||
}
|
||||
else if (usage == HUG_DPAD_RIGHT) {
|
||||
} else if (usage == HUG_DPAD_RIGHT) {
|
||||
dpad[2] = (Sint32) hid_get_data(REP_BUF_DATA(rep), &hitem);
|
||||
SDL_PrivateJoystickHat(joy, 0, dpad_to_sdl(dpad));
|
||||
}
|
||||
else if (usage == HUG_DPAD_LEFT) {
|
||||
} else if (usage == HUG_DPAD_LEFT) {
|
||||
dpad[3] = (Sint32) hid_get_data(REP_BUF_DATA(rep), &hitem);
|
||||
SDL_PrivateJoystickHat(joy, 0, dpad_to_sdl(dpad));
|
||||
}
|
||||
|
Reference in New Issue
Block a user