Skip to content

Commit d6c4a8f

Browse files
BillyDonahuebaylesj
authored andcommitted
tweak to avoid implicit narrowing warning. (#1114)
* tweak to avoid implicit narrowing warning. change an int to size_t #1113 * Update main.cpp
1 parent a3c8642 commit d6c4a8f

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

Diff for: src/test_lib_json/main.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -124,8 +124,8 @@ Json::String ValueTest::normalizeFloatingPointStr(const Json::String& s) {
124124
auto index = s.find_last_of("eE");
125125
if (index == s.npos)
126126
return s;
127-
int hasSign = (s[index + 1] == '+' || s[index + 1] == '-') ? 1 : 0;
128-
auto exponentStartIndex = index + 1 + hasSign;
127+
std::size_t signWidth = (s[index + 1] == '+' || s[index + 1] == '-') ? 1 : 0;
128+
auto exponentStartIndex = index + 1 + signWidth;
129129
Json::String normalized = s.substr(0, exponentStartIndex);
130130
auto indexDigit = s.find_first_not_of('0', exponentStartIndex);
131131
Json::String exponent = "0";

0 commit comments

Comments
 (0)