From 33fd4579fb39ebc5c9bc558e65ad965a6b6052fa Mon Sep 17 00:00:00 2001 From: Denis Pauk Date: Wed, 1 Jan 2025 22:34:21 +0200 Subject: [PATCH] client: code style cleanup --- src/backends/unix/system.c | 20 ++++++++++---------- src/backends/windows/system.c | 2 +- src/client/input/sdl2.c | 12 ++++++------ src/client/input/sdl3.c | 12 ++++++------ src/client/refresh/gl3/gl3_sdl.c | 20 ++++++++++---------- src/client/refresh/gl4/gl4_sdl.c | 24 ++++++++++++------------ src/game/g_misc.c | 2 +- src/game/player/client.c | 14 +++++++------- 8 files changed, 53 insertions(+), 53 deletions(-) diff --git a/src/backends/unix/system.c b/src/backends/unix/system.c index 59ebcc68..655d96b2 100644 --- a/src/backends/unix/system.c +++ b/src/backends/unix/system.c @@ -618,21 +618,21 @@ Sys_Realpath(const char *in, char *out, size_t size) void * Sys_GetProcAddress(void *handle, const char *sym) { - if (handle == NULL) - { + if (handle == NULL) + { #ifdef RTLD_DEFAULT - return dlsym(RTLD_DEFAULT, sym); + return dlsym(RTLD_DEFAULT, sym); #else - /* POSIX suggests that this is a portable equivalent */ - static void *global_namespace = NULL; + /* POSIX suggests that this is a portable equivalent */ + static void *global_namespace = NULL; - if (global_namespace == NULL) - global_namespace = dlopen(NULL, RTLD_GLOBAL|RTLD_LAZY); + if (global_namespace == NULL) + global_namespace = dlopen(NULL, RTLD_GLOBAL|RTLD_LAZY); - return dlsym(global_namespace, sym); + return dlsym(global_namespace, sym); #endif - } - return dlsym(handle, sym); + } + return dlsym(handle, sym); } void diff --git a/src/backends/windows/system.c b/src/backends/windows/system.c index f9059c76..cf869679 100644 --- a/src/backends/windows/system.c +++ b/src/backends/windows/system.c @@ -275,7 +275,7 @@ Sys_Microseconds(void) static LARGE_INTEGER freq = { 0 }; static LARGE_INTEGER base = { 0 }; - if (!freq.QuadPart) + if (!freq.QuadPart) { QueryPerformanceFrequency(&freq); } diff --git a/src/client/input/sdl2.c b/src/client/input/sdl2.c index d5754309..06d4d595 100644 --- a/src/client/input/sdl2.c +++ b/src/client/input/sdl2.c @@ -508,14 +508,14 @@ static void IN_Controller_Shutdown(qboolean notify_user); qboolean IN_NumpadIsOn() { - SDL_Keymod mod = SDL_GetModState(); + SDL_Keymod mod = SDL_GetModState(); - if ((mod & KMOD_NUM) == KMOD_NUM) - { - return true; - } + if ((mod & KMOD_NUM) == KMOD_NUM) + { + return true; + } - return false; + return false; } /* ------------------------------------------------------------------ */ diff --git a/src/client/input/sdl3.c b/src/client/input/sdl3.c index 808ae93c..a3545850 100644 --- a/src/client/input/sdl3.c +++ b/src/client/input/sdl3.c @@ -506,14 +506,14 @@ static void IN_Controller_Shutdown(qboolean notify_user); qboolean IN_NumpadIsOn() { - SDL_Keymod mod = SDL_GetModState(); + SDL_Keymod mod = SDL_GetModState(); - if ((mod & SDL_KMOD_NUM) == SDL_KMOD_NUM) - { - return true; - } + if ((mod & SDL_KMOD_NUM) == SDL_KMOD_NUM) + { + return true; + } - return false; + return false; } /* ------------------------------------------------------------------ */ diff --git a/src/client/refresh/gl3/gl3_sdl.c b/src/client/refresh/gl3/gl3_sdl.c index a8e06567..ebc8ec01 100644 --- a/src/client/refresh/gl3/gl3_sdl.c +++ b/src/client/refresh/gl3/gl3_sdl.c @@ -53,7 +53,7 @@ enum { */ static void APIENTRY DebugCallback(GLenum source, GLenum type, GLuint id, GLenum severity, GLsizei length, - const GLchar *message, const void *userParam) + const GLchar *message, const void *userParam) { const char* sourceStr = "Source: Unknown"; const char* typeStr = "Type: Unknown"; @@ -172,15 +172,15 @@ void GL3_SetVsync(void) #ifdef USE_SDL3 int vsyncState; - if (!SDL_GL_GetSwapInterval(&vsyncState)) - { - R_Printf(PRINT_ALL, "Failed to get vsync state, assuming vsync inactive.\n"); - vsyncActive = false; - } - else - { - vsyncActive = vsyncState ? true : false; - } + if (!SDL_GL_GetSwapInterval(&vsyncState)) + { + R_Printf(PRINT_ALL, "Failed to get vsync state, assuming vsync inactive.\n"); + vsyncActive = false; + } + else + { + vsyncActive = vsyncState ? true : false; + } #else vsyncActive = SDL_GL_GetSwapInterval() != 0; #endif diff --git a/src/client/refresh/gl4/gl4_sdl.c b/src/client/refresh/gl4/gl4_sdl.c index 42c93fc0..1e031e51 100644 --- a/src/client/refresh/gl4/gl4_sdl.c +++ b/src/client/refresh/gl4/gl4_sdl.c @@ -53,7 +53,7 @@ enum { */ static void APIENTRY DebugCallback(GLenum source, GLenum type, GLuint id, GLenum severity, GLsizei length, - const GLchar *message, const void *userParam) + const GLchar *message, const void *userParam) { const char* sourceStr = "Source: Unknown"; const char* typeStr = "Type: Unknown"; @@ -155,15 +155,15 @@ void GL4_SetVsync(void) #ifdef USE_SDL3 int vsyncState; - if (SDL_GL_GetSwapInterval(&vsyncState) != 0) - { - R_Printf(PRINT_ALL, "Failed to get vsync state, assuming vsync inactive.\n"); - vsyncActive = false; - } - else - { - vsyncActive = vsyncState ? true : false; - } + if (SDL_GL_GetSwapInterval(&vsyncState) != 0) + { + R_Printf(PRINT_ALL, "Failed to get vsync state, assuming vsync inactive.\n"); + vsyncActive = false; + } + else + { + vsyncActive = vsyncState ? true : false; + } #else vsyncActive = SDL_GL_GetSwapInterval() != 0; #endif @@ -439,9 +439,9 @@ void GL4_ShutdownContext() if(context) { #ifdef USE_SDL3 - SDL_GL_DestroyContext(context); + SDL_GL_DestroyContext(context); #else - SDL_GL_DeleteContext(context); + SDL_GL_DeleteContext(context); #endif context = NULL; } diff --git a/src/game/g_misc.c b/src/game/g_misc.c index bdbcec23..c3af8187 100644 --- a/src/game/g_misc.c +++ b/src/game/g_misc.c @@ -393,7 +393,7 @@ ThrowHeadACID(edict_t *self, const char *gibname, int damage, int type) vec3_t vd; float vscale; - if (!self || !gibname) + if (!self || !gibname) { return; } diff --git a/src/game/player/client.c b/src/game/player/client.c index 375c1b50..0ee57e58 100644 --- a/src/game/player/client.c +++ b/src/game/player/client.c @@ -167,7 +167,7 @@ SP_CreateUnnamedSpawn(edict_t *self) } /* mine1 */ - if (Q_stricmp(level.mapname, "mine1") == 0) + if (Q_stricmp(level.mapname, "mine1") == 0) { if (Q_stricmp(self->targetname, "mintro") == 0) { @@ -183,7 +183,7 @@ SP_CreateUnnamedSpawn(edict_t *self) } /* mine2 */ - if (Q_stricmp(level.mapname, "mine2") == 0) + if (Q_stricmp(level.mapname, "mine2") == 0) { if (Q_stricmp(self->targetname, "mine1") == 0) { @@ -199,7 +199,7 @@ SP_CreateUnnamedSpawn(edict_t *self) } /* mine3 */ - if (Q_stricmp(level.mapname, "mine3") == 0) + if (Q_stricmp(level.mapname, "mine3") == 0) { if (Q_stricmp(self->targetname, "mine2a") == 0) { @@ -215,7 +215,7 @@ SP_CreateUnnamedSpawn(edict_t *self) } /* mine4 */ - if (Q_stricmp(level.mapname, "mine4") == 0) + if (Q_stricmp(level.mapname, "mine4") == 0) { if (Q_stricmp(self->targetname, "mine3") == 0) { @@ -247,7 +247,7 @@ SP_CreateUnnamedSpawn(edict_t *self) } /* waste1 */ - if (Q_stricmp(level.mapname, "waste1") == 0) + if (Q_stricmp(level.mapname, "waste1") == 0) { if (Q_stricmp(self->targetname, "power2") == 0) { @@ -263,7 +263,7 @@ SP_CreateUnnamedSpawn(edict_t *self) } /* waste2 */ - if (Q_stricmp(level.mapname, "waste2") == 0) + if (Q_stricmp(level.mapname, "waste2") == 0) { if (Q_stricmp(self->targetname, "waste1") == 0) { @@ -279,7 +279,7 @@ SP_CreateUnnamedSpawn(edict_t *self) } /* city3 */ - if (Q_stricmp(level.mapname, "city2") == 0) + if (Q_stricmp(level.mapname, "city2") == 0) { if (Q_stricmp(self->targetname, "city2NL") == 0) {