From 3f73edae00aba5b0112a80b4d41e6f1ff7d92a3d Mon Sep 17 00:00:00 2001 From: Dylan Burr Date: Fri, 9 Feb 2024 07:02:28 -0500 Subject: [PATCH] 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 --- include/rapidjson/internal/regex.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/include/rapidjson/internal/regex.h b/include/rapidjson/internal/regex.h index 6446c40..7740dcd 100644 --- a/include/rapidjson/internal/regex.h +++ b/include/rapidjson/internal/regex.h @@ -615,7 +615,7 @@ public: RAPIDJSON_ASSERT(regex_.IsValid()); if (!allocator_) ownAllocator_ = allocator_ = RAPIDJSON_NEW(Allocator)(); - stateSet_ = static_cast(allocator_->Malloc(GetStateSetSize())); + stateSet_ = static_cast(allocator_->Malloc(GetStateSetSize())); state0_.template Reserve(regex_.stateCount_); state1_.template Reserve(regex_.stateCount_); }