From a0bcb01a2a204825b8f6e3d620c3719f5c4675ba Mon Sep 17 00:00:00 2001 From: Mario Zechner Date: Fri, 25 Jul 2025 22:20:02 +0200 Subject: [PATCH] [cpp] Fix inconsistens getters/setters wrt nullability --- spine-c/src/generated/mesh_attachment.cpp | 4 ++-- spine-c/src/generated/mesh_attachment.h | 2 +- spine-c/src/generated/region_attachment.cpp | 4 ++-- spine-c/src/generated/region_attachment.h | 2 +- spine-cpp/include/spine/MeshAttachment.h | 2 +- spine-cpp/include/spine/RegionAttachment.h | 2 +- spine-cpp/src/spine/AtlasAttachmentLoader.cpp | 4 ++-- spine-cpp/src/spine/MeshAttachment.cpp | 8 ++++---- spine-cpp/src/spine/RegionAttachment.cpp | 4 ++-- spine-cpp/src/spine/Sequence.cpp | 4 ++-- 10 files changed, 18 insertions(+), 18 deletions(-) diff --git a/spine-c/src/generated/mesh_attachment.cpp b/spine-c/src/generated/mesh_attachment.cpp index 649d055ca..d8729ea74 100644 --- a/spine-c/src/generated/mesh_attachment.cpp +++ b/spine-c/src/generated/mesh_attachment.cpp @@ -88,9 +88,9 @@ void spine_mesh_attachment_set_path(spine_mesh_attachment self, const char *inVa return (spine_texture_region) _self->getRegion(); } -void spine_mesh_attachment_set_region(spine_mesh_attachment self, spine_texture_region region) { +void spine_mesh_attachment_set_region(spine_mesh_attachment self, /*@null*/ spine_texture_region region) { MeshAttachment *_self = (MeshAttachment *) self; - _self->setRegion(*((TextureRegion *) region)); + _self->setRegion((TextureRegion *) region); } /*@null*/ spine_sequence spine_mesh_attachment_get_sequence(spine_mesh_attachment self) { diff --git a/spine-c/src/generated/mesh_attachment.h b/spine-c/src/generated/mesh_attachment.h index 048daf77e..65dfa0d34 100644 --- a/spine-c/src/generated/mesh_attachment.h +++ b/spine-c/src/generated/mesh_attachment.h @@ -30,7 +30,7 @@ SPINE_C_API spine_color spine_mesh_attachment_get_color(spine_mesh_attachment se SPINE_C_API const char *spine_mesh_attachment_get_path(spine_mesh_attachment self); SPINE_C_API void spine_mesh_attachment_set_path(spine_mesh_attachment self, const char *inValue); SPINE_C_API /*@null*/ spine_texture_region spine_mesh_attachment_get_region(spine_mesh_attachment self); -SPINE_C_API void spine_mesh_attachment_set_region(spine_mesh_attachment self, spine_texture_region region); +SPINE_C_API void spine_mesh_attachment_set_region(spine_mesh_attachment self, /*@null*/ spine_texture_region region); SPINE_C_API /*@null*/ spine_sequence spine_mesh_attachment_get_sequence(spine_mesh_attachment self); SPINE_C_API void spine_mesh_attachment_set_sequence(spine_mesh_attachment self, /*@null*/ spine_sequence sequence); SPINE_C_API /*@null*/ spine_mesh_attachment spine_mesh_attachment_get_parent_mesh(spine_mesh_attachment self); diff --git a/spine-c/src/generated/region_attachment.cpp b/spine-c/src/generated/region_attachment.cpp index ea2b947f1..0f2ef47bb 100644 --- a/spine-c/src/generated/region_attachment.cpp +++ b/spine-c/src/generated/region_attachment.cpp @@ -123,9 +123,9 @@ void spine_region_attachment_set_path(spine_region_attachment self, const char * return (spine_texture_region) _self->getRegion(); } -void spine_region_attachment_set_region(spine_region_attachment self, spine_texture_region region) { +void spine_region_attachment_set_region(spine_region_attachment self, /*@null*/ spine_texture_region region) { RegionAttachment *_self = (RegionAttachment *) self; - _self->setRegion(*((TextureRegion *) region)); + _self->setRegion((TextureRegion *) region); } /*@null*/ spine_sequence spine_region_attachment_get_sequence(spine_region_attachment self) { diff --git a/spine-c/src/generated/region_attachment.h b/spine-c/src/generated/region_attachment.h index 86a28e139..374cd25a2 100644 --- a/spine-c/src/generated/region_attachment.h +++ b/spine-c/src/generated/region_attachment.h @@ -37,7 +37,7 @@ SPINE_C_API spine_color spine_region_attachment_get_color(spine_region_attachmen SPINE_C_API const char *spine_region_attachment_get_path(spine_region_attachment self); SPINE_C_API void spine_region_attachment_set_path(spine_region_attachment self, const char *inValue); SPINE_C_API /*@null*/ spine_texture_region spine_region_attachment_get_region(spine_region_attachment self); -SPINE_C_API void spine_region_attachment_set_region(spine_region_attachment self, spine_texture_region region); +SPINE_C_API void spine_region_attachment_set_region(spine_region_attachment self, /*@null*/ spine_texture_region region); SPINE_C_API /*@null*/ spine_sequence spine_region_attachment_get_sequence(spine_region_attachment self); SPINE_C_API void spine_region_attachment_set_sequence(spine_region_attachment self, /*@null*/ spine_sequence sequence); SPINE_C_API spine_array_float spine_region_attachment_get_offset(spine_region_attachment self); diff --git a/spine-cpp/include/spine/MeshAttachment.h b/spine-cpp/include/spine/MeshAttachment.h index 4fd991f80..29ee64799 100644 --- a/spine-cpp/include/spine/MeshAttachment.h +++ b/spine-cpp/include/spine/MeshAttachment.h @@ -83,7 +83,7 @@ namespace spine { TextureRegion *getRegion(); - void setRegion(TextureRegion ®ion); + void setRegion(TextureRegion *region); Sequence *getSequence(); diff --git a/spine-cpp/include/spine/RegionAttachment.h b/spine-cpp/include/spine/RegionAttachment.h index 72bee3a6e..af5820e4b 100644 --- a/spine-cpp/include/spine/RegionAttachment.h +++ b/spine-cpp/include/spine/RegionAttachment.h @@ -104,7 +104,7 @@ namespace spine { TextureRegion *getRegion(); - void setRegion(TextureRegion ®ion); + void setRegion(TextureRegion *region); Sequence *getSequence(); diff --git a/spine-cpp/src/spine/AtlasAttachmentLoader.cpp b/spine-cpp/src/spine/AtlasAttachmentLoader.cpp index cb60285b9..50f6257d8 100644 --- a/spine-cpp/src/spine/AtlasAttachmentLoader.cpp +++ b/spine-cpp/src/spine/AtlasAttachmentLoader.cpp @@ -61,7 +61,7 @@ RegionAttachment *AtlasAttachmentLoader::newRegionAttachment(Skin &skin, const S } else { AtlasRegion *region = findRegion(path); if (!region) return NULL; - attachment->setRegion(*region); + attachment->setRegion(region); } return attachment; } @@ -75,7 +75,7 @@ MeshAttachment *AtlasAttachmentLoader::newMeshAttachment(Skin &skin, const Strin } else { AtlasRegion *region = findRegion(path); if (!region) return NULL; - attachment->setRegion(*region); + attachment->setRegion(region); } return attachment; } diff --git a/spine-cpp/src/spine/MeshAttachment.cpp b/spine-cpp/src/spine/MeshAttachment.cpp index 6d6a84a95..fdc2ef007 100644 --- a/spine-cpp/src/spine/MeshAttachment.cpp +++ b/spine-cpp/src/spine/MeshAttachment.cpp @@ -157,8 +157,8 @@ TextureRegion *MeshAttachment::getRegion() { return _region; } -void MeshAttachment::setRegion(TextureRegion ®ion) { - _region = ®ion; +void MeshAttachment::setRegion(TextureRegion *region) { + _region = region; } Sequence *MeshAttachment::getSequence() { @@ -220,7 +220,7 @@ Attachment &MeshAttachment::copy() { if (_parentMesh) return newLinkedMesh(); MeshAttachment *copy = new (__FILE__, __LINE__) MeshAttachment(getName()); - copy->setRegion(*_region); + copy->setRegion(_region); copy->setSequence(_sequence != NULL ? &_sequence->copy() : NULL); copy->_path = _path; copy->_color.set(_color); @@ -240,7 +240,7 @@ Attachment &MeshAttachment::copy() { MeshAttachment &MeshAttachment::newLinkedMesh() { MeshAttachment *copy = new (__FILE__, __LINE__) MeshAttachment(getName()); - copy->setRegion(*_region); + copy->setRegion(_region); copy->_path = _path; copy->_color.set(_color); copy->_timelineAttachment = this->_timelineAttachment; diff --git a/spine-cpp/src/spine/RegionAttachment.cpp b/spine-cpp/src/spine/RegionAttachment.cpp index 7ee802083..706569755 100644 --- a/spine-cpp/src/spine/RegionAttachment.cpp +++ b/spine-cpp/src/spine/RegionAttachment.cpp @@ -242,8 +242,8 @@ TextureRegion *RegionAttachment::getRegion() { return _region; } -void RegionAttachment::setRegion(TextureRegion ®ion) { - _region = ®ion; +void RegionAttachment::setRegion(TextureRegion *region) { + _region = region; } Sequence *RegionAttachment::getSequence() { diff --git a/spine-cpp/src/spine/Sequence.cpp b/spine-cpp/src/spine/Sequence.cpp index 0900f80b3..741714f81 100644 --- a/spine-cpp/src/spine/Sequence.cpp +++ b/spine-cpp/src/spine/Sequence.cpp @@ -65,7 +65,7 @@ void Sequence::apply(SlotPose *slot, Attachment *attachment) { if (attachment->getRTTI().isExactly(RegionAttachment::rtti)) { RegionAttachment *regionAttachment = static_cast(attachment); if (regionAttachment->getRegion() != region) { - regionAttachment->setRegion(*region); + regionAttachment->setRegion(region); regionAttachment->updateRegion(); } } @@ -73,7 +73,7 @@ void Sequence::apply(SlotPose *slot, Attachment *attachment) { if (attachment->getRTTI().isExactly(MeshAttachment::rtti)) { MeshAttachment *meshAttachment = static_cast(attachment); if (meshAttachment->getRegion() != region) { - meshAttachment->setRegion(*region); + meshAttachment->setRegion(region); meshAttachment->updateRegion(); } }