Skip to content

Commit

Permalink
Merge pull request #757 from patcheng/feature/fix_clang_warning
Browse files Browse the repository at this point in the history
added assertion to help suppress clang warnings
  • Loading branch information
miloyip committed Dec 23, 2016
2 parents 369e07d + 95224af commit 03a7391
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 4 deletions.
1 change: 1 addition & 0 deletions include/rapidjson/internal/stack.h
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,7 @@ class Stack {

template<typename T>
RAPIDJSON_FORCEINLINE T* PushUnsafe(size_t count = 1) {
RAPIDJSON_ASSERT(stackTop_);
RAPIDJSON_ASSERT(stackTop_ + sizeof(T) * count <= stackEnd_);
T* ret = reinterpret_cast<T*>(stackTop_);
stackTop_ += sizeof(T) * count;
Expand Down
10 changes: 6 additions & 4 deletions include/rapidjson/reader.h
Original file line number Diff line number Diff line change
Expand Up @@ -934,11 +934,13 @@ class GenericReader {
#else
length = static_cast<SizeType>(__builtin_ffs(r) - 1);
#endif
char* q = reinterpret_cast<char*>(os.Push(length));
for (size_t i = 0; i < length; i++)
q[i] = p[i];
if (length != 0) {
char* q = reinterpret_cast<char*>(os.Push(length));
for (size_t i = 0; i < length; i++)
q[i] = p[i];

p += length;
p += length;
}
break;
}
_mm_storeu_si128(reinterpret_cast<__m128i *>(os.Push(16)), s);
Expand Down

0 comments on commit 03a7391

Please sign in to comment.