Commit a26267d1 authored by Philipp A Hartmann's avatar Philipp A Hartmann Committed by Philipp A Hartmann

Fix -Wsign-conversion warnings/errors

GCC 8 (incorrectly) warns about sign conversions in (constant)
array size expressions:

error: conversion to 'long unsigned int' from 'int' may
change the sign of the result [-Werror=sign-conversion]
     char schemaBuffer_[128 * 1024];

Make these expressions unsigned by adding a 'u' suffix to
the first operands.
parent fa5963a2
......@@ -464,7 +464,7 @@ public:
enum_ = static_cast<uint64_t*>(allocator_->Malloc(sizeof(uint64_t) * v->Size()));
for (ConstValueIterator itr = v->Begin(); itr != v->End(); ++itr) {
typedef Hasher<EncodingType, MemoryPoolAllocator<> > EnumHasherType;
char buffer[256 + 24];
char buffer[256u + 24];
MemoryPoolAllocator<> hasherAllocator(buffer, sizeof(buffer));
EnumHasherType h(&hasherAllocator, 256);
itr->Accept(h);
......
......@@ -1762,7 +1762,7 @@ private:
typename DocumentType::AllocatorType documentAllocator_;
typename SchemaDocumentType::AllocatorType schemaAllocator_;
char documentBuffer_[16384];
char schemaBuffer_[128 * 1024];
char schemaBuffer_[128u * 1024];
};
TEST(SchemaValidator, TestSuite) {
......
......@@ -109,8 +109,8 @@ struct ScanCopyUnescapedStringHandler : BaseReaderHandler<UTF8<>, ScanCopyUnesca
template <unsigned parseFlags, typename StreamType>
void TestScanCopyUnescapedString() {
char buffer[1024 + 5 + 32];
char backup[1024 + 5 + 32];
char buffer[1024u + 5 + 32];
char backup[1024u + 5 + 32];
// Test "ABCDABCD...\\"
for (size_t offset = 0; offset < 32; offset++) {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment