mirror of
				https://github.com/Tencent/rapidjson.git
				synced 2025-11-04 12:17:41 +01:00 
			
		
		
		
	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:
		@@ -615,7 +615,7 @@ public:
 | 
				
			|||||||
        RAPIDJSON_ASSERT(regex_.IsValid());
 | 
					        RAPIDJSON_ASSERT(regex_.IsValid());
 | 
				
			||||||
        if (!allocator_)
 | 
					        if (!allocator_)
 | 
				
			||||||
            ownAllocator_ = allocator_ = RAPIDJSON_NEW(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_);
 | 
					        state0_.template Reserve<SizeType>(regex_.stateCount_);
 | 
				
			||||||
        state1_.template Reserve<SizeType>(regex_.stateCount_);
 | 
					        state1_.template Reserve<SizeType>(regex_.stateCount_);
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user