From e5a2cc3eacb9e3c163cffdd5f5fabd3761be6460 Mon Sep 17 00:00:00 2001 From: SAN4EZDREAMS Date: Mon, 11 Aug 2025 11:40:08 +0300 Subject: [PATCH 01/10] [BUG] [GCC] warning: comparison of integer expressions --- src/common/console/c_dispatch.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/common/console/c_dispatch.cpp b/src/common/console/c_dispatch.cpp index c4a364a6183..61aa457df88 100644 --- a/src/common/console/c_dispatch.cpp +++ b/src/common/console/c_dispatch.cpp @@ -195,7 +195,7 @@ bool C_IsValidInt(const char* arg, int& value, int base) char* end_read; value = std::strtol(arg, &end_read, base); ptrdiff_t chars_read = end_read - arg; - return chars_read == strlen(arg); + return chars_read == (ptrdiff_t)strlen(arg); } bool C_IsValidFloat(const char* arg, double& value) @@ -203,7 +203,7 @@ bool C_IsValidFloat(const char* arg, double& value) char* end_read; value = std::strtod(arg, &end_read); ptrdiff_t chars_read = end_read - arg; - return chars_read == strlen(arg); + return chars_read == (ptrdiff_t)strlen(arg); } void C_DoCommand (const char *cmd, int keynum) From 8ece961df2c04c8b6558333de9f6334bc1bb7e8d Mon Sep 17 00:00:00 2001 From: SAN4EZDREAMS Date: Mon, 11 Aug 2025 12:42:02 +0300 Subject: [PATCH 02/10] [BUG] [GCC] warning: comparison of integer expressions 2 --- src/am_map.cpp | 2 +- src/d_net.cpp | 14 +++++++------- src/d_netinfo.cpp | 6 +++--- 3 files changed, 11 insertions(+), 11 deletions(-) diff --git a/src/am_map.cpp b/src/am_map.cpp index 03dd7f215f6..49b9fc5b930 100644 --- a/src/am_map.cpp +++ b/src/am_map.cpp @@ -2855,7 +2855,7 @@ void DAutomap::drawPlayers () } // We don't always want to show allies on the automap. - if (dmflags2 & DF2_NO_AUTOMAP_ALLIES && i != consoleplayer) + if (dmflags2 & DF2_NO_AUTOMAP_ALLIES && (int)i != consoleplayer) continue; if (deathmatch && !demoplayback && diff --git a/src/d_net.cpp b/src/d_net.cpp index 0648c81d71b..33a4987d76c 100644 --- a/src/d_net.cpp +++ b/src/d_net.cpp @@ -1546,7 +1546,7 @@ void NetUpdate(int tics) // If player count is < 8, scale the number of commands by 1 per every 1 less player. // If player count is < 4, scale the number of commands by 4 per every 1 less player. constexpr size_t MaxTicsPerPacket = 2u; - if (players > 1u) + if (players > 1) { maxCommands = MaxTicsPerPacket; if (players >= MaxPlayersPerPacket / 2 && players < MaxPlayersPerPacket) @@ -1878,7 +1878,7 @@ bool D_CheckNetGame() for (auto client : NetworkClients) playeringame[client] = true; - if (MaxClients > 1u) + if (MaxClients > 1) { if (consoleplayer == Net_Arbitrator) Printf("Selected " TEXTCOLOR_BLUE "%s" TEXTCOLOR_NORMAL " networking mode\n", NetMode == NET_PeerToPeer ? "peer to peer" : "packet server"); @@ -3298,7 +3298,7 @@ CCMD(kick) } TArray cNums = {}; - for (size_t i = 1u; i < argv.argc(); ++i) + for (size_t i = 1u; i < (size_t)argv.argc(); ++i) { int cNum = -1; if (!C_IsValidInt(argv[i], cNum) || cNum < 0 || cNum >= MAXPLAYERS) @@ -3336,7 +3336,7 @@ CCMD(mute) } TArray pNums = {}; - for (size_t i = 1u; i < argv.argc(); ++i) + for (size_t i = 1u; i < (size_t)argv.argc(); ++i) { int pNum = -1; if (!C_IsValidInt(argv[i], pNum) || pNum < 0 || pNum >= MAXPLAYERS) @@ -3411,7 +3411,7 @@ CCMD(unmute) } TArray pNums = {}; - for (size_t i = 1u; i < argv.argc(); ++i) + for (size_t i = 1u; i < (size_t)argv.argc(); ++i) { int pNum = -1; if (!C_IsValidInt(argv[i], pNum) || pNum < 0 || pNum >= MAXPLAYERS) @@ -3509,7 +3509,7 @@ CCMD(addsettingscontrollers) } TArray cNums = {}; - for (size_t i = 1u; i < argv.argc(); ++i) + for (size_t i = 1u; i < (size_t)argv.argc(); ++i) { int cNum = -1; if (!C_IsValidInt(argv[i], cNum) || cNum < 0 || cNum >= MAXPLAYERS) @@ -3536,7 +3536,7 @@ CCMD(removesettingscontrollers) } TArray cNums = {}; - for (size_t i = 1u; i < argv.argc(); ++i) + for (size_t i = 1u; i < (size_t)argv.argc(); ++i) { int cNum = -1; if (!C_IsValidInt(argv[i], cNum) || cNum < 0 || cNum >= MAXPLAYERS) diff --git a/src/d_netinfo.cpp b/src/d_netinfo.cpp index 7ddd5c24971..cd8936b6248 100644 --- a/src/d_netinfo.cpp +++ b/src/d_netinfo.cpp @@ -750,7 +750,7 @@ static int namesortfunc(const void *a, const void *b) FString D_GetUserInfoStrings(int pnum, bool compact) { FString result; - if (pnum >= 0 && pnum < MAXPLAYERS) + if (pnum >= 0 && pnum < (int)MAXPLAYERS) { userinfo_t* info = &players[pnum].userinfo; TArray::Pair*> userinfo_pairs(info->CountUsed()); @@ -838,7 +838,7 @@ void D_ReadUserInfoStrings (int pnum, TArrayView& stream, bool update) qsort(&compact_names[0], compact_names.Size(), sizeof(FName), namesortfunc); } - if (pnum < MAXPLAYERS) + if (pnum < (int)MAXPLAYERS) { for (breakpt = ptr; breakpt != NULL; ptr = breakpt + 1) { @@ -1055,7 +1055,7 @@ CCMD(playerinfo) { i = consoleplayer; } - else if (!C_IsValidInt(argv[1], i) || i < 0 || i >= MAXPLAYERS) + else if (!C_IsValidInt(argv[1], i) || i < 0 || i >= (int)MAXPLAYERS) { Printf("Bad player number %s\n", argv[1]); return; From 05429e95e7abfb9634a04147b60b9adc162d8863 Mon Sep 17 00:00:00 2001 From: SAN4EZDREAMS Date: Mon, 11 Aug 2025 12:48:38 +0300 Subject: [PATCH 03/10] [BUG] [GCC] warning: comparison of integer expressions 3 --- src/d_net.cpp | 12 ++++++------ src/g_game.cpp | 2 +- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/src/d_net.cpp b/src/d_net.cpp index 33a4987d76c..d9830c5aae1 100644 --- a/src/d_net.cpp +++ b/src/d_net.cpp @@ -3301,7 +3301,7 @@ CCMD(kick) for (size_t i = 1u; i < (size_t)argv.argc(); ++i) { int cNum = -1; - if (!C_IsValidInt(argv[i], cNum) || cNum < 0 || cNum >= MAXPLAYERS) + if (!C_IsValidInt(argv[i], cNum) || cNum < 0 || cNum >= (int)MAXPLAYERS) Printf("Bad client number %s\n", argv[i]); else if (cNum != consoleplayer && cNums.Find(cNum) >= cNums.Size()) cNums.Push(cNum); @@ -3339,7 +3339,7 @@ CCMD(mute) for (size_t i = 1u; i < (size_t)argv.argc(); ++i) { int pNum = -1; - if (!C_IsValidInt(argv[i], pNum) || pNum < 0 || pNum >= MAXPLAYERS) + if (!C_IsValidInt(argv[i], pNum) || pNum < 0 || pNum >= (int)MAXPLAYERS) Printf("Bad player number %s\n", argv[i]); else if (pNum != consoleplayer && pNums.Find(pNum) >= pNums.Size()) pNums.Push(pNum); @@ -3367,7 +3367,7 @@ CCMD(muteall) return; } - for (int i = 0; i < MAXPLAYERS; ++i) + for (int i = 0; i < (int)MAXPLAYERS; ++i) { if (playeringame[i] && i != consoleplayer) MutedClients |= (uint64_t)1u << i; @@ -3414,7 +3414,7 @@ CCMD(unmute) for (size_t i = 1u; i < (size_t)argv.argc(); ++i) { int pNum = -1; - if (!C_IsValidInt(argv[i], pNum) || pNum < 0 || pNum >= MAXPLAYERS) + if (!C_IsValidInt(argv[i], pNum) || pNum < 0 || pNum >= (int)MAXPLAYERS) Printf("Bad player number %s\n", argv[i]); else if (pNum != consoleplayer && pNums.Find(pNum) >= pNums.Size()) pNums.Push(pNum); @@ -3512,7 +3512,7 @@ CCMD(addsettingscontrollers) for (size_t i = 1u; i < (size_t)argv.argc(); ++i) { int cNum = -1; - if (!C_IsValidInt(argv[i], cNum) || cNum < 0 || cNum >= MAXPLAYERS) + if (!C_IsValidInt(argv[i], cNum) || cNum < 0 || cNum >= (int)MAXPLAYERS) Printf("Bad client number %s\n", argv[i]); else if (cNum != Net_Arbitrator && cNums.Find(cNum) >= cNums.Size()) cNums.Push(cNum); @@ -3539,7 +3539,7 @@ CCMD(removesettingscontrollers) for (size_t i = 1u; i < (size_t)argv.argc(); ++i) { int cNum = -1; - if (!C_IsValidInt(argv[i], cNum) || cNum < 0 || cNum >= MAXPLAYERS) + if (!C_IsValidInt(argv[i], cNum) || cNum < 0 || cNum >= (int)MAXPLAYERS) Printf("Bad player number %s\n", argv[i]); else if (cNum != Net_Arbitrator && cNums.Find(cNum) >= cNums.Size()) cNums.Push(cNum); diff --git a/src/g_game.cpp b/src/g_game.cpp index b0ac2ec21ee..04994474e3f 100644 --- a/src/g_game.cpp +++ b/src/g_game.cpp @@ -2907,7 +2907,7 @@ void G_DoPlayDemo (void) } size_t demolen = fr.GetLength(); demobuffer.Resize(demolen); - if (fr.Read(demobuffer.Data(), demolen) != demolen) + if (fr.Read(demobuffer.Data(), demolen) != (FileSys::FileReader::Size)demolen) { I_Error("Unable to read demo '%s'", defdemoname.GetChars()); } From 182c75801517c8f8505a51121c3f0496859d6442 Mon Sep 17 00:00:00 2001 From: SAN4EZDREAMS Date: Mon, 11 Aug 2025 13:26:36 +0300 Subject: [PATCH 04/10] [BUG] [GCC] warning: comparison of integer expressions 4 --- src/playsim/p_acs.cpp | 16 ++++++++-------- src/playsim/p_effect.cpp | 2 +- src/playsim/p_lnspec.cpp | 8 ++++---- 3 files changed, 13 insertions(+), 13 deletions(-) diff --git a/src/playsim/p_acs.cpp b/src/playsim/p_acs.cpp index 3ce65b755bd..27f1d4228de 100644 --- a/src/playsim/p_acs.cpp +++ b/src/playsim/p_acs.cpp @@ -4605,7 +4605,7 @@ int DLevelScript::GetPlayerInput(int playernum, int inputnum) } p = activator->player; } - else if (playernum >= MAXPLAYERS || !Level->PlayerInGame(playernum)) + else if (playernum >= (int)MAXPLAYERS || !Level->PlayerInGame(playernum)) { return 0; } @@ -5541,7 +5541,7 @@ int DLevelScript::CallFunction(int argCount, int funcIndex, int32_t *args, int & case ACSF_GetAirSupply: MIN_ARG_COUNT(1); { - if (args[0] < 0 || args[0] >= MAXPLAYERS || !Level->PlayerInGame(args[0])) + if (args[0] < 0 || args[0] >= (int)MAXPLAYERS || !Level->PlayerInGame(args[0])) { return 0; } @@ -5554,7 +5554,7 @@ int DLevelScript::CallFunction(int argCount, int funcIndex, int32_t *args, int & case ACSF_SetAirSupply: MIN_ARG_COUNT(2); { - if (args[0] < 0 || args[0] >= MAXPLAYERS || !Level->PlayerInGame(args[0])) + if (args[0] < 0 || args[0] >= (int)MAXPLAYERS || !Level->PlayerInGame(args[0])) { return 0; } @@ -5577,7 +5577,7 @@ int DLevelScript::CallFunction(int argCount, int funcIndex, int32_t *args, int & case ACSF_GetArmorType: MIN_ARG_COUNT(2); { - if (args[1] < 0 || args[1] >= MAXPLAYERS || !Level->PlayerInGame(args[1])) + if (args[1] < 0 || args[1] >= (int)MAXPLAYERS || !Level->PlayerInGame(args[1])) { return 0; } @@ -9865,7 +9865,7 @@ int DLevelScript::RunScript() break; case PCD_PLAYERINGAME: - if (STACK(1) < 0 || STACK(1) >= MAXPLAYERS) + if (STACK(1) < 0 || STACK(1) >= (int)MAXPLAYERS) { STACK(1) = false; } @@ -9876,7 +9876,7 @@ int DLevelScript::RunScript() break; case PCD_PLAYERISBOT: - if (STACK(1) < 0 || STACK(1) >= MAXPLAYERS || !Level->PlayerInGame(STACK(1))) + if (STACK(1) < 0 || STACK(1) >= (int)MAXPLAYERS || !Level->PlayerInGame(STACK(1))) { STACK(1) = false; } @@ -10075,7 +10075,7 @@ int DLevelScript::RunScript() break; case PCD_PLAYERCLASS: // [GRB] - if (STACK(1) < 0 || STACK(1) >= MAXPLAYERS || !Level->PlayerInGame(STACK(1))) + if (STACK(1) < 0 || STACK(1) >= (int)MAXPLAYERS || !Level->PlayerInGame(STACK(1))) { STACK(1) = -1; } @@ -10086,7 +10086,7 @@ int DLevelScript::RunScript() break; case PCD_GETPLAYERINFO: // [GRB] - if (STACK(2) < 0 || STACK(2) >= MAXPLAYERS || !Level->PlayerInGame(STACK(2))) + if (STACK(2) < 0 || STACK(2) >= (int)MAXPLAYERS || !Level->PlayerInGame(STACK(2))) { STACK(2) = -1; } diff --git a/src/playsim/p_effect.cpp b/src/playsim/p_effect.cpp index 5ad98215965..2da5df3032f 100644 --- a/src/playsim/p_effect.cpp +++ b/src/playsim/p_effect.cpp @@ -124,7 +124,7 @@ static void FreeParticle(FLevelLocals* Level, particle_t* particle) assert(next->tprev == pindex); next->tprev = particle->tprev; } - if (Level->OldestParticle == pindex) + if ((int)Level->OldestParticle == pindex) { assert(tnext == NO_PARTICLE); Level->OldestParticle = particle->tprev; diff --git a/src/playsim/p_lnspec.cpp b/src/playsim/p_lnspec.cpp index be85ba44ff3..74b84fae4c6 100644 --- a/src/playsim/p_lnspec.cpp +++ b/src/playsim/p_lnspec.cpp @@ -2857,7 +2857,7 @@ FUNC(LS_ChangeCamera) { int i; - for (i = 0; i < MAXPLAYERS; i++) + for (i = 0; i < (int)MAXPLAYERS; i++) { if (!Level->PlayerInGame(i)) continue; @@ -3007,7 +3007,7 @@ FUNC(LS_SetPlayerProperty) { int i; - for (i = 0; i < MAXPLAYERS; i++) + for (i = 0; i < (int)MAXPLAYERS; i++) { auto p = Level->Players[i]; if (!Level->PlayerInGame(i) || p->mo == nullptr) @@ -3122,7 +3122,7 @@ FUNC(LS_SetPlayerProperty) mask = CF_FROZEN | CF_TOTALLYFROZEN; } - for (i = 0; i < MAXPLAYERS; i++) + for (i = 0; i < (int)MAXPLAYERS; i++) { if (!Level->PlayerInGame(i)) continue; @@ -3363,7 +3363,7 @@ FUNC(LS_GlassBreak) { // Up stats and signal this mission is complete if (it == NULL) { - for (int i = 0; i < MAXPLAYERS; ++i) + for (int i = 0; i < (int)MAXPLAYERS; ++i) { if (Level->PlayerInGame(i)) { From c77b150ff4708c3c34d65d6227040d0f403c21ea Mon Sep 17 00:00:00 2001 From: SAN4EZDREAMS Date: Mon, 11 Aug 2025 17:26:16 +0300 Subject: [PATCH 05/10] [BUG] [GCC] warning: comparison of integer expressions 5 --- src/common/engine/i_net.cpp | 4 ++-- src/common/filesystem/source/files_decompress.cpp | 2 +- src/common/scripting/vm/vm.h | 4 ++-- src/common/widgets/netstartwindow.cpp | 2 +- src/gamedata/teaminfo.cpp | 2 +- src/playsim/p_mobj.cpp | 2 +- 6 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/common/engine/i_net.cpp b/src/common/engine/i_net.cpp index 46607b5ddb0..735e3c7e340 100644 --- a/src/common/engine/i_net.cpp +++ b/src/common/engine/i_net.cpp @@ -972,7 +972,7 @@ static bool HostGame(int arg, bool forcedNetMode) MaxClients = 2u; } - if (MaxClients > MAXPLAYERS) + if (MaxClients > (int)MAXPLAYERS) I_FatalError("Cannot host a game with %u players. The limit is currently %lu", MaxClients, MAXPLAYERS); GenerateGameID(); @@ -1029,7 +1029,7 @@ static bool HostGame(int arg, bool forcedNetMode) NetBuffer[1] = PRE_GO; NetBuffer[2] = NetMode; NetBufferLength = 3u; - for (size_t client = 1u; client < MaxClients; ++client) + for (size_t client = 1u; client < (size_t)MaxClients; ++client) { if (Connected[client].Status != CSTAT_NONE) SendPacket(Connected[client].Address); diff --git a/src/common/filesystem/source/files_decompress.cpp b/src/common/filesystem/source/files_decompress.cpp index 3f7dfb86598..a209d37a581 100644 --- a/src/common/filesystem/source/files_decompress.cpp +++ b/src/common/filesystem/source/files_decompress.cpp @@ -1018,7 +1018,7 @@ bool FCompressedBuffer::Decompress(char* destbuffer) FileReader frz; if (OpenDecompressor(frz, mr, mSize, mMethod)) { - return frz.Read(destbuffer, mSize) != mSize; + return frz.Read(destbuffer, mSize) != (FileSys::FileReader::Size)mSize; } } return false; diff --git a/src/common/scripting/vm/vm.h b/src/common/scripting/vm/vm.h index 1828799af31..b509e109926 100644 --- a/src/common/scripting/vm/vm.h +++ b/src/common/scripting/vm/vm.h @@ -738,7 +738,7 @@ typename VMReturnTypeTrait::type VMCallSingle(VMFunction* func, Args... VMValue params[argCount]; - for(int i = 0, j = 0; i < sizeof...(Args); i++) + for(size_t i = 0, j = 0; i < sizeof...(Args); i++) { for(int k = 0; k < arglist[i].count; k++, j++) { @@ -774,7 +774,7 @@ std::tuple::type...> VMCallMultiImpl(VMFunction VMValue params[argCount]; - for(int i = 0, j = 0; i < sizeof...(Args); i++) + for(size_t i = 0, j = 0; i < sizeof...(Args); i++) { for(int k = 0; k < arglist[i].count; k++, j++) { diff --git a/src/common/widgets/netstartwindow.cpp b/src/common/widgets/netstartwindow.cpp index c7ec55f332e..cb2a4af17bb 100644 --- a/src/common/widgets/netstartwindow.cpp +++ b/src/common/widgets/netstartwindow.cpp @@ -89,7 +89,7 @@ void NetStartWindow::NetProgress(int cur, int limit) Instance->maxpos = limit; Instance->SetProgress(cur); - for (size_t start = Instance->LobbyWindow->GetItemAmount(); start < Instance->maxpos; ++start) + for (size_t start = Instance->LobbyWindow->GetItemAmount(); start < (size_t)Instance->maxpos; ++start) Instance->LobbyWindow->AddItem(std::to_string(start)); } diff --git a/src/gamedata/teaminfo.cpp b/src/gamedata/teaminfo.cpp index 44e8c0e374c..2147ab9f720 100644 --- a/src/gamedata/teaminfo.cpp +++ b/src/gamedata/teaminfo.cpp @@ -258,7 +258,7 @@ bool FTeam::IsValid (unsigned int uiTeam) bool FTeam::ChangeTeam(unsigned int pNum, unsigned int newTeam) { - if (!multiplayer || !teamplay || pNum >= MAXPLAYERS || !playeringame[pNum] || !FTeam::IsValid(newTeam) || players[pNum].userinfo.GetTeam() == newTeam) + if (!multiplayer || !teamplay || pNum >= (int)MAXPLAYERS || !playeringame[pNum] || !FTeam::IsValid(newTeam) || players[pNum].userinfo.GetTeam() == newTeam) return false; players[pNum].userinfo.TeamChanged(newTeam); diff --git a/src/playsim/p_mobj.cpp b/src/playsim/p_mobj.cpp index 4e034ebff8d..d4bfca982b1 100644 --- a/src/playsim/p_mobj.cpp +++ b/src/playsim/p_mobj.cpp @@ -1374,7 +1374,7 @@ DEFINE_ACTION_FUNCTION(AActor, CheckLocalView) void AActor::DisableLocalRendering(const unsigned int pNum, const bool disable) { - if (pNum == consoleplayer) + if ((int)pNum == consoleplayer) NoLocalRender = disable; } From 7e6f1c5ae71591725246bcc208f858ad4fada0c4 Mon Sep 17 00:00:00 2001 From: SAN4EZDREAMS Date: Mon, 11 Aug 2025 17:49:48 +0300 Subject: [PATCH 06/10] [BUG] [GCC] warning: comparison of integer expressions 6 --- src/g_game.cpp | 2 +- src/gamedata/teaminfo.cpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/g_game.cpp b/src/g_game.cpp index 04994474e3f..a745716907c 100644 --- a/src/g_game.cpp +++ b/src/g_game.cpp @@ -1274,7 +1274,7 @@ void G_Ticker () // check for turbo cheats if (multiplayer && turbo > 100.f && cmd->forwardmove > TURBOTHRESHOLD && - !(gametic & 31) && ((gametic >> 5) & (MAXPLAYERS-1)) == client) + !(gametic & 31) && (int)((gametic >> 5) & (MAXPLAYERS-1)) == client) { Printf("%s is turbo!\n", players[client].userinfo.GetName()); } diff --git a/src/gamedata/teaminfo.cpp b/src/gamedata/teaminfo.cpp index 2147ab9f720..2a456fe9040 100644 --- a/src/gamedata/teaminfo.cpp +++ b/src/gamedata/teaminfo.cpp @@ -258,7 +258,7 @@ bool FTeam::IsValid (unsigned int uiTeam) bool FTeam::ChangeTeam(unsigned int pNum, unsigned int newTeam) { - if (!multiplayer || !teamplay || pNum >= (int)MAXPLAYERS || !playeringame[pNum] || !FTeam::IsValid(newTeam) || players[pNum].userinfo.GetTeam() == newTeam) + if (!multiplayer || !teamplay || pNum >= (int)MAXPLAYERS || !playeringame[pNum] || !FTeam::IsValid(newTeam) || players[pNum].userinfo.GetTeam() == (int)newTeam) return false; players[pNum].userinfo.TeamChanged(newTeam); From 0dce7522cbf859bd4c5548008325b6ce34f41658 Mon Sep 17 00:00:00 2001 From: SAN4EZDREAMS Date: Mon, 18 Aug 2025 14:01:45 +0300 Subject: [PATCH 07/10] [BUG] [GCC] warning: comparison of integer expressions 7 --- src/am_map.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/am_map.cpp b/src/am_map.cpp index 49b9fc5b930..f69e60a9ea8 100644 --- a/src/am_map.cpp +++ b/src/am_map.cpp @@ -2844,7 +2844,7 @@ void DAutomap::drawPlayers () return; } - for (i = 0; i < MAXPLAYERS; i++) + for (unsigned int i = 0; i < MAXPLAYERS; i++) { player_t *p = &players[i]; AMColor color; From 2890a36f87680599333c5b81a34d0b22b840787f Mon Sep 17 00:00:00 2001 From: SAN4EZDREAMS Date: Mon, 18 Aug 2025 15:07:47 +0300 Subject: [PATCH 08/10] [BUG] [GCC] warning: comparison of integer expressions 8 --- src/d_net.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/d_net.cpp b/src/d_net.cpp index d9830c5aae1..4ab3f3822ed 100644 --- a/src/d_net.cpp +++ b/src/d_net.cpp @@ -3301,7 +3301,7 @@ CCMD(kick) for (size_t i = 1u; i < (size_t)argv.argc(); ++i) { int cNum = -1; - if (!C_IsValidInt(argv[i], cNum) || cNum < 0 || cNum >= (int)MAXPLAYERS) + if (!C_IsValidInt(argv[i], cNum) || cNum < 0 || (unsigned int)cNum >= MAXPLAYERS) Printf("Bad client number %s\n", argv[i]); else if (cNum != consoleplayer && cNums.Find(cNum) >= cNums.Size()) cNums.Push(cNum); @@ -3512,7 +3512,7 @@ CCMD(addsettingscontrollers) for (size_t i = 1u; i < (size_t)argv.argc(); ++i) { int cNum = -1; - if (!C_IsValidInt(argv[i], cNum) || cNum < 0 || cNum >= (int)MAXPLAYERS) + if (!C_IsValidInt(argv[i], cNum) || cNum < 0 || (unsigned int)cNum >= MAXPLAYERS) Printf("Bad client number %s\n", argv[i]); else if (cNum != Net_Arbitrator && cNums.Find(cNum) >= cNums.Size()) cNums.Push(cNum); @@ -3539,7 +3539,7 @@ CCMD(removesettingscontrollers) for (size_t i = 1u; i < (size_t)argv.argc(); ++i) { int cNum = -1; - if (!C_IsValidInt(argv[i], cNum) || cNum < 0 || cNum >= (int)MAXPLAYERS) + if (!C_IsValidInt(argv[i], cNum) || cNum < 0 || (unsigned int)cNum >= MAXPLAYERS) Printf("Bad player number %s\n", argv[i]); else if (cNum != Net_Arbitrator && cNums.Find(cNum) >= cNums.Size()) cNums.Push(cNum); From 2d7b7b83239d3be5cdcda686c2390cfe1b43aca4 Mon Sep 17 00:00:00 2001 From: SAN4EZDREAMS Date: Mon, 18 Aug 2025 15:15:43 +0300 Subject: [PATCH 09/10] [BUG] [GCC] warning: comparison of integer expressions 9 --- src/d_netinfo.cpp | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/src/d_netinfo.cpp b/src/d_netinfo.cpp index cd8936b6248..856b289551b 100644 --- a/src/d_netinfo.cpp +++ b/src/d_netinfo.cpp @@ -750,7 +750,7 @@ static int namesortfunc(const void *a, const void *b) FString D_GetUserInfoStrings(int pnum, bool compact) { FString result; - if (pnum >= 0 && pnum < (int)MAXPLAYERS) + if (pnum >= 0 && (unsigned int)pnum < MAXPLAYERS) { userinfo_t* info = &players[pnum].userinfo; TArray::Pair*> userinfo_pairs(info->CountUsed()); @@ -838,7 +838,7 @@ void D_ReadUserInfoStrings (int pnum, TArrayView& stream, bool update) qsort(&compact_names[0], compact_names.Size(), sizeof(FName), namesortfunc); } - if (pnum < (int)MAXPLAYERS) + if (pnum >= 0 && (unsigned int)pnum < MAXPLAYERS) { for (breakpt = ptr; breakpt != NULL; ptr = breakpt + 1) { @@ -1055,7 +1055,7 @@ CCMD(playerinfo) { i = consoleplayer; } - else if (!C_IsValidInt(argv[1], i) || i < 0 || i >= (int)MAXPLAYERS) + else if (!C_IsValidInt(argv[1], i) || i < 0 || (unsigned int)i >= MAXPLAYERS) { Printf("Bad player number %s\n", argv[1]); return; From a2c667855d1899f8bc6f891820841fe44817f69c Mon Sep 17 00:00:00 2001 From: SAN4EZDREAMS Date: Mon, 18 Aug 2025 15:46:29 +0300 Subject: [PATCH 10/10] [BUG] [GCC] warning: comparison of integer expressions 10 --- src/d_net.cpp | 2 +- src/gamedata/teaminfo.cpp | 2 +- src/playsim/p_lnspec.cpp | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/src/d_net.cpp b/src/d_net.cpp index 4ab3f3822ed..1ecb4ddc2c0 100644 --- a/src/d_net.cpp +++ b/src/d_net.cpp @@ -3367,7 +3367,7 @@ CCMD(muteall) return; } - for (int i = 0; i < (int)MAXPLAYERS; ++i) + for (unsigned int i = 0; i < MAXPLAYERS; ++i) { if (playeringame[i] && i != consoleplayer) MutedClients |= (uint64_t)1u << i; diff --git a/src/gamedata/teaminfo.cpp b/src/gamedata/teaminfo.cpp index 2a456fe9040..5724cbdbc76 100644 --- a/src/gamedata/teaminfo.cpp +++ b/src/gamedata/teaminfo.cpp @@ -258,7 +258,7 @@ bool FTeam::IsValid (unsigned int uiTeam) bool FTeam::ChangeTeam(unsigned int pNum, unsigned int newTeam) { - if (!multiplayer || !teamplay || pNum >= (int)MAXPLAYERS || !playeringame[pNum] || !FTeam::IsValid(newTeam) || players[pNum].userinfo.GetTeam() == (int)newTeam) + if (!multiplayer || !teamplay || pNum >= MAXPLAYERS || !playeringame[pNum] || !FTeam::IsValid(newTeam) || players[pNum].userinfo.GetTeam() == (int)newTeam) return false; players[pNum].userinfo.TeamChanged(newTeam); diff --git a/src/playsim/p_lnspec.cpp b/src/playsim/p_lnspec.cpp index 74b84fae4c6..cda7d46d9d5 100644 --- a/src/playsim/p_lnspec.cpp +++ b/src/playsim/p_lnspec.cpp @@ -3363,7 +3363,7 @@ FUNC(LS_GlassBreak) { // Up stats and signal this mission is complete if (it == NULL) { - for (int i = 0; i < (int)MAXPLAYERS; ++i) + for (unsigned int i = 0; i < MAXPLAYERS; ++i) { if (Level->PlayerInGame(i)) {