From 637f0b04f9daebcb5d33ac85105268ce8a1ee94c Mon Sep 17 00:00:00 2001 From: Christian Panov Date: Fri, 8 Nov 2024 13:06:11 +0200 Subject: [PATCH] Fixed static analysis issues --- lwlog/src/details/os/time_point_impl.h | 4 ++-- lwlog/src/policy/log_policy_impl.h | 5 +---- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/lwlog/src/details/os/time_point_impl.h b/lwlog/src/details/os/time_point_impl.h index b931dd2..6701c7e 100644 --- a/lwlog/src/details/os/time_point_impl.h +++ b/lwlog/src/details/os/time_point_impl.h @@ -21,7 +21,7 @@ namespace lwlog::details::os minute = m_now.wMinute; second = m_now.wSecond; - hour = datetime::handle_timezone(m_now.wHour); + hour = datetime::handle_timezone(static_cast(m_now.wHour)); ::FILETIME now_ft; ::GetSystemTimePreciseAsFileTime(&now_ft); @@ -51,7 +51,7 @@ namespace lwlog::details::os minute = static_cast(details.tm_min); second = static_cast(details.tm_sec); - hour = datetime::handle_timezone(details.tm_hour); + hour = datetime::handle_timezone(static_cast(details.tm_hour)); const auto nanoseconds_since_unix_epoch{ std::chrono::duration_cast(m_now.time_since_epoch()).count() }; diff --git a/lwlog/src/policy/log_policy_impl.h b/lwlog/src/policy/log_policy_impl.h index e70d047..be6212e 100644 --- a/lwlog/src/policy/log_policy_impl.h +++ b/lwlog/src/policy/log_policy_impl.h @@ -37,11 +37,8 @@ namespace lwlog backend.shutdown.store(false, std::memory_order_relaxed); backend.worker_thread = std::thread([&backend]() { - while (true) + while (!backend.shutdown.load(std::memory_order_relaxed) || !backend.queue.is_empty()) { - if (backend.shutdown.load(std::memory_order_relaxed) - && backend.queue.is_empty()) break; - if (!backend.queue.is_empty()) { const auto& item{ backend.queue.dequeue() };