[Commits] [SCM] claws branch, master, updated. 3.14.1-105-g87b362f

wwp at claws-mail.org wwp at claws-mail.org
Mon Jan 9 11:37:33 CET 2017


The branch, master has been updated
       via  87b362fc337957c73b9ce0d4f7321674693a30ad (commit)
      from  be36f031fa3f722c5dbce3dedb33429fadade08a (commit)

Summary of changes:
 src/plugins/archive/archiver_gtk.c               |   23 ++++++++++++----------
 src/plugins/notification/notification_core.c     |    8 ++++----
 src/plugins/notification/notification_trayicon.c |    2 +-
 src/plugins/rssyl/opml_export.c                  |    2 +-
 src/plugins/rssyl/rssyl_feed_props.c             |    6 ++----
 src/plugins/rssyl/rssyl_parse_feed.c             |   10 ++++++++--
 src/plugins/rssyl/rssyl_update_format.c          |    8 ++++++--
 src/plugins/tnef_parse/tnef_parse.c              |   18 +++++++++++------
 src/plugins/vcalendar/day-view.c                 |    6 +++---
 src/prefs_folder_item.c                          |    8 +++++---
 src/prefs_gtk.c                                  |    9 +++------
 11 files changed, 58 insertions(+), 42 deletions(-)


- Log -----------------------------------------------------------------
commit 87b362fc337957c73b9ce0d4f7321674693a30ad
Author: wwp <wwp at free.fr>
Date:   Mon Jan 9 11:37:18 2017 +0100

    Fixes Coverity CIDs: 1220388 1372362 1220222 1358399 1223756 1223757 1220305 1220269 1220243 1396991.

diff --git a/src/plugins/archive/archiver_gtk.c b/src/plugins/archive/archiver_gtk.c
index 604ac25..55156ed 100644
--- a/src/plugins/archive/archiver_gtk.c
+++ b/src/plugins/archive/archiver_gtk.c
@@ -734,7 +734,10 @@ static void show_result(struct ArchivePage* page) {
 			format = g_strdup("NO FORMAT");
 	}
 
-	g_stat(page->name, &st);
+	if (g_stat(page->name, &st) == -1) {
+		alertpanel_error("Could not get size of archive file '%s'.", page->name);
+		return;
+	}
 	dialog = gtk_dialog_new_with_buttons(
 			_("Archive result"),
 			GTK_WINDOW(mainwin->window),
@@ -849,17 +852,17 @@ static void show_result(struct ArchivePage* page) {
 				STRING2, msg, -1);
 	g_free(msg);
         
-        msg = g_strdup(gtk_entry_get_text(GTK_ENTRY(page->isoDate)));
-        if (msg) {
-	    gtk_list_store_append(list, &iter);
-	    gtk_list_store_set(
-				list, &iter,
-				STRING1, _("Select mails before"),
-				STRING2, msg, -1);
-        }
+	msg = g_strdup(gtk_entry_get_text(GTK_ENTRY(page->isoDate)));
+	if (msg) {
+	gtk_list_store_append(list, &iter);
+	gtk_list_store_set(
+			list, &iter,
+			STRING1, _("Select mails before"),
+			STRING2, msg, -1);
+	}
 	g_free(msg);
 
-        gtk_window_set_default_size(GTK_WINDOW(dialog), 320, 260);
+	gtk_window_set_default_size(GTK_WINDOW(dialog), 320, 260);
 
 	gtk_widget_show_all(dialog);
 }
