Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in / Register
Toggle navigation
R
rapidjson
Project
Project
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
Packages
Packages
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
submodule
rapidjson
Commits
58e0fb89
Commit
58e0fb89
authored
Jul 26, 2014
by
Milo Yip
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
In iterative parsing, always use SizeType to prevent potential alignment problem on some platforms.
parent
7fa194d1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
7 additions
and
7 deletions
+7
-7
reader.h
include/rapidjson/reader.h
+7
-7
No files found.
include/rapidjson/reader.h
View file @
58e0fb89
...
...
@@ -1045,9 +1045,9 @@ private:
else
if
(
src
==
IterativeParsingKeyValueDelimiterState
)
n
=
IterativeParsingMemberValueState
;
// Push current state.
*
stack_
.
template
Push
<
IterativeParsingStat
e
>
(
1
)
=
n
;
*
stack_
.
template
Push
<
SizeTyp
e
>
(
1
)
=
n
;
// Initialize and push the member/element count.
*
stack_
.
template
Push
<
int
>
(
1
)
=
0
;
*
stack_
.
template
Push
<
SizeType
>
(
1
)
=
0
;
// Call handler
bool
hr
=
(
dst
==
IterativeParsingObjectInitialState
)
?
handler
.
StartObject
()
:
handler
.
StartArray
();
// On handler short circuits the parsing.
...
...
@@ -1096,18 +1096,18 @@ private:
case
IterativeParsingElementDelimiterState
:
is
.
Take
();
// Update member/element count.
*
stack_
.
template
Top
<
int
>
()
=
*
stack_
.
template
Top
<
int
>
()
+
1
;
*
stack_
.
template
Top
<
SizeType
>
()
=
*
stack_
.
template
Top
<
SizeType
>
()
+
1
;
return
dst
;
case
IterativeParsingObjectFinishState
:
{
// Get member count.
int
c
=
*
stack_
.
template
Pop
<
int
>
(
1
);
SizeType
c
=
*
stack_
.
template
Pop
<
SizeType
>
(
1
);
// If the object is not empty, count the last member.
if
(
src
==
IterativeParsingMemberValueState
)
++
c
;
// Restore the state.
IterativeParsingState
n
=
*
stack_
.
template
Pop
<
IterativeParsingState
>
(
1
);
IterativeParsingState
n
=
static_cast
<
IterativeParsingState
>
(
*
stack_
.
template
Pop
<
SizeType
>
(
1
)
);
// Transit to Finish state if this is the topmost scope.
if
(
n
==
IterativeParsingStartState
)
n
=
IterativeParsingFinishState
;
...
...
@@ -1127,12 +1127,12 @@ private:
case
IterativeParsingArrayFinishState
:
{
// Get element count.
int
c
=
*
stack_
.
template
Pop
<
int
>
(
1
);
SizeType
c
=
*
stack_
.
template
Pop
<
SizeType
>
(
1
);
// If the array is not empty, count the last element.
if
(
src
==
IterativeParsingElementState
)
++
c
;
// Restore the state.
IterativeParsingState
n
=
*
stack_
.
template
Pop
<
IterativeParsingState
>
(
1
);
IterativeParsingState
n
=
static_cast
<
IterativeParsingState
>
(
*
stack_
.
template
Pop
<
SizeType
>
(
1
)
);
// Transit to Finish state if this is the topmost scope.
if
(
n
==
IterativeParsingStartState
)
n
=
IterativeParsingFinishState
;
...
...
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