From 7cf122fc2a604bae77d0b935536c41ec9203e62d Mon Sep 17 00:00:00 2001 From: Giacomo Pozzoni Date: Fri, 31 Jul 2020 20:53:13 +0000 Subject: Core/Misc: Fix static analysis issues (#25178) --- src/common/Logging/Log.cpp | 7 ++++--- src/common/Logging/Log.h | 2 +- 2 files changed, 5 insertions(+), 4 deletions(-) (limited to 'src/common/Logging') diff --git a/src/common/Logging/Log.cpp b/src/common/Logging/Log.cpp index 13720c4ba41..436f0366064 100644 --- a/src/common/Logging/Log.cpp +++ b/src/common/Logging/Log.cpp @@ -270,12 +270,13 @@ std::string Log::GetTimestampStr() aTm.tm_year + 1900, aTm.tm_mon + 1, aTm.tm_mday, aTm.tm_hour, aTm.tm_min, aTm.tm_sec); } -bool Log::SetLogLevel(std::string const& name, char const* newLevelc, bool isLogger /* = true */) +bool Log::SetLogLevel(std::string const& name, int32 newLeveli, bool isLogger /* = true */) { - LogLevel newLevel = LogLevel(atoi(newLevelc)); - if (newLevel < 0) + if (newLeveli < 0) return false; + LogLevel newLevel = LogLevel(newLeveli); + if (isLogger) { auto it = loggers.begin(); diff --git a/src/common/Logging/Log.h b/src/common/Logging/Log.h index 86ef98cb569..44d0db4f607 100644 --- a/src/common/Logging/Log.h +++ b/src/common/Logging/Log.h @@ -69,7 +69,7 @@ class TC_COMMON_API Log void LoadFromConfig(); void Close(); bool ShouldLog(std::string const& type, LogLevel level) const; - bool SetLogLevel(std::string const& name, char const* level, bool isLogger = true); + bool SetLogLevel(std::string const& name, int32 level, bool isLogger = true); template inline void outMessage(std::string const& filter, LogLevel const level, Format&& fmt, Args&&... args) -- cgit v1.2.3