diff --git a/src/plugins/notification/notification_core.c b/src/plugins/notification/notification_core.c
index 69bdf31..22fb659 100644
--- a/src/plugins/notification/notification_core.c
+++ b/src/plugins/notification/notification_core.c
@@ -653,22 +653,22 @@ gchar* notification_libnotify_sanitize_str(gchar *in)
   i_out = 0;
   while(*in) {
     if(*in == '<') {
-      if(i_out+3 >= STR_MAX_LEN) break;
+      if(i_out+3 > STR_MAX_LEN) break;
       memcpy(&(tmp_str[i_out]),"<",4);
       in++; i_out += 4;
     }
     else if(*in == '>') {
-      if(i_out+3 >= STR_MAX_LEN) break;
+      if(i_out+3 > STR_MAX_LEN) break;
       memcpy(&(tmp_str[i_out]),">",4);
       in++; i_out += 4;
     }
     else if(*in == '&') {
-      if(i_out+4 >= STR_MAX_LEN) break;
+      if(i_out+4 > STR_MAX_LEN) break;
       memcpy(&(tmp_str[i_out]),"&",5);
       in++; i_out += 5;
     }
     else {
-      if(i_out >= STR_MAX_LEN) break;
+      if(i_out > STR_MAX_LEN) break;
       tmp_str[i_out++] = *in++;
     }
   }
diff --git a/src/plugins/notification/notification_trayicon.c b/src/plugins/notification/notification_trayicon.c
index 7201837..09c9400 100644
--- a/src/plugins/notification/notification_trayicon.c
+++ b/src/plugins/notification/notification_trayicon.c
@@ -921,7 +921,7 @@ static gchar* notification_trayicon_popup_assemble_body(MsgInfo *msginfo)
 		      		     "%d new mail messages arrived",
 		            popup.num_mail),
 			    popup.num_mail);
-      tmp = g_strdup_printf("%s%s%s",utf8_str,str_empty?"":"\n",msg);
+      tmp = g_strdup_printf("%s%s%s",utf8_str,"",msg);
       g_free(msg);
       g_free(utf8_str);
       utf8_str = tmp;
diff --git a/src/plugins/rssyl/opml_export.c b/src/plugins/rssyl/opml_export.c
index bc165ee..6bde580 100644
--- a/src/plugins/rssyl/opml_export.c
+++ b/src/plugins/rssyl/opml_export.c
@@ -130,7 +130,7 @@ void rssyl_opml_export(void)
 			log_warning(LOG_PROTOCOL,
 					_("RSSyl: Couldn't delete old OPML file '%s': %s\n"),
 					opmlfile, g_strerror(errno));
-			debug_print("RSSyl: couldn't delete old file '%s'\n", opmlfile);
+			debug_print("RSSyl: Couldn't delete old file '%s'\n", opmlfile);
 			g_free(opmlfile);
 			return;
 		}
diff --git a/src/plugins/rssyl/rssyl_feed_props.c b/src/plugins/rssyl/rssyl_feed_props.c
index 4b4e987..d2936c0 100644
--- a/src/plugins/rssyl/rssyl_feed_props.c
+++ b/src/plugins/rssyl/rssyl_feed_props.c
@@ -54,10 +54,8 @@ static void rssyl_gtk_prop_store(RFolderItem *ritem)
 	url = (gchar *)gtk_entry_get_text(GTK_ENTRY(ritem->feedprop->url));
 
 	if( strlen(url) && strcmp(ritem->url, url)) {
-		if( ritem->url ) {
-			rssyl_passwd_set(ritem, NULL);
-			g_free(ritem->url);
-		}
+		rssyl_passwd_set(ritem, NULL);
+		g_free(ritem->url);
 		ritem->url = g_strdup(url);
 	}
 
diff --git a/src/plugins/rssyl/rssyl_parse_feed.c b/src/plugins/rssyl/rssyl_parse_feed.c
index 6eeb611..237a2fe 100644
--- a/src/plugins/rssyl/rssyl_parse_feed.c
+++ b/src/plugins/rssyl/rssyl_parse_feed.c
@@ -120,7 +120,10 @@ static void rssyl_expire_items(RFolderItem *ritem, Feed *feed)
 			ctx->expired_ids = g_slist_prepend(ctx->expired_ids,
 					g_strdup(feed_item_get_id(item)));
 			fctx = (RFeedCtx *)item->data;
-			g_remove(fctx->path);
+			if (g_remove(fctx->path) != 0) {
+				debug_print("RSSyl: couldn't delete expiring item file '%s'\n",
+						fctx->path);
+			}
 		}
 	}
 
