aboutsummaryrefslogtreecommitdiffstats
path: root/plugins/save-calendar
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/save-calendar
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/save-calendar')
-rw-r--r--plugins/save-calendar/save-calendar.c39
1 files changed, 22 insertions, 17 deletions
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 */