[Commits] [SCM] claws branch, master, updated. 3.10.0-65-g91d4164

Colin colin at claws-mail.org
Fri Jun 6 16:14:25 CEST 2014


The branch master of project "claws" (Claws Mail) has been updated
       via  91d41645220dc77f4dea46b4548968652ab73ab7 (commit)
      from  f5eb56464104b0c6d067c14092f7f359c565fbbb (commit)


- Log -----------------------------------------------------------------
commit 91d41645220dc77f4dea46b4548968652ab73ab7
Author: Colin Leroy <colin at colino.net>
Date:   Fri Jun 6 16:14:26 2014 +0200

    Coverity fixes

diff --git a/src/addr_compl.c b/src/addr_compl.c
index 1d7d65d..adcb7cc 100644
--- a/src/addr_compl.c
+++ b/src/addr_compl.c
@@ -972,9 +972,10 @@ static void addrcompl_add_entry( CompletionWindow *cw, gchar *address ) {
 	}
 #ifndef GENERIC_UMPC
 	else if( cw->listCount == 2 ) {
-		gtk_tree_model_iter_next(GTK_TREE_MODEL(store), &iter);
-		/* Move off first row */
-		gtk_tree_selection_select_iter(selection, &iter);
+		if (gtk_tree_model_iter_next(GTK_TREE_MODEL(store), &iter)) {
+			/* Move off first row */
+			gtk_tree_selection_select_iter(selection, &iter);
+		}
 	}
 #endif
 }
diff --git a/src/addressbook.c b/src/addressbook.c
index a516b92..ffd6909 100644
--- a/src/addressbook.c
+++ b/src/addressbook.c
@@ -3191,7 +3191,6 @@ static void addressbook_new_address_cb( GtkAction *action, gpointer data ) {
 				}
 				folder = addressbook_setup_subf( ds, _("New Contacts"), parentNode );
 
-				pobj = gtk_cmctree_node_get_row_data(GTK_CMCTREE(addrbook.ctree), addrbook.treeSelected);
 				ds = addressbook_find_datasource( GTK_CMCTREE_NODE(addrbook.treeSelected) );
 				if (ds)
 					abf = ds->rawDataSource;
diff --git a/src/common/ssl_certificate.c b/src/common/ssl_certificate.c
index 0a8b828..c1e7dbf 100644
--- a/src/common/ssl_certificate.c
+++ b/src/common/ssl_certificate.c
@@ -536,6 +536,9 @@ static guint check_cert(SSLCertificate *cert)
 	else
 		return (guint)-1;
 
+	if (fp == NULL)
+		return (guint)-1;
+
 	if ((r = gnutls_import_X509_list_fp(fp, GNUTLS_X509_FMT_PEM, &ca_list, &max_ca)) < 0) {
 		debug_print("CA import failed: %s\n", gnutls_strerror(r));
 		fclose(fp);
diff --git a/src/prefs_account.c b/src/prefs_account.c
index a03f500..bb9c07a 100644
--- a/src/prefs_account.c
+++ b/src/prefs_account.c
@@ -3843,7 +3843,7 @@ static void auto_configure_cb (GtkWidget *widget, gpointer data)
 
 	address = gtk_editable_get_chars(GTK_EDITABLE(basic_page.addr_entry), 0, -1);
 
-	if (strchr(address, '@') < 0) {
+	if (strchr(address, '@') == NULL) {
 		g_free(address);
 		gtk_label_set_text(GTK_LABEL(basic_page.auto_configure_lbl),
 			   _("Failed (wrong address)"));
diff --git a/src/prefs_common.c b/src/prefs_common.c
index 93fcce6..a417b0d 100644
--- a/src/prefs_common.c
+++ b/src/prefs_common.c
@@ -1467,7 +1467,7 @@ void pref_set_textview_from_pref(GtkTextView *textview, const gchar *txt)
 
 		pref_get_unescaped_pref(out, txt);
 
-		gtk_text_buffer_set_text(buffer, out?out:"", -1);
+		gtk_text_buffer_set_text(buffer, out, -1);
 		g_free(out);
 	}
 }
@@ -1486,7 +1486,7 @@ void pref_set_entry_from_pref(GtkEntry *entry, const gchar *txt)
 
 		pref_get_unescaped_pref(out, txt);
 
-		gtk_entry_set_text(entry, out?out:"");
+		gtk_entry_set_text(entry, out);
 		g_free(out);
 	}
 }
