mirror of
https://github.com/open-source-parsers/jsoncpp.git
synced 2024-12-27 11:21:02 +08:00
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:
parent
a3c8642886
commit
d6c4a8fb2d
@ -124,8 +124,8 @@ Json::String ValueTest::normalizeFloatingPointStr(const Json::String& s) {
|
|||||||
auto index = s.find_last_of("eE");
|
auto index = s.find_last_of("eE");
|
||||||
if (index == s.npos)
|
if (index == s.npos)
|
||||||
return s;
|
return s;
|
||||||
int hasSign = (s[index + 1] == '+' || s[index + 1] == '-') ? 1 : 0;
|
std::size_t signWidth = (s[index + 1] == '+' || s[index + 1] == '-') ? 1 : 0;
|
||||||
auto exponentStartIndex = index + 1 + hasSign;
|
auto exponentStartIndex = index + 1 + signWidth;
|
||||||
Json::String normalized = s.substr(0, exponentStartIndex);
|
Json::String normalized = s.substr(0, exponentStartIndex);
|
||||||
auto indexDigit = s.find_first_not_of('0', exponentStartIndex);
|
auto indexDigit = s.find_first_not_of('0', exponentStartIndex);
|
||||||
Json::String exponent = "0";
|
Json::String exponent = "0";
|
||||||
|
Loading…
x
Reference in New Issue
Block a user