From 82607efb57dd425d3db1dc6f59d5a946efe24d8e Mon Sep 17 00:00:00 2001 From: sven-herrmann <47666325+sven-herrmann@users.noreply.github.com> Date: Tue, 25 May 2021 17:13:39 +0200 Subject: [PATCH] Fixed int conversion warning (#2313) * Fixed int conversion warning Compiler warns about conversion from int to size_t, thus added explicit cast. * now using detail::to_unsigned for the cast --- include/fmt/format.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/include/fmt/format.h b/include/fmt/format.h index 6df5d849..9f1178bd 100644 --- a/include/fmt/format.h +++ b/include/fmt/format.h @@ -550,7 +550,7 @@ FMT_CONSTEXPR inline size_t compute_width(string_view s) { size_t* count; FMT_CONSTEXPR void operator()(uint32_t cp, int error) const { *count += - 1 + + detail::to_unsigned(1 + (error == 0 && cp >= 0x1100 && (cp <= 0x115f || // Hangul Jamo init. consonants cp == 0x2329 || // LEFT-POINTING ANGLE BRACKET〈 @@ -568,7 +568,7 @@ FMT_CONSTEXPR inline size_t compute_width(string_view s) { // Miscellaneous Symbols and Pictographs + Emoticons: (cp >= 0x1f300 && cp <= 0x1f64f) || // Supplemental Symbols and Pictographs: - (cp >= 0x1f900 && cp <= 0x1f9ff))); + (cp >= 0x1f900 && cp <= 0x1f9ff)))); } }; for_each_codepoint(s, count_code_points{&num_code_points});