aboutsummaryrefslogtreecommitdiffstats
path: root/core/logging.cpp
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2021-10-03 08:02:57 -0700
committerChris Robinson <[email protected]>2021-10-03 08:02:57 -0700
commitf92cc479d82fbf85591d8918bbf469c4b329c31c (patch)
treef18d486b88aa274cd172496c133e6a82c1033dbb /core/logging.cpp
parent53d9033ec70019353dfa255b63cbe9eb21c70888 (diff)
Silence some static analysis warnings
Diffstat (limited to 'core/logging.cpp')
-rw-r--r--core/logging.cpp12
1 files changed, 6 insertions, 6 deletions
diff --git a/core/logging.cpp b/core/logging.cpp
index dd7f53c7..b06fb35a 100644
--- a/core/logging.cpp
+++ b/core/logging.cpp
@@ -25,12 +25,12 @@ void al_print(LogLevel level, FILE *logfile, const char *fmt, ...)
std::va_list args, args2;
va_start(args, fmt);
va_copy(args2, args);
- int msglen{std::vsnprintf(str, sizeof(stcmsg), fmt, args)};
- if UNLIKELY(msglen >= 0 && static_cast<size_t>(msglen) >= sizeof(stcmsg))
+ const int msglen{std::vsnprintf(str, sizeof(stcmsg), fmt, args)};
+ if(unlikely(msglen >= 0 && static_cast<size_t>(msglen) >= sizeof(stcmsg)))
{
dynmsg.resize(static_cast<size_t>(msglen) + 1u);
str = dynmsg.data();
- msglen = std::vsnprintf(str, dynmsg.size(), fmt, args2);
+ std::vsnprintf(str, dynmsg.size(), fmt, args2);
}
va_end(args2);
va_end(args);
@@ -59,12 +59,12 @@ void al_print(LogLevel level, FILE *logfile, const char *fmt, ...)
std::va_list args, args2;
va_start(args, fmt);
va_copy(args2, args);
- int msglen{std::vsnprintf(str, sizeof(stcmsg), fmt, args)};
- if UNLIKELY(msglen >= 0 && static_cast<size_t>(msglen) >= sizeof(stcmsg))
+ const int msglen{std::vsnprintf(str, sizeof(stcmsg), fmt, args)};
+ if(unlikely(msglen >= 0 && static_cast<size_t>(msglen) >= sizeof(stcmsg)))
{
dynmsg.resize(static_cast<size_t>(msglen) + 1u);
str = dynmsg.data();
- msglen = std::vsnprintf(str, dynmsg.size(), fmt, args2);
+ std::vsnprintf(str, dynmsg.size(), fmt, args2);
}
va_end(args2);
va_end(args);