tweak to avoid implicit narrowing warning. (#1114)

* tweak to avoid implicit narrowing warning.

change an int to size_t #1113

* Update main.cpp
This commit is contained in:
Billy Donahue 2019-12-11 15:12:37 -05:00 committed by Jordan Bayles
parent a3c8642886
commit d6c4a8fb2d

View File

@ -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";