diff --git a/native/cocos/editor-support/spine/3.8/spine/Vector.h b/native/cocos/editor-support/spine/3.8/spine/Vector.h index 5f485d2260c..ca895b9e9c3 100644 --- a/native/cocos/editor-support/spine/3.8/spine/Vector.h +++ b/native/cocos/editor-support/spine/3.8/spine/Vector.h @@ -80,7 +80,11 @@ class SP_API Vector : public SpineObject { size_t oldSize = _size; _size = newSize; if (_capacity < newSize) { - _capacity = (int)(_size * 1.75f); + if (_capacity == 0) { + _capacity = _size; + } else { + _capacity = (int)(_size * 1.75f); + } if (_capacity < 8) _capacity = 8; _buffer = spine::SpineExtension::realloc(_buffer, _capacity, __SPINE_FILE__, __SPINE_LINE__); } diff --git a/native/cocos/editor-support/spine/4.2/spine/Vector.h b/native/cocos/editor-support/spine/4.2/spine/Vector.h index ffa356bea2b..ba7f8cbc028 100644 --- a/native/cocos/editor-support/spine/4.2/spine/Vector.h +++ b/native/cocos/editor-support/spine/4.2/spine/Vector.h @@ -58,7 +58,7 @@ namespace spine { deallocate(_buffer); } - inline void clear() { + void clear() { for (size_t i = 0; i < _size; ++i) { destroy(_buffer + (_size - 1 - i)); } @@ -74,12 +74,16 @@ namespace spine { return _size; } - inline void setSize(size_t newSize, const T &defaultValue) { + void setSize(size_t newSize, const T &defaultValue) { assert(newSize >= 0); size_t oldSize = _size; _size = newSize; if (_capacity < newSize) { - _capacity = (int) (_size * 1.75f); + if (_capacity == 0) { + _capacity = _size; + } else { + _capacity = (int) (_size * 1.75f); + } if (_capacity < 8) _capacity = 8; _buffer = spine::SpineExtension::realloc(_buffer, _capacity, __FILE__, __LINE__); } @@ -94,13 +98,13 @@ namespace spine { } } - inline void ensureCapacity(size_t newCapacity = 0) { + void ensureCapacity(size_t newCapacity = 0) { if (_capacity >= newCapacity) return; _capacity = newCapacity; _buffer = SpineExtension::realloc(_buffer, newCapacity, __FILE__, __LINE__); } - inline void add(const T &inValue) { + void add(const T &inValue) { if (_size == _capacity) { // inValue might reference an element in this buffer // When we reallocate, the reference becomes invalid. @@ -128,7 +132,7 @@ namespace spine { this->addAll(inValue); } - inline void removeAt(size_t inIndex) { + void removeAt(size_t inIndex) { assert(inIndex < _size); --_size; diff --git a/native/external-config.json b/native/external-config.json index 1ea1afa19ea..a709aa42dcb 100644 --- a/native/external-config.json +++ b/native/external-config.json @@ -3,6 +3,6 @@ "type": "github", "owner": "cocos", "name": "cocos-engine-external", - "checkout": "v3.8.7-9" + "checkout": "v3.8.7-10" } } \ No newline at end of file