Fix static_cast in regex.h

In the constructor for GenericRegexSearch, there was an issue with a
static_cast casting the result of the Malloc call. The issue was that
the stateSet_ member is of type uint32_t*, and there was an attempt to
assign an unsigned* to it. On some systems, uint32_t is not equivalent
to unsigned, thus yielding a compile error for assigning pointers of
different type.
Change-Id: I5b5036100305510b83cc4893b784a2dc9f3e4849
This commit is contained in:
Dylan Burr 2024-02-09 07:02:28 -05:00 committed by Milo Yip
parent 5a74efa8c7
commit 3f73edae00
1 changed files with 1 additions and 1 deletions

View File

@ -615,7 +615,7 @@ public:
RAPIDJSON_ASSERT(regex_.IsValid());
if (!allocator_)
ownAllocator_ = allocator_ = RAPIDJSON_NEW(Allocator)();
stateSet_ = static_cast<unsigned*>(allocator_->Malloc(GetStateSetSize()));
stateSet_ = static_cast<uint32_t*>(allocator_->Malloc(GetStateSetSize()));
state0_.template Reserve<SizeType>(regex_.stateCount_);
state1_.template Reserve<SizeType>(regex_.stateCount_);
}