diff --git a/src/prefs_filtering.c b/src/prefs_filtering.c
index 4077324..662c375 100644
--- a/src/prefs_filtering.c
+++ b/src/prefs_filtering.c
@@ -1437,10 +1437,8 @@ static void prefs_filtering_select_set(FilteringProp *prop)
 	gtk_entry_set_text(GTK_ENTRY(filtering.cond_entry), matcher_str);
 
         action_str = filteringaction_list_to_string(prop->action_list);
-	if (matcher_str == NULL) {
-		return;
-	}
-	gtk_entry_set_text(GTK_ENTRY(filtering.action_entry), action_str);
+	if (action_str != NULL)
+		gtk_entry_set_text(GTK_ENTRY(filtering.action_entry), action_str);
 
 	g_free(action_str);
 	g_free(matcher_str);
diff --git a/src/prefs_themes.c b/src/prefs_themes.c
index 9f02566..0b4ad1b 100644
--- a/src/prefs_themes.c
+++ b/src/prefs_themes.c
@@ -704,7 +704,7 @@ static void prefs_themes_display_global_stats(const ThemesData *tdata)
 		if (line[len - 1] == '\n') line[len - 1] = '\0'; \
 	} \
 	else { \
-		strcpy(line, _("Unknown")); \
+		g_strlcpy(line, _("Unknown"),sizeof(line)); \
 	}
 
 static void prefs_themes_get_theme_info(ThemesData *tdata)
