From 20fea9515d90ddd00bb65d78acf3a9eb47db6ad7 Mon Sep 17 00:00:00 2001 From: Philip Withnall Date: Tue, 28 Nov 2023 17:14:30 +0000 Subject: [PATCH] girepository: Add various missing casts MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 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 Helps: #3155 --- girepository/giarginfo.c | 2 +- girepository/gicallableinfo.c | 4 ++-- girepository/gifieldinfo.c | 2 +- girepository/giinterfaceinfo.c | 2 +- girepository/giobjectinfo.c | 12 ++++++------ girepository/girepository.c | 10 +++++----- girepository/girffi.c | 2 +- girepository/girwriter.c | 2 +- girepository/gitypeinfo.c | 2 +- girepository/givfuncinfo.c | 6 +++--- 10 files changed, 22 insertions(+), 22 deletions(-) diff --git a/girepository/giarginfo.c b/girepository/giarginfo.c index 9d169ab01..58eed2c5f 100644 --- a/girepository/giarginfo.c +++ b/girepository/giarginfo.c @@ -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)); } diff --git a/girepository/gicallableinfo.c b/girepository/gicallableinfo.c index 6c6193f35..2bdcd1b8e 100644 --- a/girepository/gicallableinfo.c +++ b/girepository/gicallableinfo.c @@ -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; diff --git a/girepository/gifieldinfo.c b/girepository/gifieldinfo.c index d5be687ab..4e7c0fb27 100644 --- a/girepository/gifieldinfo.c +++ b/girepository/gifieldinfo.c @@ -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; } /** diff --git a/girepository/giinterfaceinfo.c b/girepository/giinterfaceinfo.c index 460947573..1097c9537 100644 --- a/girepository/giinterfaceinfo.c +++ b/girepository/giinterfaceinfo.c @@ -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; diff --git a/girepository/giobjectinfo.c b/girepository/giobjectinfo.c index 4c1e1f0a1..f9248f260 100644 --- a/girepository/giobjectinfo.c +++ b/girepository/giobjectinfo.c @@ -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); diff --git a/girepository/girepository.c b/girepository/girepository.c index 1b19040e6..c7ad8abcb 100644 --- a/girepository/girepository.c +++ b/girepository/girepository.c @@ -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; diff --git a/girepository/girffi.c b/girepository/girffi.c index ad2c57006..a9e64fa55 100644 --- a/girepository/girffi.c +++ b/girepository/girffi.c @@ -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); } /** diff --git a/girepository/girwriter.c b/girepository/girwriter.c index 44300cb72..1a039fff1 100644 --- a/girepository/girwriter.c +++ b/girepository/girwriter.c @@ -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); } } diff --git a/girepository/gitypeinfo.c b/girepository/gitypeinfo.c index c66504aaf..c614bffc4 100644 --- a/girepository/gitypeinfo.c +++ b/girepository/gitypeinfo.c @@ -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); } diff --git a/girepository/givfuncinfo.c b/girepository/givfuncinfo.c index 3fba0c028..c15df8a60 100644 --- a/girepository/givfuncinfo.c +++ b/girepository/givfuncinfo.c @@ -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) {