From d440df54a8a719d6da8f9d6556e1191bfdb38924 Mon Sep 17 00:00:00 2001 From: Srinivasa Ragavan Date: Sun, 2 Sep 2007 18:56:05 +0000 Subject: ** Fix for bug #471791 (Move away from asserts to g_ret*) svn path=/trunk/; revision=34159 --- shell/ChangeLog | 13 +++++++++++++ shell/e-shell-importer.c | 7 +++++-- shell/e-shell-window-commands.c | 2 +- shell/e-shell-window.c | 15 +++++++-------- shell/e-shell.c | 10 +++++----- shell/e-user-creatable-items-handler.c | 6 +++--- shell/main.c | 4 ++-- 7 files changed, 36 insertions(+), 21 deletions(-) diff --git a/shell/ChangeLog b/shell/ChangeLog index d1410e0a10..6a1da2b985 100644 --- a/shell/ChangeLog +++ b/shell/ChangeLog @@ -1,3 +1,16 @@ +2007-09-03 Srinivasa Ragavan + + ** Fix for bug #471791 (Move away from asserts to g_ret*) + + * e-shell-importer.c: (create_help): + * e-shell-window-commands.c: (update_offline_menu_item): + * e-shell-window.c: (init_view), (update_offline_toggle_status), + (offline_toggle_clicked_callback), (setup_offline_toggle): + * e-shell.c: (window_delete_event_cb), (e_shell_construct), + (remove_dir), (e_shell_attempt_upgrade): + * e-user-creatable-items-handler.c: (execute_verb): + * main.c: (open_uris), (idle_cb): + 2007-08-08 Srinivasa Ragavan ** Add a new command line option to disable crash-on-select mails, diff --git a/shell/e-shell-importer.c b/shell/e-shell-importer.c index 35bb771653..ab8d4f6caa 100644 --- a/shell/e-shell-importer.c +++ b/shell/e-shell-importer.c @@ -165,9 +165,12 @@ create_help (const char *name) if (!strcmp (name, info[i].name)) break; } - g_assert(i != num_info); - label = gtk_label_new(_(info[i].text)); + if (i >= num_info) + g_warning ("i > num_info\n"); + + + label = gtk_label_new(i < num_info ? _(info[i].text): NULL); gtk_widget_show (label); gtk_label_set_line_wrap((GtkLabel *)label, TRUE); diff --git a/shell/e-shell-window-commands.c b/shell/e-shell-window-commands.c index 7d75517786..e2b6fc94f1 100644 --- a/shell/e-shell-window-commands.c +++ b/shell/e-shell-window-commands.c @@ -837,7 +837,7 @@ update_offline_menu_item (EShellWindow *shell_window, break; default: - g_assert_not_reached (); + g_return_if_reached(); } } diff --git a/shell/e-shell-window.c b/shell/e-shell-window.c index 7ddf6aa429..eb4708cc7a 100644 --- a/shell/e-shell-window.c +++ b/shell/e-shell-window.c @@ -228,9 +228,9 @@ init_view (EShellWindow *window, int sidebar_notebook_page_num; int view_notebook_page_num; - g_assert (view->view_widget == NULL); - g_assert (view->sidebar_widget == NULL); - g_assert (view->notebook_page_num == -1); + g_return_if_fail (view->view_widget == NULL); + g_return_if_fail (view->sidebar_widget == NULL); + g_return_if_fail (view->notebook_page_num == -1); CORBA_exception_init (&ev); @@ -294,7 +294,7 @@ init_view (EShellWindow *window, view_notebook_page_num = gtk_notebook_page_num (GTK_NOTEBOOK (priv->view_notebook), view->view_widget); /* Since we always add a view page and a sidebar page at the same time... */ - g_assert (sidebar_notebook_page_num == view_notebook_page_num); + g_return_if_fail (sidebar_notebook_page_num == view_notebook_page_num); view->notebook_page_num = view_notebook_page_num; @@ -398,8 +398,7 @@ update_offline_toggle_status (EShellWindow *window) flags = ES_MENU_SHELL_OFFLINE; break; default: - g_assert_not_reached (); - return; + g_return_if_reached (); } gtk_image_set_from_pixmap (GTK_IMAGE (priv->offline_toggle_image), icon_pixmap, icon_mask); @@ -488,7 +487,7 @@ offline_toggle_clicked_callback (GtkButton *button, e_shell_go_online (priv->shell, window, GNOME_Evolution_USER_ONLINE); break; default: - g_assert_not_reached (); + g_return_if_reached(); } } @@ -582,7 +581,7 @@ setup_offline_toggle (EShellWindow *window) update_offline_toggle_status (window); - g_assert (priv->status_bar != NULL); + g_return_if_fail (priv->status_bar != NULL); gtk_box_pack_start (GTK_BOX (priv->status_bar), priv->offline_toggle, FALSE, TRUE, 0); } diff --git a/shell/e-shell.c b/shell/e-shell.c index 667b02299d..5a8091e2af 100644 --- a/shell/e-shell.c +++ b/shell/e-shell.c @@ -351,7 +351,7 @@ window_delete_event_cb (GtkWidget *widget, { EShell *shell; - g_assert (E_IS_SHELL_WINDOW (widget)); + g_return_val_if_fail (E_IS_SHELL_WINDOW (widget), TRUE); shell = E_SHELL (data); return ! e_shell_request_close_window (shell, E_SHELL_WINDOW (widget)); @@ -706,7 +706,7 @@ e_shell_construct (EShell *shell, break; default: start_online = FALSE; /* Make compiler happy. */ - g_assert_not_reached (); + g_return_val_if_reached(E_SHELL_CONSTRUCT_RESULT_OK); } e_passwords_set_online(start_online); @@ -767,8 +767,8 @@ remove_dir(const char *root, const char *path) goto fail; /* make sure we're really removing something from evolution dir */ - g_assert(strlen(path) >= strlen(root) - && strncmp(root, path, strlen(root)) == 0); + g_return_val_if_fail (strlen(path) >= strlen(root) + && strncmp(root, path, strlen(root)) == 0, -1); if (S_ISDIR(st.st_mode)) { if (remove_dir(root, new) == -1) @@ -813,7 +813,7 @@ e_shell_attempt_upgrade (EShell *shell) oldpath = g_build_filename(g_get_home_dir(), "evolution", NULL); - g_assert(sscanf(BASE_VERSION, "%u.%u", &cmajor, &cminor) == 2); + g_return_val_if_fail (sscanf(BASE_VERSION, "%u.%u", &cmajor, &cminor) == 2, TRUE); crevision = atoi(UPGRADE_REVISION); detect_version (gconf_client, &major, &minor, &revision); diff --git a/shell/e-user-creatable-items-handler.c b/shell/e-user-creatable-items-handler.c index c80796cffb..0ed012ea69 100644 --- a/shell/e-user-creatable-items-handler.c +++ b/shell/e-user-creatable-items-handler.c @@ -357,15 +357,15 @@ execute_verb (EUserCreatableItemsHandler *handler, priv = handler->priv; p = strchr (verb_name, ':'); - g_assert (p != NULL); + g_return_if_fail (p != NULL); component_number = atoi (p + 1); p = strchr (p + 1, ':'); - g_assert (p != NULL); + g_return_if_fail (p != NULL); id = p + 1; component_list_item = g_slist_nth (priv->components, component_number); - g_assert (component_list_item != NULL); + g_return_if_fail (component_list_item != NULL); component = (const Component *) component_list_item->data; diff --git a/shell/main.c b/shell/main.c index 24183e553f..9fb14522a9 100644 --- a/shell/main.c +++ b/shell/main.c @@ -290,7 +290,7 @@ open_uris (GNOME_Evolution_Shell corba_shell, gchar **uris) CORBA_Environment ev; guint n_uris, ii; - g_assert (uris != NULL); + g_return_if_fail (uris != NULL); n_uris = g_strv_length (uris); CORBA_exception_init (&ev); @@ -316,7 +316,7 @@ idle_cb (gchar **uris) EShellConstructResult result; EShellStartupLineMode startup_line_mode; - g_assert (uris == NULL || g_strv_length (uris) > 0); + g_return_val_if_fail (uris == NULL || g_strv_length (uris) > 0, FALSE); #ifdef KILL_PROCESS_CMD kill_old_dataserver (); -- cgit