Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion native/cocos/editor-support/spine/3.8/spine/Vector.h
Original file line number Diff line number Diff line change
Expand Up @@ -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<T>(_buffer, _capacity, __SPINE_FILE__, __SPINE_LINE__);
}
Expand Down
16 changes: 10 additions & 6 deletions native/cocos/editor-support/spine/4.2/spine/Vector.h
Original file line number Diff line number Diff line change
Expand Up @@ -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));
}
Expand All @@ -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<T>(_buffer, _capacity, __FILE__, __LINE__);
}
Expand All @@ -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<T>(_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.
Expand Down Expand Up @@ -128,7 +132,7 @@ namespace spine {
this->addAll(inValue);
}

inline void removeAt(size_t inIndex) {
void removeAt(size_t inIndex) {
assert(inIndex < _size);

--_size;
Expand Down
2 changes: 1 addition & 1 deletion native/external-config.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@
"type": "github",
"owner": "cocos",
"name": "cocos-engine-external",
"checkout": "v3.8.7-9"
"checkout": "v3.8.7-10"
}
}
Loading