[c] Constructor nullability.

This commit is contained in:
Mario Zechner 2025-07-25 22:02:43 +02:00
parent 854b6f9a2a
commit 85aab233ee
17 changed files with 47 additions and 48 deletions

View File

@ -251,7 +251,7 @@ void spine_atlas_result_dispose(spine_atlas_result result) {
spine_skeleton_data_result spine_skeleton_data_load_json(spine_atlas atlas, const char *skeletonData, const char *path) { spine_skeleton_data_result spine_skeleton_data_load_json(spine_atlas atlas, const char *skeletonData, const char *path) {
if (!atlas || !skeletonData) return nullptr; if (!atlas || !skeletonData) return nullptr;
_spine_skeleton_data_result *result = SpineExtension::calloc<_spine_skeleton_data_result>(1, __FILE__, __LINE__); _spine_skeleton_data_result *result = SpineExtension::calloc<_spine_skeleton_data_result>(1, __FILE__, __LINE__);
SkeletonJson json((Atlas *) atlas); SkeletonJson json(*(Atlas *) atlas);
json.setScale(1); json.setScale(1);
SkeletonData *data = json.readSkeletonData(skeletonData); SkeletonData *data = json.readSkeletonData(skeletonData);
@ -287,7 +287,7 @@ spine_skeleton_data_result spine_skeleton_data_load_json(spine_atlas atlas, cons
spine_skeleton_data_result spine_skeleton_data_load_binary(spine_atlas atlas, const uint8_t *skeletonData, int32_t length, const char *path) { spine_skeleton_data_result spine_skeleton_data_load_binary(spine_atlas atlas, const uint8_t *skeletonData, int32_t length, const char *path) {
if (!atlas || !skeletonData) return nullptr; if (!atlas || !skeletonData) return nullptr;
_spine_skeleton_data_result *result = SpineExtension::calloc<_spine_skeleton_data_result>(1, __FILE__, __LINE__); _spine_skeleton_data_result *result = SpineExtension::calloc<_spine_skeleton_data_result>(1, __FILE__, __LINE__);
SkeletonBinary binary((Atlas *) atlas); SkeletonBinary binary(*(Atlas *) atlas);
binary.setScale(1); binary.setScale(1);
SkeletonData *data = binary.readSkeletonData((const unsigned char *) skeletonData, length); SkeletonData *data = binary.readSkeletonData((const unsigned char *) skeletonData, length);
@ -345,8 +345,8 @@ spine_skeleton_drawable spine_skeleton_drawable_create(spine_skeleton_data skele
_spine_skeleton_drawable *drawable = new (__FILE__, __LINE__) _spine_skeleton_drawable(); _spine_skeleton_drawable *drawable = new (__FILE__, __LINE__) _spine_skeleton_drawable();
Skeleton *skeleton = new (__FILE__, __LINE__) Skeleton(*((SkeletonData *) skeletonData)); Skeleton *skeleton = new (__FILE__, __LINE__) Skeleton(*((SkeletonData *) skeletonData));
AnimationStateData *stateData = new (__FILE__, __LINE__) AnimationStateData((SkeletonData *) skeletonData); AnimationStateData *stateData = new (__FILE__, __LINE__) AnimationStateData(*(SkeletonData *) skeletonData);
AnimationState *state = new (__FILE__, __LINE__) AnimationState(stateData); AnimationState *state = new (__FILE__, __LINE__) AnimationState(*stateData);
EventListener *listener = new (__FILE__, __LINE__) EventListener(); EventListener *listener = new (__FILE__, __LINE__) EventListener();
state->setListener(listener); state->setListener(listener);

View File

@ -3,8 +3,8 @@
using namespace spine; using namespace spine;
spine_animation_state spine_animation_state_create(/*@null*/ spine_animation_state_data data) { spine_animation_state spine_animation_state_create(spine_animation_state_data data) {
return (spine_animation_state) new (__FILE__, __LINE__) AnimationState((AnimationStateData *) data); return (spine_animation_state) new (__FILE__, __LINE__) AnimationState(*((AnimationStateData *) data));
} }
void spine_animation_state_dispose(spine_animation_state self) { void spine_animation_state_dispose(spine_animation_state self) {
@ -36,10 +36,9 @@ spine_track_entry spine_animation_state_set_animation_1(spine_animation_state se
return (spine_track_entry) &_self->setAnimation(trackIndex, String(animationName), loop); return (spine_track_entry) &_self->setAnimation(trackIndex, String(animationName), loop);
} }
spine_track_entry spine_animation_state_set_animation_2(spine_animation_state self, size_t trackIndex, /*@null*/ spine_animation animation, spine_track_entry spine_animation_state_set_animation_2(spine_animation_state self, size_t trackIndex, spine_animation animation, bool loop) {
bool loop) {
AnimationState *_self = (AnimationState *) self; AnimationState *_self = (AnimationState *) self;
return (spine_track_entry) &_self->setAnimation(trackIndex, (Animation *) animation, loop); return (spine_track_entry) &_self->setAnimation(trackIndex, *((Animation *) animation), loop);
} }
spine_track_entry spine_animation_state_add_animation_1(spine_animation_state self, size_t trackIndex, const char *animationName, bool loop, spine_track_entry spine_animation_state_add_animation_1(spine_animation_state self, size_t trackIndex, const char *animationName, bool loop,
@ -48,10 +47,10 @@ spine_track_entry spine_animation_state_add_animation_1(spine_animation_state se
return (spine_track_entry) &_self->addAnimation(trackIndex, String(animationName), loop, delay); return (spine_track_entry) &_self->addAnimation(trackIndex, String(animationName), loop, delay);
} }
spine_track_entry spine_animation_state_add_animation_2(spine_animation_state self, size_t trackIndex, /*@null*/ spine_animation animation, bool loop, spine_track_entry spine_animation_state_add_animation_2(spine_animation_state self, size_t trackIndex, spine_animation animation, bool loop,
float delay) { float delay) {
AnimationState *_self = (AnimationState *) self; AnimationState *_self = (AnimationState *) self;
return (spine_track_entry) &_self->addAnimation(trackIndex, (Animation *) animation, loop, delay); return (spine_track_entry) &_self->addAnimation(trackIndex, *((Animation *) animation), loop, delay);
} }
spine_track_entry spine_animation_state_set_empty_animation(spine_animation_state self, size_t trackIndex, float mixDuration) { spine_track_entry spine_animation_state_set_empty_animation(spine_animation_state self, size_t trackIndex, float mixDuration) {

View File

@ -9,7 +9,7 @@
extern "C" { extern "C" {
#endif #endif
SPINE_C_API spine_animation_state spine_animation_state_create(/*@null*/ spine_animation_state_data data); SPINE_C_API spine_animation_state spine_animation_state_create(spine_animation_state_data data);
SPINE_C_API void spine_animation_state_dispose(spine_animation_state self); SPINE_C_API void spine_animation_state_dispose(spine_animation_state self);
@ -19,12 +19,12 @@ SPINE_C_API void spine_animation_state_clear_tracks(spine_animation_state self);
SPINE_C_API void spine_animation_state_clear_track(spine_animation_state self, size_t trackIndex); SPINE_C_API void spine_animation_state_clear_track(spine_animation_state self, size_t trackIndex);
SPINE_C_API spine_track_entry spine_animation_state_set_animation_1(spine_animation_state self, size_t trackIndex, const char *animationName, SPINE_C_API spine_track_entry spine_animation_state_set_animation_1(spine_animation_state self, size_t trackIndex, const char *animationName,
bool loop); bool loop);
SPINE_C_API spine_track_entry spine_animation_state_set_animation_2(spine_animation_state self, size_t trackIndex, SPINE_C_API spine_track_entry spine_animation_state_set_animation_2(spine_animation_state self, size_t trackIndex, spine_animation animation,
/*@null*/ spine_animation animation, bool loop); bool loop);
SPINE_C_API spine_track_entry spine_animation_state_add_animation_1(spine_animation_state self, size_t trackIndex, const char *animationName, SPINE_C_API spine_track_entry spine_animation_state_add_animation_1(spine_animation_state self, size_t trackIndex, const char *animationName,
bool loop, float delay); bool loop, float delay);
SPINE_C_API spine_track_entry spine_animation_state_add_animation_2(spine_animation_state self, size_t trackIndex, SPINE_C_API spine_track_entry spine_animation_state_add_animation_2(spine_animation_state self, size_t trackIndex, spine_animation animation,
/*@null*/ spine_animation animation, bool loop, float delay); bool loop, float delay);
SPINE_C_API spine_track_entry spine_animation_state_set_empty_animation(spine_animation_state self, size_t trackIndex, float mixDuration); SPINE_C_API spine_track_entry spine_animation_state_set_empty_animation(spine_animation_state self, size_t trackIndex, float mixDuration);
SPINE_C_API spine_track_entry spine_animation_state_add_empty_animation(spine_animation_state self, size_t trackIndex, float mixDuration, SPINE_C_API spine_track_entry spine_animation_state_add_empty_animation(spine_animation_state self, size_t trackIndex, float mixDuration,
float delay); float delay);

View File

@ -3,8 +3,8 @@
using namespace spine; using namespace spine;
spine_animation_state_data spine_animation_state_data_create(/*@null*/ spine_skeleton_data skeletonData) { spine_animation_state_data spine_animation_state_data_create(spine_skeleton_data skeletonData) {
return (spine_animation_state_data) new (__FILE__, __LINE__) AnimationStateData((SkeletonData *) skeletonData); return (spine_animation_state_data) new (__FILE__, __LINE__) AnimationStateData(*((SkeletonData *) skeletonData));
} }
void spine_animation_state_data_dispose(spine_animation_state_data self) { void spine_animation_state_data_dispose(spine_animation_state_data self) {

View File

@ -9,7 +9,7 @@
extern "C" { extern "C" {
#endif #endif
SPINE_C_API spine_animation_state_data spine_animation_state_data_create(/*@null*/ spine_skeleton_data skeletonData); SPINE_C_API spine_animation_state_data spine_animation_state_data_create(spine_skeleton_data skeletonData);
SPINE_C_API void spine_animation_state_data_dispose(spine_animation_state_data self); SPINE_C_API void spine_animation_state_data_dispose(spine_animation_state_data self);

View File

@ -3,8 +3,8 @@
using namespace spine; using namespace spine;
spine_atlas_attachment_loader spine_atlas_attachment_loader_create(/*@null*/ spine_atlas atlas) { spine_atlas_attachment_loader spine_atlas_attachment_loader_create(spine_atlas atlas) {
return (spine_atlas_attachment_loader) new (__FILE__, __LINE__) AtlasAttachmentLoader((Atlas *) atlas); return (spine_atlas_attachment_loader) new (__FILE__, __LINE__) AtlasAttachmentLoader(*((Atlas *) atlas));
} }
void spine_atlas_attachment_loader_dispose(spine_atlas_attachment_loader self) { void spine_atlas_attachment_loader_dispose(spine_atlas_attachment_loader self) {

View File

@ -9,7 +9,7 @@
extern "C" { extern "C" {
#endif #endif
SPINE_C_API spine_atlas_attachment_loader spine_atlas_attachment_loader_create(/*@null*/ spine_atlas atlas); SPINE_C_API spine_atlas_attachment_loader spine_atlas_attachment_loader_create(spine_atlas atlas);
SPINE_C_API void spine_atlas_attachment_loader_dispose(spine_atlas_attachment_loader self); SPINE_C_API void spine_atlas_attachment_loader_dispose(spine_atlas_attachment_loader self);

View File

@ -3,9 +3,8 @@
using namespace spine; using namespace spine;
spine_deform_timeline spine_deform_timeline_create(size_t frameCount, size_t bezierCount, int slotIndex, spine_deform_timeline spine_deform_timeline_create(size_t frameCount, size_t bezierCount, int slotIndex, spine_vertex_attachment attachment) {
/*@null*/ spine_vertex_attachment attachment) { return (spine_deform_timeline) new (__FILE__, __LINE__) DeformTimeline(frameCount, bezierCount, slotIndex, *((VertexAttachment *) attachment));
return (spine_deform_timeline) new (__FILE__, __LINE__) DeformTimeline(frameCount, bezierCount, slotIndex, (VertexAttachment *) attachment);
} }
void spine_deform_timeline_dispose(spine_deform_timeline self) { void spine_deform_timeline_dispose(spine_deform_timeline self) {

View File

@ -10,7 +10,7 @@ extern "C" {
#endif #endif
SPINE_C_API spine_deform_timeline spine_deform_timeline_create(size_t frameCount, size_t bezierCount, int slotIndex, SPINE_C_API spine_deform_timeline spine_deform_timeline_create(size_t frameCount, size_t bezierCount, int slotIndex,
/*@null*/ spine_vertex_attachment attachment); spine_vertex_attachment attachment);
SPINE_C_API void spine_deform_timeline_dispose(spine_deform_timeline self); SPINE_C_API void spine_deform_timeline_dispose(spine_deform_timeline self);

View File

@ -3,15 +3,16 @@
using namespace spine; using namespace spine;
spine_linked_mesh spine_linked_mesh_create(/*@null*/ spine_mesh_attachment mesh, const int skinIndex, size_t slotIndex, const char *parent, spine_linked_mesh spine_linked_mesh_create(spine_mesh_attachment mesh, const int skinIndex, size_t slotIndex, const char *parent,
bool inheritTimelines) {
return (spine_linked_mesh) new (__FILE__, __LINE__) LinkedMesh((MeshAttachment *) mesh, skinIndex, slotIndex, String(parent), inheritTimelines);
}
spine_linked_mesh spine_linked_mesh_create2(/*@null*/ spine_mesh_attachment mesh, const char *skin, size_t slotIndex, const char *parent,
bool inheritTimelines) { bool inheritTimelines) {
return (spine_linked_mesh) new (__FILE__, __LINE__) return (spine_linked_mesh) new (__FILE__, __LINE__)
LinkedMesh((MeshAttachment *) mesh, String(skin), slotIndex, String(parent), inheritTimelines); LinkedMesh(*((MeshAttachment *) mesh), skinIndex, slotIndex, String(parent), inheritTimelines);
}
spine_linked_mesh spine_linked_mesh_create2(spine_mesh_attachment mesh, const char *skin, size_t slotIndex, const char *parent,
bool inheritTimelines) {
return (spine_linked_mesh) new (__FILE__, __LINE__)
LinkedMesh(*((MeshAttachment *) mesh), String(skin), slotIndex, String(parent), inheritTimelines);
} }
void spine_linked_mesh_dispose(spine_linked_mesh self) { void spine_linked_mesh_dispose(spine_linked_mesh self) {

View File

@ -9,9 +9,9 @@
extern "C" { extern "C" {
#endif #endif
SPINE_C_API spine_linked_mesh spine_linked_mesh_create(/*@null*/ spine_mesh_attachment mesh, const int skinIndex, size_t slotIndex, SPINE_C_API spine_linked_mesh spine_linked_mesh_create(spine_mesh_attachment mesh, const int skinIndex, size_t slotIndex, const char *parent,
const char *parent, bool inheritTimelines); bool inheritTimelines);
SPINE_C_API spine_linked_mesh spine_linked_mesh_create2(/*@null*/ spine_mesh_attachment mesh, const char *skin, size_t slotIndex, const char *parent, SPINE_C_API spine_linked_mesh spine_linked_mesh_create2(spine_mesh_attachment mesh, const char *skin, size_t slotIndex, const char *parent,
bool inheritTimelines); bool inheritTimelines);
SPINE_C_API void spine_linked_mesh_dispose(spine_linked_mesh self); SPINE_C_API void spine_linked_mesh_dispose(spine_linked_mesh self);

View File

@ -3,8 +3,8 @@
using namespace spine; using namespace spine;
spine_sequence_timeline spine_sequence_timeline_create(size_t frameCount, int slotIndex, /*@null*/ spine_attachment attachment) { spine_sequence_timeline spine_sequence_timeline_create(size_t frameCount, int slotIndex, spine_attachment attachment) {
return (spine_sequence_timeline) new (__FILE__, __LINE__) SequenceTimeline(frameCount, slotIndex, (Attachment *) attachment); return (spine_sequence_timeline) new (__FILE__, __LINE__) SequenceTimeline(frameCount, slotIndex, *((Attachment *) attachment));
} }
void spine_sequence_timeline_dispose(spine_sequence_timeline self) { void spine_sequence_timeline_dispose(spine_sequence_timeline self) {

View File

@ -9,7 +9,7 @@
extern "C" { extern "C" {
#endif #endif
SPINE_C_API spine_sequence_timeline spine_sequence_timeline_create(size_t frameCount, int slotIndex, /*@null*/ spine_attachment attachment); SPINE_C_API spine_sequence_timeline spine_sequence_timeline_create(size_t frameCount, int slotIndex, spine_attachment attachment);
SPINE_C_API void spine_sequence_timeline_dispose(spine_sequence_timeline self); SPINE_C_API void spine_sequence_timeline_dispose(spine_sequence_timeline self);

View File

@ -3,12 +3,12 @@
using namespace spine; using namespace spine;
spine_skeleton_binary spine_skeleton_binary_create(/*@null*/ spine_atlas atlas) { spine_skeleton_binary spine_skeleton_binary_create(spine_atlas atlas) {
return (spine_skeleton_binary) new (__FILE__, __LINE__) SkeletonBinary((Atlas *) atlas); return (spine_skeleton_binary) new (__FILE__, __LINE__) SkeletonBinary(*((Atlas *) atlas));
} }
spine_skeleton_binary spine_skeleton_binary_create2(/*@null*/ spine_attachment_loader attachmentLoader, bool ownsLoader) { spine_skeleton_binary spine_skeleton_binary_create2(spine_attachment_loader attachmentLoader, bool ownsLoader) {
return (spine_skeleton_binary) new (__FILE__, __LINE__) SkeletonBinary((AttachmentLoader *) attachmentLoader, ownsLoader); return (spine_skeleton_binary) new (__FILE__, __LINE__) SkeletonBinary(*((AttachmentLoader *) attachmentLoader), ownsLoader);
} }
void spine_skeleton_binary_dispose(spine_skeleton_binary self) { void spine_skeleton_binary_dispose(spine_skeleton_binary self) {

View File

@ -9,8 +9,8 @@
extern "C" { extern "C" {
#endif #endif
SPINE_C_API spine_skeleton_binary spine_skeleton_binary_create(/*@null*/ spine_atlas atlas); SPINE_C_API spine_skeleton_binary spine_skeleton_binary_create(spine_atlas atlas);
SPINE_C_API spine_skeleton_binary spine_skeleton_binary_create2(/*@null*/ spine_attachment_loader attachmentLoader, bool ownsLoader); SPINE_C_API spine_skeleton_binary spine_skeleton_binary_create2(spine_attachment_loader attachmentLoader, bool ownsLoader);
SPINE_C_API void spine_skeleton_binary_dispose(spine_skeleton_binary self); SPINE_C_API void spine_skeleton_binary_dispose(spine_skeleton_binary self);

View File

@ -3,12 +3,12 @@
using namespace spine; using namespace spine;
spine_skeleton_json spine_skeleton_json_create(/*@null*/ spine_atlas atlas) { spine_skeleton_json spine_skeleton_json_create(spine_atlas atlas) {
return (spine_skeleton_json) new (__FILE__, __LINE__) SkeletonJson((Atlas *) atlas); return (spine_skeleton_json) new (__FILE__, __LINE__) SkeletonJson(*((Atlas *) atlas));
} }
spine_skeleton_json spine_skeleton_json_create2(/*@null*/ spine_attachment_loader attachmentLoader, bool ownsLoader) { spine_skeleton_json spine_skeleton_json_create2(spine_attachment_loader attachmentLoader, bool ownsLoader) {
return (spine_skeleton_json) new (__FILE__, __LINE__) SkeletonJson((AttachmentLoader *) attachmentLoader, ownsLoader); return (spine_skeleton_json) new (__FILE__, __LINE__) SkeletonJson(*((AttachmentLoader *) attachmentLoader), ownsLoader);
} }
void spine_skeleton_json_dispose(spine_skeleton_json self) { void spine_skeleton_json_dispose(spine_skeleton_json self) {

View File

@ -9,8 +9,8 @@
extern "C" { extern "C" {
#endif #endif
SPINE_C_API spine_skeleton_json spine_skeleton_json_create(/*@null*/ spine_atlas atlas); SPINE_C_API spine_skeleton_json spine_skeleton_json_create(spine_atlas atlas);
SPINE_C_API spine_skeleton_json spine_skeleton_json_create2(/*@null*/ spine_attachment_loader attachmentLoader, bool ownsLoader); SPINE_C_API spine_skeleton_json spine_skeleton_json_create2(spine_attachment_loader attachmentLoader, bool ownsLoader);
SPINE_C_API void spine_skeleton_json_dispose(spine_skeleton_json self); SPINE_C_API void spine_skeleton_json_dispose(spine_skeleton_json self);