File tree Expand file tree Collapse file tree 1 file changed +3
-2
lines changed
include/rapidjson/internal Expand file tree Collapse file tree 1 file changed +3
-2
lines changed Original file line number Diff line number Diff line change 17
17
18
18
#include " ../allocators.h"
19
19
#include " swap.h"
20
+ #include < cstddef>
20
21
21
22
#if defined(__clang__)
22
23
RAPIDJSON_DIAG_PUSH
@@ -114,7 +115,7 @@ class Stack {
114
115
template <typename T>
115
116
RAPIDJSON_FORCEINLINE void Reserve (size_t count = 1 ) {
116
117
// Expand the stack if needed
117
- if (RAPIDJSON_UNLIKELY (stackTop_ + sizeof (T) * count > stackEnd_))
118
+ if (RAPIDJSON_UNLIKELY (static_cast <std:: ptrdiff_t >( sizeof (T) * count) > ( stackEnd_ - stackTop_) ))
118
119
Expand<T>(count);
119
120
}
120
121
@@ -127,7 +128,7 @@ class Stack {
127
128
template <typename T>
128
129
RAPIDJSON_FORCEINLINE T* PushUnsafe (size_t count = 1 ) {
129
130
RAPIDJSON_ASSERT (stackTop_);
130
- RAPIDJSON_ASSERT (stackTop_ + sizeof (T) * count <= stackEnd_);
131
+ RAPIDJSON_ASSERT (static_cast <std:: ptrdiff_t >( sizeof (T) * count) <= ( stackEnd_ - stackTop_) );
131
132
T* ret = reinterpret_cast <T*>(stackTop_);
132
133
stackTop_ += sizeof (T) * count;
133
134
return ret;
You can’t perform that action at this time.
0 commit comments