giunioninfo: Fix int signedness in APIs

Signed-off-by: Philip Withnall <pwithnall@gnome.org>

Helps: #3155
This commit is contained in:
Philip Withnall 2023-12-12 18:39:22 +00:00
parent 5db23afe14
commit b10b5a2fe6
3 changed files with 18 additions and 19 deletions

View File

@ -1249,8 +1249,7 @@ write_union_info (const gchar *ns,
const gchar *type_init;
const gchar *func;
gboolean deprecated;
gint i;
gint size;
gsize size;
name = gi_base_info_get_name ((GIBaseInfo *)info);
deprecated = gi_base_info_is_deprecated ((GIBaseInfo *)info);
@ -1268,8 +1267,8 @@ write_union_info (const gchar *ns,
xml_printf (file, " deprecated=\"1\"");
size = gi_union_info_get_size (info);
if (file->show_all && size >= 0)
xml_printf (file, " size=\"%d\"", size);
if (file->show_all)
xml_printf (file, " size=\"%" G_GSIZE_FORMAT "\"", size);
func = gi_union_info_get_copy_function (info);
if (func)
@ -1283,7 +1282,7 @@ write_union_info (const gchar *ns,
if (gi_union_info_is_discriminated (info))
{
gint offset;
guint offset;
GITypeInfo *type;
offset = gi_union_info_get_discriminator_offset (info);
@ -1296,7 +1295,7 @@ write_union_info (const gchar *ns,
gi_base_info_unref ((GIBaseInfo *)type);
}
for (i = 0; i < gi_union_info_get_n_fields (info); i++)
for (guint i = 0; i < gi_union_info_get_n_fields (info); i++)
{
GIFieldInfo *field = gi_union_info_get_field (info, i);
GIConstantInfo *constant = gi_union_info_get_discriminator (info, i);
@ -1306,7 +1305,7 @@ write_union_info (const gchar *ns,
gi_base_info_unref ((GIBaseInfo *)constant);
}
for (i = 0; i < gi_union_info_get_n_methods (info); i++)
for (guint i = 0; i < gi_union_info_get_n_methods (info); i++)
{
GIFunctionInfo *function = gi_union_info_get_method (info, i);
write_function_info (ns, function, file);

View File

@ -53,7 +53,7 @@
* Returns: number of fields
* Since: 2.80
*/
gint
guint
gi_union_info_get_n_fields (GIUnionInfo *info)
{
GIRealInfo *rinfo = (GIRealInfo *)info;
@ -75,7 +75,7 @@ gi_union_info_get_n_fields (GIUnionInfo *info)
*/
GIFieldInfo *
gi_union_info_get_field (GIUnionInfo *info,
gint n)
guint n)
{
GIRealInfo *rinfo = (GIRealInfo *)info;
Header *header = (Header *)rinfo->typelib->data;
@ -94,7 +94,7 @@ gi_union_info_get_field (GIUnionInfo *info,
* Returns: number of methods
* Since: 2.80
*/
gint
guint
gi_union_info_get_n_methods (GIUnionInfo *info)
{
GIRealInfo *rinfo = (GIRealInfo *)info;
@ -116,7 +116,7 @@ gi_union_info_get_n_methods (GIUnionInfo *info)
*/
GIFunctionInfo *
gi_union_info_get_method (GIUnionInfo *info,
gint n)
guint n)
{
GIRealInfo *rinfo = (GIRealInfo *)info;
UnionBlob *blob = (UnionBlob *)&rinfo->typelib->data[rinfo->offset];
@ -157,7 +157,7 @@ gi_union_info_is_discriminated (GIUnionInfo *info)
* Returns: offset, in bytes, of the discriminator
* Since: 2.80
*/
gint
guint
gi_union_info_get_discriminator_offset (GIUnionInfo *info)
{
GIRealInfo *rinfo = (GIRealInfo *)info;
@ -201,7 +201,7 @@ gi_union_info_get_discriminator_type (GIUnionInfo *info)
*/
GIConstantInfo *
gi_union_info_get_discriminator (GIUnionInfo *info,
gint n)
guint n)
{
GIRealInfo *rinfo = (GIRealInfo *)info;
UnionBlob *blob = (UnionBlob *)&rinfo->typelib->data[rinfo->offset];

View File

@ -44,31 +44,31 @@ G_BEGIN_DECLS
(gi_base_info_get_info_type ((GIBaseInfo*) info) == GI_INFO_TYPE_UNION)
GI_AVAILABLE_IN_ALL
gint gi_union_info_get_n_fields (GIUnionInfo *info);
guint gi_union_info_get_n_fields (GIUnionInfo *info);
GI_AVAILABLE_IN_ALL
GIFieldInfo * gi_union_info_get_field (GIUnionInfo *info,
gint n);
guint n);
GI_AVAILABLE_IN_ALL
gint gi_union_info_get_n_methods (GIUnionInfo *info);
guint gi_union_info_get_n_methods (GIUnionInfo *info);
GI_AVAILABLE_IN_ALL
GIFunctionInfo * gi_union_info_get_method (GIUnionInfo *info,
gint n);
guint n);
GI_AVAILABLE_IN_ALL
gboolean gi_union_info_is_discriminated (GIUnionInfo *info);
GI_AVAILABLE_IN_ALL
gint gi_union_info_get_discriminator_offset (GIUnionInfo *info);
guint gi_union_info_get_discriminator_offset (GIUnionInfo *info);
GI_AVAILABLE_IN_ALL
GITypeInfo * gi_union_info_get_discriminator_type (GIUnionInfo *info);
GI_AVAILABLE_IN_ALL
GIConstantInfo * gi_union_info_get_discriminator (GIUnionInfo *info,
gint n);
guint n);
GI_AVAILABLE_IN_ALL
GIFunctionInfo * gi_union_info_find_method (GIUnionInfo *info,