Commit 50e61198 authored by JINMEI Tatuya's avatar JINMEI Tatuya
Browse files

[2665] use istream::ignore() (and ignore result) to skip chars instead of get()

ignoring the result fixes a scan-build error.  besides, ignore() should be
more appropriate choice for what it intends to do anyway.
parent aa5b7e12
......@@ -261,7 +261,7 @@ skipChars(std::istream& in, const char* chars, int& line, int& pos) {
} else {
++pos;
}
in.get();
in.ignore();
c = in.peek();
}
}
......@@ -291,7 +291,7 @@ skipTo(std::istream& in, const std::string& file, int& line,
pos = 1;
++line;
}
in.get();
in.ignore();
++pos;
}
in.putback(c);
......@@ -352,7 +352,7 @@ strFromStringstream(std::istream& in, const std::string& file,
throwJSONError("Bad escape", file, line, pos);
}
// drop the escaped char
in.get();
in.ignore();
++pos;
}
ss.put(c);
......@@ -490,14 +490,14 @@ fromStringstreamMap(std::istream& in, const std::string& file, int& line,
throwJSONError(std::string("Unterminated map, <string> or } expected"), file, line, pos);
} else if (c == '}') {
// empty map, skip closing curly
c = in.get();
in.ignore();
} else {
while (c != EOF && c != '}') {
std::string key = strFromStringstream(in, file, line, pos);
skipTo(in, file, line, pos, ":", WHITESPACE);
// skip the :
in.get();
in.ignore();
pos++;
ConstElementPtr value = Element::fromJSON(in, file, line, pos);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment