aboutsummaryrefslogtreecommitdiffstats
path: root/plugins
diff options
context:
space:
mode:
authorMilan Crha <mcrha@redhat.com>2013-11-15 16:06:57 +0800
committerMilan Crha <mcrha@redhat.com>2013-11-15 16:06:57 +0800
commit570c6374806d0f1ec59cf7a72543efe6b5b637be (patch)
treec5390b1fcb73f30c28bf37168add9bf1dc622b42 /plugins
parent1be51f232560f864ba8795a38e55d472b5b0e2b3 (diff)
downloadgsoc2013-evolution-570c6374806d0f1ec59cf7a72543efe6b5b637be.tar
gsoc2013-evolution-570c6374806d0f1ec59cf7a72543efe6b5b637be.tar.gz
gsoc2013-evolution-570c6374806d0f1ec59cf7a72543efe6b5b637be.tar.bz2
gsoc2013-evolution-570c6374806d0f1ec59cf7a72543efe6b5b637be.tar.lz
gsoc2013-evolution-570c6374806d0f1ec59cf7a72543efe6b5b637be.tar.xz
gsoc2013-evolution-570c6374806d0f1ec59cf7a72543efe6b5b637be.tar.zst
gsoc2013-evolution-570c6374806d0f1ec59cf7a72543efe6b5b637be.zip
Fix/mute issues found by Coverity scan
This makes the code free of Coverity scan issues. It is sometimes quite pedantic and expects/suggests some coding habits, thus certain changes may look weird, but for a good thing, I hope. The code is also tagged with Coverity scan suppressions, to keep the code as is and hide the warning too. Also note that Coverity treats g_return_if_fail(), g_assert() and similar macros as unreliable, and it's true these can be disabled during the compile time, thus it brings in other set of 'weird' changes.
Diffstat (limited to 'plugins')
-rw-r--r--plugins/attachment-reminder/attachment-reminder.c4
-rw-r--r--plugins/dbx-import/dbx-importer.c3
-rw-r--r--plugins/email-custom-header/email-custom-header.c1
-rw-r--r--plugins/external-editor/external-editor.c6
-rw-r--r--plugins/mail-to-task/mail-to-task.c42
-rw-r--r--plugins/mailing-list-actions/mailing-list-actions.c4
-rw-r--r--plugins/pst-import/pst-importer.c11
-rw-r--r--plugins/publish-calendar/url-editor-dialog.c3
-rw-r--r--plugins/save-calendar/save-calendar.c39
9 files changed, 56 insertions, 57 deletions
diff --git a/plugins/attachment-reminder/attachment-reminder.c b/plugins/attachment-reminder/attachment-reminder.c
index 52a03231b7..5ee371987e 100644
--- a/plugins/attachment-reminder/attachment-reminder.c
+++ b/plugins/attachment-reminder/attachment-reminder.c
@@ -622,9 +622,7 @@ e_plugin_lib_get_configure_widget (EPlugin *plugin)
gtk_list_store_set (ui->store, &iter, CLUE_KEYWORD_COLUMN, clue_list[i], -1);
}
- if (clue_list) {
- g_strfreev (clue_list);
- }
+ g_strfreev (clue_list);
/* Add the list here */
diff --git a/plugins/dbx-import/dbx-importer.c b/plugins/dbx-import/dbx-importer.c
index 47a2bb94bf..5fe0863c31 100644
--- a/plugins/dbx-import/dbx-importer.c
+++ b/plugins/dbx-import/dbx-importer.c
@@ -446,7 +446,8 @@ dbx_read_mail_body (DbxImporter *m,
guint32 buflen = 0x200;
guchar *buffer = g_malloc (buflen);
- ftruncate (bodyfd, 0);
+ if (ftruncate (bodyfd, 0) == -1)
+ g_warning ("%s: Failed to truncate file: %s", G_STRFUNC, g_strerror (errno));
lseek (bodyfd, 0, SEEK_SET);
while (offset) {
diff --git a/plugins/email-custom-header/email-custom-header.c b/plugins/email-custom-header/email-custom-header.c
index 78364fa84f..c7e8f50b45 100644
--- a/plugins/email-custom-header/email-custom-header.c
+++ b/plugins/email-custom-header/email-custom-header.c
@@ -177,6 +177,7 @@ epech_header_options_cb (GtkDialog *dialog,
switch (state) {
case GTK_RESPONSE_OK:
epech_get_widgets_data (mch);
+ /* coverity[fallthrough] */
case GTK_RESPONSE_CANCEL:
gtk_widget_hide (priv->main);
gtk_widget_destroy (priv->main);
diff --git a/plugins/external-editor/external-editor.c b/plugins/external-editor/external-editor.c
index 8f6e782919..97cb6abf5e 100644
--- a/plugins/external-editor/external-editor.c
+++ b/plugins/external-editor/external-editor.c
@@ -26,6 +26,8 @@
#include <config.h>
#endif
+#include <errno.h>
+
#include <mail/em-config.h>
#include <mail/em-composer-utils.h>
#include <e-msg-composer.h>
@@ -374,7 +376,9 @@ external_editor_thread (gpointer user_data)
g_idle_add ((GSourceFunc) update_composer_text, array);
/* We no longer need that temporary file */
- g_remove (filename);
+ if (g_remove (filename) == -1)
+ g_warning ("%s: Failed to remove file '%s': %s",
+ G_STRFUNC, filename, g_strerror (errno));
g_free (filename);
}
}
diff --git a/plugins/mail-to-task/mail-to-task.c b/plugins/mail-to-task/mail-to-task.c
index b2c995e0e8..f4bfe1927a 100644
--- a/plugins/mail-to-task/mail-to-task.c
+++ b/plugins/mail-to-task/mail-to-task.c
@@ -852,23 +852,19 @@ do_mail_to_event (AsyncData *data)
if (error != NULL) {
report_error_idle (_("Cannot open calendar. %s"), error->message);
} else if (e_client_is_readonly (E_CLIENT (client))) {
- if (error != NULL)
- report_error_idle ("Check readonly failed. %s", error->message);
- else {
- switch (data->source_type) {
- case E_CAL_CLIENT_SOURCE_TYPE_EVENTS:
- report_error_idle (_("Selected calendar is read only, thus cannot create event there. Select other calendar, please."), NULL);
- break;
- case E_CAL_CLIENT_SOURCE_TYPE_TASKS:
- report_error_idle (_("Selected task list is read only, thus cannot create task there. Select other task list, please."), NULL);
- break;
- case E_CAL_CLIENT_SOURCE_TYPE_MEMOS:
- report_error_idle (_("Selected memo list is read only, thus cannot create memo there. Select other memo list, please."), NULL);
- break;
- default:
- g_assert_not_reached ();
- break;
- }
+ switch (data->source_type) {
+ case E_CAL_CLIENT_SOURCE_TYPE_EVENTS:
+ report_error_idle (_("Selected calendar is read only, thus cannot create event there. Select other calendar, please."), NULL);
+ break;
+ case E_CAL_CLIENT_SOURCE_TYPE_TASKS:
+ report_error_idle (_("Selected task list is read only, thus cannot create task there. Select other task list, please."), NULL);
+ break;
+ case E_CAL_CLIENT_SOURCE_TYPE_MEMOS:
+ report_error_idle (_("Selected memo list is read only, thus cannot create memo there. Select other memo list, please."), NULL);
+ break;
+ default:
+ g_assert_not_reached ();
+ break;
}
} else {
gint i;
@@ -1114,7 +1110,6 @@ mail_to_event (ECalClientSourceType source_type,
GList *list, *iter;
GtkWindow *parent;
const gchar *extension_name;
- GError *error = NULL;
parent = e_mail_reader_get_window (reader);
uids = e_mail_reader_get_selected_uids (reader);
@@ -1193,16 +1188,6 @@ mail_to_event (ECalClientSourceType source_type,
E_SOURCE_SELECTOR_DIALOG (dialog));
gtk_widget_destroy (dialog);
- } else if (!source && default_source) {
- source = default_source;
- } else if (!source) {
- e_notice (
- NULL, GTK_MESSAGE_ERROR,
- _("No writable calendar is available."));
-
- if (error != NULL)
- g_error_free (error);
- goto exit;
}
if (source) {
@@ -1234,7 +1219,6 @@ mail_to_event (ECalClientSourceType source_type,
}
}
-exit:
g_object_unref (default_source);
g_ptr_array_unref (uids);
}
diff --git a/plugins/mailing-list-actions/mailing-list-actions.c b/plugins/mailing-list-actions/mailing-list-actions.c
index d9466013c2..35a379c771 100644
--- a/plugins/mailing-list-actions/mailing-list-actions.c
+++ b/plugins/mailing-list-actions/mailing-list-actions.c
@@ -229,7 +229,7 @@ emla_list_action_cb (CamelFolder *folder,
/* get URL portion */
url = g_strndup (headerpos, end - headerpos);
- if (strncmp (url, "mailto:", 6) == 0) {
+ if (url && strncmp (url, "mailto:", 6) == 0) {
if (emla_action_headers[t].interactive)
send_message_response = GTK_RESPONSE_NO;
else
@@ -253,7 +253,7 @@ emla_list_action_cb (CamelFolder *folder,
}
goto exit;
- } else {
+ } else if (url && *url) {
e_show_uri (window, url);
goto exit;
}
diff --git a/plugins/pst-import/pst-importer.c b/plugins/pst-import/pst-importer.c
index 853a16cbd8..f16f476920 100644
--- a/plugins/pst-import/pst-importer.c
+++ b/plugins/pst-import/pst-importer.c
@@ -807,13 +807,14 @@ pst_import_folders (PstImporter *m,
pst_desc_tree *topitem)
{
GHashTable *node_to_folderuri; /* pointers of hierarchy nodes, to them associated folder uris */
- pst_desc_tree *d_ptr;
+ pst_desc_tree *d_ptr = NULL;
node_to_folderuri = g_hash_table_new_full (g_direct_hash, g_direct_equal, NULL, g_free);
- d_ptr = topitem->child;
- if (topitem)
+ if (topitem) {
+ d_ptr = topitem->child;
g_hash_table_insert (node_to_folderuri, topitem, g_strdup (m->folder_uri));
+ }
/* Walk through folder tree */
while (d_ptr != NULL && (g_cancellable_is_cancelled (m->cancellable) == FALSE)) {
@@ -866,7 +867,7 @@ pst_import_folders (PstImporter *m,
break;
}
- d_ptr = d_ptr->next;
+ d_ptr = d_ptr ? d_ptr->next : NULL;
}
g_free (previous_folder);
@@ -1865,6 +1866,8 @@ fill_calcomponent (PstImporter *m,
case PST_FREEBUSY_FREE:
/* mark as transparent and as confirmed */
e_cal_component_set_transparency (ec, E_CAL_COMPONENT_TRANSP_TRANSPARENT);
+ e_cal_component_set_status (ec, ICAL_STATUS_CONFIRMED);
+ break;
case PST_FREEBUSY_BUSY:
case PST_FREEBUSY_OUT_OF_OFFICE:
e_cal_component_set_status (ec, ICAL_STATUS_CONFIRMED);
diff --git a/plugins/publish-calendar/url-editor-dialog.c b/plugins/publish-calendar/url-editor-dialog.c
index 04bbe5d9f9..d01c585307 100644
--- a/plugins/publish-calendar/url-editor-dialog.c
+++ b/plugins/publish-calendar/url-editor-dialog.c
@@ -72,6 +72,9 @@ create_uri (UrlEditorDialog *dialog)
case TYPE_ANON_FTP:
g_free (username);
username = g_strdup ("anonymous");
+ method = "ftp";
+ break;
+
case TYPE_FTP:
method = "ftp";
break;
diff --git a/plugins/save-calendar/save-calendar.c b/plugins/save-calendar/save-calendar.c
index c713612db8..e4228cb339 100644
--- a/plugins/save-calendar/save-calendar.c
+++ b/plugins/save-calendar/save-calendar.c
@@ -82,14 +82,14 @@ on_type_combobox_changed (GtkComboBox *combobox,
extra_widget_foreach_hide,
g_object_get_data (G_OBJECT (combobox), "format-box"));
- gtk_combo_box_get_active_iter (combobox, &iter);
+ if (!gtk_combo_box_get_active_iter (combobox, &iter))
+ return;
gtk_tree_model_get (
model, &iter,
DEST_HANDLER, &handler, -1);
- if (handler->options_widget)
- {
+ if (handler && handler->options_widget) {
gtk_widget_show (handler->options_widget);
}
@@ -202,25 +202,30 @@ ask_destination_and_save (ESourceSelector *selector,
if (gtk_dialog_run (GTK_DIALOG (dialog)) == GTK_RESPONSE_OK) {
gchar *tmp = NULL;
- gtk_combo_box_get_active_iter (combo, &iter);
- gtk_tree_model_get (
- model, &iter,
- DEST_HANDLER, &handler, -1);
+ if (gtk_combo_box_get_active_iter (combo, &iter))
+ gtk_tree_model_get (
+ model, &iter,
+ DEST_HANDLER, &handler, -1);
+ else
+ handler = NULL;
- dest_uri = gtk_file_chooser_get_uri
- (GTK_FILE_CHOOSER (dialog));
+ dest_uri = gtk_file_chooser_get_uri (GTK_FILE_CHOOSER (dialog));
- tmp = strstr (dest_uri, handler->filename_ext);
+ if (handler) {
+ tmp = strstr (dest_uri, handler->filename_ext);
- if (!(tmp && *(tmp + strlen (handler->filename_ext)) == '\0')) {
+ if (!(tmp && *(tmp + strlen (handler->filename_ext)) == '\0')) {
- gchar *temp;
- temp = g_strconcat (dest_uri, handler->filename_ext, NULL);
- g_free (dest_uri);
- dest_uri = temp;
- }
+ gchar *temp;
+ temp = g_strconcat (dest_uri, handler->filename_ext, NULL);
+ g_free (dest_uri);
+ dest_uri = temp;
+ }
- handler->save (handler, selector, type, dest_uri);
+ handler->save (handler, selector, type, dest_uri);
+ } else {
+ g_warn_if_reached ();
+ }
}
/* Free the handlers */