From dbb1ab70e5a4d569c28f22563eaf2f07efbe8567 Mon Sep 17 00:00:00 2001 From: Vasily Date: Thu, 21 Feb 2019 16:32:54 +0100 Subject: [PATCH] Clarify cast in easylogging++ `tval.tv_usec` is a (signed) `long` and `ssPrec->m_offset` is an `unsigned int`. Clang warns upon realizing that we are attempting to divide a signed `long` with an `unsigned int`. Casting the `long` to `unsigned long` makes both operands `unsigned` and allows for auto conversion to `size_t`. The `size_t` cast is to make it apparent that the cast is correct. --- third-party/easylogging++/easylogging++.cc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/third-party/easylogging++/easylogging++.cc b/third-party/easylogging++/easylogging++.cc index f876396..16ceda2 100644 --- a/third-party/easylogging++/easylogging++.cc +++ b/third-party/easylogging++/easylogging++.cc @@ -1190,7 +1190,7 @@ std::string DateTime::timevalToString(struct timeval tval, const char* format, buildTimeInfo(&tval, &timeInfo); const int kBuffSize = 30; char buff_[kBuffSize] = ""; - parseFormat(buff_, kBuffSize, format, &timeInfo, static_cast(tval.tv_usec) / ssPrec->m_offset, + parseFormat(buff_, kBuffSize, format, &timeInfo, static_cast(static_cast(tval.tv_usec) / ssPrec->m_offset), ssPrec); return std::string(buff_); }