Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/miloyip/rapidjson.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorjwillcox-telework <65623287+jwillcox-telework@users.noreply.github.com>2022-08-22 18:39:34 +0300
committerMilo Yip <miloyip@gmail.com>2022-08-23 05:52:40 +0300
commit22a62fcc2c2fa2418f5d358cdf65c1df73b418ae (patch)
tree49d4d30c5ad545555fd44e231c85b75abc8b66f1
parent27c3a8dc0e2c9218fe94986d249a12b5ed838f1d (diff)
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<size_t>::max() in code to get rid of SIZE_MAX error.
-rw-r--r--include/rapidjson/allocators.h3
1 files changed, 2 insertions, 1 deletions
diff --git a/include/rapidjson/allocators.h b/include/rapidjson/allocators.h
index 12bc5baf..ddcf4781 100644
--- a/include/rapidjson/allocators.h
+++ b/include/rapidjson/allocators.h
@@ -19,6 +19,7 @@
#include "internal/meta.h"
#include <memory>
+#include <limits>
#if RAPIDJSON_HAS_CXX11
#include <type_traits>
@@ -433,7 +434,7 @@ namespace internal {
template<typename T, typename A>
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<size_t>::max() / sizeof(T) && new_n <= std::numeric_limits<size_t>::max() / sizeof(T));
return static_cast<T*>(a.Realloc(old_p, old_n * sizeof(T), new_n * sizeof(T)));
}