From f8c37da731af9f6cd74e7a0ef08fa02059d981ac Mon Sep 17 00:00:00 2001 From: Philip Withnall Date: Thu, 8 Jul 2010 11:39:07 +0100 Subject: Fix missing entries in switch statements Added missing default cases and missing enum cases. --- libempathy-gtk/empathy-account-widget.c | 1 + libempathy-gtk/empathy-avatar-image.c | 4 +--- libempathy-gtk/empathy-chat.c | 4 ++++ libempathy-gtk/empathy-contact-list-store.c | 3 +++ libempathy-gtk/empathy-contact-list-view.c | 4 +--- libempathy-gtk/empathy-individual-store.c | 3 +++ libempathy-gtk/empathy-individual-view.c | 4 +--- libempathy-gtk/empathy-live-search.c | 24 ++++++++++++++++++++++++ libempathy-gtk/empathy-ui-utils.c | 1 + libempathy/empathy-contact.c | 6 ++++++ libempathy/empathy-dispatch-operation.c | 5 ++++- libempathy/empathy-dispatcher.c | 3 +++ libempathy/empathy-ft-handler.c | 1 + libempathy/empathy-message.c | 3 +++ libempathy/empathy-status-presets.c | 4 +++- libempathy/empathy-utils.c | 7 +++++++ src/empathy-account-assistant.c | 14 +++++--------- src/empathy-call-window.c | 29 +++++++++++++++++++++++++++++ src/empathy-ft-manager.c | 2 ++ src/empathy-main-window.c | 3 +++ 20 files changed, 105 insertions(+), 20 deletions(-) diff --git a/libempathy-gtk/empathy-account-widget.c b/libempathy-gtk/empathy-account-widget.c index caabdeb04..66c7e467b 100644 --- a/libempathy-gtk/empathy-account-widget.c +++ b/libempathy-gtk/empathy-account-widget.c @@ -600,6 +600,7 @@ accounts_widget_generic_setup (EmpathyAccountWidget *self, case 't': minint = 0; maxint = G_MAXUINT64; break; case 'd': minint = G_MININT32; maxint = G_MAXINT32; step = 0.1; break; + default: g_assert_not_reached (); } str = g_strdup_printf (_("%s:"), param_name_formatted); diff --git a/libempathy-gtk/empathy-avatar-image.c b/libempathy-gtk/empathy-avatar-image.c index 97818554f..cfc73b702 100644 --- a/libempathy-gtk/empathy-avatar-image.c +++ b/libempathy-gtk/empathy-avatar-image.c @@ -132,8 +132,7 @@ avatar_image_filter_func (GdkXEvent *gdkxevent, priv = GET_PRIV (data); - switch (xevent->type) { - case PropertyNotify: + if (xevent->type == PropertyNotify) { atom = gdk_x11_get_xatom_by_name ("_NET_CURRENT_DESKTOP"); if (xevent->xproperty.atom == atom) { if (priv->popup) { @@ -141,7 +140,6 @@ avatar_image_filter_func (GdkXEvent *gdkxevent, priv->popup = NULL; } } - break; } return GDK_FILTER_CONTINUE; diff --git a/libempathy-gtk/empathy-chat.c b/libempathy-gtk/empathy-chat.c index 5d8fe71d3..dd140587c 100644 --- a/libempathy-gtk/empathy-chat.c +++ b/libempathy-gtk/empathy-chat.c @@ -255,6 +255,9 @@ reconnected_connection_ready_cb (TpConnection *connection, empathy_dispatcher_join_muc (connection, priv->id, EMPATHY_DISPATCHER_NON_USER_ACTION); break; + case TP_HANDLE_TYPE_NONE: + case TP_HANDLE_TYPE_LIST: + case TP_HANDLE_TYPE_GROUP: default: g_assert_not_reached (); break; @@ -1166,6 +1169,7 @@ chat_send_error_cb (EmpathyTpChat *tp_chat, case TP_CHANNEL_TEXT_SEND_ERROR_NOT_IMPLEMENTED: error = _("not implemented"); break; + case TP_CHANNEL_TEXT_SEND_ERROR_UNKNOWN: default: error = _("unknown"); break; diff --git a/libempathy-gtk/empathy-contact-list-store.c b/libempathy-gtk/empathy-contact-list-store.c index a7a5beca9..d87461eeb 100644 --- a/libempathy-gtk/empathy-contact-list-store.c +++ b/libempathy-gtk/empathy-contact-list-store.c @@ -712,6 +712,9 @@ empathy_contact_list_store_set_sort_criterium (EmpathyContactListStore *stor EMPATHY_CONTACT_LIST_STORE_COL_NAME, GTK_SORT_ASCENDING); break; + + default: + g_assert_not_reached (); } g_object_notify (G_OBJECT (store), "sort-criterium"); diff --git a/libempathy-gtk/empathy-contact-list-view.c b/libempathy-gtk/empathy-contact-list-view.c index e0c93e28e..f36718c83 100644 --- a/libempathy-gtk/empathy-contact-list-view.c +++ b/libempathy-gtk/empathy-contact-list-view.c @@ -763,11 +763,9 @@ contact_list_view_drag_data_get (GtkWidget *widget, g_object_unref (contact); str = g_strconcat (account_id, ":", contact_id, NULL); - switch (info) { - case DND_DRAG_TYPE_CONTACT_ID: + if (info == DND_DRAG_TYPE_CONTACT_ID) { gtk_selection_data_set (selection, drag_atoms_source[info], 8, (guchar *) str, strlen (str) + 1); - break; } g_free (str); diff --git a/libempathy-gtk/empathy-individual-store.c b/libempathy-gtk/empathy-individual-store.c index 0a628855c..89cbc062a 100644 --- a/libempathy-gtk/empathy-individual-store.c +++ b/libempathy-gtk/empathy-individual-store.c @@ -1651,6 +1651,9 @@ empathy_individual_store_set_sort_criterium (EmpathyIndividualStore *self, gtk_tree_sortable_set_sort_column_id (GTK_TREE_SORTABLE (self), EMPATHY_INDIVIDUAL_STORE_COL_NAME, GTK_SORT_ASCENDING); break; + + default: + g_assert_not_reached (); } g_object_notify (G_OBJECT (self), "sort-criterium"); diff --git a/libempathy-gtk/empathy-individual-view.c b/libempathy-gtk/empathy-individual-view.c index 369933e6a..239eda7d0 100644 --- a/libempathy-gtk/empathy-individual-view.c +++ b/libempathy-gtk/empathy-individual-view.c @@ -783,12 +783,10 @@ individual_view_drag_data_get (GtkWidget *widget, individual_id = folks_individual_get_id (individual); - switch (info) + if (info == DND_DRAG_TYPE_INDIVIDUAL_ID) { - case DND_DRAG_TYPE_INDIVIDUAL_ID: gtk_selection_data_set (selection, drag_atoms_source[info], 8, (guchar *) individual_id, strlen (individual_id) + 1); - break; } g_object_unref (individual); diff --git a/libempathy-gtk/empathy-live-search.c b/libempathy-gtk/empathy-live-search.c index 399733ced..41325c34b 100644 --- a/libempathy-gtk/empathy-live-search.c +++ b/libempathy-gtk/empathy-live-search.c @@ -89,6 +89,30 @@ stripped_char (gunichar ch) case G_UNICODE_ENCLOSING_MARK: /* Ignore those */ break; + case G_UNICODE_PRIVATE_USE: + case G_UNICODE_SURROGATE: + case G_UNICODE_LOWERCASE_LETTER: + case G_UNICODE_MODIFIER_LETTER: + case G_UNICODE_OTHER_LETTER: + case G_UNICODE_TITLECASE_LETTER: + case G_UNICODE_UPPERCASE_LETTER: + case G_UNICODE_DECIMAL_NUMBER: + case G_UNICODE_LETTER_NUMBER: + case G_UNICODE_OTHER_NUMBER: + case G_UNICODE_CONNECT_PUNCTUATION: + case G_UNICODE_DASH_PUNCTUATION: + case G_UNICODE_CLOSE_PUNCTUATION: + case G_UNICODE_FINAL_PUNCTUATION: + case G_UNICODE_INITIAL_PUNCTUATION: + case G_UNICODE_OTHER_PUNCTUATION: + case G_UNICODE_OPEN_PUNCTUATION: + case G_UNICODE_CURRENCY_SYMBOL: + case G_UNICODE_MODIFIER_SYMBOL: + case G_UNICODE_MATH_SYMBOL: + case G_UNICODE_OTHER_SYMBOL: + case G_UNICODE_LINE_SEPARATOR: + case G_UNICODE_PARAGRAPH_SEPARATOR: + case G_UNICODE_SPACE_SEPARATOR: default: ch = g_unichar_tolower (ch); decomp = g_unicode_canonical_decomposition (ch, &dlen); diff --git a/libempathy-gtk/empathy-ui-utils.c b/libempathy-gtk/empathy-ui-utils.c index 9fcdc985e..703d3e37c 100644 --- a/libempathy-gtk/empathy-ui-utils.c +++ b/libempathy-gtk/empathy-ui-utils.c @@ -206,6 +206,7 @@ empathy_icon_name_for_presence (TpConnectionPresenceType presence) case TP_CONNECTION_PRESENCE_TYPE_UNKNOWN: return EMPATHY_IMAGE_PENDING; case TP_CONNECTION_PRESENCE_TYPE_UNSET: + default: return NULL; } diff --git a/libempathy/empathy-contact.c b/libempathy/empathy-contact.c index e7286ac84..5347e7f38 100644 --- a/libempathy/empathy-contact.c +++ b/libempathy/empathy-contact.c @@ -1048,7 +1048,13 @@ empathy_contact_is_online (EmpathyContact *contact) case TP_CONNECTION_PRESENCE_TYPE_OFFLINE: case TP_CONNECTION_PRESENCE_TYPE_UNKNOWN: case TP_CONNECTION_PRESENCE_TYPE_ERROR: + case TP_CONNECTION_PRESENCE_TYPE_UNSET: return FALSE; + case TP_CONNECTION_PRESENCE_TYPE_AVAILABLE: + case TP_CONNECTION_PRESENCE_TYPE_AWAY: + case TP_CONNECTION_PRESENCE_TYPE_EXTENDED_AWAY: + case TP_CONNECTION_PRESENCE_TYPE_HIDDEN: + case TP_CONNECTION_PRESENCE_TYPE_BUSY: default: return TRUE; } diff --git a/libempathy/empathy-dispatch-operation.c b/libempathy/empathy-dispatch-operation.c index e59d69771..fa71f0130 100644 --- a/libempathy/empathy-dispatch-operation.c +++ b/libempathy/empathy-dispatch-operation.c @@ -130,10 +130,11 @@ empathy_dispatch_operation_set_property (GObject *object, case PROP_INCOMING: priv->incoming = g_value_get_boolean (value); break; - case PROP_USER_ACTION_TIME: priv->user_action_time = g_value_get_int64 (value); break; + default: + g_assert_not_reached (); } } @@ -167,6 +168,8 @@ empathy_dispatch_operation_get_property (GObject *object, case PROP_USER_ACTION_TIME: g_value_set_int64 (value, priv->user_action_time); break; + default: + g_assert_not_reached (); } } diff --git a/libempathy/empathy-dispatcher.c b/libempathy/empathy-dispatcher.c index 30369c849..1cec0e9d8 100644 --- a/libempathy/empathy-dispatcher.c +++ b/libempathy/empathy-dispatcher.c @@ -526,6 +526,9 @@ dispatcher_start_dispatching (EmpathyDispatcher *self, case EMPATHY_DISPATCHER_OPERATION_STATE_PENDING: dispatch_operation_ready_cb (operation, self); break; + case EMPATHY_DISPATCHER_OPERATION_STATE_DISPATCHING: + case EMPATHY_DISPATCHER_OPERATION_STATE_CLAIMED: + case EMPATHY_DISPATCHER_OPERATION_STATE_INVALIDATED: default: g_assert_not_reached (); } diff --git a/libempathy/empathy-ft-handler.c b/libempathy/empathy-ft-handler.c index 0140fc3cc..9fd993115 100644 --- a/libempathy/empathy-ft-handler.c +++ b/libempathy/empathy-ft-handler.c @@ -584,6 +584,7 @@ tp_file_hash_to_g_checksum (TpFileHashType type) case TP_FILE_HASH_TYPE_SHA256: retval = G_CHECKSUM_SHA256; break; + case TP_FILE_HASH_TYPE_NONE: default: g_assert_not_reached (); break; diff --git a/libempathy/empathy-message.c b/libempathy/empathy-message.c index 07827f8e0..0ac6e01b5 100644 --- a/libempathy/empathy-message.c +++ b/libempathy/empathy-message.c @@ -603,6 +603,9 @@ empathy_message_type_to_str (TpChannelTextMessageType type) return "notice"; case TP_CHANNEL_TEXT_MESSAGE_TYPE_AUTO_REPLY: return "auto-reply"; + case TP_CHANNEL_TEXT_MESSAGE_TYPE_DELIVERY_REPORT: + return "delivery-report"; + case TP_CHANNEL_TEXT_MESSAGE_TYPE_NORMAL: default: return "normal"; } diff --git a/libempathy/empathy-status-presets.c b/libempathy/empathy-status-presets.c index 255f7ab21..319ca53d9 100644 --- a/libempathy/empathy-status-presets.c +++ b/libempathy/empathy-status-presets.c @@ -431,6 +431,8 @@ empathy_status_presets_is_valid (TpConnectionPresenceType state) case TP_CONNECTION_PRESENCE_TYPE_HIDDEN: case TP_CONNECTION_PRESENCE_TYPE_BUSY: return TRUE; + + default: + return FALSE; } - return FALSE; } diff --git a/libempathy/empathy-utils.c b/libempathy/empathy-utils.c index b47987f85..fdc5b465d 100644 --- a/libempathy/empathy-utils.c +++ b/libempathy/empathy-utils.c @@ -254,6 +254,7 @@ empathy_presence_get_default_message (TpConnectionPresenceType presence) return _("Unknown"); case TP_CONNECTION_PRESENCE_TYPE_UNSET: case TP_CONNECTION_PRESENCE_TYPE_ERROR: + default: return NULL; } @@ -643,6 +644,12 @@ empathy_connect_new_account (TpAccount *account, g_free (message); break; + case TP_CONNECTION_PRESENCE_TYPE_AVAILABLE: + case TP_CONNECTION_PRESENCE_TYPE_AWAY: + case TP_CONNECTION_PRESENCE_TYPE_EXTENDED_AWAY: + case TP_CONNECTION_PRESENCE_TYPE_HIDDEN: + case TP_CONNECTION_PRESENCE_TYPE_BUSY: + case TP_CONNECTION_PRESENCE_TYPE_ERROR: default: /* do nothing if the presence is not offline */ break; diff --git a/src/empathy-account-assistant.c b/src/empathy-account-assistant.c index 6ad475652..585916903 100644 --- a/src/empathy-account-assistant.c +++ b/src/empathy-account-assistant.c @@ -57,12 +57,12 @@ typedef enum { RESPONSE_CREATE_STOP = 2 } CreateEnterPageResponse; -enum { +typedef enum { PAGE_INTRO = 0, PAGE_IMPORT = 1, PAGE_ENTER_CREATE = 2, PAGE_SALUT = 3, -}; +} PageID; enum { PROP_PARENT = 1, @@ -75,7 +75,7 @@ typedef struct { gboolean enter_create_forward; TpAccountManager *account_mgr; EmpathyConnectionManagers *connection_mgrs; - gint current_page_id; + PageID current_page_id; /* enter or create page */ GtkWidget *enter_or_create_page; @@ -933,12 +933,8 @@ impl_signal_prepare (GtkAssistant *assistant, gint current_idx; /* check from which page we are coming from */ - switch (priv->current_page_id) - { - case PAGE_IMPORT: - empathy_import_widget_add_selected_accounts (priv->iw); - break; - } + if (priv->current_page_id == PAGE_IMPORT) + empathy_import_widget_add_selected_accounts (priv->iw); current_idx = gtk_assistant_get_current_page (assistant); priv->current_page_id = current_idx; diff --git a/src/empathy-call-window.c b/src/empathy-call-window.c index d64d59302..c2416ea03 100644 --- a/src/empathy-call-window.c +++ b/src/empathy-call-window.c @@ -2377,6 +2377,10 @@ media_stream_error_to_txt (EmpathyCallWindow *self, case TP_MEDIA_STREAM_ERROR_MEDIA_ERROR: return g_strdup (_("There was a failure in the call engine")); + case TP_MEDIA_STREAM_ERROR_EOS: + return g_strdup (_("The end of the stream was reached")); + + case TP_MEDIA_STREAM_ERROR_UNKNOWN: default: return NULL; } @@ -2737,6 +2741,31 @@ empathy_call_window_bus_message (GstBus *bus, GstMessage *message, g_error_free (error); g_free (debug); } + case GST_MESSAGE_UNKNOWN: + case GST_MESSAGE_EOS: + case GST_MESSAGE_WARNING: + case GST_MESSAGE_INFO: + case GST_MESSAGE_TAG: + case GST_MESSAGE_BUFFERING: + case GST_MESSAGE_STATE_DIRTY: + case GST_MESSAGE_STEP_DONE: + case GST_MESSAGE_CLOCK_PROVIDE: + case GST_MESSAGE_CLOCK_LOST: + case GST_MESSAGE_NEW_CLOCK: + case GST_MESSAGE_STRUCTURE_CHANGE: + case GST_MESSAGE_STREAM_STATUS: + case GST_MESSAGE_APPLICATION: + case GST_MESSAGE_ELEMENT: + case GST_MESSAGE_SEGMENT_START: + case GST_MESSAGE_SEGMENT_DONE: + case GST_MESSAGE_DURATION: + case GST_MESSAGE_LATENCY: + case GST_MESSAGE_ASYNC_START: + case GST_MESSAGE_ASYNC_DONE: + case GST_MESSAGE_REQUEST_STATE: + case GST_MESSAGE_STEP_START: + case GST_MESSAGE_QOS: + case GST_MESSAGE_ANY: default: break; } diff --git a/src/empathy-ft-manager.c b/src/empathy-ft-manager.c index 58edc584e..14f67e51a 100644 --- a/src/empathy-ft-manager.c +++ b/src/empathy-ft-manager.c @@ -881,6 +881,8 @@ ft_manager_response_cb (GtkWidget *widget, case RESPONSE_STOP: ft_manager_stop (manager); break; + default: + g_assert_not_reached (); } } diff --git a/src/empathy-main-window.c b/src/empathy-main-window.c index 4aa38f5f4..73d84ab44 100644 --- a/src/empathy-main-window.c +++ b/src/empathy-main-window.c @@ -1017,6 +1017,9 @@ account_status_changed_cb (TpAccount *account, case TP_CONNECTION_STATUS_CONNECTED: /* We can join the room */ break; + + default: + g_assert_not_reached (); } join_chatroom (ctx->chatroom, ctx->timestamp); -- cgit v1.2.3