Skip to content

Commit

Permalink
skip_space issue
Browse files Browse the repository at this point in the history
  • Loading branch information
danielaparker committed Nov 15, 2024

Verified

This commit was signed with the committer’s verified signature. The key has expired.
litaocdl Tao Li
1 parent 9e6db17 commit 3530245
Showing 2 changed files with 16 additions and 6 deletions.
20 changes: 15 additions & 5 deletions include/jsoncons/json_parser.hpp
Original file line number Diff line number Diff line change
@@ -297,6 +297,7 @@ class basic_json_parser : public ser_context, public virtual basic_parser_input<

void skip_space(std::error_code& ec)
{
bool got_cr = false;
const char_type* local_input_end = input_end_;
while (true)
{
@@ -316,17 +317,25 @@ class basic_json_parser : public ser_context, public virtual basic_parser_input<
++position_;
break;
case '\r':
push_state(state_);
++input_ptr_;
++line_;
++position_;
state_ = json_parse_state::cr;
return;
mark_position_ = position_;
got_cr = true;
break;
case '\n':
++input_ptr_;
++line_;
if (got_cr)
{
got_cr = false;
}
else
{
++line_;
}
++position_;
mark_position_ = position_;
return;
break;
default:
return;
}
@@ -335,6 +344,7 @@ class basic_json_parser : public ser_context, public virtual basic_parser_input<

void skip_whitespace(std::error_code& ec)
{
bool got_cr = false;
const char_type* local_input_end = input_end_;

while (true)
2 changes: 1 addition & 1 deletion include/jsoncons/json_reader.hpp
Original file line number Diff line number Diff line change
@@ -321,7 +321,7 @@ namespace jsoncons {

while (!source_.eof())
{
parser_.skip_whitespace(ec);
parser_.skip_space(ec);
if (parser_.source_exhausted())
{
auto s1 = source_.read_buffer(ec);

0 comments on commit 3530245

Please sign in to comment.