aboutsummaryrefslogtreecommitdiffstats
path: root/mail
diff options
context:
space:
mode:
Diffstat (limited to 'mail')
-rw-r--r--mail/ChangeLog45
-rw-r--r--mail/em-account-editor.c4
-rw-r--r--mail/em-filter-editor.c2
-rw-r--r--mail/em-filter-rule.c2
-rw-r--r--mail/em-folder-properties.c4
-rw-r--r--mail/em-folder-tree-model.c4
-rw-r--r--mail/em-folder-tree.c3
-rw-r--r--mail/em-folder-utils.c3
-rw-r--r--mail/em-folder-view.c4
-rw-r--r--mail/em-format-html-display.c6
-rw-r--r--mail/em-format-html.c7
-rw-r--r--mail/em-format.c12
-rw-r--r--mail/em-migrate.c2
-rw-r--r--mail/em-sync-stream.c2
-rw-r--r--mail/em-utils.c2
-rw-r--r--mail/em-vfolder-rule.c12
-rw-r--r--mail/mail-component.c10
-rw-r--r--mail/mail-config-factory.c2
-rw-r--r--mail/mail-config.c3
-rw-r--r--mail/mail-folder-cache.c6
-rw-r--r--mail/mail-mt.c2
-rw-r--r--mail/mail-ops.c10
-rw-r--r--mail/mail-send-recv.c6
-rw-r--r--mail/mail-session.c2
-rw-r--r--mail/mail-tools.c2
-rw-r--r--mail/mail-vfolder.c34
-rw-r--r--mail/message-list.c49
27 files changed, 157 insertions, 83 deletions
diff --git a/mail/ChangeLog b/mail/ChangeLog
index df64a2e602..5ab9fc61d8 100644
--- a/mail/ChangeLog
+++ b/mail/ChangeLog
@@ -1,3 +1,48 @@
+2007-08-31 Srinivasa Ragavan <sragavan@novell.com>
+
+ ** Move away from g_assert to g_return* calls
+
+ * em-account-editor.c: (emae_auto_detect), (emae_queue_widgets):
+ * em-filter-editor.c: (select_source):
+ * em-filter-rule.c: (xml_encode):
+ * em-folder-properties.c: (emfp_commit), (emfp_get_folder_item):
+ * em-folder-tree-model.c: (folder_renamed):
+ * em-folder-tree.c: (em_folder_tree_get_model_storeinfo):
+ * em-folder-utils.c: (emfu_popup_new_folder_response):
+ * em-folder-view.c: (emfv_setup_view_instance):
+ * em-format-html-display.c: (efhd_attachment_optional):
+ * em-format-html.c: (em_format_html_add_pobject),
+ (efh_format_timeout):
+ * em-format.c: (em_format_add_puri):
+ * em-migrate.c: (emm_setup_initial):
+ * em-sync-stream.c: (sync_op):
+ * em-utils.c: (em_uri_to_camel):
+ * em-vfolder-rule.c: (em_vfolder_rule_add_source),
+ (em_vfolder_rule_find_source), (em_vfolder_rule_remove_source),
+ (xml_encode):
+ * mail-component.c: (view_control_activate_cb), (setline_done),
+ (mail_component_get_folder), (mail_component_get_folder_uri):
+ * mail-config-factory.c: (mail_config_control_factory_cb):
+ * mail-config.c: (mail_config_get_accounts):
+ * mail-folder-cache.c: (mail_note_store_remove), (mail_note_store):
+ * mail-mt.c: (do_op_status):
+ * mail-ops.c: (mail_append_mail), (mail_transfer_messages):
+ * mail-send-recv.c: (free_send_data), (mail_send_receive),
+ (mail_receive_uri):
+ * mail-session.c: (alert_user):
+ * mail-tools.c: (mail_tool_uri_to_folder):
+ * mail-vfolder.c: (mail_vfolder_add_uri),
+ (mail_vfolder_delete_uri), (mail_vfolder_rename_uri),
+ (store_folder_renamed):
+ * message-list.c: (get_message_uid), (get_message_info),
+ (get_normalised_string), (ml_duplicate_value), (ml_free_value),
+ (ml_initialize_value), (ml_value_is_empty), (ml_value_to_string),
+ (subtree_unread), (subtree_size), (subtree_latest),
+ (ml_tree_value_at), (ml_tree_sort_value_at),
+ (ml_tree_set_value_at), (build_subtree), (add_node_diff),
+ (remove_node_diff), (build_subtree_diff), (ml_getselected_cb),
+ (message_list_thaw):
+
2007-08-30 Gavin Scott <gavindscott@yahoo.com>
** Fixes bug #351672
diff --git a/mail/em-account-editor.c b/mail/em-account-editor.c
index 5fd986d938..1bf6900413 100644
--- a/mail/em-account-editor.c
+++ b/mail/em-account-editor.c
@@ -563,7 +563,7 @@ emae_auto_detect(EMAccountEditor *emae)
continue;
/* only 2 providers use this, and they only do it for 3 entries only */
- g_assert(entries[i].type == CAMEL_PROVIDER_CONF_ENTRY);
+ g_return_if_fail (entries[i].type == CAMEL_PROVIDER_CONF_ENTRY);
w = NULL;
for (l = emae->priv->extra_items;l;l=g_slist_next(l)) {
@@ -1752,7 +1752,7 @@ emae_queue_widgets(EMAccountEditor *emae, GladeXML *xml, const char *first, ...)
}
va_end(ap);
- g_assert(i < sizeof(emae->priv->widgets)/sizeof(emae->priv->widgets[0]));
+ g_return_if_fail(i < sizeof(emae->priv->widgets)/sizeof(emae->priv->widgets[0]));
emae->priv->widgets[i] = NULL;
emae->priv->widgets_index = 0;
diff --git a/mail/em-filter-editor.c b/mail/em-filter-editor.c
index 7d98a96583..35aec1c38b 100644
--- a/mail/em-filter-editor.c
+++ b/mail/em-filter-editor.c
@@ -127,7 +127,7 @@ select_source (GtkMenuItem *mi, EMFilterEditor *fe)
char *source;
source = g_object_get_data(G_OBJECT(mi), "source");
- g_assert (source);
+ g_return_if_fail (source);
rule_editor_set_source ((RuleEditor *)fe, source);
}
diff --git a/mail/em-filter-rule.c b/mail/em-filter-rule.c
index a68f135e15..b4ea9abbf0 100644
--- a/mail/em-filter-rule.c
+++ b/mail/em-filter-rule.c
@@ -220,7 +220,7 @@ xml_encode(FilterRule *fr)
GList *l;
node = FILTER_RULE_CLASS(parent_class)->xml_encode(fr);
- g_assert(node != NULL);
+ g_return_val_if_fail (node != NULL, NULL);
set = xmlNewNode(NULL, (const unsigned char *)"actionset");
xmlAddChild(node, set);
l = ff->actions;
diff --git a/mail/em-folder-properties.c b/mail/em-folder-properties.c
index 711b7f3652..b2a8a47736 100644
--- a/mail/em-folder-properties.c
+++ b/mail/em-folder-properties.c
@@ -97,7 +97,7 @@ emfp_commit(EConfig *ec, GSList *items, void *data)
arg->ca_str = (char *) gtk_entry_get_text ((GtkEntry *) prop_data->widgets[i]);
break;
default:
- g_assert_not_reached ();
+ g_warning ("This shouldn't be reached\n");
break;
}
}
@@ -203,7 +203,7 @@ emfp_get_folder_item(EConfig *ec, EConfigItem *item, struct _GtkWidget *parent,
prop_data->widgets[i] = w;
break;
default:
- g_assert_not_reached ();
+ g_warning ("This shouldn't be reached\n");
break;
}
diff --git a/mail/em-folder-tree-model.c b/mail/em-folder-tree-model.c
index 32172aa961..8fe8ae12f0 100644
--- a/mail/em-folder-tree-model.c
+++ b/mail/em-folder-tree-model.c
@@ -725,7 +725,7 @@ folder_renamed (CamelStore *store, CamelRenameInfo *info, EMFolderTreeModel *mod
* suppose if it does in reality, we can add
* code here to add the missing nodes to the
* tree */
- g_assert_not_reached ();
+ g_warning ("This shouldn't be reached\n");
g_free (parent);
goto done;
}
@@ -737,7 +737,7 @@ folder_renamed (CamelStore *store, CamelRenameInfo *info, EMFolderTreeModel *mod
if (!gtk_tree_model_get_iter ((GtkTreeModel *) model, &root, path)) {
gtk_tree_path_free (path);
- g_assert_not_reached ();
+ g_warning ("This shouldn't be reached\n");
goto done;
}
diff --git a/mail/em-folder-tree.c b/mail/em-folder-tree.c
index c4e4d7ff04..05bdfbc904 100644
--- a/mail/em-folder-tree.c
+++ b/mail/em-folder-tree.c
@@ -2577,8 +2577,7 @@ em_folder_tree_get_model_storeinfo (EMFolderTree *emft, CamelStore *store)
struct _EMFolderTreeModelStoreInfo *si;
if (!(si = g_hash_table_lookup (priv->model->store_hash, store))) {
- g_assert_not_reached ();
- return NULL;
+ g_return_val_if_reached (NULL);
}
return si;
}
diff --git a/mail/em-folder-utils.c b/mail/em-folder-utils.c
index c795bb90f9..500741ae41 100644
--- a/mail/em-folder-utils.c
+++ b/mail/em-folder-utils.c
@@ -709,9 +709,8 @@ emfu_popup_new_folder_response (EMFolderSelector *emfs, int response, gpointer d
}
if (!(si = em_folder_tree_get_model_storeinfo (emfs->emft, store))) {
- g_assert_not_reached ();
camel_object_unref (store);
- return;
+ g_return_if_reached();
}
/* HACK: we need to create vfolders using the vfolder editor */
diff --git a/mail/em-folder-view.c b/mail/em-folder-view.c
index 6ad0afaf15..72aba77213 100644
--- a/mail/em-folder-view.c
+++ b/mail/em-folder-view.c
@@ -589,8 +589,8 @@ emfv_setup_view_instance(EMFolderView *emfv)
gboolean outgoing, show_wide;
char *id;
- g_assert(emfv->folder);
- g_assert(emfv->folder_uri);
+ g_return_if_fail (emfv->folder);
+ g_return_if_fail (emfv->folder_uri);
if (collection == NULL) {
ETableSpecification *spec;
diff --git a/mail/em-format-html-display.c b/mail/em-format-html-display.c
index 13b9e0d64f..4d6e467a31 100644
--- a/mail/em-format-html-display.c
+++ b/mail/em-format-html-display.c
@@ -2477,8 +2477,10 @@ efhd_attachment_optional(EMFormatHTML *efh, GtkHTMLEmbedded *eb, EMFormatHTMLPOb
d(printf("adding attachment button/content for optional rendering\n"));
info = (struct _attach_puri *)em_format_find_puri((EMFormat *)efh, pobject->classid);
- g_assert(info != NULL);
- g_assert(info->forward == NULL);
+ if (!info || info->forward) {
+ g_warning ("unable to expand the attachment\n");
+ return TRUE;
+ }
scroll = gtk_scrolled_window_new (NULL, NULL);
mainbox = gtk_hbox_new(FALSE, 0);
diff --git a/mail/em-format-html.c b/mail/em-format-html.c
index 47c62e4c23..afd2c653a5 100644
--- a/mail/em-format-html.c
+++ b/mail/em-format-html.c
@@ -348,7 +348,10 @@ em_format_html_add_pobject(EMFormatHTML *efh, size_t size, const char *classid,
{
EMFormatHTMLPObject *pobj;
- g_assert(size >= sizeof(EMFormatHTMLPObject));
+ if (size < sizeof(EMFormatHTMLPObject)) {
+ g_warning ("size is less than the size of EMFormatHTMLPObject\n");
+ size = sizeof(EMFormatHTMLPObject);
+ }
pobj = g_malloc0(size);
if (classid)
@@ -1359,7 +1362,7 @@ efh_format_timeout(struct _format_msg *m)
return TRUE;
}
- g_assert(e_dlist_empty(&p->pending_jobs));
+ g_return_val_if_fail (e_dlist_empty(&p->pending_jobs), FALSE);
d(printf(" ready to go, firing off format thread\n"));
diff --git a/mail/em-format.c b/mail/em-format.c
index 7584f3301f..815b8cb0c3 100644
--- a/mail/em-format.c
+++ b/mail/em-format.c
@@ -333,7 +333,11 @@ em_format_add_puri(EMFormat *emf, size_t size, const char *cid, CamelMimePart *p
d(printf("adding puri for part: %s\n", emf->part_id->str));
- g_assert(size >= sizeof(*puri));
+ if (size < sizeof(*puri)) {
+ g_warning ("size (%d) less than size of puri\n", size);
+ size = sizeof (*puri);
+ }
+
puri = g_malloc0(size);
puri->format = emf;
@@ -374,9 +378,9 @@ em_format_add_puri(EMFormat *emf, size_t size, const char *cid, CamelMimePart *p
}
}
- g_assert(puri->cid != NULL);
- g_assert(emf->pending_uri_level != NULL);
- g_assert(emf->pending_uri_table != NULL);
+ g_return_val_if_fail (puri->cid != NULL, NULL);
+ g_return_val_if_fail (emf->pending_uri_level != NULL, NULL);
+ g_return_val_if_fail (emf->pending_uri_table != NULL, NULL);
e_dlist_addtail(&emf->pending_uri_level->uri_list, (EDListNode *)puri);
diff --git a/mail/em-migrate.c b/mail/em-migrate.c
index 82109a1f3c..06bc8bfe2b 100644
--- a/mail/em-migrate.c
+++ b/mail/em-migrate.c
@@ -2706,7 +2706,7 @@ emm_setup_initial(const char *evolution_dir)
}
/* Make sure we found one. */
- g_assert (*language_names != NULL);
+ g_return_val_if_fail (*language_names != NULL, 0);
dir = g_dir_open(local, 0, NULL);
if (dir) {
diff --git a/mail/em-sync-stream.c b/mail/em-sync-stream.c
index 26201ea7e9..ded71b7ba4 100644
--- a/mail/em-sync-stream.c
+++ b/mail/em-sync-stream.c
@@ -228,7 +228,7 @@ sync_op(EMSyncStream *emss, enum _write_msg_t op, const char *data, size_t n)
e_msgport_put(p->data_port, &msg.msg);
reply_msg = e_msgport_wait(p->reply_port);
- g_assert(reply_msg == &msg.msg);
+ g_return_if_fail (reply_msg == &msg.msg);
d(printf("%p: returned sync op %d\n", emss, op));
}
diff --git a/mail/em-utils.c b/mail/em-utils.c
index 6a9762f02b..063dde8307 100644
--- a/mail/em-utils.c
+++ b/mail/em-utils.c
@@ -1737,7 +1737,7 @@ char *em_uri_to_camel(const char *euri)
if (eurl == NULL)
return g_strdup(euri);
- g_assert(eurl->host != NULL);
+ g_return_val_if_fail (eurl->host != NULL, g_strdup(euri));
if (eurl->user != NULL) {
/* Sigh, shoul'dve used mbox@local for mailboxes, not local@local */
diff --git a/mail/em-vfolder-rule.c b/mail/em-vfolder-rule.c
index f8dbf8e593..0852712a08 100644
--- a/mail/em-vfolder-rule.c
+++ b/mail/em-vfolder-rule.c
@@ -142,7 +142,7 @@ em_vfolder_rule_new(void)
void
em_vfolder_rule_add_source(EMVFolderRule *vr, const char *uri)
{
- g_assert(EM_IS_VFOLDER_RULE(vr));
+ g_return_if_fail (EM_IS_VFOLDER_RULE(vr));
g_return_if_fail (uri);
vr->sources = g_list_append(vr->sources, g_strdup(uri));
@@ -155,7 +155,7 @@ em_vfolder_rule_find_source(EMVFolderRule *vr, const char *uri)
{
GList *l;
- g_assert(EM_IS_VFOLDER_RULE(vr));
+ g_return_val_if_fail (EM_IS_VFOLDER_RULE(vr), NULL);
/* only does a simple string or address comparison, should
probably do a decoded url comparison */
@@ -174,7 +174,7 @@ em_vfolder_rule_remove_source(EMVFolderRule *vr, const char *uri)
{
char *found;
- g_assert(EM_IS_VFOLDER_RULE(vr));
+ g_return_if_fail (EM_IS_VFOLDER_RULE(vr));
found =(char *)em_vfolder_rule_find_source(vr, uri);
if (found) {
@@ -256,9 +256,11 @@ xml_encode(FilterRule *fr)
EMVFolderRule *vr =(EMVFolderRule *)fr;
xmlNodePtr node, set, work;
GList *l;
+
node = FILTER_RULE_CLASS(parent_class)->xml_encode(fr);
- g_assert(node != NULL);
- g_assert(vr->with >= 0 && vr->with < sizeof(with_names)/sizeof(with_names[0]));
+ g_return_val_if_fail (node != NULL, NULL);
+ g_return_val_if_fail (vr->with >= 0 && vr->with < sizeof(with_names)/sizeof(with_names[0]), NULL);
+
set = xmlNewNode(NULL, (const unsigned char *)"sources");
xmlAddChild(node, set);
xmlSetProp(set, (const unsigned char *)"with", (unsigned char *)with_names[vr->with]);
diff --git a/mail/mail-component.c b/mail/mail-component.c
index 79d5350fc8..6e1c1f0732 100644
--- a/mail/mail-component.c
+++ b/mail/mail-component.c
@@ -404,7 +404,7 @@ view_control_activate_cb (BonoboControl *control, gboolean activate, EMFolderVie
static int recover = 0;
uic = bonobo_control_get_ui_component (control);
- g_assert (uic != NULL);
+ g_return_if_fail (uic != NULL);
if (activate) {
Bonobo_UIContainer container;
@@ -413,7 +413,7 @@ view_control_activate_cb (BonoboControl *control, gboolean activate, EMFolderVie
bonobo_ui_component_set_container (uic, container, NULL);
bonobo_object_release_unref (container, NULL);
- g_assert (container == bonobo_ui_component_get_container(uic));
+ g_return_if_fail (container == bonobo_ui_component_get_container(uic));
g_return_if_fail (container != CORBA_OBJECT_NIL);
em_folder_view_activate (view, uic, activate);
@@ -1053,7 +1053,7 @@ setline_done(CamelStore *store, void *data)
{
struct _setline_data *sd = data;
- g_assert(sd->pending > 0);
+ g_return_if_fail (sd->pending > 0);
sd->pending--;
if (sd->pending == 0) {
@@ -1439,7 +1439,7 @@ mail_component_peek_local_store (MailComponent *mc)
struct _CamelFolder *
mail_component_get_folder(MailComponent *mc, enum _mail_component_folder_t id)
{
- g_assert(id <= MAIL_COMPONENT_FOLDER_LOCAL_INBOX);
+ g_return_val_if_fail (id <= MAIL_COMPONENT_FOLDER_LOCAL_INBOX, NULL);
MAIL_COMPONENT_DEFAULT(mc);
mc_setup_local_store(mc);
@@ -1459,7 +1459,7 @@ mail_component_get_folder(MailComponent *mc, enum _mail_component_folder_t id)
const char *
mail_component_get_folder_uri(MailComponent *mc, enum _mail_component_folder_t id)
{
- g_assert(id <= MAIL_COMPONENT_FOLDER_LOCAL_INBOX);
+ g_return_val_if_fail (id <= MAIL_COMPONENT_FOLDER_LOCAL_INBOX, NULL);
MAIL_COMPONENT_DEFAULT(mc);
mc_setup_local_store(mc);
diff --git a/mail/mail-config-factory.c b/mail/mail-config-factory.c
index 9c2525df14..1166e9ee51 100644
--- a/mail/mail-config-factory.c
+++ b/mail/mail-config-factory.c
@@ -49,7 +49,7 @@ mail_config_control_factory_cb (BonoboGenericFactory *factory, const char *compo
} else if (!strcmp (component_id, EM_COMPOSER_PREFS_CONTROL_ID)) {
prefs = em_composer_prefs_new ();
} else {
- g_assert_not_reached ();
+ g_return_val_if_reached(NULL);
}
gtk_widget_show_all (prefs);
diff --git a/mail/mail-config.c b/mail/mail-config.c
index e85661bf53..668a8c4483 100644
--- a/mail/mail-config.c
+++ b/mail/mail-config.c
@@ -768,7 +768,8 @@ mail_config_prune_proxies (void)
EAccountList *
mail_config_get_accounts (void)
{
- g_assert (config != NULL);
+ if (config == NULL)
+ mail_config_init ();
return config->accounts;
}
diff --git a/mail/mail-folder-cache.c b/mail/mail-folder-cache.c
index fe2d99f4f3..9cc0910136 100644
--- a/mail/mail-folder-cache.c
+++ b/mail/mail-folder-cache.c
@@ -798,7 +798,7 @@ mail_note_store_remove(CamelStore *store)
struct _update_data *ud;
struct _store_info *si;
- g_assert(CAMEL_IS_STORE(store));
+ g_return_if_fail (CAMEL_IS_STORE(store));
if (stores == NULL)
return;
@@ -970,8 +970,8 @@ mail_note_store(CamelStore *store, CamelOperation *op,
guint timeout;
int hook = 0;
- g_assert(CAMEL_IS_STORE(store));
- g_assert(pthread_equal(pthread_self(), mail_gui_thread));
+ g_return_if_fail (CAMEL_IS_STORE(store));
+ g_return_if_fail (pthread_equal(pthread_self(), mail_gui_thread));
LOCK(info_lock);
diff --git a/mail/mail-mt.c b/mail/mail-mt.c
index 4be57aaea4..09fdd996da 100644
--- a/mail/mail-mt.c
+++ b/mail/mail-mt.c
@@ -947,7 +947,7 @@ static void do_op_status(struct _mail_msg *mm)
char *out, *p, *o, c;
int pc;
- g_assert (pthread_equal(mail_gui_thread, pthread_self ()));
+ g_return_if_fail (pthread_equal(mail_gui_thread, pthread_self ()));
MAIL_MT_LOCK (mail_msg_lock);
diff --git a/mail/mail-ops.c b/mail/mail-ops.c
index 777639fc50..c02a9def2e 100644
--- a/mail/mail-ops.c
+++ b/mail/mail-ops.c
@@ -904,8 +904,8 @@ mail_append_mail (CamelFolder *folder, CamelMimeMessage *message, CamelMessageIn
{
struct _append_msg *m;
- g_assert(CAMEL_IS_FOLDER (folder));
- g_assert(CAMEL_IS_MIME_MESSAGE (message));
+ g_return_if_fail (CAMEL_IS_FOLDER (folder));
+ g_return_if_fail (CAMEL_IS_MIME_MESSAGE (message));
if (!camel_medium_get_header (CAMEL_MEDIUM (message), "X-Mailer"))
camel_medium_set_header (CAMEL_MEDIUM (message), "X-Mailer",
@@ -1022,9 +1022,9 @@ mail_transfer_messages (CamelFolder *source, GPtrArray *uids,
{
struct _transfer_msg *m;
- g_assert(CAMEL_IS_FOLDER (source));
- g_assert(uids != NULL);
- g_assert(dest_uri != NULL);
+ g_return_if_fail (CAMEL_IS_FOLDER (source));
+ g_return_if_fail (uids != NULL);
+ g_return_if_fail (dest_uri != NULL);
m = mail_msg_new(&transfer_messages_op, NULL, sizeof(*m));
m->source = source;
diff --git a/mail/mail-send-recv.c b/mail/mail-send-recv.c
index 5ee1f04fc1..a784d9b0db 100644
--- a/mail/mail-send-recv.c
+++ b/mail/mail-send-recv.c
@@ -191,7 +191,7 @@ free_send_data(void)
{
struct _send_data *data = send_data;
- g_assert(g_hash_table_size(data->active) == 0);
+ g_return_if_fail (g_hash_table_size(data->active) == 0);
if (data->inbox) {
mail_sync_folder(data->inbox, NULL, NULL);
@@ -942,8 +942,6 @@ mail_send_receive (void)
mail_get_store(info->uri, info->cancel, receive_update_got_store, info);
break;
default:
- /* Commented for pluggable hooks*/
- /* g_assert_not_reached () */
break;
}
scan = scan->next;
@@ -1145,7 +1143,7 @@ mail_receive_uri (const char *uri, int keep)
mail_get_store (info->uri, info->cancel, receive_update_got_store, info);
break;
default:
- g_assert_not_reached ();
+ g_return_if_reached();
}
}
diff --git a/mail/mail-session.c b/mail/mail-session.c
index 3d6d1f0674..4773fadda8 100644
--- a/mail/mail-session.c
+++ b/mail/mail-session.c
@@ -397,7 +397,7 @@ alert_user(CamelSession *session, CamelSessionAlertType type, const char *prompt
if (cancel) {
r = (struct _user_message_msg *)e_msgport_wait(user_message_reply);
- g_assert(m == r);
+ g_return_val_if_fail (m == r, FALSE);
ret = m->result;
mail_msg_free(m);
diff --git a/mail/mail-tools.c b/mail/mail-tools.c
index 69617b14f9..2cd33867f6 100644
--- a/mail/mail-tools.c
+++ b/mail/mail-tools.c
@@ -327,8 +327,6 @@ mail_tool_uri_to_folder (const char *uri, guint32 flags, CamelException *ex)
folder = camel_store_get_trash (store, ex);
else if (offset == 6)
folder = camel_store_get_junk (store, ex);
- else
- g_assert (FALSE);
} else
folder = camel_store_get_folder (store, name, flags, ex);
camel_object_unref (store);
diff --git a/mail/mail-vfolder.c b/mail/mail-vfolder.c
index 5b68e4e019..ba60971639 100644
--- a/mail/mail-vfolder.c
+++ b/mail/mail-vfolder.c
@@ -447,7 +447,7 @@ mail_vfolder_add_uri(CamelStore *store, const char *curi, int remove)
return;
}
- g_assert(pthread_equal(pthread_self(), mail_gui_thread));
+ g_return_if_fail (pthread_equal(pthread_self(), mail_gui_thread));
is_ignore = uri_is_ignore(store, curi);
@@ -508,7 +508,10 @@ mail_vfolder_add_uri(CamelStore *store, const char *curi, int remove)
if (found) {
vf = g_hash_table_lookup(vfolder_hash, rule->name);
- g_assert(vf);
+ if (!vf) {
+ g_warning ("vf is NULL for %s\n", rule->name);
+ continue;
+ }
camel_object_ref(vf);
folders = g_list_prepend(folders, vf);
}
@@ -540,7 +543,7 @@ mail_vfolder_delete_uri(CamelStore *store, const char *curi)
d(printf ("Deleting uri to check: %s\n", uri));
- g_assert (pthread_equal(pthread_self(), mail_gui_thread));
+ g_return_if_fail (pthread_equal(pthread_self(), mail_gui_thread));
changed = g_string_new ("");
@@ -549,6 +552,12 @@ mail_vfolder_delete_uri(CamelStore *store, const char *curi)
/* see if any rules directly reference this removed uri */
rule = NULL;
while ((rule = rule_context_next_rule ((RuleContext *) context, rule, NULL))) {
+
+ if (!rule->name) {
+ d(printf("invalid rule (%p): rule->name is set to NULL\n", rule));
+ continue;
+ }
+
source = NULL;
while ((source = em_vfolder_rule_next_source ((EMVFolderRule *) rule, source))) {
char *csource = em_uri_to_camel(source);
@@ -557,7 +566,10 @@ mail_vfolder_delete_uri(CamelStore *store, const char *curi)
because the adduri call above does the work async */
if (camel_store_folder_uri_equal(store, curi, csource)) {
vf = g_hash_table_lookup (vfolder_hash, rule->name);
- g_assert (vf != NULL);
+ if (!vf) {
+ g_warning ("vf is NULL for %s\n", rule->name);
+ continue;
+ }
g_signal_handlers_disconnect_matched (rule, G_SIGNAL_MATCH_FUNC|G_SIGNAL_MATCH_DATA, 0,
0, NULL, rule_changed, vf);
em_vfolder_rule_remove_source ((EMVFolderRule *)rule, source);
@@ -615,7 +627,7 @@ mail_vfolder_rename_uri(CamelStore *store, const char *cfrom, const char *cto)
if (context == NULL || uri_is_spethal(store, cfrom) || uri_is_spethal(store, cto))
return;
- g_assert(pthread_equal(pthread_self(), mail_gui_thread));
+ g_return_if_fail (pthread_equal(pthread_self(), mail_gui_thread));
from = em_uri_from_camel(cfrom);
to = em_uri_from_camel(cto);
@@ -634,7 +646,10 @@ mail_vfolder_rename_uri(CamelStore *store, const char *cfrom, const char *cto)
if (camel_store_folder_uri_equal(store, cfrom, csource)) {
d(printf("Vfolder '%s' used '%s' ('%s') now uses '%s'\n", rule->name, source, from, to));
vf = g_hash_table_lookup(vfolder_hash, rule->name);
- g_assert(vf);
+ if (!vf) {
+ g_warning ("vf is NULL for %s\n", rule->name);
+ continue;
+ }
g_signal_handlers_disconnect_matched(rule, G_SIGNAL_MATCH_FUNC|G_SIGNAL_MATCH_DATA, 0,
0, NULL, rule_changed, vf);
em_vfolder_rule_remove_source((EMVFolderRule *)rule, source);
@@ -866,7 +881,12 @@ store_folder_renamed(CamelObject *o, void *event_data, void *data)
g_hash_table_insert(vfolder_hash, g_strdup(info->new->full_name), folder);
rule = rule_context_find_rule((RuleContext *)context, info->old_base, NULL);
- g_assert(rule);
+ if (!rule) {
+ UNLOCK ();
+ g_warning ("Rule shouldn't be NULL\n");
+ return;
+ }
+
g_signal_handlers_disconnect_matched(rule, G_SIGNAL_MATCH_FUNC|G_SIGNAL_MATCH_DATA, 0,
0, NULL, rule_changed, folder);
filter_rule_set_name(rule, info->new->full_name);
diff --git a/mail/message-list.c b/mail/message-list.c
index 79f6c9e525..f1ecb782da 100644
--- a/mail/message-list.c
+++ b/mail/message-list.c
@@ -391,10 +391,10 @@ get_message_uid (MessageList *message_list, ETreePath node)
{
CamelMessageInfo *info;
- g_assert (node != NULL);
+ g_return_val_if_fail (node != NULL, NULL);
info = e_tree_memory_node_get_data (E_TREE_MEMORY (message_list->model), node);
/* correct me if I'm wrong, but this should never be NULL, should it? */
- g_assert (info != NULL);
+ g_return_val_if_fail (info != NULL, NULL);
return camel_message_info_uid (info);
}
@@ -407,9 +407,9 @@ get_message_info (MessageList *message_list, ETreePath node)
{
CamelMessageInfo *info;
- g_assert (node != NULL);
+ g_return_val_if_fail (node != NULL, NULL);
info = e_tree_memory_node_get_data (E_TREE_MEMORY (message_list->model), node);
- g_assert (info != NULL);
+ g_return_val_if_fail (info != NULL, NULL);
return info;
}
@@ -438,7 +438,7 @@ get_normalised_string (MessageList *message_list, CamelMessageInfo *info, int co
default:
string = NULL;
index = NORMALISED_LAST;
- g_assert_not_reached ();
+ g_warning ("Should not be reached\n");
}
/* slight optimisation */
@@ -913,7 +913,7 @@ ml_duplicate_value (ETreeModel *etm, int col, const void *value, void *data)
case COL_LOCATION:
return g_strdup (value);
default:
- g_assert_not_reached ();
+ g_warning ("This shouldn't be reached\n");
}
return NULL;
}
@@ -947,7 +947,7 @@ ml_free_value (ETreeModel *etm, int col, void *value, void *data)
g_free (value);
break;
default:
- g_assert_not_reached ();
+ g_warning ("This shouldn't be reached\n");
}
}
@@ -979,7 +979,7 @@ ml_initialize_value (ETreeModel *etm, int col, void *data)
case COL_MIXED_RECIPIENTS:
return g_strdup ("");
default:
- g_assert_not_reached ();
+ g_warning ("This shouldn't be reached\n");
}
return NULL;
@@ -1013,7 +1013,7 @@ ml_value_is_empty (ETreeModel *etm, int col, const void *value, void *data)
case COL_MIXED_RECIPIENTS:
return !(value && *(char *)value);
default:
- g_assert_not_reached ();
+ g_warning ("This shouldn't be reached\n");
return FALSE;
}
}
@@ -1081,7 +1081,7 @@ ml_value_to_string (ETreeModel *etm, int col, const void *value, void *data)
case COL_MIXED_RECIPIENTS:
return g_strdup (value);
default:
- g_assert_not_reached ();
+ g_warning ("This shouldn't be reached\n");
return NULL;
}
}
@@ -1102,7 +1102,7 @@ subtree_unread(MessageList *ml, ETreePath node)
while (node) {
info = e_tree_memory_node_get_data((ETreeMemory *)ml->model, node);
- g_assert(info);
+ g_return_val_if_fail (info != NULL, FALSE);
if (!(camel_message_info_flags(info) & CAMEL_MESSAGE_SEEN))
return TRUE;
@@ -1124,7 +1124,7 @@ subtree_size(MessageList *ml, ETreePath node)
while (node) {
info = e_tree_memory_node_get_data((ETreeMemory *)ml->model, node);
- g_assert(info);
+ g_return_val_if_fail (info != NULL, 0);
size += camel_message_info_size(info);
if ((child = e_tree_model_node_get_first_child (E_TREE_MODEL (ml->model), node)))
@@ -1144,7 +1144,7 @@ subtree_latest(MessageList *ml, ETreePath node, int sent)
while (node) {
info = e_tree_memory_node_get_data((ETreeMemory *)ml->model, node);
- g_assert(info);
+ g_return_val_if_fail (info != NULL, 0);
if (sent)
date = camel_message_info_date_sent(info);
@@ -1226,7 +1226,7 @@ ml_tree_value_at (ETreeModel *etm, ETreePath path, int col, void *model_data)
/* retrieve the message information array */
msg_info = e_tree_memory_node_get_data (E_TREE_MEMORY(etm), path);
- g_assert (msg_info != NULL);
+ g_return_val_if_fail (msg_info != NULL, NULL);
switch (col){
case COL_MESSAGE_STATUS:
@@ -1419,7 +1419,7 @@ ml_tree_value_at (ETreeModel *etm, ETreePath path, int col, void *model_data)
return (void *)("");
}
default:
- g_assert_not_reached ();
+ g_warning ("This shouldn't be reached\n");
return NULL;
}
}
@@ -1438,7 +1438,7 @@ ml_tree_sort_value_at (ETreeModel *etm, ETreePath path, int col, void *model_dat
/* retrieve the message information array */
msg_info = e_tree_memory_node_get_data (E_TREE_MEMORY(etm), path);
- g_assert (msg_info != NULL);
+ g_return_val_if_fail (msg_info != NULL, NULL);
if (col == COL_SENT) {
ETreePath child;
@@ -1467,7 +1467,7 @@ static void
ml_tree_set_value_at (ETreeModel *etm, ETreePath path, int col,
const void *val, void *model_data)
{
- g_assert_not_reached ();
+ g_warning ("This shouldn't be reached\n");
}
static gboolean
@@ -2602,7 +2602,11 @@ build_subtree (MessageList *ml, ETreePath parent, CamelFolderThreadNode *c, int
while (c) {
/* phantom nodes no longer allowed */
- g_assert(c->message);
+ if (!c->message) {
+ g_warning("c->message shouldn't be NULL\n");
+ c = c->next;
+ continue;
+ }
node = e_tree_memory_node_insert(E_TREE_MEMORY(tree), parent, -1, (void *)c->message);
g_hash_table_insert(ml->uid_nodemap, (void *)camel_message_info_uid(c->message), node);
@@ -2678,7 +2682,7 @@ add_node_diff(MessageList *ml, ETreePath parent, ETreePath path, CamelFolderThre
ETreeModel *etm = ml->model;
ETreePath node;
- g_assert(c->message);
+ g_return_if_fail (c->message != NULL);
/* we just update the hashtable key, umm, does this leak the info on the message node? */
g_hash_table_remove(ml->uid_nodemap, camel_message_info_uid(c->message));
@@ -2717,7 +2721,7 @@ remove_node_diff(MessageList *ml, ETreePath node, int depth)
if (depth == 0)
e_tree_memory_node_remove(E_TREE_MEMORY(etm), node);
- g_assert(info);
+ g_return_if_fail (info);
g_hash_table_remove(ml->uid_nodemap, camel_message_info_uid(info));
camel_folder_free_message_info(ml->folder, info);
}
@@ -2763,7 +2767,6 @@ build_subtree_diff(MessageList *ml, ETreePath parent, ETreePath path, CamelFolde
}
} else {
g_warning("Cannot find uid %s in table?", camel_message_info_uid(bp->message));
- /*g_assert_not_reached();*/
}
}
#endif
@@ -3340,7 +3343,7 @@ ml_getselected_cb(ETreePath path, void *user_data)
return;
uid = get_message_uid(data->ml, path);
- g_assert(uid != NULL);
+ g_return_if_fail(uid != NULL);
g_ptr_array_add(data->uids, g_strdup(uid));
}
@@ -3398,7 +3401,7 @@ message_list_freeze(MessageList *ml)
void
message_list_thaw(MessageList *ml)
{
- g_assert(ml->frozen != 0);
+ g_return_if_fail (ml->frozen != 0);
ml->frozen--;
if (ml->frozen == 0) {