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
387 changed files with 6094 additions and 4633 deletions

View File

@@ -66,30 +66,42 @@ print_modifiers(char **text, size_t *maxlen)
print_string(text, maxlen, " (none)");
return;
}
if (mod & KMOD_LSHIFT)
if (mod & KMOD_LSHIFT) {
print_string(text, maxlen, " LSHIFT");
if (mod & KMOD_RSHIFT)
}
if (mod & KMOD_RSHIFT) {
print_string(text, maxlen, " RSHIFT");
if (mod & KMOD_LCTRL)
}
if (mod & KMOD_LCTRL) {
print_string(text, maxlen, " LCTRL");
if (mod & KMOD_RCTRL)
}
if (mod & KMOD_RCTRL) {
print_string(text, maxlen, " RCTRL");
if (mod & KMOD_LALT)
}
if (mod & KMOD_LALT) {
print_string(text, maxlen, " LALT");
if (mod & KMOD_RALT)
}
if (mod & KMOD_RALT) {
print_string(text, maxlen, " RALT");
if (mod & KMOD_LGUI)
}
if (mod & KMOD_LGUI) {
print_string(text, maxlen, " LGUI");
if (mod & KMOD_RGUI)
}
if (mod & KMOD_RGUI) {
print_string(text, maxlen, " RGUI");
if (mod & KMOD_NUM)
}
if (mod & KMOD_NUM) {
print_string(text, maxlen, " NUM");
if (mod & KMOD_CAPS)
}
if (mod & KMOD_CAPS) {
print_string(text, maxlen, " CAPS");
if (mod & KMOD_MODE)
}
if (mod & KMOD_MODE) {
print_string(text, maxlen, " MODE");
if (mod & KMOD_SCROLL)
}
if (mod & KMOD_SCROLL) {
print_string(text, maxlen, " SCROLL");
}
}
static void
@@ -145,8 +157,7 @@ PrintText(const char *eventtype, const char *text)
char expanded[1024];
expanded[0] = '\0';
for ( spot = text; *spot; ++spot )
{
for ( spot = text; *spot; ++spot ) {
size_t length = SDL_strlen(expanded);
SDL_snprintf(expanded + length, sizeof(expanded) - length, "\\x%.2x", (unsigned char)*spot);
}
@@ -251,21 +262,21 @@ main(int argc, char *argv[])
/* Initialize SDL */
if (SDL_Init(SDL_INIT_VIDEO) < 0) {
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't initialize SDL: %s\n", SDL_GetError());
return (1);
return 1;
}
/* Set 640x480 video mode */
window = SDL_CreateWindow("CheckKeys Test",
SDL_WINDOWPOS_CENTERED, SDL_WINDOWPOS_CENTERED,
640, 480, 0);
if (!window) {
if (window == NULL) {
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't create 640x480 window: %s\n",
SDL_GetError());
quit(2);
}
renderer = SDL_CreateRenderer(window, -1, 0);
if (!renderer) {
if (renderer == NULL) {
SDL_LogError(SDL_LOG_CATEGORY_APPLICATION, "Couldn't create renderer: %s\n",
SDL_GetError());
quit(2);
@@ -296,7 +307,7 @@ main(int argc, char *argv[])
#endif
SDL_Quit();
return (0);
return 0;
}
/* vi: set ts=4 sw=4 expandtab: */