girepository: Add various missing casts

These aren’t needed at the moment, since all the `TypeInfo` structs in
libgirepository are all aliases for each other.

An upcoming commit will change that, however, so we need to be a little
bit stricter about type safety in advance.

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

Helps: #3155
This commit is contained in:
Philip Withnall 2023-11-28 17:14:30 +00:00
parent 9eabdd7c2e
commit 20fea9515d
10 changed files with 22 additions and 22 deletions

View File

@ -331,5 +331,5 @@ gi_arg_info_load_type (GIArgInfo *info,
g_return_if_fail (info != NULL);
g_return_if_fail (GI_IS_ARG_INFO (info));
gi_type_info_init (type, (GIBaseInfo*)info, rinfo->typelib, rinfo->offset + G_STRUCT_OFFSET (ArgBlob, arg_type));
gi_type_info_init ((GIBaseInfo *) type, (GIBaseInfo*)info, rinfo->typelib, rinfo->offset + G_STRUCT_OFFSET (ArgBlob, arg_type));
}

View File

@ -211,7 +211,7 @@ gi_callable_info_load_return_type (GICallableInfo *info,
offset = signature_offset (info);
gi_type_info_init (type, (GIBaseInfo*)info, rinfo->typelib, offset);
gi_type_info_init ((GIBaseInfo *) type, (GIBaseInfo*)info, rinfo->typelib, offset);
}
/**
@ -458,7 +458,7 @@ gi_callable_info_iterate_return_attributes (GICallableInfo *info,
if (iterator->data != NULL)
next = (AttributeBlob *) iterator->data;
else
next = _attribute_blob_find_first (info, blob_offset);
next = _attribute_blob_find_first ((GIBaseInfo *) info, blob_offset);
if (next == NULL || next->offset != blob_offset || next >= after)
return FALSE;

View File

@ -158,7 +158,7 @@ gi_field_info_get_type_info (GIFieldInfo *info)
else
return gi_type_info_new ((GIBaseInfo*)info, rinfo->typelib, rinfo->offset + G_STRUCT_OFFSET (FieldBlob, type));
return (GIBaseInfo*)type_info;
return (GITypeInfo *) type_info;
}
/**

View File

@ -311,7 +311,7 @@ gi_interface_info_find_signal (GIInterfaceInfo *info,
{
GISignalInfo *siginfo = gi_interface_info_get_signal (info, i);
if (g_strcmp0 (gi_base_info_get_name (siginfo), name) != 0)
if (g_strcmp0 (gi_base_info_get_name ((GIBaseInfo *) siginfo), name) != 0)
{
gi_base_info_unref ((GIBaseInfo*)siginfo);
continue;

View File

@ -496,7 +496,7 @@ gi_object_info_find_method_using_interfaces (GIObjectInfo *info,
result = gi_object_info_find_method (info, name);
if (result)
implementor_result = gi_base_info_ref ((GIBaseInfo*) info);
implementor_result = (GIObjectInfo *) gi_base_info_ref ((GIBaseInfo*) info);
if (result == NULL)
{
@ -514,7 +514,7 @@ gi_object_info_find_method_using_interfaces (GIObjectInfo *info,
if (result != NULL)
{
implementor_result = iface_info;
implementor_result = (GIObjectInfo *) iface_info;
break;
}
gi_base_info_unref ((GIBaseInfo*) iface_info);
@ -607,7 +607,7 @@ gi_object_info_find_signal (GIObjectInfo *info,
{
GISignalInfo *siginfo = gi_object_info_get_signal (info, i);
if (g_strcmp0 (gi_base_info_get_name (siginfo), name) != 0)
if (g_strcmp0 (gi_base_info_get_name ((GIBaseInfo *) siginfo), name) != 0)
{
gi_base_info_unref ((GIBaseInfo*)siginfo);
continue;
@ -750,7 +750,7 @@ gi_object_info_find_vfunc_using_interfaces (GIObjectInfo *info,
result = gi_object_info_find_vfunc (info, name);
if (result)
implementor_result = gi_base_info_ref ((GIBaseInfo*) info);
implementor_result = (GIObjectInfo *) gi_base_info_ref ((GIBaseInfo*) info);
if (result == NULL)
{
@ -768,7 +768,7 @@ gi_object_info_find_vfunc_using_interfaces (GIObjectInfo *info,
if (result != NULL)
{
implementor_result = iface_info;
implementor_result = (GIObjectInfo *) iface_info;
break;
}
gi_base_info_unref ((GIBaseInfo*) iface_info);
@ -881,7 +881,7 @@ _get_func(GIObjectInfo *info,
GIObjectInfo *parent_info;
gpointer func = NULL;
parent_info = gi_base_info_ref (info);
parent_info = (GIObjectInfo *) gi_base_info_ref ((GIBaseInfo *) info);
while (parent_info != NULL)
{
parents = g_slist_prepend (parents, parent_info);

View File

@ -958,7 +958,7 @@ gi_repository_find_by_error_domain (GIRepository *repository,
GUINT_TO_POINTER (domain));
if (cached != NULL)
return gi_base_info_ref ((GIBaseInfo *)cached);
return (GIEnumInfo *) gi_base_info_ref ((GIBaseInfo *)cached);
data.repository = repository;
data.domain = domain;
@ -971,13 +971,13 @@ gi_repository_find_by_error_domain (GIRepository *repository,
if (data.result != NULL)
{
cached = gi_info_new_full (data.result->blob_type,
repository,
NULL, data.result_typelib, data.result->offset);
cached = (GIEnumInfo *) gi_info_new_full (data.result->blob_type,
repository,
NULL, data.result_typelib, data.result->offset);
g_hash_table_insert (repository->priv->info_by_error_domain,
GUINT_TO_POINTER (domain),
gi_base_info_ref (cached));
gi_base_info_ref ((GIBaseInfo *) cached));
return cached;
}
return NULL;

View File

@ -293,7 +293,7 @@ gi_function_info_prep_invoker (GIFunctionInfo *info,
return FALSE;
}
return gi_function_invoker_new_for_address (addr, info, invoker, error);
return gi_function_invoker_new_for_address (addr, (GICallableInfo *) info, invoker, error);
}
/**

View File

@ -607,7 +607,7 @@ write_function_info (const gchar *ns,
else if (flags & GI_FUNCTION_IS_GETTER)
xml_printf (file, " glib:get-property=\"%s\"", property_name);
gi_base_info_unref (property);
gi_base_info_unref ((GIBaseInfo *) property);
}
}

View File

@ -367,7 +367,7 @@ gi_type_info_get_storage_type (GITypeInfo *info)
GIBaseInfo *interface = gi_type_info_get_interface (info);
GIInfoType info_type = gi_base_info_get_type (interface);
if (info_type == GI_INFO_TYPE_ENUM || info_type == GI_INFO_TYPE_FLAGS)
type_tag = gi_enum_info_get_storage_type (interface);
type_tag = gi_enum_info_get_storage_type ((GIEnumInfo *) interface);
gi_base_info_unref (interface);
}

View File

@ -233,7 +233,7 @@ gi_vfunc_info_get_address (GIVFuncInfo *vfunc_info,
g_return_val_if_fail (GI_IS_VFUNC_INFO (vfunc_info), NULL);
g_return_val_if_fail (error == NULL || *error == NULL, NULL);
container_info = gi_base_info_get_container (vfunc_info);
container_info = gi_base_info_get_container ((GIBaseInfo *) vfunc_info);
if (gi_base_info_get_type (container_info) == GI_INFO_TYPE_OBJECT)
{
object_info = (GIObjectInfo*) container_info;
@ -254,7 +254,7 @@ gi_vfunc_info_get_address (GIVFuncInfo *vfunc_info,
if (strcmp (gi_base_info_get_name ( (GIBaseInfo*) field_info),
gi_base_info_get_name ( (GIBaseInfo*) vfunc_info)) != 0) {
gi_base_info_unref (field_info);
gi_base_info_unref ((GIBaseInfo *) field_info);
field_info = NULL;
continue;
}
@ -288,7 +288,7 @@ gi_vfunc_info_get_address (GIVFuncInfo *vfunc_info,
offset = gi_field_info_get_offset (field_info);
func = *(gpointer*) G_STRUCT_MEMBER_P (implementor_vtable, offset);
g_type_class_unref (implementor_class);
gi_base_info_unref (field_info);
gi_base_info_unref ((GIBaseInfo *) field_info);
if (func == NULL)
{