From a09c0ea8e349821fbe62b9eaeca98d125d7eeb19 Mon Sep 17 00:00:00 2001 From: Saint Wish <6036821+SaintWish@users.noreply.github.com> Date: Wed, 25 Sep 2024 00:31:28 -0500 Subject: [PATCH] fix most linux warnings and errors take 3 --- src/game/client/hud.h | 2 +- src/game/client/inc_huditem.h | 6 +++--- src/game/client/ms/clglobal.cpp | 2 +- src/game/client/render/studiomodelrenderer.cpp | 2 +- src/game/server/fn/FNSharedDefs.cpp | 2 +- src/game/server/fn/FNSharedDefs.h | 2 +- src/game/server/gamerules/multiplay_gamerules.cpp | 3 +-- src/game/server/hl/util.cpp | 2 +- src/game/server/hl/util.h | 2 +- src/game/shared/ms/global.cpp | 2 +- src/game/shared/ms/groupfile.cpp | 2 +- src/game/shared/ms/logger.h | 2 +- src/game/shared/ms/sharedutil.h | 2 +- src/game/shared/strhelper.h | 4 ++++ 14 files changed, 19 insertions(+), 16 deletions(-) diff --git a/src/game/client/hud.h b/src/game/client/hud.h index 34314863..68f20450 100644 --- a/src/game/client/hud.h +++ b/src/game/client/hud.h @@ -90,7 +90,7 @@ typedef struct cvar_s cvar_t; #endif #include "hud_spectator.h" //SDK 2.3 -void Print(char *szFmt, ...); +void Print(const char *szFmt, ...); void ShowVGUIMenu(int iMenu); //ripped from windef.h diff --git a/src/game/client/inc_huditem.h b/src/game/client/inc_huditem.h index 4e478875..430b0a81 100644 --- a/src/game/client/inc_huditem.h +++ b/src/game/client/inc_huditem.h @@ -4,6 +4,6 @@ #define INC_HUDITEM_H -void Print(char *szFmt, ...); -char *UTIL_VarArgs(char *format, ...); -inline const char *Localized(const char *pszText) { return CHudTextMessage::BufferedLocaliseTextString(pszText); } +void Print(const char *szFmt, ...); +char* UTIL_VarArgs(const char *format, ...); +inline const char* Localized(const char *pszText) { return CHudTextMessage::BufferedLocaliseTextString(pszText); } diff --git a/src/game/client/ms/clglobal.cpp b/src/game/client/ms/clglobal.cpp index 492e05c4..d0d1aee2 100644 --- a/src/game/client/ms/clglobal.cpp +++ b/src/game/client/ms/clglobal.cpp @@ -282,7 +282,7 @@ void AlertMessage(ALERT_TYPE atype, char *szFmt, ...) ConsolePrint("cl: "); ConsolePrint(string); } -char *UTIL_VarArgs(char *format, ...) +char* UTIL_VarArgs(const char *format, ...) { static char string[1024]; diff --git a/src/game/client/render/studiomodelrenderer.cpp b/src/game/client/render/studiomodelrenderer.cpp index 9719b687..e1cd2d89 100644 --- a/src/game/client/render/studiomodelrenderer.cpp +++ b/src/game/client/render/studiomodelrenderer.cpp @@ -45,7 +45,7 @@ engine_studio_api_t IEngineStudio; modelinfo_t CModelMgr::m_ModelInfo[4096]; -void Print(char* szFmt, ...); +void Print(const char* szFmt, ...); void VectorAngles(const float* forward, float* angles); int ViewModel_ExclusiveViewHand = -1; diff --git a/src/game/server/fn/FNSharedDefs.cpp b/src/game/server/fn/FNSharedDefs.cpp index 0586176b..99806a9c 100644 --- a/src/game/server/fn/FNSharedDefs.cpp +++ b/src/game/server/fn/FNSharedDefs.cpp @@ -22,7 +22,7 @@ #define STRING_BUFFER 1024 -void FNShared::Print(char* fmt, ...) +void FNShared::Print(const char* fmt, ...) { static char string[STRING_BUFFER]; diff --git a/src/game/server/fn/FNSharedDefs.h b/src/game/server/fn/FNSharedDefs.h index a20dd9aa..bd98a26d 100644 --- a/src/game/server/fn/FNSharedDefs.h +++ b/src/game/server/fn/FNSharedDefs.h @@ -18,7 +18,7 @@ enum FnPlayerFlags namespace FNShared { - void Print(char* fmt, ...); + void Print(const char* fmt, ...); bool IsSlotValid(int slot); bool IsEnabled(void); void Validate(void); diff --git a/src/game/server/gamerules/multiplay_gamerules.cpp b/src/game/server/gamerules/multiplay_gamerules.cpp index 3b19ec67..857c5fe9 100644 --- a/src/game/server/gamerules/multiplay_gamerules.cpp +++ b/src/game/server/gamerules/multiplay_gamerules.cpp @@ -376,8 +376,7 @@ void CHalfLifeMultiplay::UpdateGameMode( CBasePlayer *pPlayer ) void CHalfLifeMultiplay::InitHUD( CBasePlayer *pPlayer ) { // notify other clients of player joining the game - UTIL_ClientPrintAll( HUD_PRINTNOTIFY, UTIL_VarArgs( "%s has joined the game\n", - ( pPlayer->pev->netname && STRING(pPlayer->pev->netname)[0] != 0 ) ? STRING(pPlayer->pev->netname) : "unconnected" ) ); + UTIL_ClientPrintAll( HUD_PRINTNOTIFY, UTIL_VarArgs("%s has joined the game\n", (pPlayer->pev->netname && STRING(pPlayer->pev->netname)[0] != 0) ? STRING(pPlayer->pev->netname) : "unconnected" )); UTIL_LogPrintf( "\"%s<%i>\" has entered the game\n", STRING( pPlayer->pev->netname ), GETPLAYERUSERID( pPlayer->edict() ) ); diff --git a/src/game/server/hl/util.cpp b/src/game/server/hl/util.cpp index af4bd89c..90ebbaaf 100644 --- a/src/game/server/hl/util.cpp +++ b/src/game/server/hl/util.cpp @@ -1459,7 +1459,7 @@ float UTIL_SplineFraction(float value, float scale) return 3 * valueSquared - 2 * valueSquared * value; } -char *UTIL_VarArgs(char *format, ...) +char* UTIL_VarArgs(const char *format, ...) { static char string[1024]; diff --git a/src/game/server/hl/util.h b/src/game/server/hl/util.h index ecb07021..dd331448 100644 --- a/src/game/server/hl/util.h +++ b/src/game/server/hl/util.h @@ -325,7 +325,7 @@ extern float UTIL_Approach(float target, float value, float speed); extern float UTIL_ApproachAngle(float target, float value, float speed); extern float UTIL_AngleDistance(float next, float cur); -extern char *UTIL_VarArgs(char *format, ...); +extern char *UTIL_VarArgs(const char *format, ...); extern void UTIL_Remove(CBaseEntity *pEntity); extern BOOL UTIL_IsValidEntity(edict_t *pent); extern BOOL UTIL_TeamsMatch(const char *pTeamName1, const char *pTeamName2); diff --git a/src/game/shared/ms/global.cpp b/src/game/shared/ms/global.cpp index 63868f51..33fc4d80 100644 --- a/src/game/shared/ms/global.cpp +++ b/src/game/shared/ms/global.cpp @@ -534,7 +534,7 @@ AlertMessage Print debug messages to console ====================== */ -void Print(char *szFmt, ...) +void Print(const char *szFmt, ...) { static char string[1024]; diff --git a/src/game/shared/ms/groupfile.cpp b/src/game/shared/ms/groupfile.cpp index f1e868a7..549b3ec4 100644 --- a/src/game/shared/ms/groupfile.cpp +++ b/src/game/shared/ms/groupfile.cpp @@ -26,7 +26,7 @@ void operator delete(void* ptr, const char* pszSourceFile, int LineNum); #define msnew new #endif -void Print(char* szFmt, ...); +void Print(const char* szFmt, ...); /*----------- CGroupFile - File packwout without encryption. diff --git a/src/game/shared/ms/logger.h b/src/game/shared/ms/logger.h index dbdfd57c..2d2ab6ff 100644 --- a/src/game/shared/ms/logger.h +++ b/src/game/shared/ms/logger.h @@ -123,7 +123,7 @@ extern Logger chatlog; extern Logger NullFile; extern bool g_log_initialized; -void Print(char* szFmt, ...); +void Print(const char* szFmt, ...); void Log(char* szFmt, ...); void OpenLogFiles(); diff --git a/src/game/shared/ms/sharedutil.h b/src/game/shared/ms/sharedutil.h index aa2342a3..b5bf836b 100644 --- a/src/game/shared/ms/sharedutil.h +++ b/src/game/shared/ms/sharedutil.h @@ -45,7 +45,7 @@ class Color4F //For opengl or when you need colors in the [0-1] range #define MACRO_CREATEITEM(item) (CBaseEntity *)GET_PRIVATE(CREATE_NAMED_ENTITY(MAKE_STRING(item))) //#define clrmem( a ) memset( &a, 0, sizeof(a) ); int numofdigits(int x); -void Print(char *szFmt, ...); +void Print(const char *szFmt, ...); #define FloatToString( a ) UTIL_VarArgs( "%.2f", a ) #define IntToString( a ) UTIL_VarArgs( "%i", a ) diff --git a/src/game/shared/strhelper.h b/src/game/shared/strhelper.h index 000a5273..bf72045a 100644 --- a/src/game/shared/strhelper.h +++ b/src/game/shared/strhelper.h @@ -4,6 +4,10 @@ #ifdef POSIX char* strupr(char* start); char* strlower(char* start); + +// These need to be defined here otherwise we could fuck up SDL2's headers. +#define _strupr strupr +#define _strlwr strlower #endif #endif // STR_HELPER_H \ No newline at end of file