Open xiegd opened 1 week ago
setCapacity may indeed return a capacity greater than what was requested, I think this might be a bit counterintuitive, but it doesn't affect the correctness of any program.
setCapacity 确实可能返回比申请的更大的容量,我觉得这个可能是有点脱离一般常识,但是不会影响什么程序正确性。
TRANS_BY_GITHUB_AI_ASSISTANT
Issue Description
In the
BufferRaw::setCapacity
method (file:ZLToolKit/src/Network/Buffer.h
), there seems to be a potential inconsistency in how the capacity is handled when_data
is not null.Current Behavior
The current implementation sometimes returns early without updating
_capacity
, which may lead to a mismatch between_capacity
and the actual allocated memory size.Code in Question
Current Behavior
The current implementation sometimes returns early without updating
_capacity
, which may lead to a mismatch between_capacity
and the actual allocated memory size.Code in Question
TRANS_BY_GITHUB_AI_ASSISTANT