From 186734cf8b90c6d62bef6ed433e7e6b989abdc90 Mon Sep 17 00:00:00 2001 From: Victor Zverovich Date: Mon, 18 Aug 2014 07:03:12 -0700 Subject: [PATCH] Fix warnings. --- format.cc | 4 ++-- test/printf-test.cc | 7 +++++-- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/format.cc b/format.cc index f488bcf7..6a78b941 100644 --- a/format.cc +++ b/format.cc @@ -253,8 +253,8 @@ class ArgConverter : public fmt::internal::ArgVisitor, void> { arg_.int_value = static_cast(static_cast(value)); } else { arg_.type = Arg::UINT; - arg_.uint_value = - static_cast::Type>(value); + arg_.uint_value = static_cast( + static_cast::Type>(value)); } } else { if (is_signed) { diff --git a/test/printf-test.cc b/test/printf-test.cc index dfb022b7..df938ced 100644 --- a/test/printf-test.cc +++ b/test/printf-test.cc @@ -296,7 +296,8 @@ void TestLength(const char *length_spec, U value) { if (max <= std::numeric_limits::max()) { signed_value = static_cast(value); unsigned_value = static_cast(value); - } else if (max <= std::numeric_limits::max()) { + } else if (static_cast(max) <= + std::numeric_limits::max()) { signed_value = static_cast(value); unsigned_value = static_cast(value); } @@ -333,8 +334,10 @@ void TestLength(const char *length_spec) { TestLength(length_spec, -42); TestLength(length_spec, min); TestLength(length_spec, max); - if (min > std::numeric_limits::min()) + if (min >= 0 || static_cast(min) > + std::numeric_limits::min()) { TestLength(length_spec, fmt::LongLong(min) - 1); + } if (max < std::numeric_limits::max()) TestLength(length_spec, fmt::LongLong(max) + 1); TestLength(length_spec, std::numeric_limits::min());