From 3b5c07cdade18c12c594ba6b8f9e0e5ba03a0c06 Mon Sep 17 00:00:00 2001 From: Philip Withnall Date: Wed, 28 Mar 2012 14:33:22 +0100 Subject: [PATCH] tests: Fix some C warnings in the Telepathy tests library --- 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 | 51 +++++++++++++++++++---------------- tests/lib/textchan-null.c | 16 +++++----- tests/lib/util.c | 11 ++++++- 6 files changed, 62 insertions(+), 42 deletions(-) diff --git a/tests/lib/contact-list-manager.c b/tests/lib/contact-list-manager.c index b816673..76872d3 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) { @@ -524,11 +524,19 @@ status_changed_cb (TpBaseConnection *conn, } break; + case TP_CONNECTION_STATUS_CONNECTING: + break; + case TP_CONNECTION_STATUS_DISCONNECTED: { close_all (self); } 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..a7a880a 100644 --- a/tests/lib/simple-account.c +++ b/tests/lib/simple-account.c @@ -288,45 +288,50 @@ tp_tests_simple_account_class_init (TpTestsSimpleAccountClass *klass) GObjectClass *object_class = (GObjectClass *) klass; GParamSpec *param_spec; +#define MIXIN_PROP(N, g) \ + { N, (gpointer) g, NULL } + 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 }, + MIXIN_PROP ("Interfaces", "interfaces"), + MIXIN_PROP ("DisplayName", "display-name"), + MIXIN_PROP ("Icon", "icon"), + MIXIN_PROP ("Valid", "valid"), + MIXIN_PROP ("Enabled", "enabled"), + MIXIN_PROP ("Nickname", "nickname"), + MIXIN_PROP ("Parameters", "parameters"), + MIXIN_PROP ("AutomaticPresence", "automatic-presence"), + MIXIN_PROP ("ConnectAutomatically", "connect-automatically"), + MIXIN_PROP ("Connection", "connection"), + MIXIN_PROP ("ConnectionStatus", "connection-status"), + MIXIN_PROP ("ConnectionStatusReason", "connection-status-reason"), + MIXIN_PROP ("CurrentPresence", "current-presence"), + MIXIN_PROP ("RequestedPresence", "requested-presence"), + MIXIN_PROP ("NormalizedName", "normalized-name"), + MIXIN_PROP ("HasBeenOnline", "has-been-online"), + MIXIN_PROP ("Supersedes", "supersedes"), { NULL } }; static TpDBusPropertiesMixinPropImpl ais_props[] = { - { "StorageProvider", "storage-provider", NULL }, - { "StorageIdentifier", "storage-identifier", NULL }, - { "StorageSpecificInformation", "storage-specific-information", NULL }, - { "StorageRestrictions", "storage-restrictions", NULL }, + MIXIN_PROP ("StorageProvider", "storage-provider"), + MIXIN_PROP ("StorageIdentifier", "storage-identifier"), + MIXIN_PROP ("StorageSpecificInformation", "storage-specific-information"), + MIXIN_PROP ("StorageRestrictions", "storage-restrictions"), { NULL }, }; static TpDBusPropertiesMixinPropImpl aia_props[] = { - { "URISchemes", "uri-schemes", NULL }, + MIXIN_PROP ("URISchemes", "uri-schemes"), { NULL }, }; static TpDBusPropertiesMixinPropImpl avatar_props[] = { - { "Avatar", "avatar", NULL }, + MIXIN_PROP ("Avatar", "avatar"), { NULL }, }; +#undef MIXIN_PROP + static TpDBusPropertiesMixinIfaceImpl prop_interfaces[] = { { TP_IFACE_ACCOUNT, tp_dbus_properties_mixin_getter_gobject_properties, 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 009d964..f742179 100644 --- a/tests/lib/util.c +++ b/tests/lib/util.c @@ -331,18 +331,21 @@ _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: @@ -359,6 +362,7 @@ _tp_create_local_socket (TpSocketAddressType address_type, break; } + case TP_SOCKET_ADDRESS_TYPE_ABSTRACT_UNIX: default: g_assert_not_reached (); } @@ -374,8 +378,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 ( @@ -384,6 +388,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: @@ -403,6 +409,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