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
6cc2d58d
Commit
6cc2d58d
authored
Nov 22, 2016
by
Niels
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
🐛
hopefully fixing the crashes on Linux (#365)
parent
f620d749
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
22 deletions
+12
-22
json.hpp
src/json.hpp
+6
-11
json.hpp.re2c
src/json.hpp.re2c
+6
-11
No files found.
src/json.hpp
View file @
6cc2d58d
...
@@ -8733,10 +8733,7 @@ basic_json_parser_66:
...
@@ -8733,10 +8733,7 @@ basic_json_parser_66:
if
(
m_start
!=
reinterpret_cast
<
const
lexer_char_t
*>
(
m_line_buffer
.
data
()))
if
(
m_start
!=
reinterpret_cast
<
const
lexer_char_t
*>
(
m_line_buffer
.
data
()))
{
{
// copy unprocessed characters to line buffer
// copy unprocessed characters to line buffer
m_line_buffer
.
clear
();
m_line_buffer
.
assign
(
m_start
,
m_limit
);
m_line_buffer
.
append
(
reinterpret_cast
<
const
typename
string_t
::
value_type
*>
(
m_start
),
static_cast
<
size_t
>
(
m_limit
-
m_start
));
m_cursor
=
m_limit
;
m_cursor
=
m_limit
;
}
}
...
@@ -8842,18 +8839,16 @@ basic_json_parser_66:
...
@@ -8842,18 +8839,16 @@ basic_json_parser_66:
// iterate the result between the quotes
// iterate the result between the quotes
for
(
const
lexer_char_t
*
i
=
m_start
+
1
;
i
<
m_cursor
-
1
;
++
i
)
for
(
const
lexer_char_t
*
i
=
m_start
+
1
;
i
<
m_cursor
-
1
;
++
i
)
{
{
// number of non-escaped characters
// find next escape character
const
size_t
n
=
static_cast
<
size_t
>
(
std
::
find
(
i
,
m_cursor
-
1
,
'\\'
)
-
i
);
auto
e
=
std
::
find
(
i
,
m_cursor
-
1
,
'\\'
);
if
(
e
!=
i
)
if
(
n
!=
0
)
{
{
result
.
append
(
reinterpret_cast
<
const
typename
string_t
::
value_type
*>
(
i
),
n
);
result
.
append
(
i
,
e
);
i
+=
n
-
1
;
// -1 because will
++i
i
=
e
-
1
;
// -1 because of
++i
}
}
else
else
{
{
// processing escaped character
// processing escaped character
// read next character
// read next character
++
i
;
++
i
;
...
...
src/json.hpp.re2c
View file @
6cc2d58d
...
@@ -7882,10 +7882,7 @@ class basic_json
...
@@ -7882,10 +7882,7 @@ class basic_json
if (m_start != reinterpret_cast<const lexer_char_t*>(m_line_buffer.data()))
if (m_start != reinterpret_cast<const lexer_char_t*>(m_line_buffer.data()))
{
{
// copy unprocessed characters to line buffer
// copy unprocessed characters to line buffer
m_line_buffer.clear();
m_line_buffer.assign(m_start, m_limit);
m_line_buffer.append(
reinterpret_cast<const typename string_t::value_type*>(m_start),
static_cast<size_t>(m_limit - m_start));
m_cursor = m_limit;
m_cursor = m_limit;
}
}
...
@@ -7991,18 +7988,16 @@ class basic_json
...
@@ -7991,18 +7988,16 @@ class basic_json
// iterate the result between the quotes
// iterate the result between the quotes
for (const lexer_char_t* i = m_start + 1; i < m_cursor - 1; ++i)
for (const lexer_char_t* i = m_start + 1; i < m_cursor - 1; ++i)
{
{
// number of non-escaped characters
// find next escape character
const size_t n = static_cast<size_t>(std::find(i, m_cursor - 1, '\\') - i);
auto e = std::find(i, m_cursor - 1, '\\');
if (e != i)
if (n != 0)
{
{
result.append(
reinterpret_cast<const typename string_t::value_type*>(i), n
);
result.append(
i, e
);
i
+= n - 1; // -1 because will
++i
i
= e - 1; // -1 because of
++i
}
}
else
else
{
{
// processing escaped character
// processing escaped character
// read next character
// read next character
++i;
++i;
...
...
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