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
695c9cb9
Commit
695c9cb9
authored
Jun 15, 2018
by
abolz
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Use C macros with the correct header instead of std::numeric_limits and static_cast
=D
parent
1d636de8
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
5 deletions
+5
-5
strtod.h
include/rapidjson/internal/strtod.h
+5
-5
No files found.
include/rapidjson/internal/strtod.h
View file @
695c9cb9
...
...
@@ -19,7 +19,7 @@
#include "biginteger.h"
#include "diyfp.h"
#include "pow10.h"
#include <limits>
#include <
c
limits>
RAPIDJSON_NAMESPACE_BEGIN
namespace
internal
{
...
...
@@ -230,18 +230,18 @@ inline double StrtodFullPrecision(double d, int p, const char* decimals, size_t
if
(
StrtodFast
(
d
,
p
,
&
result
))
return
result
;
RAPIDJSON_ASSERT
(
length
<=
std
::
numeric_limits
<
int
>::
max
()
);
RAPIDJSON_ASSERT
(
length
<=
INT_MAX
);
int
dLen
=
static_cast
<
int
>
(
length
);
RAPIDJSON_ASSERT
(
length
>=
decimalPosition
);
RAPIDJSON_ASSERT
(
length
-
decimalPosition
<=
std
::
numeric_limits
<
int
>::
max
()
);
RAPIDJSON_ASSERT
(
length
-
decimalPosition
<=
INT_MAX
);
int
dExpAdjust
=
static_cast
<
int
>
(
length
-
decimalPosition
);
RAPIDJSON_ASSERT
(
exp
>=
std
::
numeric_limits
<
int
>::
min
()
+
dExpAdjust
);
RAPIDJSON_ASSERT
(
exp
>=
INT_MIN
+
dExpAdjust
);
int
dExp
=
exp
-
dExpAdjust
;
// Make sure length+dExp does not overflow
RAPIDJSON_ASSERT
(
dExp
<=
std
::
numeric_limits
<
int
>::
max
()
-
dLen
);
RAPIDJSON_ASSERT
(
dExp
<=
INT_MAX
-
dLen
);
// Trim leading zeros
while
(
dLen
>
0
&&
*
decimals
==
'0'
)
{
...
...
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