+ overworked parser
This commit is contained in:
parent
4e44390090
commit
9e61092fc6
3 changed files with 19 additions and 3 deletions
11
src/JSON.cc
11
src/JSON.cc
|
|
@ -1776,8 +1776,15 @@ Initialize the JSON parser given an input stream \p _is.
|
|||
JSON::Parser::Parser(std::istream& _is)
|
||||
{
|
||||
// copy stream to string
|
||||
std::istreambuf_iterator<char> eos;
|
||||
std::string string_input(std::istreambuf_iterator<char>(_is), eos);
|
||||
std::string input_line, string_input;
|
||||
|
||||
// from http://www.manticmoo.com/articles/jeff/programming/c++/making-io-streams-efficient-in-c++.php
|
||||
// Don't sync C++ and C I/O
|
||||
std::ios_base::sync_with_stdio(false);
|
||||
while(_is) {
|
||||
std::getline(_is, input_line);
|
||||
string_input += input_line;
|
||||
}
|
||||
|
||||
_length = string_input.size();
|
||||
_buffer = new char[_length + 1];
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue