mirror of
https://gitlab.gnome.org/GNOME/glib.git
synced 2024-12-25 15:06:14 +01:00
gobject: fix typecasts via g_object_ref
Now that g_object_ref() propagates the parameter type to the return value, we need to cast to ensure the result is warning free. https://bugzilla.gnome.org/show_bug.cgi?id=790697
This commit is contained in:
parent
c26aab36db
commit
f44472e715
@ -457,7 +457,7 @@ g_async_initable_new_finish (GAsyncInitable *initable,
|
|||||||
GError **error)
|
GError **error)
|
||||||
{
|
{
|
||||||
if (g_async_initable_init_finish (initable, res, error))
|
if (g_async_initable_init_finish (initable, res, error))
|
||||||
return g_object_ref (initable);
|
return g_object_ref (G_OBJECT (initable));
|
||||||
else
|
else
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
@ -1033,7 +1033,7 @@ g_dbus_object_manager_server_get_object (GDBusObjectManager *_manager,
|
|||||||
g_mutex_lock (&manager->priv->lock);
|
g_mutex_lock (&manager->priv->lock);
|
||||||
data = g_hash_table_lookup (manager->priv->map_object_path_to_data, object_path);
|
data = g_hash_table_lookup (manager->priv->map_object_path_to_data, object_path);
|
||||||
if (data != NULL)
|
if (data != NULL)
|
||||||
ret = g_object_ref (data->object);
|
ret = g_object_ref (G_DBUS_OBJECT (data->object));
|
||||||
g_mutex_unlock (&manager->priv->lock);
|
g_mutex_unlock (&manager->priv->lock);
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
|
@ -57,7 +57,7 @@ _g_local_file_io_stream_new (GLocalFileOutputStream *output_stream)
|
|||||||
int fd;
|
int fd;
|
||||||
|
|
||||||
stream = g_object_new (G_TYPE_LOCAL_FILE_IO_STREAM, NULL);
|
stream = g_object_new (G_TYPE_LOCAL_FILE_IO_STREAM, NULL);
|
||||||
stream->output_stream = g_object_ref (output_stream);
|
stream->output_stream = g_object_ref (G_OUTPUT_STREAM (output_stream));
|
||||||
_g_local_file_output_stream_set_do_close (output_stream, FALSE);
|
_g_local_file_output_stream_set_do_close (output_stream, FALSE);
|
||||||
fd = _g_local_file_output_stream_get_fd (output_stream);
|
fd = _g_local_file_output_stream_get_fd (output_stream);
|
||||||
stream->input_stream = (GInputStream *)_g_local_file_input_stream_new (fd);
|
stream->input_stream = (GInputStream *)_g_local_file_input_stream_new (fd);
|
||||||
|
@ -1088,7 +1088,7 @@ g_network_address_connectable_enumerate (GSocketConnectable *connectable)
|
|||||||
GNetworkAddressAddressEnumerator *addr_enum;
|
GNetworkAddressAddressEnumerator *addr_enum;
|
||||||
|
|
||||||
addr_enum = g_object_new (G_TYPE_NETWORK_ADDRESS_ADDRESS_ENUMERATOR, NULL);
|
addr_enum = g_object_new (G_TYPE_NETWORK_ADDRESS_ADDRESS_ENUMERATOR, NULL);
|
||||||
addr_enum->addr = g_object_ref (connectable);
|
addr_enum->addr = g_object_ref (G_NETWORK_ADDRESS (connectable));
|
||||||
|
|
||||||
return (GSocketAddressEnumerator *)addr_enum;
|
return (GSocketAddressEnumerator *)addr_enum;
|
||||||
}
|
}
|
||||||
|
@ -729,7 +729,7 @@ g_network_service_connectable_enumerate (GSocketConnectable *connectable)
|
|||||||
GNetworkServiceAddressEnumerator *srv_enum;
|
GNetworkServiceAddressEnumerator *srv_enum;
|
||||||
|
|
||||||
srv_enum = g_object_new (G_TYPE_NETWORK_SERVICE_ADDRESS_ENUMERATOR, NULL);
|
srv_enum = g_object_new (G_TYPE_NETWORK_SERVICE_ADDRESS_ENUMERATOR, NULL);
|
||||||
srv_enum->srv = g_object_ref (connectable);
|
srv_enum->srv = g_object_ref (G_NETWORK_SERVICE (connectable));
|
||||||
srv_enum->resolver = g_resolver_get_default ();
|
srv_enum->resolver = g_resolver_get_default ();
|
||||||
srv_enum->use_proxy = FALSE;
|
srv_enum->use_proxy = FALSE;
|
||||||
|
|
||||||
|
@ -375,7 +375,7 @@ g_socket_address_connectable_enumerate (GSocketConnectable *connectable)
|
|||||||
GSocketAddressAddressEnumerator *sockaddr_enum;
|
GSocketAddressAddressEnumerator *sockaddr_enum;
|
||||||
|
|
||||||
sockaddr_enum = g_object_new (G_TYPE_SOCKET_ADDRESS_ADDRESS_ENUMERATOR, NULL);
|
sockaddr_enum = g_object_new (G_TYPE_SOCKET_ADDRESS_ADDRESS_ENUMERATOR, NULL);
|
||||||
sockaddr_enum->sockaddr = g_object_ref (connectable);
|
sockaddr_enum->sockaddr = g_object_ref (G_SOCKET_ADDRESS (connectable));
|
||||||
|
|
||||||
return (GSocketAddressEnumerator *)sockaddr_enum;
|
return (GSocketAddressEnumerator *)sockaddr_enum;
|
||||||
}
|
}
|
||||||
|
@ -252,7 +252,7 @@ g_unix_volume_get_mount (GVolume *volume)
|
|||||||
GUnixVolume *unix_volume = G_UNIX_VOLUME (volume);
|
GUnixVolume *unix_volume = G_UNIX_VOLUME (volume);
|
||||||
|
|
||||||
if (unix_volume->mount != NULL)
|
if (unix_volume->mount != NULL)
|
||||||
return g_object_ref (unix_volume->mount);
|
return g_object_ref (G_MOUNT (unix_volume->mount));
|
||||||
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
@ -46,7 +46,7 @@ my_singleton_constructor (GType type,
|
|||||||
GObjectConstructParam *construct_properties)
|
GObjectConstructParam *construct_properties)
|
||||||
{
|
{
|
||||||
if (the_one_and_only)
|
if (the_one_and_only)
|
||||||
return g_object_ref (the_one_and_only);
|
return g_object_ref (G_OBJECT (the_one_and_only));
|
||||||
else
|
else
|
||||||
return G_OBJECT_CLASS (my_singleton_parent_class)->constructor (type, n_construct_properties, construct_properties);
|
return G_OBJECT_CLASS (my_singleton_parent_class)->constructor (type, n_construct_properties, construct_properties);
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user