From 22a62fcc2c2fa2418f5d358cdf65c1df73b418ae Mon Sep 17 00:00:00 2001 From: jwillcox-telework <65623287+jwillcox-telework@users.noreply.github.com> Date: Mon, 22 Aug 2022 10:39:34 -0500 Subject: [PATCH] Update allocators.h Fixing compiler error on older compilers, such as SLED 11.0. cd rapidjson-master g++ -Wall -m32 -ggdb -Iinclude -O1 ./example/simpledom/simpledom.cpp -o simpledom 2>&1 | tee out.txt Changed SIZE_MAX to std::numeric_limits::max() in code to get rid of SIZE_MAX error. --- include/rapidjson/allocators.h | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/include/rapidjson/allocators.h b/include/rapidjson/allocators.h index 12bc5ba..ddcf478 100644 --- a/include/rapidjson/allocators.h +++ b/include/rapidjson/allocators.h @@ -19,6 +19,7 @@ #include "internal/meta.h" #include +#include #if RAPIDJSON_HAS_CXX11 #include @@ -433,7 +434,7 @@ namespace internal { template inline T* Realloc(A& a, T* old_p, size_t old_n, size_t new_n) { - RAPIDJSON_NOEXCEPT_ASSERT(old_n <= SIZE_MAX / sizeof(T) && new_n <= SIZE_MAX / sizeof(T)); + RAPIDJSON_NOEXCEPT_ASSERT(old_n <= std::numeric_limits::max() / sizeof(T) && new_n <= std::numeric_limits::max() / sizeof(T)); return static_cast(a.Realloc(old_p, old_n * sizeof(T), new_n * sizeof(T))); }