From 1fff4f74c4e1b8ebdf5dc18dafb448731d46c28e Mon Sep 17 00:00:00 2001 From: Philip Withnall Date: Mon, 30 Jul 2012 10:36:03 +0200 Subject: [PATCH] tests: Fix some C warnings in the Telepathy tests library Closes: https://bugs.freedesktop.org/show_bug.cgi?id=51356 --- tests/lib/contact-list-manager.c | 10 +++++++- tests/lib/room-list-chan.c | 6 ++-- tests/lib/simple-account-manager.c | 10 ++++---- tests/lib/simple-account.c | 46 ++++++++++++++++++------------------ tests/lib/textchan-null.c | 16 ++++++------ tests/lib/util.c | 13 ++++++++-- 6 files changed, 58 insertions(+), 43 deletions(-) diff --git a/tests/lib/contact-list-manager.c b/tests/lib/contact-list-manager.c index b816673..1e44c92 100644 --- a/tests/lib/contact-list-manager.c +++ b/tests/lib/contact-list-manager.c @@ -512,7 +512,7 @@ contact_list_unpublish_async (TpBaseContactList *self, static void status_changed_cb (TpBaseConnection *conn, - guint status, + TpConnectionStatus status, guint reason, TpTestsContactListManager *self) { @@ -529,6 +529,14 @@ status_changed_cb (TpBaseConnection *conn, close_all (self); } break; + case TP_CONNECTION_STATUS_CONNECTING: + /* Nothing to do here. */ + break; + default: + { + g_assert_not_reached (); + } + break; } } diff --git a/tests/lib/room-list-chan.c b/tests/lib/room-list-chan.c index 49ed291..66c35ba 100644 --- a/tests/lib/room-list-chan.c +++ b/tests/lib/room-list-chan.c @@ -125,7 +125,7 @@ tp_tests_room_list_chan_class_init ( TpBaseChannelClass *base_class = TP_BASE_CHANNEL_CLASS (klass); GParamSpec *spec; static TpDBusPropertiesMixinPropImpl room_list_props[] = { - { "Server", "server", NULL, }, + { "Server", (gpointer) "server", NULL, }, { NULL } }; @@ -217,7 +217,7 @@ room_list_list_rooms (TpSvcChannelTypeRoomList *chan, if (self->priv->listing) { GError error = { TP_ERROR, TP_ERROR_INVALID_ARGUMENT, - "Already listing" }; + (gpointer) "Already listing" }; dbus_g_method_return_error (context, &error); return; @@ -226,7 +226,7 @@ room_list_list_rooms (TpSvcChannelTypeRoomList *chan, if (!tp_strdiff (self->priv->server, "ListRoomsFail")) { GError error = { TP_ERROR, TP_ERROR_SERVICE_CONFUSED, - "Computer says no" }; + (gpointer) "Computer says no" }; dbus_g_method_return_error (context, &error); return; diff --git a/tests/lib/simple-account-manager.c b/tests/lib/simple-account-manager.c index e1fec67..2981504 100644 --- a/tests/lib/simple-account-manager.c +++ b/tests/lib/simple-account-manager.c @@ -64,7 +64,7 @@ tp_tests_simple_account_manager_create_account (TpSvcAccountManager *svc, /* if we have fail=yes as a parameter, make the call fail */ if (!tp_strdiff (tp_asv_get_string (in_Parameters, "fail"), "yes")) { - GError e = { TP_ERROR, TP_ERROR_INVALID_ARGUMENT, "loldongs" }; + GError e = { TP_ERROR, TP_ERROR_INVALID_ARGUMENT, (gpointer) "loldongs" }; dbus_g_method_return_error (context, &e); return; } @@ -159,11 +159,11 @@ tp_tests_simple_account_manager_class_init ( GParamSpec *param_spec; static TpDBusPropertiesMixinPropImpl am_props[] = { - { "Interfaces", "interfaces", NULL }, - { "ValidAccounts", "valid-accounts", NULL }, - { "InvalidAccounts", "invalid-accounts", NULL }, + { "Interfaces", (gpointer) "interfaces", NULL }, + { "ValidAccounts", (gpointer) "valid-accounts", NULL }, + { "InvalidAccounts", (gpointer) "invalid-accounts", NULL }, /* - { "SupportedAccountProperties", "supported-account-properties", NULL }, + { "SupportedAccountProperties", (gpointer) "supported-account-properties", NULL }, */ { NULL } }; diff --git a/tests/lib/simple-account.c b/tests/lib/simple-account.c index 6279d75..fefda9e 100644 --- a/tests/lib/simple-account.c +++ b/tests/lib/simple-account.c @@ -289,41 +289,41 @@ tp_tests_simple_account_class_init (TpTestsSimpleAccountClass *klass) GParamSpec *param_spec; static TpDBusPropertiesMixinPropImpl a_props[] = { - { "Interfaces", "interfaces", NULL }, - { "DisplayName", "display-name", NULL }, - { "Icon", "icon", NULL }, - { "Valid", "valid", NULL }, - { "Enabled", "enabled", NULL }, - { "Nickname", "nickname", NULL }, - { "Parameters", "parameters", NULL }, - { "AutomaticPresence", "automatic-presence", NULL }, - { "ConnectAutomatically", "connect-automatically", NULL }, - { "Connection", "connection", NULL }, - { "ConnectionStatus", "connection-status", NULL }, - { "ConnectionStatusReason", "connection-status-reason", NULL }, - { "CurrentPresence", "current-presence", NULL }, - { "RequestedPresence", "requested-presence", NULL }, - { "NormalizedName", "normalized-name", NULL }, - { "HasBeenOnline", "has-been-online", NULL }, - { "Supersedes", "supersedes", NULL }, + { "Interfaces", (gpointer) "interfaces", NULL }, + { "DisplayName", (gpointer) "display-name", NULL }, + { "Icon", (gpointer) "icon", NULL }, + { "Valid", (gpointer) "valid", NULL }, + { "Enabled", (gpointer) "enabled", NULL }, + { "Nickname", (gpointer) "nickname", NULL }, + { "Parameters", (gpointer) "parameters", NULL }, + { "AutomaticPresence", (gpointer) "automatic-presence", NULL }, + { "ConnectAutomatically", (gpointer) "connect-automatically", NULL }, + { "Connection", (gpointer) "connection", NULL }, + { "ConnectionStatus", (gpointer) "connection-status", NULL }, + { "ConnectionStatusReason", (gpointer) "connection-status-reason", NULL }, + { "CurrentPresence", (gpointer) "current-presence", NULL }, + { "RequestedPresence", (gpointer) "requested-presence", NULL }, + { "NormalizedName", (gpointer) "normalized-name", NULL }, + { "HasBeenOnline", (gpointer) "has-been-online", NULL }, + { "Supersedes", (gpointer) "supersedes", NULL }, { NULL } }; static TpDBusPropertiesMixinPropImpl ais_props[] = { - { "StorageProvider", "storage-provider", NULL }, - { "StorageIdentifier", "storage-identifier", NULL }, - { "StorageSpecificInformation", "storage-specific-information", NULL }, - { "StorageRestrictions", "storage-restrictions", NULL }, + { "StorageProvider", (gpointer) "storage-provider", NULL }, + { "StorageIdentifier", (gpointer) "storage-identifier", NULL }, + { "StorageSpecificInformation", (gpointer) "storage-specific-information", NULL }, + { "StorageRestrictions", (gpointer) "storage-restrictions", NULL }, { NULL }, }; static TpDBusPropertiesMixinPropImpl aia_props[] = { - { "URISchemes", "uri-schemes", NULL }, + { "URISchemes", (gpointer) "uri-schemes", NULL }, { NULL }, }; static TpDBusPropertiesMixinPropImpl avatar_props[] = { - { "Avatar", "avatar", NULL }, + { "Avatar", (gpointer) "avatar", NULL }, { NULL }, }; diff --git a/tests/lib/textchan-null.c b/tests/lib/textchan-null.c index bbeb0c7..36c0c74 100644 --- a/tests/lib/textchan-null.c +++ b/tests/lib/textchan-null.c @@ -349,14 +349,14 @@ tp_tests_props_text_channel_class_init (TpTestsPropsTextChannelClass *klass) { GObjectClass *object_class = (GObjectClass *) klass; static TpDBusPropertiesMixinPropImpl channel_props[] = { - { "TargetHandleType", "handle-type", NULL }, - { "TargetHandle", "handle", NULL }, - { "ChannelType", "channel-type", NULL }, - { "Interfaces", "interfaces", NULL }, - { "TargetID", "target-id", NULL }, - { "Requested", "requested", NULL }, - { "InitiatorHandle", "initiator-handle", NULL }, - { "InitiatorID", "initiator-id", NULL }, + { "TargetHandleType", (gpointer) "handle-type", NULL }, + { "TargetHandle", (gpointer) "handle", NULL }, + { "ChannelType", (gpointer) "channel-type", NULL }, + { "Interfaces", (gpointer) "interfaces", NULL }, + { "TargetID", (gpointer) "target-id", NULL }, + { "Requested", (gpointer) "requested", NULL }, + { "InitiatorHandle", (gpointer) "initiator-handle", NULL }, + { "InitiatorID", (gpointer) "initiator-id", NULL }, { NULL } }; static TpDBusPropertiesMixinIfaceImpl prop_interfaces[] = { diff --git a/tests/lib/util.c b/tests/lib/util.c index 21d3855..046d0d4 100644 --- a/tests/lib/util.c +++ b/tests/lib/util.c @@ -334,19 +334,22 @@ _tp_create_local_socket (TpSocketAddressType address_type, case TP_SOCKET_ACCESS_CONTROL_PORT: break; + case TP_SOCKET_ACCESS_CONTROL_NETMASK: default: g_assert_not_reached (); } switch (address_type) { -#ifdef HAVE_GIO_UNIX case TP_SOCKET_ADDRESS_TYPE_UNIX: { +#ifdef HAVE_GIO_UNIX address = g_unix_socket_address_new (tmpnam (NULL)); break; - } +#else + g_assert_not_reached (); #endif + } case TP_SOCKET_ADDRESS_TYPE_IPV4: case TP_SOCKET_ADDRESS_TYPE_IPV6: @@ -362,6 +365,7 @@ _tp_create_local_socket (TpSocketAddressType address_type, break; } + case TP_SOCKET_ADDRESS_TYPE_ABSTRACT_UNIX: default: g_assert_not_reached (); } @@ -377,8 +381,8 @@ _tp_create_local_socket (TpSocketAddressType address_type, switch (address_type) { -#ifdef HAVE_GIO_UNIX case TP_SOCKET_ADDRESS_TYPE_UNIX: +#ifdef HAVE_GIO_UNIX *unix_address = g_strdup (g_unix_socket_address_get_path ( G_UNIX_SOCKET_ADDRESS (effective_address))); address_gvalue = tp_g_value_slice_new_bytes ( @@ -387,6 +391,8 @@ _tp_create_local_socket (TpSocketAddressType address_type, g_unix_socket_address_get_path ( G_UNIX_SOCKET_ADDRESS (effective_address))); break; +#else + g_assert_not_reached (); #endif case TP_SOCKET_ADDRESS_TYPE_IPV4: @@ -406,6 +412,7 @@ _tp_create_local_socket (TpSocketAddressType address_type, G_MAXUINT); break; + case TP_SOCKET_ADDRESS_TYPE_ABSTRACT_UNIX: default: g_assert_not_reached (); } -- 1.7.7.6