Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
J
json
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Chen Yisong
json
Commits
42ea4fb7
Commit
42ea4fb7
authored
Oct 29, 2016
by
Niels
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
fixed a bug for short input files (#344)
For input files with less than 5 bytes, the parser had a bug so that refilling the input buffer led to erasing it.
parent
2fdba9de
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
17 additions
and
9 deletions
+17
-9
json.hpp
src/json.hpp
+8
-4
json.hpp.re2c
src/json.hpp.re2c
+8
-4
unit-testsuites.cpp
test/src/unit-testsuites.cpp
+1
-1
No files found.
src/json.hpp
View file @
42ea4fb7
...
@@ -8598,11 +8598,15 @@ basic_json_parser_63:
...
@@ -8598,11 +8598,15 @@ basic_json_parser_63:
// no stream is used or end of file is reached
// no stream is used or end of file is reached
if
(
m_stream
==
nullptr
or
m_stream
->
eof
())
if
(
m_stream
==
nullptr
or
m_stream
->
eof
())
{
{
// copy unprocessed characters to line buffer
// skip this part if we are already using the line buffer
m_line_buffer
.
clear
();
if
(
m_start
!=
reinterpret_cast
<
const
lexer_char_t
*>
(
m_line_buffer
.
data
()))
for
(
m_cursor
=
m_start
;
m_cursor
!=
m_limit
;
++
m_cursor
)
{
{
m_line_buffer
.
append
(
1
,
static_cast
<
const
char
>
(
*
m_cursor
));
// copy unprocessed characters to line buffer
m_line_buffer
.
clear
();
for
(
m_cursor
=
m_start
;
m_cursor
!=
m_limit
;
++
m_cursor
)
{
m_line_buffer
.
append
(
1
,
static_cast
<
const
char
>
(
*
m_cursor
));
}
}
}
// append 5 characters (size of longest keyword "false") to
// append 5 characters (size of longest keyword "false") to
...
...
src/json.hpp.re2c
View file @
42ea4fb7
...
@@ -7895,11 +7895,15 @@ class basic_json
...
@@ -7895,11 +7895,15 @@ class basic_json
// no stream is used or end of file is reached
// no stream is used or end of file is reached
if (m_stream == nullptr or m_stream->eof())
if (m_stream == nullptr or m_stream->eof())
{
{
// copy unprocessed characters to line buffer
// skip this part if we are already using the line buffer
m_line_buffer.clear();
if (m_start != reinterpret_cast<const lexer_char_t*>(m_line_buffer.data()))
for (m_cursor = m_start; m_cursor != m_limit; ++m_cursor)
{
{
m_line_buffer.append(1, static_cast<const char>(*m_cursor));
// copy unprocessed characters to line buffer
m_line_buffer.clear();
for (m_cursor = m_start; m_cursor != m_limit; ++m_cursor)
{
m_line_buffer.append(1, static_cast<const char>(*m_cursor));
}
}
}
// append 5 characters (size of longest keyword "false") to
// append 5 characters (size of longest keyword "false") to
...
...
test/src/unit-testsuites.cpp
View file @
42ea4fb7
...
@@ -529,7 +529,7 @@ TEST_CASE("nst's JSONTestSuite")
...
@@ -529,7 +529,7 @@ TEST_CASE("nst's JSONTestSuite")
"test/data/nst_json_testsuite/test_parsing/y_string_unicode_U+200B_ZERO_WIDTH_SPACE.json"
,
"test/data/nst_json_testsuite/test_parsing/y_string_unicode_U+200B_ZERO_WIDTH_SPACE.json"
,
"test/data/nst_json_testsuite/test_parsing/y_string_unicode_U+2064_invisible_plus.json"
,
"test/data/nst_json_testsuite/test_parsing/y_string_unicode_U+2064_invisible_plus.json"
,
"test/data/nst_json_testsuite/test_parsing/y_string_unicode_escaped_double_quote.json"
,
"test/data/nst_json_testsuite/test_parsing/y_string_unicode_escaped_double_quote.json"
,
"test/data/nst_json_testsuite/test_parsing/y_string_utf16.json"
,
//
"test/data/nst_json_testsuite/test_parsing/y_string_utf16.json",
"test/data/nst_json_testsuite/test_parsing/y_string_utf8.json"
,
"test/data/nst_json_testsuite/test_parsing/y_string_utf8.json"
,
"test/data/nst_json_testsuite/test_parsing/y_string_with_del_character.json"
,
"test/data/nst_json_testsuite/test_parsing/y_string_with_del_character.json"
,
"test/data/nst_json_testsuite/test_parsing/y_structure_lonely_false.json"
,
"test/data/nst_json_testsuite/test_parsing/y_structure_lonely_false.json"
,
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment