Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
J
json
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Libraries
json
Commits
33f5e749
Commit
33f5e749
authored
Jan 09, 2015
by
Niels
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
minor syntax adjustments
parent
661a44d1
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
17 additions
and
9 deletions
+17
-9
src/json.cc
src/json.cc
+17
-9
No files found.
src/json.cc
View file @
33f5e749
...
@@ -2049,13 +2049,16 @@ std::string json::parser::parseString()
...
@@ -2049,13 +2049,16 @@ std::string json::parser::parseString()
bool
evenAmountOfBackslashes
=
true
;
bool
evenAmountOfBackslashes
=
true
;
// iterate with pos_ over the whole string
// iterate with pos_ over the whole string
for
(;
pos_
<
buffer_
.
size
();
pos_
++
)
{
for
(;
pos_
<
buffer_
.
size
();
pos_
++
)
{
char
currentChar
=
buffer_
[
pos_
];
char
currentChar
=
buffer_
[
pos_
];
// currentChar is a quote, so we might have found the end of the string
// currentChar is a quote, so we might have found the end of the string
if
(
currentChar
==
'"'
)
{
if
(
currentChar
==
'"'
)
{
// but only if the amount of backslashes before that quote is even
// but only if the amount of backslashes before that quote is even
if
(
evenAmountOfBackslashes
)
{
if
(
evenAmountOfBackslashes
)
{
const
auto
stringLength
=
pos_
-
startPos
;
const
auto
stringLength
=
pos_
-
startPos
;
// set pos_ behind the trailing quote
// set pos_ behind the trailing quote
...
@@ -2068,13 +2071,18 @@ std::string json::parser::parseString()
...
@@ -2068,13 +2071,18 @@ std::string json::parser::parseString()
}
}
}
}
// remember if we have an even amount of backslashes before the current character
// remember if we have an even amount of backslashes before the current
if
(
currentChar
==
'\\'
)
{
// character
if
(
currentChar
==
'\\'
)
{
// jump between even/uneven for each backslash we encounter
// jump between even/uneven for each backslash we encounter
evenAmountOfBackslashes
=
!
evenAmountOfBackslashes
;
evenAmountOfBackslashes
=
not
evenAmountOfBackslashes
;
}
else
{
}
// zero backslashes are also an even number, so as soon as we encounter a non-backslash
else
// the chain of backslashes breaks and we start again from zero
{
// zero backslashes are also an even number, so as soon as we
// encounter a non-backslash the chain of backslashes breaks and
// we start again from zero
evenAmountOfBackslashes
=
true
;
evenAmountOfBackslashes
=
true
;
}
}
}
}
...
...
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