diff --git a/src/prefs_toolbar.c b/src/prefs_toolbar.c
index 9969063..8504b79 100644
--- a/src/prefs_toolbar.c
+++ b/src/prefs_toolbar.c
@@ -1635,10 +1635,10 @@ static gboolean icon_list_button_release(GtkWidget *widget,
 					       GdkEventButton *event,
 					       ToolbarPage *prefs_toolbar )
 {
-	static guint id = -1;
-	if (id >= 0) {
+	static guint id = 0;
+	if (id > 0) {
 		g_source_remove(id);
-		id = -1;
+		id = 0;
 	}
 	id = g_timeout_add(100, ok_cb, prefs_toolbar);
 	return FALSE;
diff --git a/src/printing.c b/src/printing.c
index 369f922..e4cb1f1 100644
--- a/src/printing.c
+++ b/src/printing.c
@@ -1281,7 +1281,8 @@ static void printing_layout_set_text_attributes(PrintData *print_data,
 							attr_color = (PangoAttrColor*) attr;
 							g_object_get(G_OBJECT(tag), "background-gdk",
 								     &color, NULL);
-							if (printing_is_pango_gdk_color_equal(&(attr_color->color),
+							if (color && 
+							    printing_is_pango_gdk_color_equal(&(attr_color->color),
 							    color)) {
 								attr->end_index = printing_text_iter_get_offset_bytes(print_data, &iter);
 								pango_attr_list_insert(attr_list, attr);
diff --git a/src/quote_fmt_parse.y b/src/quote_fmt_parse.y
index 3567ffa..4ad346b 100644
--- a/src/quote_fmt_parse.y
+++ b/src/quote_fmt_parse.y
@@ -88,8 +88,8 @@ static void add_visibility(gboolean val)
 		if (visible == NULL)
 			maxsize = 0;
 	}
-
-	visible[stacksize - 1] = val;
+	if (visible != NULL)
+		visible[stacksize - 1] = val;
 }
 
 static void remove_visibility(void)
diff --git a/src/send_message.c b/src/send_message.c
index d048630..4bd2ecf 100644
--- a/src/send_message.c
+++ b/src/send_message.c
@@ -231,6 +231,10 @@ gint send_message_smtp_full(PrefsAccount *ac_prefs, GSList *to_list, FILE *fp, g
 	 * because it's editable. */
 
 	fp_pos = ftell(fp);
+	if (fp_pos < 0) {
+		perror("ftell");
+		return -1;
+	}
 	tmp_msginfo = procheader_parse_stream(fp, flags, TRUE, FALSE);
 	fseek(fp, fp_pos, SEEK_SET);
 
diff --git a/src/textview.c b/src/textview.c
index 31708d6..ae6de82 100644
--- a/src/textview.c
+++ b/src/textview.c
@@ -693,7 +693,12 @@ static void textview_add_part(TextView *textview, MimeInfo *mimeinfo)
 			END_TIMING();
 			return;
 		}
-		fseek(fp, mimeinfo->offset, SEEK_SET);
+		if (fseek(fp, mimeinfo->offset, SEEK_SET) < 0) {
+			FILE_OP_ERROR(mimeinfo->data.filename, "fseek");
+			fclose(fp);
+			END_TIMING();
+			return;
+		}
 		headers = textview_scan_header(textview, fp);
 		if (headers) {
 			if (charcount > 0)
@@ -1075,8 +1080,10 @@ static void textview_write_body(TextView *textview, MimeInfo *mimeinfo)
 		filename = procmime_get_tmp_file_name(mimeinfo);
 		if (procmime_get_part(filename, mimeinfo) == 0) {
 			tmpfp = g_fopen(filename, "rb");
-			textview_show_ertf(textview, tmpfp, conv);
-			fclose(tmpfp);
+			if (tmpfp) {
+				textview_show_ertf(textview, tmpfp, conv);
+				fclose(tmpfp);
+			}
 			claws_unlink(filename);
 		}
 		g_free(filename);
@@ -1155,7 +1162,11 @@ textview_default:
 			FILE_OP_ERROR(mimeinfo->data.filename, "fopen");
 			return;
 		}
-		fseek(tmpfp, mimeinfo->offset, SEEK_SET);
+		if (fseek(tmpfp, mimeinfo->offset, SEEK_SET) < 0) {
+			FILE_OP_ERROR(mimeinfo->data.filename, "fseek");
+			fclose(tmpfp);
+			return;
+		}
 		debug_print("Viewing text content of type: %s (length: %d)\n", mimeinfo->subtype, mimeinfo->length);
 		while (((i = ftell(tmpfp)) < mimeinfo->offset + mimeinfo->length) &&
 		       (fgets(buf, sizeof(buf), tmpfp) != NULL)
@@ -2347,7 +2358,7 @@ void textview_scroll_max(TextView *textview, gboolean up)
 static gint textview_key_pressed(GtkWidget *widget, GdkEventKey *event,
 				 TextView *textview)
 {
-	GdkWindow *window;
+	GdkWindow *window = NULL;
 	SummaryView *summaryview = NULL;
 	MessageView *messageview = textview->messageview;
 
@@ -2393,15 +2404,17 @@ static gint textview_key_pressed(GtkWidget *widget, GdkEventKey *event,
 			summary_pass_key_press_event(summaryview, event);
 		break;
 	default:
-		window = gtk_widget_get_window(messageview->mainwin->window);
-		if (summaryview &&
-		    event->window != window) {
-			GdkEventKey tmpev = *event;
-
-			tmpev.window = window;
-			KEY_PRESS_EVENT_STOP();
-			gtk_widget_event(messageview->mainwin->window,
-					 (GdkEvent *)&tmpev);
+		if (messageview->mainwin) {
+			window = gtk_widget_get_window(messageview->mainwin->window);
+			if (summaryview &&
+			    event->window != window) {
+				GdkEventKey tmpev = *event;
+
+				tmpev.window = window;
+				KEY_PRESS_EVENT_STOP();
+				gtk_widget_event(messageview->mainwin->window,
+						 (GdkEvent *)&tmpev);
+			}
 		}
 		break;
 	}

-----------------------------------------------------------------------

Summary of changes:
 src/addr_compl.c             |    7 ++++---
 src/addressbook.c            |    1 -
 src/common/ssl_certificate.c |    3 +++
 src/prefs_account.c          |    2 +-
 src/prefs_common.c           |    4 ++--
 src/prefs_filtering.c        |    6 ++----
 src/prefs_themes.c           |    2 +-
 src/prefs_toolbar.c          |    6 +++---
 src/printing.c               |    3 ++-
 src/quote_fmt_parse.y        |    4 ++--
 src/send_message.c           |    4 ++++
 src/textview.c               |   41 +++++++++++++++++++++++++++--------------
 12 files changed, 51 insertions(+), 32 deletions(-)


hooks/post-receive
-- 
Claws Mail


More information about the Commits mailing list