mirror of
https://github.com/gabime/spdlog.git
synced 2025-09-30 10:29:02 +08:00
Fixed some msvc code analysis warnings
This commit is contained in:
@@ -40,7 +40,8 @@ struct async_factory_impl
|
||||
auto ®istry_inst = details::registry::instance();
|
||||
|
||||
// create global thread pool if not already exists..
|
||||
std::lock_guard<std::recursive_mutex> tp_lock(registry_inst.tp_mutex());
|
||||
auto& mutex = registry_inst.tp_mutex();
|
||||
std::lock_guard<std::recursive_mutex> tp_lock(mutex);
|
||||
auto tp = registry_inst.get_tp();
|
||||
if (tp == nullptr)
|
||||
{
|
||||
|
@@ -1259,10 +1259,10 @@ SPDLOG_INLINE details::padding_info pattern_formatter::handle_padspec_(std::stri
|
||||
return padding_info{0, side};
|
||||
}
|
||||
|
||||
auto width = static_cast<size_t>(*it - '0');
|
||||
auto width = static_cast<size_t>(*it) - '0';
|
||||
for (++it; it != end && std::isdigit(static_cast<unsigned char>(*it)); ++it)
|
||||
{
|
||||
auto digit = static_cast<size_t>(*it - '0');
|
||||
auto digit = static_cast<size_t>(*it) - '0';
|
||||
width = width * 10 + digit;
|
||||
}
|
||||
return details::padding_info{std::min<size_t>(width, max_width), side};
|
||||
|
@@ -31,16 +31,20 @@ enum class async_msg_type
|
||||
// Movable only. should never be copied
|
||||
struct async_msg
|
||||
{
|
||||
async_msg_type msg_type;
|
||||
level::level_enum level;
|
||||
async_msg_type msg_type;
|
||||
level::level_enum level;
|
||||
log_clock::time_point time;
|
||||
size_t thread_id;
|
||||
size_t thread_id;
|
||||
fmt::basic_memory_buffer<char, 176> raw;
|
||||
|
||||
source_loc source;
|
||||
async_logger_ptr worker_ptr;
|
||||
|
||||
async_msg() = default;
|
||||
async_msg()
|
||||
:msg_type(async_msg_type::log),
|
||||
level(level::info),
|
||||
thread_id(0)
|
||||
{}
|
||||
~async_msg() = default;
|
||||
|
||||
// should only be moved in or out of the queue..
|
||||
@@ -48,7 +52,7 @@ struct async_msg
|
||||
|
||||
// support for vs2013 move
|
||||
#if defined(_MSC_VER) && _MSC_VER <= 1800
|
||||
async_msg(async_msg &&other) SPDLOG_NOEXCEPT : msg_type(other.msg_type),
|
||||
async_msg(async_msg &&other) : msg_type(other.msg_type),
|
||||
level(other.level),
|
||||
time(other.time),
|
||||
thread_id(other.thread_id),
|
||||
@@ -58,7 +62,7 @@ struct async_msg
|
||||
worker_ptr(std::move(other.worker_ptr))
|
||||
{}
|
||||
|
||||
async_msg &operator=(async_msg &&other) SPDLOG_NOEXCEPT
|
||||
async_msg &operator=(async_msg &&other)
|
||||
{
|
||||
msg_type = other.msg_type;
|
||||
level = other.level;
|
||||
|
Reference in New Issue
Block a user