From e0d6f630f8407bf63ca809dd31ab4a613ff01aaa Mon Sep 17 00:00:00 2001 From: Victor Zverovich Date: Wed, 15 Jun 2016 06:29:47 -0700 Subject: [PATCH] Fix MSVC warnings --- fmt/format.h | 3 ++- fmt/printf.h | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/fmt/format.h b/fmt/format.h index 79390d64..2c0b36ee 100644 --- a/fmt/format.h +++ b/fmt/format.h @@ -1518,7 +1518,7 @@ class ArgVisitor { case Arg::NONE: case Arg::NAMED_ARG: FMT_ASSERT(false, "invalid argument type"); - return Result(); + break; case Arg::INT: return FMT_DISPATCH(visit_int(arg.int_value)); case Arg::UINT: @@ -1546,6 +1546,7 @@ class ArgVisitor { case Arg::CUSTOM: return FMT_DISPATCH(visit_custom(arg.custom)); } + return Result(); } }; diff --git a/fmt/printf.h b/fmt/printf.h index aa754a6a..d06aca54 100644 --- a/fmt/printf.h +++ b/fmt/printf.h @@ -164,7 +164,8 @@ class WidthHandler : public ArgVisitor { spec_.align_ = ALIGN_LEFT; width = 0 - width; } - if (width > std::numeric_limits::max()) + unsigned int_max = std::numeric_limits::max(); + if (width > int_max) FMT_THROW(FormatError("number is too big")); return static_cast(width); }