@@ -137,7 +140,10 @@ static void rssyl_expire_items(RFolderItem *ritem, Feed *feed)
 					feed_item_get_parent_id(item), (GCompareFunc)g_strcmp0)) {
 				debug_print("RSSyl: expiring comment '%s'\n", feed_item_get_id(item));
 				fctx = (RFeedCtx *)item->data;
-				g_remove(fctx->path);
+				if (g_remove(fctx->path) != 0) {
+					debug_print("RSSyl: couldn't delete expiring comment file '%s'\n",
+							fctx->path);
+				}
 			}
 		}
 	}
diff --git a/src/plugins/rssyl/rssyl_update_format.c b/src/plugins/rssyl/rssyl_update_format.c
index 35fe172..184dee3 100644
--- a/src/plugins/rssyl/rssyl_update_format.c
+++ b/src/plugins/rssyl/rssyl_update_format.c
@@ -227,7 +227,9 @@ void rssyl_update_format()
 
 	g_free(ctx);
 
-	g_remove(old_feeds_xml);
+	if (g_remove(old_feeds_xml) != 0) {
+		debug_print("RSSyl: Couldn't delete '%s'\n", old_feeds_xml);
+	}
 	g_free(old_feeds_xml);
 }
 
@@ -267,7 +269,9 @@ static void rssyl_update_format_move_contents(FolderItem *olditem,
 			move_file(fpath, nfpath, FALSE);
 			g_free(nfpath);
 		}
-		g_remove(fpath);
+		if (g_remove(fpath) != 0) {
+			debug_print("RSSyl: (FORMAT) couldn't delete '%s'\n", fpath);
+		}
 		g_free(fpath);
 	}
 
diff --git a/src/plugins/tnef_parse/tnef_parse.c b/src/plugins/tnef_parse/tnef_parse.c
index e694313..fc8b8ef 100644
--- a/src/plugins/tnef_parse/tnef_parse.c
+++ b/src/plugins/tnef_parse/tnef_parse.c
@@ -236,6 +236,7 @@ MimeInfo *tnef_parse_vcard(TNEFStruct *tnef)
 	FILE *fp = get_tmpfile_in_dir(get_mime_tmp_dir(), &tmpfilename);
 	GStatBuf statbuf;
 	gboolean result = FALSE;
+	gint ret;
 	if (!fp) {
 		g_free(tmpfilename);
 		return NULL;
@@ -252,16 +253,21 @@ MimeInfo *tnef_parse_vcard(TNEFStruct *tnef)
 	result = SaveVCard(fp, tnef);
 	
 	fclose(fp);
-	g_stat(tmpfilename, &statbuf);
-	sub_info->tmp = TRUE;
-	sub_info->length = statbuf.st_size;
-	sub_info->encoding_type = ENC_BINARY;
-	
-	if (!result) {
+
+	ret = g_stat(tmpfilename, &statbuf);
+	if (ret == -1) {
+		debug_printf("couldn't stat tmpfilename '%s'\n", tmpfilename);
+	}
+
+	if ((ret == -1) || !result) {
 		claws_unlink(tmpfilename);
 		procmime_mimeinfo_free_all(&sub_info);
 		return tnef_broken_mimeinfo(_("Failed to parse VCard data."));
 	}
+
+	sub_info->tmp = TRUE;
+	sub_info->length = statbuf.st_size;
+	sub_info->encoding_type = ENC_BINARY;
 	return sub_info;
 }
 
diff --git a/src/plugins/vcalendar/day-view.c b/src/plugins/vcalendar/day-view.c
index 1d130fe..553dc8f 100644
--- a/src/plugins/vcalendar/day-view.c
+++ b/src/plugins/vcalendar/day-view.c
@@ -240,7 +240,7 @@ static void dw_summary_selected(GtkCMCTree *ctree, GtkCMCTreeNode *row,
 				localtime_r(&t_start, &tm_start);
 				if (tm_start.tm_hour > 2)
 					gtk_adjustment_set_value(v_adj, 
-						(v_adj->upper-v_adj->page_size)/(24/(tm_start.tm_hour-2)));
+						((v_adj->upper-v_adj->page_size)/(gdouble)(24/(tm_start.tm_hour-2))));
 				else
 					gtk_adjustment_set_value(v_adj, 0);
 				gtk_adjustment_changed(v_adj);
@@ -264,7 +264,7 @@ static void day_view_new_meeting_cb(day_win *dw, gpointer data_i, gpointer data_
             || ((tm_date.tm_year%400) == 0)))
         monthdays[1] = 29;
 
