From 21a383a20e7c0cb791631ed121f0e1230327b40f Mon Sep 17 00:00:00 2001 From: Kawe Mazidjatari <48657826+Mauler125@users.noreply.github.com> Date: Mon, 19 Feb 2024 20:46:08 +0100 Subject: [PATCH] Tier1: light cleanup on low level types CCommand: use 'V_isdigit()' since that is faster, we don't need it to be locale aware. CMemoryStack: move 'highest' var to string format directly to avoid compile warnings (unused loval variables) on more recent visual studio compilers when compiling the DLL in cert mode. --- src/tier1/cmd.cpp | 6 +++--- src/tier1/memstack.cpp | 3 +-- 2 files changed, 4 insertions(+), 5 deletions(-) diff --git a/src/tier1/cmd.cpp b/src/tier1/cmd.cpp index 36f1895b..2da0c997 100644 --- a/src/tier1/cmd.cpp +++ b/src/tier1/cmd.cpp @@ -119,7 +119,7 @@ bool CCommand::Tokenize(const char* pCommand, cmd_source_t source, characterset_ size_t nLen = Q_strlen(pCommand); if (nLen >= COMMAND_MAX_LENGTH - 1) { - Warning(eDLL_T::COMMON, "%s: Encountered command which overflows the tokenizer buffer... Skipping!\n", __FUNCTION__); + Warning(eDLL_T::COMMON, "%s: Encountered command which overflows the tokenizer buffer... Skipped!\n", __FUNCTION__); return false; } @@ -175,7 +175,7 @@ bool CCommand::Tokenize(const char* pCommand, cmd_source_t source, characterset_ if (m_nArgc >= COMMAND_MAX_ARGC) { - Warning(eDLL_T::COMMON, "%s: Encountered command which overflows the argument buffer.. Clamped!\n", __FUNCTION__); + Warning(eDLL_T::COMMON, "%s: Encountered command which overflows the argument buffer... Clamped!\n", __FUNCTION__); } nArgvBufferSize += nSize + 1; @@ -195,7 +195,7 @@ bool CCommand::HasOnlyDigits(int nIndex) const for (size_t i = 0; source[i] != '\0'; i++) { - if (!isdigit(source[i])) + if (!V_isdigit(source[i])) { return false; } diff --git a/src/tier1/memstack.cpp b/src/tier1/memstack.cpp index 8a885dd9..8d04dd65 100644 --- a/src/tier1/memstack.cpp +++ b/src/tier1/memstack.cpp @@ -476,7 +476,6 @@ void CMemoryStack::PrintContents() const return; } - const size_t highest = m_pHighestAllocLimit - m_pBase; MEMORY_BASIC_INFORMATION info; char moduleName[260]; strcpy( moduleName, "unknown module" ); @@ -491,5 +490,5 @@ void CMemoryStack::PrintContents() const DevMsg( eDLL_T::COMMON, "CMemoryStack %s in %s\n", m_pszAllocOwner, moduleName ); DevMsg( eDLL_T::COMMON, " Total used memory: %zu KB\n", GetUsed() / 1024 ); DevMsg( eDLL_T::COMMON, " Total committed memory: %zu KB\n", GetSize() / 1024 ); - DevMsg( eDLL_T::COMMON, " Max committed memory: %zu KB out of %zu KB\n", highest / 1024, GetMaxSize() / 1024 ); + DevMsg( eDLL_T::COMMON, " Max committed memory: %zu KB out of %zu KB\n", (m_pHighestAllocLimit - m_pBase) / 1024, GetMaxSize() / 1024 ); }