[balsa/gtk3] Various cppcheck fixes



commit 6176beeeeb5e8e7e4a5ba3b0c61e75a8590ebccb
Author: Peter Bloomfield <PeterBloomfield bellsouth net>
Date:   Sun Jul 22 15:38:23 2012 -0400

    Various cppcheck fixes
    
    	* src/main-window.c: use sscanf field limits; suppress null
    	pointer warning.

 ChangeLog         |    5 +++++
 src/main-window.c |    5 +++--
 2 files changed, 8 insertions(+), 2 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index 9cab46f..e5fe07d 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,10 @@
 2012-07-22  Peter Bloomfield
 
+	* src/main-window.c: use sscanf field limits; suppress null
+	pointer warning.
+
+2012-07-22  Peter Bloomfield
+
 	* src/mailbox-conf.c (mailbox_conf_update): reduce scope of
 	variable.
 
diff --git a/src/main-window.c b/src/main-window.c
index 6daad9a..5591c73 100644
--- a/src/main-window.c
+++ b/src/main-window.c
@@ -1177,7 +1177,7 @@ static LibBalsaCondition *
 bw_filter_old(const char *str)
 {
     int days;
-    if(str && sscanf(str, "%d", &days) == 1) {
+    if(str && sscanf(str, "%10d", &days) == 1) {
         time_t upperbound = time(NULL)-(days-1)*24*3600;
         return libbalsa_condition_new_date(FALSE, NULL, &upperbound);
     } else return NULL;
@@ -1187,7 +1187,7 @@ static LibBalsaCondition *
 bw_filter_recent(const char *str)
 {
     int days;
-    if(str && sscanf(str, "%d", &days) == 1) {
+    if(str && sscanf(str, "%10d", &days) == 1) {
         time_t lowerbound = time(NULL)-(days-1)*24*3600;
         return libbalsa_condition_new_date(FALSE, &lowerbound, NULL);
     } else return NULL;
@@ -1938,6 +1938,7 @@ bw_enable_mailbox_menus(BalsaWindow * window, BalsaIndex * index)
         mbnode = index->mailbox_node;
         mailbox = mbnode->mailbox;
     }
+    /* cppcheck-suppress nullPointer */
     bw_set_sensitive(window, "Expunge", mailbox && !mailbox->readonly);
 #if defined(ENABLE_TOUCH_UI)
     {gboolean can_sort, can_thread; guint i;



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]