From b0059b290f3b6e0697c2a207096b8a48e7e16832 Mon Sep 17 00:00:00 2001 From: gabime Date: Fri, 20 Jul 2018 23:26:52 +0300 Subject: [PATCH] Fix issue #761 --- include/spdlog/details/fmt_helper.h | 12 ++++----- include/spdlog/details/thread_pool.h | 37 ++++++++++++++-------------- 2 files changed, 25 insertions(+), 24 deletions(-) diff --git a/include/spdlog/details/fmt_helper.h b/include/spdlog/details/fmt_helper.h index 05a41526..1997c35d 100644 --- a/include/spdlog/details/fmt_helper.h +++ b/include/spdlog/details/fmt_helper.h @@ -51,14 +51,14 @@ inline void pad2(int n, fmt::basic_memory_buffer &dest) } if (n > 9) // 10-99 { - dest.push_back('0' + (n / 10)); - dest.push_back('0' + (n % 10)); + dest.push_back('0' + static_cast(n / 10)); + dest.push_back('0' + static_cast(n % 10)); return; } if (n >= 0) // 0-9 { dest.push_back('0'); - dest.push_back('0' + n); + dest.push_back('0' + static_cast(n)); return; } // negatives (unlikely, but just in case, let fmt deal with it) @@ -76,15 +76,15 @@ inline void pad3(int n, fmt::basic_memory_buffer &dest) if (n > 9) // 10-99 { dest.push_back('0'); - dest.push_back('0' + n / 10); - dest.push_back('0' + n % 10); + dest.push_back('0' + static_cast(n / 10)); + dest.push_back('0' + static_cast(n % 10)); return; } if (n >= 0) { dest.push_back('0'); dest.push_back('0'); - dest.push_back('0' + n); + dest.push_back('0' + static_cast(n)); return; } // negatives (unlikely, but just in case let fmt deal with it) diff --git a/include/spdlog/details/thread_pool.h b/include/spdlog/details/thread_pool.h index 4fee130c..e49e3d7a 100644 --- a/include/spdlog/details/thread_pool.h +++ b/include/spdlog/details/thread_pool.h @@ -175,7 +175,9 @@ private: void worker_loop_() { - while (process_next_msg_()) {}; + while (process_next_msg_()) + { + }; } // process next message in the queue @@ -191,26 +193,25 @@ private: switch (incoming_async_msg.msg_type) { - case async_msg_type::flush: - { - incoming_async_msg.worker_ptr->backend_flush_(); - return true; - } + case async_msg_type::flush: + { + incoming_async_msg.worker_ptr->backend_flush_(); + return true; + } - case async_msg_type::terminate: - { - return false; - } + case async_msg_type::terminate: + { + return false; + } - default: - { - log_msg msg; - incoming_async_msg.to_log_msg(msg); - incoming_async_msg.worker_ptr->backend_log_(msg); - return true; + default: + { + log_msg msg; + incoming_async_msg.to_log_msg(msg); + incoming_async_msg.worker_ptr->backend_log_(msg); + return true; + } } - } - assert(false); return true; // should not be reached } };