From 1d751bc617f6191d77af67957f7feddd8e9e16d7 Mon Sep 17 00:00:00 2001 From: JP Cimalando Date: Sun, 12 Nov 2017 08:39:10 +0100 Subject: [PATCH] fix warning in header: signed/unsigned comparison --- fmt/format.h | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/fmt/format.h b/fmt/format.h index 5966a2d0..f28c467f 100644 --- a/fmt/format.h +++ b/fmt/format.h @@ -3940,7 +3940,8 @@ const Char *BasicFormatter::format( default: FMT_THROW(FormatError("width is not integer")); } - if (value > (std::numeric_limits::max)()) + unsigned max_int = (std::numeric_limits::max)(); + if (value > max_int) FMT_THROW(FormatError("number is too big")); spec.width_ = static_cast(value); } @@ -3978,7 +3979,8 @@ const Char *BasicFormatter::format( default: FMT_THROW(FormatError("precision is not integer")); } - if (value > (std::numeric_limits::max)()) + unsigned max_int = (std::numeric_limits::max)(); + if (value > max_int) FMT_THROW(FormatError("number is too big")); spec.precision_ = static_cast(value); } else {