From d6c4a8fb2defc505d401d39097c00fdd8be9ae33 Mon Sep 17 00:00:00 2001 From: Billy Donahue Date: Wed, 11 Dec 2019 15:12:37 -0500 Subject: [PATCH] tweak to avoid implicit narrowing warning. (#1114) * tweak to avoid implicit narrowing warning. change an int to size_t #1113 * Update main.cpp --- src/test_lib_json/main.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/test_lib_json/main.cpp b/src/test_lib_json/main.cpp index a20ef3e..6f4bbde 100644 --- a/src/test_lib_json/main.cpp +++ b/src/test_lib_json/main.cpp @@ -124,8 +124,8 @@ Json::String ValueTest::normalizeFloatingPointStr(const Json::String& s) { auto index = s.find_last_of("eE"); if (index == s.npos) return s; - int hasSign = (s[index + 1] == '+' || s[index + 1] == '-') ? 1 : 0; - auto exponentStartIndex = index + 1 + hasSign; + std::size_t signWidth = (s[index + 1] == '+' || s[index + 1] == '-') ? 1 : 0; + auto exponentStartIndex = index + 1 + signWidth; Json::String normalized = s.substr(0, exponentStartIndex); auto indexDigit = s.find_first_not_of('0', exponentStartIndex); Json::String exponent = "0";