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

@ -65,9 +65,9 @@ Emscripten_CreateDevice(void)
/* Initialize all variables that we clean on shutdown */
device = (SDL_VideoDevice *) SDL_calloc(1, sizeof(SDL_VideoDevice));
if (!device) {
if (device == NULL) {
SDL_OutOfMemory();
return (0);
return 0;
}
/* Firefox sends blur event which would otherwise prevent full screen
@ -310,7 +310,7 @@ Emscripten_DestroyWindow(_THIS, SDL_Window * window)
{
SDL_WindowData *data;
if(window->driverdata) {
if (window->driverdata) {
data = (SDL_WindowData *) window->driverdata;
Emscripten_UnregisterEventHandlers(data);
@ -328,19 +328,19 @@ static void
Emscripten_SetWindowFullscreen(_THIS, SDL_Window * window, SDL_VideoDisplay * display, SDL_bool fullscreen)
{
SDL_WindowData *data;
if(window->driverdata) {
if (window->driverdata) {
data = (SDL_WindowData *) window->driverdata;
if(fullscreen) {
if (fullscreen) {
EmscriptenFullscreenStrategy strategy;
SDL_bool is_desktop_fullscreen = (window->flags & SDL_WINDOW_FULLSCREEN_DESKTOP) == SDL_WINDOW_FULLSCREEN_DESKTOP;
int res;
strategy.scaleMode = is_desktop_fullscreen ? EMSCRIPTEN_FULLSCREEN_SCALE_STRETCH : EMSCRIPTEN_FULLSCREEN_SCALE_ASPECT;
if(!is_desktop_fullscreen) {
if (!is_desktop_fullscreen) {
strategy.canvasResolutionScaleMode = EMSCRIPTEN_FULLSCREEN_CANVAS_SCALE_NONE;
} else if(window->flags & SDL_WINDOW_ALLOW_HIGHDPI) {
} else if (window->flags & SDL_WINDOW_ALLOW_HIGHDPI) {
strategy.canvasResolutionScaleMode = EMSCRIPTEN_FULLSCREEN_CANVAS_SCALE_HIDEF;
} else {
strategy.canvasResolutionScaleMode = EMSCRIPTEN_FULLSCREEN_CANVAS_SCALE_STDDEF;
@ -355,12 +355,11 @@ Emscripten_SetWindowFullscreen(_THIS, SDL_Window * window, SDL_VideoDisplay * di
data->fullscreen_resize = is_desktop_fullscreen;
res = emscripten_request_fullscreen_strategy(data->canvas_id, 1, &strategy);
if(res != EMSCRIPTEN_RESULT_SUCCESS && res != EMSCRIPTEN_RESULT_DEFERRED) {
if (res != EMSCRIPTEN_RESULT_SUCCESS && res != EMSCRIPTEN_RESULT_DEFERRED) {
/* unset flags, fullscreen failed */
window->flags &= ~(SDL_WINDOW_FULLSCREEN_DESKTOP | SDL_WINDOW_FULLSCREEN);
}
}
else
} else
emscripten_exit_fullscreen();
}
}