Skip to content

Commit ed1ab7a

Browse files
committed
Avoid getline(s, EOF)
Fixes open-source-parsers#1288
1 parent bb34617 commit ed1ab7a

File tree

1 file changed

+1
-2
lines changed

1 file changed

+1
-2
lines changed

src/lib_json/json_reader.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -104,8 +104,7 @@ bool Reader::parse(std::istream& is, Value& root, bool collectComments) {
104104

105105
// Since String is reference-counted, this at least does not
106106
// create an extra copy.
107-
String doc;
108-
std::getline(is, doc, static_cast<char> EOF);
107+
String doc(std::istreambuf_iterator<char>(is), {});
109108
return parse(doc.data(), doc.data() + doc.size(), root, collectComments);
110109
}
111110

0 commit comments

Comments
 (0)