From f908e4a182423e4ba25bae3f068e7cd6a8f45688 Mon Sep 17 00:00:00 2001 From: Chairn Date: Wed, 29 Jun 2022 21:28:27 +0200 Subject: [PATCH 1/2] Updated french language --- data/languages/french.txt | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/data/languages/french.txt b/data/languages/french.txt index a149bc16b..ebd8348cc 100644 --- a/data/languages/french.txt +++ b/data/languages/french.txt @@ -1038,7 +1038,7 @@ AntiPing == AntiPing Enable long pain sound (used when shooting in freeze) -== Activer les sons de douleur du Tee (utilisé lorsqu'un Tee tire depuis le freeze (gèle)) +== Activer les sons de douleur du Tee (utilisé lorsqu'un Tee tire depuis le freeze (gel)) 9+ new mentions == 9+ nouveaux messages @@ -1461,13 +1461,13 @@ UI mouse sens. == Sensibilité souris (menus) Controller -== Manette +== Manette Show dummy actions == Afficher les actions du dummy Show freeze bars -== Afficher la barre de gel +== Afficher la barre de gel Show player position == Afficher la position @@ -1479,16 +1479,16 @@ Show player target angle == Afficher l'angle de visée Show jump indicator -== +== Indicateur de sauts Opacity of freeze bars inside freeze -== +== Opacité de la barre de gel dans le gel Normal Color -== +== Couleur normal Highlight Color -== +== Couleur surbrillante Extras -== +== Extras From 96e9364fb0b1d27380d25a51e453cfadfdda4fac Mon Sep 17 00:00:00 2001 From: Chairn Date: Wed, 29 Jun 2022 23:46:28 +0200 Subject: [PATCH 2/2] Fix more unsafe define --- src/base/hash_libtomcrypt.cpp | 13 ++++++----- src/engine/client/client.cpp | 1 + src/engine/shared/config.cpp | 4 ++-- src/engine/shared/huffman.cpp | 36 +++++++++++++++++------------ src/game/client/components/chat.cpp | 1 + src/game/gamecore.h | 2 +- src/game/mapbugs.cpp | 2 +- src/game/server/ddracechat.cpp | 22 +++++++++--------- 8 files changed, 45 insertions(+), 36 deletions(-) diff --git a/src/base/hash_libtomcrypt.cpp b/src/base/hash_libtomcrypt.cpp index 7cd7456ad..165422cd7 100644 --- a/src/base/hash_libtomcrypt.cpp +++ b/src/base/hash_libtomcrypt.cpp @@ -63,7 +63,7 @@ static u32 Gamma1(u32 x) { return Rot(x, 17) ^ Rot(x, 19) ^ Sh(x, 10); } static void sha_compress(sha256_state *md, const unsigned char *buf) { - u32 S[8], W[64], t0, t1, t; + u32 S[8], W[64], t; int i; // Copy state into S @@ -80,12 +80,13 @@ static void sha_compress(sha256_state *md, const unsigned char *buf) // Compress #define RND(a, b, c, d, e, f, g, h, i) \ + do \ { \ - t0 = h + Sigma1(e) + Ch(e, f, g) + K[i] + W[i]; \ - t1 = Sigma0(a) + Maj(a, b, c); \ - d += t0; \ - h = t0 + t1; \ - } + u32 t0 = (h) + Sigma1(e) + Ch(e, f, g) + K[i] + W[i]; \ + u32 t1 = Sigma0(a) + Maj(a, b, c); \ + (d) += t0; \ + (h) = t0 + t1; \ + } while(0) for(i = 0; i < 64; ++i) { diff --git a/src/engine/client/client.cpp b/src/engine/client/client.cpp index 76eb2d99a..fd8c0e41c 100644 --- a/src/engine/client/client.cpp +++ b/src/engine/client/client.cpp @@ -4406,6 +4406,7 @@ void CClient::RegisterCommands() #define CONSOLE_COMMAND(name, params, flags, callback, userdata, help) m_pConsole->Register(name, params, flags, 0, 0, help); #include +#undef CONSOLE_COMMAND } static CClient *CreateClient() diff --git a/src/engine/shared/config.cpp b/src/engine/shared/config.cpp index 48301a23f..027e79cf4 100644 --- a/src/engine/shared/config.cpp +++ b/src/engine/shared/config.cpp @@ -82,13 +82,13 @@ bool CConfigManager::Save() char aEscapeBuf[1024 * 2]; #define MACRO_CONFIG_INT(Name, ScriptName, def, min, max, flags, desc) \ - if((flags)&CFGFLAG_SAVE && g_Config.m_##Name != def) \ + if((flags)&CFGFLAG_SAVE && g_Config.m_##Name != (def)) \ { \ str_format(aLineBuf, sizeof(aLineBuf), "%s %i", #ScriptName, g_Config.m_##Name); \ WriteLine(aLineBuf); \ } #define MACRO_CONFIG_COL(Name, ScriptName, def, flags, desc) \ - if((flags)&CFGFLAG_SAVE && g_Config.m_##Name != def) \ + if((flags)&CFGFLAG_SAVE && g_Config.m_##Name != (def)) \ { \ str_format(aLineBuf, sizeof(aLineBuf), "%s %u", #ScriptName, g_Config.m_##Name); \ WriteLine(aLineBuf); \ diff --git a/src/engine/shared/huffman.cpp b/src/engine/shared/huffman.cpp index 47d9c3f6a..d25ae2b74 100644 --- a/src/engine/shared/huffman.cpp +++ b/src/engine/shared/huffman.cpp @@ -132,19 +132,25 @@ int CHuffman::Compress(const void *pInput, int InputSize, void *pOutput, int Out { // this macro loads a symbol for a byte into bits and bitcount #define HUFFMAN_MACRO_LOADSYMBOL(Sym) \ - Bits |= m_aNodes[Sym].m_Bits << Bitcount; \ - Bitcount += m_aNodes[Sym].m_NumBits; + do \ + { \ + Bits |= m_aNodes[Sym].m_Bits << Bitcount; \ + Bitcount += m_aNodes[Sym].m_NumBits; \ + } while(0) // this macro writes the symbol stored in bits and bitcount to the dst pointer #define HUFFMAN_MACRO_WRITE() \ - while(Bitcount >= 8) \ + do \ { \ - *pDst++ = (unsigned char)(Bits & 0xff); \ - if(pDst == pDstEnd) \ - return -1; \ - Bits >>= 8; \ - Bitcount -= 8; \ - } + while(Bitcount >= 8) \ + { \ + *pDst++ = (unsigned char)(Bits & 0xff); \ + if(pDst == pDstEnd) \ + return -1; \ + Bits >>= 8; \ + Bitcount -= 8; \ + } \ + } while(0) // setup buffer pointers const unsigned char *pSrc = (const unsigned char *)pInput; @@ -165,23 +171,23 @@ int CHuffman::Compress(const void *pInput, int InputSize, void *pOutput, int Out while(pSrc != pSrcEnd) { // {B} load the symbol - HUFFMAN_MACRO_LOADSYMBOL(Symbol) + HUFFMAN_MACRO_LOADSYMBOL(Symbol); // {C} fetch next symbol, this is done here because it will reduce dependency in the code Symbol = *pSrc++; // {B} write the symbol loaded at - HUFFMAN_MACRO_WRITE() + HUFFMAN_MACRO_WRITE(); } // write the last symbol loaded from {C} or {A} in the case of only 1 byte input buffer - HUFFMAN_MACRO_LOADSYMBOL(Symbol) - HUFFMAN_MACRO_WRITE() + HUFFMAN_MACRO_LOADSYMBOL(Symbol); + HUFFMAN_MACRO_WRITE(); } // write EOF symbol - HUFFMAN_MACRO_LOADSYMBOL(HUFFMAN_EOF_SYMBOL) - HUFFMAN_MACRO_WRITE() + HUFFMAN_MACRO_LOADSYMBOL(HUFFMAN_EOF_SYMBOL); + HUFFMAN_MACRO_WRITE(); // write out the last bits *pDst++ = Bits; diff --git a/src/game/client/components/chat.cpp b/src/game/client/components/chat.cpp index 3770fd71d..8d3da304f 100644 --- a/src/game/client/components/chat.cpp +++ b/src/game/client/components/chat.cpp @@ -32,6 +32,7 @@ CChat::CChat() #define CHAT_COMMAND(name, params, flags, callback, userdata, help) RegisterCommand(name, params, flags, help); #include +#undef CHAT_COMMAND std::sort(m_vCommands.begin(), m_vCommands.end()); m_Mode = MODE_NONE; diff --git a/src/game/gamecore.h b/src/game/gamecore.h index 661020d04..087071c08 100644 --- a/src/game/gamecore.h +++ b/src/game/gamecore.h @@ -44,7 +44,7 @@ public: CTuningParams() { const float TicksPerSecond = 50.0f; -#define MACRO_TUNING_PARAM(Name, ScriptName, Value, Description) m_##Name.Set((int)(Value * 100.0f)); +#define MACRO_TUNING_PARAM(Name, ScriptName, Value, Description) m_##Name.Set((int)((Value)*100.0f)); #include "tuning.h" #undef MACRO_TUNING_PARAM } diff --git a/src/game/mapbugs.cpp b/src/game/mapbugs.cpp index 1cf55bbfe..3e9aee8b9 100644 --- a/src/game/mapbugs.cpp +++ b/src/game/mapbugs.cpp @@ -78,7 +78,7 @@ int CMapBugs::Update(const char *pBug) int Bug = -1; if(false) {} // NOLINT(readability-simplify-boolean-expr) #define MAPBUG(constname, string) \ - else if(str_comp(pBug, string) == 0) { Bug = constname; } + else if(str_comp(pBug, string) == 0) { Bug = (constname); } #include "mapbugs_list.h" #undef MAPBUG if(Bug == -1) diff --git a/src/game/server/ddracechat.cpp b/src/game/server/ddracechat.cpp index f8a1f14c9..3f8412a5c 100644 --- a/src/game/server/ddracechat.cpp +++ b/src/game/server/ddracechat.cpp @@ -256,18 +256,18 @@ void CGameContext::ConRules(IConsole::IResult *pResult, void *pUserData) "Be nice."); Printed = true; } -#define _RL(n) g_Config.m_SvRulesLine##n +#define GET_SERVER_RULE_LINE(n) g_Config.m_SvRulesLine##n char *pRuleLines[] = { - _RL(1), - _RL(2), - _RL(3), - _RL(4), - _RL(5), - _RL(6), - _RL(7), - _RL(8), - _RL(9), - _RL(10), + GET_SERVER_RULE_LINE(1), + GET_SERVER_RULE_LINE(2), + GET_SERVER_RULE_LINE(3), + GET_SERVER_RULE_LINE(4), + GET_SERVER_RULE_LINE(5), + GET_SERVER_RULE_LINE(6), + GET_SERVER_RULE_LINE(7), + GET_SERVER_RULE_LINE(8), + GET_SERVER_RULE_LINE(9), + GET_SERVER_RULE_LINE(10), }; for(auto &pRuleLine : pRuleLines) {