[Commits] [SCM] claws branch, master, updated. 3.16.0-171-g817deab
wwp at claws-mail.org
wwp at claws-mail.org
Tue May 22 19:15:02 CEST 2018
The branch, master has been updated
via 817deab2f1f059caa306fcbc56af728f4a41716c (commit)
from ad478394f0083f9e963ea98873d69e54ca4f6e3c (commit)
Summary of changes:
src/addr_compl.c | 9 +--
src/addrduplicates.c | 7 +--
src/compose.c | 7 +--
src/gtk/combobox.c | 5 +-
src/gtk/foldersort.c | 9 ++-
src/mimeview.c | 9 ++-
src/prefs_folder_column.c | 146 ++++++++++++++++++++++----------------------
src/prefs_summary_column.c | 134 ++++++++++++++++++++--------------------
src/prefs_toolbar.c | 9 +--
src/uri_opener.c | 6 +-
10 files changed, 172 insertions(+), 169 deletions(-)
- Log -----------------------------------------------------------------
commit 817deab2f1f059caa306fcbc56af728f4a41716c
Author: wwp <wwp at free.fr>
Date: Tue May 22 19:12:36 2018 +0200
Fix few unchecked return values reported by Coverity:
1434187, 1434189, 1434192, 1434193, 1434195, 1434196, 1434198, 1434200, 1434202, 1434203
And few more. Change few silent returns into debug ones (cm_return_if_fail).
diff --git a/src/addr_compl.c b/src/addr_compl.c
index 8ce1177..713fd50 100644
--- a/src/addr_compl.c
+++ b/src/addr_compl.c
@@ -1026,14 +1026,15 @@ static void addrcompl_add_entry( CompletionWindow *cw, gchar *address ) {
gtk_grab_add( cw->window );
selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(cw->list_view));
- gtk_tree_model_get_iter_first(GTK_TREE_MODEL(store), &iter);
+ if (!gtk_tree_model_get_iter_first(GTK_TREE_MODEL(store), &iter))
+ return;
- if( cw->listCount == 1 ) {
+ if (cw->listCount == 1) {
/* Select first row for now */
gtk_tree_selection_select_iter(selection, &iter);
}
#ifndef GENERIC_UMPC
- else if( cw->listCount == 2 ) {
+ else if (cw->listCount == 2) {
if (gtk_tree_model_iter_next(GTK_TREE_MODEL(store), &iter)) {
/* Move off first row */
gtk_tree_selection_select_iter(selection, &iter);
@@ -1216,7 +1217,7 @@ static void completion_window_apply_selection(GtkTreeView *list_view,
GList *grp_emails = NULL;
selection = gtk_tree_view_get_selection(list_view);
- if (! gtk_tree_selection_get_selected(selection, &model, &iter))
+ if (!gtk_tree_selection_get_selected(selection, &model, &iter))
return;
/* First remove the idler */
diff --git a/src/addrduplicates.c b/src/addrduplicates.c
index af3ad08..e6f1176 100644
--- a/src/addrduplicates.c
+++ b/src/addrduplicates.c
@@ -514,8 +514,7 @@ static gboolean is_editing_entry_only_selection(void)
return FALSE;
selected = gtk_tree_selection_get_selected_rows(sel_detail,&model);
- if(!selected)
- return FALSE;
+ cm_return_val_if_fail(selected, FALSE);
gtk_tree_model_get_iter(model, &iter, (GtkTreePath*)selected->data);
g_list_foreach(selected, (GFunc)gtk_tree_path_free, NULL);
@@ -786,9 +785,7 @@ static void cb_del_btn_clicked(GtkButton *button, gpointer data)
selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(detail_view));
list = gtk_tree_selection_get_selected_rows(selection, &model);
-
- if(!list)
- return;
+ cm_return_if_fail(list);
aval = alertpanel(_("Delete address(es)"),
_("Really delete the address(es)?"),
diff --git a/src/compose.c b/src/compose.c
index e8bf9c0..7888cd4 100644
--- a/src/compose.c
+++ b/src/compose.c
@@ -9192,9 +9192,7 @@ static void compose_attach_remove_selected(GtkAction *action, gpointer data)
selection = gtk_tree_view_get_selection(tree_view);
sel = gtk_tree_selection_get_selected_rows(selection, &model);
-
- if (!sel)
- return;
+ cm_return_if_fail(sel);
for (cur = sel; cur != NULL; cur = cur->next) {
GtkTreePath *path = cur->data;
@@ -9255,8 +9253,7 @@ static void compose_attach_property(GtkAction *action, gpointer data)
return;
sel = gtk_tree_selection_get_selected_rows(selection, &model);
- if (!sel)
- return;
+ cm_return_if_fail(sel);
path = (GtkTreePath *) sel->data;
gtk_tree_model_get_iter(model, &iter, path);
diff --git a/src/gtk/combobox.c b/src/gtk/combobox.c
index 4804960..151edae 100644
--- a/src/gtk/combobox.c
+++ b/src/gtk/combobox.c
@@ -263,8 +263,9 @@ void combobox_set_sensitive(GtkComboBox *combobox, const guint index,
if((model = gtk_combo_box_get_model(combobox)) == NULL)
return;
-
- gtk_tree_model_get_iter_first(model, &iter);
+
+ if(gtk_tree_model_get_iter_first(model, &iter) == FALSE)
+ return;
for(i=0; i<index; i++) {
if(gtk_tree_model_iter_next(model, &iter) == FALSE)
return;
diff --git a/src/gtk/foldersort.c b/src/gtk/foldersort.c
index 8160235..df0c0c1 100644
--- a/src/gtk/foldersort.c
+++ b/src/gtk/foldersort.c
@@ -89,7 +89,8 @@ static void set_selected(FolderSortDialog *dialog)
/* Get row number of the selected row */
sel = gtk_tree_view_get_selection(GTK_TREE_VIEW(dialog->folderlist));
- gtk_tree_selection_get_selected(sel, &model, &iter);
+ if (!gtk_tree_selection_get_selected(sel, &model, &iter))
+ return;
path = gtk_tree_model_get_path(model, &iter);
indices = gtk_tree_path_get_indices(path);
selected = indices[0];
@@ -115,7 +116,8 @@ static void moveup_clicked(GtkWidget *widget, FolderSortDialog *dialog)
/* Get currently selected iter */
sel = gtk_tree_view_get_selection(GTK_TREE_VIEW(dialog->folderlist));
- gtk_tree_selection_get_selected(sel, &model, &iter);
+ if (!gtk_tree_selection_get_selected(sel, &model, &iter))
+ return;
/* Now get the iter above it, if any */
#if GTK_CHECK_VERSION(3, 0, 0)
@@ -156,7 +158,8 @@ static void movedown_clicked(GtkWidget *widget, FolderSortDialog *dialog)
/* Get currently selected iter */
sel = gtk_tree_view_get_selection(GTK_TREE_VIEW(dialog->folderlist));
- gtk_tree_selection_get_selected(sel, &model, &iter);
+ if (!gtk_tree_selection_get_selected(sel, &model, &iter))
+ return;
/* Now get the iter above it, if any */
nextiter = iter;
diff --git a/src/mimeview.c b/src/mimeview.c
index 9dd0f49..20d2312 100644
--- a/src/mimeview.c
+++ b/src/mimeview.c
@@ -662,7 +662,8 @@ gint mimeview_get_selected_part_num(MimeView *mimeview)
GtkTreePath *path;
gint i = 0;
- gtk_tree_model_get_iter_first(model, &iter);
+ if (!gtk_tree_model_get_iter_first(model, &iter))
+ return -1;
path = gtk_tree_model_get_path(model, &iter);
do {
@@ -690,7 +691,8 @@ void mimeview_select_part_num(MimeView *mimeview, gint i)
if (i < 0)
return;
- gtk_tree_model_get_iter_first(model, &iter);
+ if (!gtk_tree_model_get_iter_first(model, &iter))
+ return;
path = gtk_tree_model_get_path(model, &iter);
while (x != i) {
@@ -2363,7 +2365,8 @@ static void icon_selected (MimeView *mimeview, gint num, MimeInfo *partinfo)
GtkTreePath *path;
MimeInfo *curr = NULL;
- gtk_tree_model_get_iter_first(model, &iter);
+ if (!gtk_tree_model_get_iter_first(model, &iter))
+ return;
path = gtk_tree_model_get_path(model, &iter);
do {
diff --git a/src/prefs_folder_column.c b/src/prefs_folder_column.c
index a37fb54..4ef90f5 100644
--- a/src/prefs_folder_column.c
+++ b/src/prefs_folder_column.c
@@ -714,11 +714,11 @@ static FolderColumnType prefs_folder_column_get_column(GtkWidget *list, gint row
if (!gtk_tree_model_iter_nth_child(model, &iter, NULL, row))
return -1;
-
+
gtk_tree_model_get(model, &iter,
SUMCOL_TYPE, &result,
-1);
-
+
return result;
}
@@ -734,7 +734,7 @@ static GtkWidget *prefs_folder_column_list_view_create(const gchar *name)
gtk_tree_view_set_rules_hint(GTK_TREE_VIEW(list_view),
prefs_common.use_stripes_everywhere);
-
+
selector = gtk_tree_view_get_selection(GTK_TREE_VIEW(list_view));
gtk_tree_selection_set_mode(selector, GTK_SELECTION_BROWSE);
@@ -745,12 +745,12 @@ static GtkWidget *prefs_folder_column_list_view_create(const gchar *name)
row_targets,
G_N_ELEMENTS(row_targets),
GDK_ACTION_MOVE);
-
+
gtk_tree_view_enable_model_drag_dest(GTK_TREE_VIEW(list_view),
row_targets,
G_N_ELEMENTS(row_targets),
GDK_ACTION_MOVE);
-
+
g_signal_connect(G_OBJECT(list_view), "drag_data_get",
G_CALLBACK(drag_data_get),
model);
@@ -810,50 +810,50 @@ static void drag_data_received(GtkTreeView *tree_view, GdkDragContext *context,
FolderColumnType type;
GtkTreeModel *sel_model;
gchar *name;
-
+
source = gtk_drag_get_source_widget(context);
-
+
if (source == GTK_WIDGET(tree_view)) {
/*
* Same widget: re-order
*/
- gtk_tree_selection_get_selected(gtk_tree_view_get_selection(tree_view),
- NULL, &isel);
- sel = gtk_tree_model_get_path(model, &isel);
- gtk_tree_view_get_dest_row_at_pos(tree_view, x, y,
- &dst, &pos);
-
- /* NOTE: dst is invalid if selection beyond last row, in that
- * case move beyond last one (XXX_move_before(..., NULL)) */
-
- if (dst)
- gtk_tree_model_get_iter(model, &idst, dst);
- else
- gtk_list_store_move_before(GTK_LIST_STORE(model),
- &isel,
- NULL);
-
- /* we do not drag if no valid dst and sel, and when
- * dst and sel are the same (moving after or before
- * itself doesn't change order...) */
- if ((dst && sel) && gtk_tree_path_compare(sel, dst) != 0) {
- if (pos == GTK_TREE_VIEW_DROP_BEFORE
- || pos == GTK_TREE_VIEW_DROP_INTO_OR_BEFORE)
+ if (gtk_tree_selection_get_selected(gtk_tree_view_get_selection(tree_view),
+ NULL, &isel)) {
+ sel = gtk_tree_model_get_path(model, &isel);
+ gtk_tree_view_get_dest_row_at_pos(tree_view, x, y,
+ &dst, &pos);
+
+ /* NOTE: dst is invalid if selection beyond last row, in that
+ * case move beyond last one (XXX_move_before(..., NULL)) */
+
+ if (dst)
+ gtk_tree_model_get_iter(model, &idst, dst);
+ else
gtk_list_store_move_before(GTK_LIST_STORE(model),
&isel,
- &idst);
- else
- gtk_list_store_move_after(GTK_LIST_STORE(model),
- &isel,
- &idst);
-
- }
- gtk_tree_path_free(dst);
- gtk_tree_path_free(sel);
+ NULL);
+
+ /* we do not drag if no valid dst and sel, and when
+ * dst and sel are the same (moving after or before
+ * itself doesn't change order...) */
+ if ((dst && sel) && gtk_tree_path_compare(sel, dst) != 0) {
+ if (pos == GTK_TREE_VIEW_DROP_BEFORE
+ || pos == GTK_TREE_VIEW_DROP_INTO_OR_BEFORE)
+ gtk_list_store_move_before(GTK_LIST_STORE(model),
+ &isel,
+ &idst);
+ else
+ gtk_list_store_move_after(GTK_LIST_STORE(model),
+ &isel,
+ &idst);
+ }
+ gtk_tree_path_free(dst);
+ gtk_tree_path_free(sel);
+ }
gtk_drag_finish(context, TRUE, FALSE, time);
-
+
} else if (source == folder_col.stock_list_view
|| source == folder_col.shown_list_view) {
@@ -861,47 +861,47 @@ static void drag_data_received(GtkTreeView *tree_view, GdkDragContext *context,
* Other widget: change and update
*/
-
/* get source information and remove */
- gtk_tree_selection_get_selected(gtk_tree_view_get_selection(
+ if (gtk_tree_selection_get_selected(gtk_tree_view_get_selection(
GTK_TREE_VIEW(source)),
- &sel_model, &isel);
- type = *((gint *) gtk_selection_data_get_data(data));
- name = gettext(col_name[type]);
- gtk_list_store_remove(GTK_LIST_STORE(sel_model), &isel);
-
- /* get insertion position */
- gtk_tree_view_get_dest_row_at_pos(tree_view, x, y, &dst, &pos);
-
- /* NOTE: dst is invalid if insertion point beyond last row,
- * just append to list in that case (XXX_store_append()) */
-
- if (dst) {
- gtk_tree_model_get_iter(model, &idst, dst);
-
- if (pos == GTK_TREE_VIEW_DROP_BEFORE
- || pos == GTK_TREE_VIEW_DROP_INTO_OR_BEFORE)
- gtk_list_store_insert_before(GTK_LIST_STORE(model),
- &isel,
- &idst);
- else
- gtk_list_store_insert_after(GTK_LIST_STORE(model),
- &isel,
- &idst);
- } else
- gtk_list_store_append(GTK_LIST_STORE(model),
- &isel);
-
- gtk_list_store_set(GTK_LIST_STORE(model), &isel,
- SUMCOL_NAME, name,
- SUMCOL_TYPE, type, -1);
- gtk_tree_path_free(dst);
+ &sel_model, &isel)) {
+ type = *((gint *) gtk_selection_data_get_data(data));
+ name = gettext(col_name[type]);
+ gtk_list_store_remove(GTK_LIST_STORE(sel_model), &isel);
+
+ /* get insertion position */
+ gtk_tree_view_get_dest_row_at_pos(tree_view, x, y, &dst, &pos);
+
+ /* NOTE: dst is invalid if insertion point beyond last row,
+ * just append to list in that case (XXX_store_append()) */
+
+ if (dst) {
+ gtk_tree_model_get_iter(model, &idst, dst);
+
+ if (pos == GTK_TREE_VIEW_DROP_BEFORE
+ || pos == GTK_TREE_VIEW_DROP_INTO_OR_BEFORE)
+ gtk_list_store_insert_before(GTK_LIST_STORE(model),
+ &isel,
+ &idst);
+ else
+ gtk_list_store_insert_after(GTK_LIST_STORE(model),
+ &isel,
+ &idst);
+ } else
+ gtk_list_store_append(GTK_LIST_STORE(model),
+ &isel);
+
+ gtk_list_store_set(GTK_LIST_STORE(model), &isel,
+ SUMCOL_NAME, name,
+ SUMCOL_TYPE, type, -1);
+ gtk_tree_path_free(dst);
+ }
gtk_drag_finish(context, TRUE, FALSE, time);
}
prefs_folder_column_shown_set_active(FALSE);
prefs_folder_column_stock_set_active(FALSE);
-
+
/* XXXX: should we call gtk_drag_finish() for other code paths? */
}
diff --git a/src/prefs_summary_column.c b/src/prefs_summary_column.c
index 39b6f80..fea0ac7 100644
--- a/src/prefs_summary_column.c
+++ b/src/prefs_summary_column.c
@@ -825,48 +825,48 @@ static void drag_data_received(GtkTreeView *tree_view, GdkDragContext *context,
SummaryColumnType type;
GtkTreeModel *sel_model;
gchar *name;
-
+
source = gtk_drag_get_source_widget(context);
-
+
if (source == GTK_WIDGET(tree_view)) {
/*
* Same widget: re-order
*/
-
- gtk_tree_selection_get_selected(gtk_tree_view_get_selection(tree_view),
- NULL, &isel);
- sel = gtk_tree_model_get_path(model, &isel);
- gtk_tree_view_get_dest_row_at_pos(tree_view, x, y,
- &dst, &pos);
-
- /* NOTE: dst is invalid if selection beyond last row, in that
- * case move beyond last one (XXX_move_before(..., NULL)) */
-
- if (dst)
- gtk_tree_model_get_iter(model, &idst, dst);
- else
- gtk_list_store_move_before(GTK_LIST_STORE(model),
- &isel,
- NULL);
-
- /* we do not drag if no valid dst and sel, and when
- * dst and sel are the same (moving after or before
- * itself doesn't change order...) */
- if ((dst && sel) && gtk_tree_path_compare(sel, dst) != 0) {
- if (pos == GTK_TREE_VIEW_DROP_BEFORE
- || pos == GTK_TREE_VIEW_DROP_INTO_OR_BEFORE)
+
+ if (gtk_tree_selection_get_selected(gtk_tree_view_get_selection(tree_view),
+ NULL, &isel)) {
+ sel = gtk_tree_model_get_path(model, &isel);
+ gtk_tree_view_get_dest_row_at_pos(tree_view, x, y,
+ &dst, &pos);
+
+ /* NOTE: dst is invalid if selection beyond last row, in that
+ * case move beyond last one (XXX_move_before(..., NULL)) */
+
+ if (dst)
+ gtk_tree_model_get_iter(model, &idst, dst);
+ else
gtk_list_store_move_before(GTK_LIST_STORE(model),
&isel,
- &idst);
- else
- gtk_list_store_move_after(GTK_LIST_STORE(model),
- &isel,
- &idst);
-
- }
- gtk_tree_path_free(dst);
- gtk_tree_path_free(sel);
+ NULL);
+
+ /* we do not drag if no valid dst and sel, and when
+ * dst and sel are the same (moving after or before
+ * itself doesn't change order...) */
+ if ((dst && sel) && gtk_tree_path_compare(sel, dst) != 0) {
+ if (pos == GTK_TREE_VIEW_DROP_BEFORE
+ || pos == GTK_TREE_VIEW_DROP_INTO_OR_BEFORE)
+ gtk_list_store_move_before(GTK_LIST_STORE(model),
+ &isel,
+ &idst);
+ else
+ gtk_list_store_move_after(GTK_LIST_STORE(model),
+ &isel,
+ &idst);
+ }
+ gtk_tree_path_free(dst);
+ gtk_tree_path_free(sel);
+ }
gtk_drag_finish(context, TRUE, FALSE, time);
} else if (source == summary_col.stock_list_view
@@ -876,41 +876,41 @@ static void drag_data_received(GtkTreeView *tree_view, GdkDragContext *context,
* Other widget: change and update
*/
-
/* get source information and remove */
- gtk_tree_selection_get_selected(gtk_tree_view_get_selection(
+ if (gtk_tree_selection_get_selected(gtk_tree_view_get_selection(
GTK_TREE_VIEW(source)),
- &sel_model, &isel);
- type = *((gint *) gtk_selection_data_get_data(data));
- name = gettext(col_name[type]);
- gtk_list_store_remove(GTK_LIST_STORE(sel_model), &isel);
-
- /* get insertion position */
- gtk_tree_view_get_dest_row_at_pos(tree_view, x, y, &dst, &pos);
-
- /* NOTE: dst is invalid if insertion point beyond last row,
- * just append to list in that case (XXX_store_append()) */
-
- if (dst) {
- gtk_tree_model_get_iter(model, &idst, dst);
-
- if (pos == GTK_TREE_VIEW_DROP_BEFORE
- || pos == GTK_TREE_VIEW_DROP_INTO_OR_BEFORE)
- gtk_list_store_insert_before(GTK_LIST_STORE(model),
- &isel,
- &idst);
- else
- gtk_list_store_insert_after(GTK_LIST_STORE(model),
- &isel,
- &idst);
- } else
- gtk_list_store_append(GTK_LIST_STORE(model),
- &isel);
-
- gtk_list_store_set(GTK_LIST_STORE(model), &isel,
- SUMCOL_NAME, name,
- SUMCOL_TYPE, type, -1);
- gtk_tree_path_free(dst);
+ &sel_model, &isel)) {
+ type = *((gint *) gtk_selection_data_get_data(data));
+ name = gettext(col_name[type]);
+ gtk_list_store_remove(GTK_LIST_STORE(sel_model), &isel);
+
+ /* get insertion position */
+ gtk_tree_view_get_dest_row_at_pos(tree_view, x, y, &dst, &pos);
+
+ /* NOTE: dst is invalid if insertion point beyond last row,
+ * just append to list in that case (XXX_store_append()) */
+
+ if (dst) {
+ gtk_tree_model_get_iter(model, &idst, dst);
+
+ if (pos == GTK_TREE_VIEW_DROP_BEFORE
+ || pos == GTK_TREE_VIEW_DROP_INTO_OR_BEFORE)
+ gtk_list_store_insert_before(GTK_LIST_STORE(model),
+ &isel,
+ &idst);
+ else
+ gtk_list_store_insert_after(GTK_LIST_STORE(model),
+ &isel,
+ &idst);
+ } else
+ gtk_list_store_append(GTK_LIST_STORE(model),
+ &isel);
+
+ gtk_list_store_set(GTK_LIST_STORE(model), &isel,
+ SUMCOL_NAME, name,
+ SUMCOL_TYPE, type, -1);
+ gtk_tree_path_free(dst);
+ }
gtk_drag_finish(context, TRUE, FALSE, time);
}
diff --git a/src/prefs_toolbar.c b/src/prefs_toolbar.c
index cc56483..464012b 100644
--- a/src/prefs_toolbar.c
+++ b/src/prefs_toolbar.c
@@ -370,10 +370,11 @@ static void prefs_toolbar_set_displayed(ToolbarPage *prefs_toolbar)
}
/* select first */
- gtk_tree_model_get_iter_first(GTK_TREE_MODEL(store), &iter);
- gtk_tree_selection_select_iter(gtk_tree_view_get_selection
- (list_view_set),
- &iter);
+ if (gtk_tree_model_get_iter_first(GTK_TREE_MODEL(store), &iter)) {
+ gtk_tree_selection_select_iter(gtk_tree_view_get_selection
+ (list_view_set),
+ &iter);
+ }
}
static void add_item_to_plugin_combo(gpointer key, gpointer data, gpointer combo_box)
diff --git a/src/uri_opener.c b/src/uri_opener.c
index 4929b52..8c47de1 100644
--- a/src/uri_opener.c
+++ b/src/uri_opener.c
@@ -303,7 +303,8 @@ static void uri_opener_load_uris (void)
g_object_unref(opener.urilist);
model = gtk_tree_view_get_model(GTK_TREE_VIEW(opener.urilist));
- gtk_tree_model_get_iter_first(model, &iter);
+ if (!gtk_tree_model_get_iter_first(model, &iter))
+ return;
selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(opener.urilist));
gtk_tree_selection_select_iter(selection, &iter);
}
@@ -364,8 +365,7 @@ static void uri_opener_open_cb(GtkWidget *widget,
selection = gtk_tree_view_get_selection(GTK_TREE_VIEW(opener.urilist));
selected = gtk_tree_selection_get_selected_rows(selection, &model);
- if(!selected)
- return;
+ cm_return_if_fail(selected);
for(cur = selected; cur != NULL; cur = g_list_next(cur))
{
-----------------------------------------------------------------------
hooks/post-receive
--
Claws Mail
More information about the Commits
mailing list