[cpp] Fix inconsistens getters/setters wrt nullability

This commit is contained in:
Mario Zechner 2025-07-25 22:20:02 +02:00
parent 65b138411c
commit a0bcb01a2a
10 changed files with 18 additions and 18 deletions

View File

@ -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) {

View File

@ -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);

View File

@ -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) {

View File

@ -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);

View File

@ -83,7 +83,7 @@ namespace spine {
TextureRegion *getRegion();
void setRegion(TextureRegion &region);
void setRegion(TextureRegion *region);
Sequence *getSequence();

View File

@ -104,7 +104,7 @@ namespace spine {
TextureRegion *getRegion();
void setRegion(TextureRegion &region);
void setRegion(TextureRegion *region);
Sequence *getSequence();

View File

@ -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;
}

View File

@ -157,8 +157,8 @@ TextureRegion *MeshAttachment::getRegion() {
return _region;
}
void MeshAttachment::setRegion(TextureRegion &region) {
_region = &region;
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;

View File

@ -242,8 +242,8 @@ TextureRegion *RegionAttachment::getRegion() {
return _region;
}
void RegionAttachment::setRegion(TextureRegion &region) {
_region = &region;
void RegionAttachment::setRegion(TextureRegion *region) {
_region = region;
}
Sequence *RegionAttachment::getSequence() {

View File

@ -65,7 +65,7 @@ void Sequence::apply(SlotPose *slot, Attachment *attachment) {
if (attachment->getRTTI().isExactly(RegionAttachment::rtti)) {
RegionAttachment *regionAttachment = static_cast<RegionAttachment *>(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<MeshAttachment *>(attachment);
if (meshAttachment->getRegion() != region) {
meshAttachment->setRegion(*region);
meshAttachment->setRegion(region);
meshAttachment->updateRegion();
}
}