summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>2014-05-21 10:50:40 +0200
committerGuillaume Desmottes <guillaume.desmottes@collabora.co.uk>2014-05-27 10:24:00 +0200
commit6f1776d368bb9b207e4c9ed58894d91810d41b7c (patch)
tree966f1200b43f4b16c01639729b5a3755be31a6fd
parent90408bfe036fba0fb2d00fe16aeb30cf8d335e7e (diff)
ensure that values received from callback are not NULLnext
Make clang happier and is safer anyway. https://bugs.freedesktop.org/show_bug.cgi?id=79006
-rw-r--r--telepathy-glib/account.c10
-rw-r--r--telepathy-glib/base-room-config.c2
-rw-r--r--telepathy-glib/connection.c1
-rw-r--r--telepathy-glib/debug-client.c2
-rw-r--r--telepathy-glib/gnio-util.c2
5 files changed, 13 insertions, 4 deletions
diff --git a/telepathy-glib/account.c b/telepathy-glib/account.c
index 8fd7c55d8..c245b6bc9 100644
--- a/telepathy-glib/account.c
+++ b/telepathy-glib/account.c
@@ -3306,21 +3306,23 @@ tp_account_get_supersedes (TpAccount *self)
static void
_tp_account_got_avatar_cb (TpProxy *proxy,
- const GValue *out_Value,
+ const GValue *value,
const GError *error,
gpointer user_data,
GObject *weak_object)
{
GTask *task = user_data;
+ g_return_if_fail (error != NULL || value != NULL);
+
if (error != NULL)
{
DEBUG ("Failed to get avatar: %s", error->message);
g_task_return_error (task, g_error_copy (error));
}
- else if (!G_VALUE_HOLDS (out_Value, TP_STRUCT_TYPE_AVATAR))
+ else if (!G_VALUE_HOLDS (value, TP_STRUCT_TYPE_AVATAR))
{
- DEBUG ("Avatar had wrong type: %s", G_VALUE_TYPE_NAME (out_Value));
+ DEBUG ("Avatar had wrong type: %s", G_VALUE_TYPE_NAME (value));
g_task_return_new_error (task, TP_ERROR, TP_ERROR_CONFUSED,
"Incorrect type for Avatar property");
}
@@ -3328,7 +3330,7 @@ _tp_account_got_avatar_cb (TpProxy *proxy,
{
/* we just put the GValueArray in the task, and use a non-trivial
* finish function to split it into data and MIME type */
- g_task_return_pointer (task, g_value_dup_boxed (out_Value),
+ g_task_return_pointer (task, g_value_dup_boxed (value),
(GDestroyNotify) tp_value_array_free);
}
diff --git a/telepathy-glib/base-room-config.c b/telepathy-glib/base-room-config.c
index 1973b97b6..8055068e8 100644
--- a/telepathy-glib/base-room-config.c
+++ b/telepathy-glib/base-room-config.c
@@ -759,6 +759,8 @@ validate_property_type (
static TpDBusPropertiesMixinIfaceInfo *iface_info = NULL;
TpDBusPropertiesMixinPropInfo *prop_info;
+ g_return_val_if_fail (value != NULL, FALSE);
+
if (G_UNLIKELY (iface_info == NULL))
iface_info = tp_svc_interface_get_dbus_properties_info (
TP_TYPE_SVC_CHANNEL_INTERFACE_ROOM_CONFIG1);
diff --git a/telepathy-glib/connection.c b/telepathy-glib/connection.c
index 93c1a1171..f88611f50 100644
--- a/telepathy-glib/connection.c
+++ b/telepathy-glib/connection.c
@@ -525,6 +525,7 @@ tp_connection_get_rcc_cb (TpProxy *proxy,
goto finally;
}
+ g_return_if_fail (value != NULL);
g_assert (self->priv->capabilities == NULL);
if (!G_VALUE_HOLDS (value, TP_ARRAY_TYPE_REQUESTABLE_CHANNEL_CLASS_LIST))
diff --git a/telepathy-glib/debug-client.c b/telepathy-glib/debug-client.c
index 4eb2811f1..4350db28f 100644
--- a/telepathy-glib/debug-client.c
+++ b/telepathy-glib/debug-client.c
@@ -268,6 +268,8 @@ got_enabled_cb (
{
TpDebugClient *self = TP_DEBUG_CLIENT (proxy);
+ g_return_if_fail (error != NULL || value != NULL);
+
if (error != NULL)
{
tp_proxy_invalidate (proxy, error);
diff --git a/telepathy-glib/gnio-util.c b/telepathy-glib/gnio-util.c
index d3d5f7347..994428cfe 100644
--- a/telepathy-glib/gnio-util.c
+++ b/telepathy-glib/gnio-util.c
@@ -82,6 +82,8 @@ tp_g_socket_address_from_variant (TpSocketAddressType type,
{
GSocketAddress *addr;
+ g_return_val_if_fail (variant != NULL, NULL);
+
switch (type)
{
#ifdef HAVE_GIO_UNIX