-    if (offset_d > monthdays[mon]) {
+    if (offset_d > (int)monthdays[mon]) {
     	while (tm_date.tm_mday > 1)
 		orage_move_day(&tm_date, 1);
 	offset_d -= monthdays[mon];
@@ -814,7 +814,7 @@ static void build_day_view_table(day_win *dw)
         gtk_table_attach(GTK_TABLE(dw->dtable_h), button, i, i+1, 0, 1
                 , (GTK_FILL), (0), 0, 0);
 
-        if (++tm_date.tm_mday == (monthdays[tm_date.tm_mon]+1)) {
+        if (++tm_date.tm_mday == (int)(monthdays[tm_date.tm_mon]+1)) {
             if (++tm_date.tm_mon == 12) {
                 ++tm_date.tm_year;
                 tm_date.tm_mon = 0;
diff --git a/src/prefs_folder_item.c b/src/prefs_folder_item.c
index 0da2f87..5608715 100644
--- a/src/prefs_folder_item.c
+++ b/src/prefs_folder_item.c
@@ -1762,9 +1762,11 @@ static void folder_regexp_test_cb(GtkWidget *widget, gpointer data)
 
 #if !GTK_CHECK_VERSION(3, 0, 0)
 	if (!colors_initialised) {
-		gdk_color_parse("#ff7070", &red);
-		colors_initialised = gdk_colormap_alloc_color(
-			gdk_colormap_get_system(), &red, FALSE, TRUE);
+		if (!gdk_color_parse("#ff7070", &red)) {
+	        g_warning("color parse failed: red");
+			colors_initialised = gdk_colormap_alloc_color(
+				gdk_colormap_get_system(), &red, FALSE, TRUE);
+		}
 	}
 #endif
 
diff --git a/src/prefs_gtk.c b/src/prefs_gtk.c
index ccab0a3..ca3051e 100644
--- a/src/prefs_gtk.c
+++ b/src/prefs_gtk.c
@@ -448,8 +448,7 @@ void prefs_set_default(PrefParam *param)
 				if (!g_ascii_strcasecmp(param[i].defval, "TRUE"))
 					*((gboolean *)param[i].data) = TRUE;
 				else
-					*((gboolean *)param[i].data) =
-						atoi(param[i].defval) ? TRUE : FALSE;
+					*((gboolean *)param[i].data) = atoi(param[i].defval) ? TRUE : FALSE;
 			} else
 				*((gboolean *)param[i].data) = FALSE;
 			break;
@@ -462,15 +461,13 @@ void prefs_set_default(PrefParam *param)
 			break;
 		case P_USHORT:
 			if (param[i].defval != NULL)
-				*((gushort *)param[i].data) =
-					(gushort)atoi(param[i].defval);
+				*((gushort *)param[i].data) = (gushort)atoi(param[i].defval);
 			else
 				*((gushort *)param[i].data) = 0;
 			break;
 		case P_COLOR:
 			if (param[i].defval != NULL && gdk_color_parse(param[i].defval, &color))
-				*((gulong *)param[i].data) =
-					RGB_FROM_GDK_COLOR(color);
+				*((gulong *)param[i].data) = RGB_FROM_GDK_COLOR(color);
 			else if (param[i].defval)
 				/* be compatible and accept ints */
 				*((gulong *)param[i].data) = strtoul(param[i].defval, 0, 10); 

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


hooks/post-receive
-- 
Claws Mail


More information about the Commits mailing list