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
b22a89bf
Commit
b22a89bf
authored
Jul 16, 2014
by
thebusytypist
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Reduce times of stack size check; reduce transition table size.
parent
1f53c6c0
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
9 additions
and
13 deletions
+9
-13
reader.h
include/rapidjson/reader.h
+9
-13
No files found.
include/rapidjson/reader.h
View file @
b22a89bf
...
...
@@ -572,7 +572,7 @@ private:
Ch
e
=
is
.
Take
();
if
((
sizeof
(
Ch
)
==
1
||
unsigned
(
e
)
<
256
)
&&
escape
[(
unsigned
char
)
e
])
{
if
(
!
(
parseFlags
&
kParseInsituFlag
))
{
if
(
!
IsStackSpaceSufficient
<
Ch
>
(
1
))
{
if
(
!
CheckStackSpaceQuota
(
sizeof
(
Ch
)
))
{
RAPIDJSON_PARSE_ERROR
(
kParseErrorStackSizeLimitExceeded
,
is
.
Tell
()
-
1
);
}
}
...
...
@@ -597,7 +597,7 @@ private:
else
if
(
c
==
'"'
)
{
// Closing double quote
is
.
Take
();
if
(
!
(
parseFlags
&
kParseInsituFlag
))
{
if
(
!
IsStackSpaceSufficient
<
Ch
>
(
1
))
{
if
(
!
CheckStackSpaceQuota
(
sizeof
(
Ch
)
))
{
RAPIDJSON_PARSE_ERROR
(
kParseErrorStackSizeLimitExceeded
,
is
.
Tell
()
-
1
);
}
}
...
...
@@ -865,7 +865,7 @@ private:
IterativeParsingState
Predict
(
IterativeParsingState
state
,
IterativeParsingToken
token
)
{
// current state x one lookahead token -> new state
static
const
IterativeParsingState
G
[
cIterativeParsingStateCount
][
cIterativeParsingTokenCount
]
=
{
static
const
char
G
[
cIterativeParsingStateCount
][
cIterativeParsingTokenCount
]
=
{
// Start
{
IterativeParsingArrayInitialState
,
// Left bracket
...
...
@@ -1018,7 +1018,7 @@ private:
}
};
// End of G
return
G
[
state
][
token
];
return
(
IterativeParsingState
)
G
[
state
][
token
];
}
// Make an advance in the token stream and state based on the candidate destination state which was returned by Transit().
...
...
@@ -1049,17 +1049,14 @@ private:
n
=
IterativeParsingElementState
;
else
if
(
src
==
IterativeParsingKeyValueDelimiterState
)
n
=
IterativeParsingMemberValueState
;
//
Push current state
.
if
(
!
IsStackSpaceSufficient
<
IterativeParsingState
>
(
1
))
{
//
Check stack space limit
.
if
(
!
CheckStackSpaceQuota
(
sizeof
(
IterativeParsingState
)
+
sizeof
(
int
)
))
{
RAPIDJSON_PARSE_ERROR_NORETURN
(
kParseErrorStackSizeLimitExceeded
,
is
.
Tell
());
return
IterativeParsingErrorState
;
}
// Push current state.
*
stack_
.
template
Push
<
IterativeParsingState
>
(
1
)
=
n
;
// Initialize and push the member/element count.
if
(
!
IsStackSpaceSufficient
<
int
>
(
1
))
{
RAPIDJSON_PARSE_ERROR_NORETURN
(
kParseErrorStackSizeLimitExceeded
,
is
.
Tell
());
return
IterativeParsingErrorState
;
}
*
stack_
.
template
Push
<
int
>
(
1
)
=
0
;
// Call handler
if
(
dst
==
IterativeParsingObjectInitialState
)
...
...
@@ -1226,9 +1223,8 @@ private:
return
parseResult_
;
}
template
<
typename
T
>
bool
IsStackSpaceSufficient
(
size_t
count
)
const
{
return
kStackSizeLimit
==
0
||
(
stack_
.
GetSize
()
+
sizeof
(
T
)
*
count
<=
kStackSizeLimit
);
bool
CheckStackSpaceQuota
(
size_t
size
)
const
{
return
kStackSizeLimit
==
0
||
(
stack_
.
GetSize
()
+
size
<=
kStackSizeLimit
);
}
static
const
size_t
kDefaultStackCapacity
=
256
;
//!< Default stack capacity in bytes for storing a single decoded string.
...
...
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