[glib] gobject: fix typecasts via g_object_ref
- From: Philip Withnall <pwithnall src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [glib] gobject: fix typecasts via g_object_ref
- Date: Mon, 4 Dec 2017 11:43:19 +0000 (UTC)
commit f44472e7157e7a09876b241a629da8597eee33b5
Author: Christian Hergert <chergert redhat com>
Date: Wed Nov 22 00:00:39 2017 -0800
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
gio/gasyncinitable.c | 2 +-
gio/gdbusobjectmanagerserver.c | 2 +-
gio/glocalfileiostream.c | 2 +-
gio/gnetworkaddress.c | 2 +-
gio/gnetworkservice.c | 2 +-
gio/gsocketaddress.c | 2 +-
gio/gunixvolume.c | 2 +-
tests/gobject/singleton.c | 2 +-
8 files changed, 8 insertions(+), 8 deletions(-)
---
diff --git a/gio/gasyncinitable.c b/gio/gasyncinitable.c
index c481843..bc5e40e 100644
--- a/gio/gasyncinitable.c
+++ b/gio/gasyncinitable.c
@@ -457,7 +457,7 @@ g_async_initable_new_finish (GAsyncInitable *initable,
GError **error)
{
if (g_async_initable_init_finish (initable, res, error))
- return g_object_ref (initable);
+ return g_object_ref (G_OBJECT (initable));
else
return NULL;
}
diff --git a/gio/gdbusobjectmanagerserver.c b/gio/gdbusobjectmanagerserver.c
index d8781ed..273629d 100644
--- a/gio/gdbusobjectmanagerserver.c
+++ b/gio/gdbusobjectmanagerserver.c
@@ -1033,7 +1033,7 @@ g_dbus_object_manager_server_get_object (GDBusObjectManager *_manager,
g_mutex_lock (&manager->priv->lock);
data = g_hash_table_lookup (manager->priv->map_object_path_to_data, object_path);
if (data != NULL)
- ret = g_object_ref (data->object);
+ ret = g_object_ref (G_DBUS_OBJECT (data->object));
g_mutex_unlock (&manager->priv->lock);
return ret;
diff --git a/gio/glocalfileiostream.c b/gio/glocalfileiostream.c
index 30e6848..779137f 100644
--- a/gio/glocalfileiostream.c
+++ b/gio/glocalfileiostream.c
@@ -57,7 +57,7 @@ _g_local_file_io_stream_new (GLocalFileOutputStream *output_stream)
int fd;
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);
fd = _g_local_file_output_stream_get_fd (output_stream);
stream->input_stream = (GInputStream *)_g_local_file_input_stream_new (fd);
diff --git a/gio/gnetworkaddress.c b/gio/gnetworkaddress.c
index 5231cad..07f923a 100644
--- a/gio/gnetworkaddress.c
+++ b/gio/gnetworkaddress.c
@@ -1088,7 +1088,7 @@ g_network_address_connectable_enumerate (GSocketConnectable *connectable)
GNetworkAddressAddressEnumerator *addr_enum;
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;
}
diff --git a/gio/gnetworkservice.c b/gio/gnetworkservice.c
index 4d4093b..a910a2d 100644
--- a/gio/gnetworkservice.c
+++ b/gio/gnetworkservice.c
@@ -729,7 +729,7 @@ g_network_service_connectable_enumerate (GSocketConnectable *connectable)
GNetworkServiceAddressEnumerator *srv_enum;
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->use_proxy = FALSE;
diff --git a/gio/gsocketaddress.c b/gio/gsocketaddress.c
index 413968b..848e37b 100644
--- a/gio/gsocketaddress.c
+++ b/gio/gsocketaddress.c
@@ -375,7 +375,7 @@ g_socket_address_connectable_enumerate (GSocketConnectable *connectable)
GSocketAddressAddressEnumerator *sockaddr_enum;
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;
}
diff --git a/gio/gunixvolume.c b/gio/gunixvolume.c
index 7abdb44..b54d1fd 100644
--- a/gio/gunixvolume.c
+++ b/gio/gunixvolume.c
@@ -252,7 +252,7 @@ g_unix_volume_get_mount (GVolume *volume)
GUnixVolume *unix_volume = G_UNIX_VOLUME (volume);
if (unix_volume->mount != NULL)
- return g_object_ref (unix_volume->mount);
+ return g_object_ref (G_MOUNT (unix_volume->mount));
return NULL;
}
diff --git a/tests/gobject/singleton.c b/tests/gobject/singleton.c
index 2795d0e..79a41b2 100644
--- a/tests/gobject/singleton.c
+++ b/tests/gobject/singleton.c
@@ -46,7 +46,7 @@ my_singleton_constructor (GType type,
GObjectConstructParam *construct_properties)
{
if (the_one_and_only)
- return g_object_ref (the_one_and_only);
+ return g_object_ref (G_OBJECT (the_one_and_only));
else
return G_OBJECT_CLASS (my_singleton_parent_class)->constructor (type, n_construct_properties,
construct_properties);
}
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]