Skip to content

Commit

Permalink
Eliminate old style cast warning
Browse files Browse the repository at this point in the history
Use static_cast to replace old style cast.

Change-Id: I30e659c8f2aadc02750555b0f041bfd2e1c8004a
  • Loading branch information
AlbertHungGarmin authored and miloyip committed Aug 17, 2023
1 parent 956063d commit 5e17dbe
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
4 changes: 2 additions & 2 deletions include/rapidjson/schema.h
Original file line number Diff line number Diff line change
Expand Up @@ -2558,7 +2558,7 @@ class GenericSchemaValidator :
// If reporting all errors, the stack will be empty, so return "errors".
const Ch* GetInvalidSchemaKeyword() const {
if (!schemaStack_.Empty()) return CurrentContext().invalidKeyword;
if (GetContinueOnErrors() && !error_.ObjectEmpty()) return (const Ch*)GetErrorsString();
if (GetContinueOnErrors() && !error_.ObjectEmpty()) return static_cast<const Ch*>(GetErrorsString());
return 0;
}

Expand Down Expand Up @@ -2900,7 +2900,7 @@ class GenericSchemaValidator :
ISchemaValidator* sv = new (GetStateAllocator().Malloc(sizeof(GenericSchemaValidator))) GenericSchemaValidator(*schemaDocument_, root, documentStack_.template Bottom<char>(), documentStack_.GetSize(),
depth_ + 1,
&GetStateAllocator());
sv->SetValidateFlags(inheritContinueOnErrors ? GetValidateFlags() : GetValidateFlags() & ~(unsigned)kValidateContinueOnErrorFlag);
sv->SetValidateFlags(inheritContinueOnErrors ? GetValidateFlags() : GetValidateFlags() & ~static_cast<unsigned>(kValidateContinueOnErrorFlag));
return sv;
}

Expand Down
4 changes: 2 additions & 2 deletions test/unittest/allocatorstest.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -231,7 +231,7 @@ TEST(Allocator, MemoryPoolAllocator) {
{
a.Clear();
const size_t bufSize = 1024;
char *buffer = (char *)a.Malloc(bufSize);
char *buffer = static_cast<char *>(a.Malloc(bufSize));
MemoryPoolAllocator<> aligned_a(buffer, bufSize);
EXPECT_TRUE(aligned_a.Capacity() > 0 && aligned_a.Capacity() <= bufSize);
EXPECT_EQ(aligned_a.Size(), 0u);
Expand All @@ -243,7 +243,7 @@ TEST(Allocator, MemoryPoolAllocator) {
{
a.Clear();
const size_t bufSize = 1024;
char *buffer = (char *)a.Malloc(bufSize);
char *buffer = static_cast<char *>(a.Malloc(bufSize));
RAPIDJSON_ASSERT(bufSize % sizeof(void*) == 0);
MemoryPoolAllocator<> unaligned_a(buffer + 1, bufSize - 1);
EXPECT_TRUE(unaligned_a.Capacity() > 0 && unaligned_a.Capacity() <= bufSize - sizeof(void*));
Expand Down

0 comments on commit 5e17dbe

Please sign in to comment.