mirror of
https://github.com/cocos/cocos4.git
synced 2026-11-20 23:52:40 +08:00
Fixes ResizableBufferAdapter<Data>::resize doesn't consider the situation of new size which is lower than old size. (#1028)
This commit is contained in:
@@ -100,7 +100,8 @@ class ResizableBufferAdapter<Data> : public ResizableBuffer {
|
||||
public:
|
||||
explicit ResizableBufferAdapter(BufferType* buffer) : _buffer(buffer) {}
|
||||
virtual void resize(size_t size) override {
|
||||
if (static_cast<size_t>(_buffer->getSize()) < size) {
|
||||
size_t oldSize = static_cast<size_t>(_buffer->getSize());
|
||||
if (oldSize != size) {
|
||||
auto old = _buffer->getBytes();
|
||||
void* buffer = realloc(old, size);
|
||||
if (buffer)
|
||||
|
||||
Reference in New Issue
Block a user