From 23d9a79c620d3f4c38d3057027efcb41b1931c36 Mon Sep 17 00:00:00 2001 From: Philip Withnall Date: Tue, 12 Dec 2023 18:22:38 +0000 Subject: [PATCH] gitypeinfo: Fix int signedness in APIs Signed-off-by: Philip Withnall Helps: #3155 --- girepository/girwriter.c | 5 +++-- girepository/gitypeinfo.c | 4 ++-- girepository/gitypeinfo.h | 4 ++-- 3 files changed, 7 insertions(+), 6 deletions(-) diff --git a/girepository/girwriter.c b/girepository/girwriter.c index 6ce9caf48..3572d4d72 100644 --- a/girepository/girwriter.c +++ b/girepository/girwriter.c @@ -244,7 +244,8 @@ write_type_info (const gchar *ns, } else if (tag == GI_TYPE_TAG_ARRAY) { - gint length, size; + gint length; + gssize size; const char *name = NULL; xml_start_element (file, "array"); @@ -276,7 +277,7 @@ write_type_info (const gchar *ns, size = gi_type_info_get_array_fixed_size (info); if (size >= 0) - xml_printf (file, " fixed-size=\"%d\"", size); + xml_printf (file, " fixed-size=\"%" G_GSSIZE_FORMAT "\"", size); if (gi_type_info_is_zero_terminated (info)) xml_printf (file, " zero-terminated=\"1\""); diff --git a/girepository/gitypeinfo.c b/girepository/gitypeinfo.c index 71605ca65..7bb6f30b8 100644 --- a/girepository/gitypeinfo.c +++ b/girepository/gitypeinfo.c @@ -135,7 +135,7 @@ gi_type_info_get_tag (GITypeInfo *info) */ GITypeInfo * gi_type_info_get_param_type (GITypeInfo *info, - gint n) + guint n) { GIRealInfo *rinfo = (GIRealInfo *)info; SimpleTypeBlob *type; @@ -270,7 +270,7 @@ gi_type_info_get_array_length (GITypeInfo *info) * Returns: the size or `-1` if the type is not an array * Since: 2.80 */ -gint +gssize gi_type_info_get_array_fixed_size (GITypeInfo *info) { GIRealInfo *rinfo = (GIRealInfo *)info; diff --git a/girepository/gitypeinfo.h b/girepository/gitypeinfo.h index e92e82837..d493574a6 100644 --- a/girepository/gitypeinfo.h +++ b/girepository/gitypeinfo.h @@ -90,7 +90,7 @@ GITypeTag gi_type_info_get_tag (GITypeInfo *info); GI_AVAILABLE_IN_ALL GITypeInfo * gi_type_info_get_param_type (GITypeInfo *info, - gint n); + guint n); GI_AVAILABLE_IN_ALL GIBaseInfo * gi_type_info_get_interface (GITypeInfo *info); @@ -99,7 +99,7 @@ GI_AVAILABLE_IN_ALL gint gi_type_info_get_array_length (GITypeInfo *info); GI_AVAILABLE_IN_ALL -gint gi_type_info_get_array_fixed_size(GITypeInfo *info); +gssize gi_type_info_get_array_fixed_size (GITypeInfo *info); GI_AVAILABLE_IN_ALL gboolean gi_type_info_is_zero_terminated (GITypeInfo *info);