Skip to content

Commit 695c9cb

Browse files
committed
Use C macros with the correct header instead of std::numeric_limits and static_cast
=D
1 parent 1d636de commit 695c9cb

File tree

1 file changed

+5
-5
lines changed

1 file changed

+5
-5
lines changed

include/rapidjson/internal/strtod.h

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
#include "biginteger.h"
2020
#include "diyfp.h"
2121
#include "pow10.h"
22-
#include <limits>
22+
#include <climits>
2323

2424
RAPIDJSON_NAMESPACE_BEGIN
2525
namespace internal {
@@ -230,18 +230,18 @@ inline double StrtodFullPrecision(double d, int p, const char* decimals, size_t
230230
if (StrtodFast(d, p, &result))
231231
return result;
232232

233-
RAPIDJSON_ASSERT(length <= std::numeric_limits<int>::max());
233+
RAPIDJSON_ASSERT(length <= INT_MAX);
234234
int dLen = static_cast<int>(length);
235235

236236
RAPIDJSON_ASSERT(length >= decimalPosition);
237-
RAPIDJSON_ASSERT(length - decimalPosition <= std::numeric_limits<int>::max());
237+
RAPIDJSON_ASSERT(length - decimalPosition <= INT_MAX);
238238
int dExpAdjust = static_cast<int>(length - decimalPosition);
239239

240-
RAPIDJSON_ASSERT(exp >= std::numeric_limits<int>::min() + dExpAdjust);
240+
RAPIDJSON_ASSERT(exp >= INT_MIN + dExpAdjust);
241241
int dExp = exp - dExpAdjust;
242242

243243
// Make sure length+dExp does not overflow
244-
RAPIDJSON_ASSERT(dExp <= std::numeric_limits<int>::max() - dLen);
244+
RAPIDJSON_ASSERT(dExp <= INT_MAX - dLen);
245245

246246
// Trim leading zeros
247247
while (dLen > 0 && *decimals == '0') {

0 commit comments

Comments
 (0)