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
74a24377
Commit
74a24377
authored
Jun 26, 2014
by
Milo Yip
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove setjmp()/longjmp()
parent
c0f89f6f
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
22 additions
and
23 deletions
+22
-23
reader.h
include/rapidjson/reader.h
+22
-23
No files found.
include/rapidjson/reader.h
View file @
74a24377
...
...
@@ -21,12 +21,21 @@
#pragma warning(disable : 4127) // conditional expression is constant
#endif
#ifndef RAPIDJSON_PARSE_ERROR_NORETURN
#define RAPIDJSON_PARSE_ERROR_NORETURN(msg, offset) \
RAPIDJSON_MULTILINEMACRO_BEGIN
\
if
(
!
HasParseError
())
{
\
parseError_
=
msg
;
\
errorOffset_
=
offset
;
\
}
\
RAPIDJSON_MULTILINEMACRO_END
#endif
#ifndef RAPIDJSON_PARSE_ERROR
#define RAPIDJSON_PARSE_ERROR(msg, offset) \
RAPIDJSON_MULTILINEMACRO_BEGIN
\
parseError_
=
msg
;
\
errorOffset_
=
offset
;
\
longjmp
(
jmpbuf_
,
1
);
\
RAPIDJSON_PARSE_ERROR_NORETURN
(
msg
,
offset
);
\
return
;
\
RAPIDJSON_MULTILINEMACRO_END
#endif
...
...
@@ -225,35 +234,23 @@ public:
parseError_
=
0
;
errorOffset_
=
0
;
#ifdef _MSC_VER
#pragma warning(push)
#pragma warning(disable : 4611) // interaction between '_setjmp' and C++ object destruction is non-portable
#endif
if
(
setjmp
(
jmpbuf_
))
{
#ifdef _MSC_VER
#pragma warning(pop)
#endif
stack_
.
Clear
();
return
false
;
}
SkipWhitespace
(
is
);
if
(
is
.
Peek
()
==
'\0'
)
RAPIDJSON_PARSE_ERROR
(
"Text only contains white space(s)"
,
is
.
Tell
());
RAPIDJSON_PARSE_ERROR
_NORETURN
(
"Text only contains white space(s)"
,
is
.
Tell
());
else
{
switch
(
is
.
Peek
())
{
case
'{'
:
ParseObject
<
parseFlags
>
(
is
,
handler
);
break
;
case
'['
:
ParseArray
<
parseFlags
>
(
is
,
handler
);
break
;
default
:
RAPIDJSON_PARSE_ERROR
(
"Expect either an object or array at root"
,
is
.
Tell
());
case
'{'
:
ParseObject
<
parseFlags
>
(
is
,
handler
);
break
;
case
'['
:
ParseArray
<
parseFlags
>
(
is
,
handler
);
break
;
default
:
RAPIDJSON_PARSE_ERROR_NORETURN
(
"Expect either an object or array at root"
,
is
.
Tell
());
}
SkipWhitespace
(
is
);
if
(
is
.
Peek
()
!=
'\0'
)
RAPIDJSON_PARSE_ERROR
(
"Nothing should follow the root object or array."
,
is
.
Tell
());
RAPIDJSON_PARSE_ERROR
_NORETURN
(
"Nothing should follow the root object or array."
,
is
.
Tell
());
}
return
true
;
return
!
HasParseError
()
;
}
bool
HasParseError
()
const
{
return
parseError_
!=
0
;
}
...
...
@@ -375,8 +372,10 @@ private:
codepoint
-=
'A'
-
10
;
else
if
(
c
>=
'a'
&&
c
<=
'f'
)
codepoint
-=
'a'
-
10
;
else
RAPIDJSON_PARSE_ERROR
(
"Incorrect hex digit after
\\
u escape"
,
s
.
Tell
()
-
1
);
else
{
RAPIDJSON_PARSE_ERROR_NORETURN
(
"Incorrect hex digit after
\\
u escape"
,
s
.
Tell
()
-
1
);
return
0
;
}
}
is
=
s
;
// Restore is
return
codepoint
;
...
...
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