2007-08-13 [wwp] 2.10.0cvs119
authorTristan Chabredier <wwp@claws-mail.org>
Mon, 13 Aug 2007 21:36:57 +0000 (21:36 +0000)
committerTristan Chabredier <wwp@claws-mail.org>
Mon, 13 Aug 2007 21:36:57 +0000 (21:36 +0000)
* src/addr_compl.c
* src/addressbook.c
* src/addrindex.c
* src/compose.c
* src/filtering.c
* src/folderview.c
* src/inc.c
* src/matcher.c
* src/mh.c
* src/partial_download.c
* src/prefs_gtk.c
* src/procmsg.c
* src/stock_pixmap.c
* src/summaryview.c
* src/common/utils.c
* src/gtk/gtkaspell.c
* src/gtk/menu.c
Make sure we never pass NULL pointers for %s substitutions
(prevent from crashing in Windows).

20 files changed:
ChangeLog
PATCHSETS
configure.ac
src/addr_compl.c
src/addressbook.c
src/addrindex.c
src/common/utils.c
src/compose.c
src/filtering.c
src/folderview.c
src/gtk/gtkaspell.c
src/gtk/menu.c
src/inc.c
src/matcher.c
src/mh.c
src/partial_download.c
src/prefs_gtk.c
src/procmsg.c
src/stock_pixmap.c
src/summaryview.c

index f266f56..ed66c53 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,25 @@
+2007-08-13 [wwp]       2.10.0cvs119
+
+       * src/addr_compl.c
+       * src/addressbook.c
+       * src/addrindex.c
+       * src/compose.c
+       * src/filtering.c
+       * src/folderview.c
+       * src/inc.c
+       * src/matcher.c
+       * src/mh.c
+       * src/partial_download.c
+       * src/prefs_gtk.c
+       * src/procmsg.c
+       * src/stock_pixmap.c
+       * src/summaryview.c
+       * src/common/utils.c
+       * src/gtk/gtkaspell.c
+       * src/gtk/menu.c
+               Make sure we never pass NULL pointers for %s substitutions
+               (prevent from crashing in Windows).
+
 2007-08-13 [wwp]       2.10.0cvs118
 
        * src/msgcache.c
index 4349255..316a10b 100644 (file)
--- a/PATCHSETS
+++ b/PATCHSETS
 ( cvs diff -u -r 1.1.2.25 -r 1.1.2.26 src/plugins/pgpcore/prefs_gpg.c;  ) > 2.10.0cvs116.patchset
 ( cvs diff -u -r 1.36.2.107 -r 1.36.2.108 src/common/utils.c;  ) > 2.10.0cvs117.patchset
 ( cvs diff -u -r 1.16.2.57 -r 1.16.2.58 src/msgcache.c;  ) > 2.10.0cvs118.patchset
+( cvs diff -u -r 1.27.2.38 -r 1.27.2.39 src/addr_compl.c;  cvs diff -u -r 1.60.2.93 -r 1.60.2.94 src/addressbook.c;  cvs diff -u -r 1.28.2.28 -r 1.28.2.29 src/addrindex.c;  cvs diff -u -r 1.382.2.400 -r 1.382.2.401 src/compose.c;  cvs diff -u -r 1.60.2.36 -r 1.60.2.37 src/filtering.c;  cvs diff -u -r 1.207.2.173 -r 1.207.2.174 src/folderview.c;  cvs diff -u -r 1.149.2.78 -r 1.149.2.79 src/inc.c;  cvs diff -u -r 1.75.2.45 -r 1.75.2.46 src/matcher.c;  cvs diff -u -r 1.79.2.59 -r 1.79.2.60 src/mh.c;  cvs diff -u -r 1.1.2.19 -r 1.1.2.20 src/partial_download.c;  cvs diff -u -r 1.10.2.33 -r 1.10.2.34 src/prefs_gtk.c;  cvs diff -u -r 1.150.2.101 -r 1.150.2.102 src/procmsg.c;  cvs diff -u -r 1.25.2.45 -r 1.25.2.46 src/stock_pixmap.c;  cvs diff -u -r 1.395.2.318 -r 1.395.2.319 src/summaryview.c;  cvs diff -u -r 1.36.2.108 -r 1.36.2.109 src/common/utils.c;  cvs diff -u -r 1.9.2.52 -r 1.9.2.53 src/gtk/gtkaspell.c;  cvs diff -u -r 1.5.2.23 -r 1.5.2.24 src/gtk/menu.c;  ) > 2.10.0cvs119.patchset
index 16b794b..54534c2 100644 (file)
@@ -11,7 +11,7 @@ MINOR_VERSION=10
 MICRO_VERSION=0
 INTERFACE_AGE=0
 BINARY_AGE=0
-EXTRA_VERSION=118
+EXTRA_VERSION=119
 EXTRA_RELEASE=
 EXTRA_GTK2_VERSION=
 
index 4365606..ca17e1e 100644 (file)
@@ -371,7 +371,7 @@ gint start_address_completion(gchar *folderpath)
 
        g_ref_count++;
        debug_print("start_address_completion(%s) ref count %d\n",
-                               folderpath, g_ref_count);
+                               folderpath?folderpath:"(null)", g_ref_count);
 
        return g_list_length(g_completion_list);
 }
index 27b4edf..cd322c4 100644 (file)
@@ -4919,7 +4919,7 @@ gboolean addressbook_folder_selection( gchar **folderpath )
                } else {
                        *folderpath = g_strdup_printf("%s", book->fileName);
                }
-               debug_print( "addressbook_foldersel: %s\n", *folderpath);
+               debug_print( "addressbook_foldersel: %s\n", *folderpath?*folderpath:"(null)");
                return (*folderpath != NULL);
        }
        return FALSE;
index 3c4e12b..e8fac83 100644 (file)
@@ -2916,7 +2916,7 @@ gboolean addrindex_load_completion(
 
                                AddressBookFile *abf = book->rawDataSource;
 
-                               debug_print("addrindex_load_completion: book %p '%s'\n", book, abf->fileName);
+                               debug_print("addrindex_load_completion: book %p '%s'\n", book, abf?abf->fileName:"(null)");
 
                                addrindex_load_completion_load_persons( callBackFunc, book );
 
index 3724dca..57949b5 100644 (file)
@@ -3467,7 +3467,7 @@ gint execute_command_line(const gchar *cmdline, gboolean async)
        gchar **argv;
        gint ret;
 
-       debug_print("execute_command_line(): executing: %s\n", cmdline);
+       debug_print("execute_command_line(): executing: %s\n", cmdline?cmdline:"(null)");
 
        argv = strsplit_with_quote(cmdline, " ", 0);
 
index 20bb291..6d7a11f 100644 (file)
@@ -8557,7 +8557,7 @@ gboolean compose_draft (gpointer data, guint action)
 
                path = folder_item_fetch_msg(draft, msgnum);
                if (path == NULL) {
-                       debug_print("can't fetch %s:%d\n",draft->path, msgnum);
+                       debug_print("can't fetch %s:%d\n", draft->path, msgnum);
                        goto unlock;
                }
                if (g_stat(path, &s) < 0) {
index fc46d00..6fa698d 100644 (file)
@@ -57,7 +57,7 @@ static inline gint strlen_with_check(const gchar *expr, gint fline, const gchar
         if (str) 
                return strlen(str);
        else {
-               debug_print("%s(%d) - invalid string %s\n", __FILE__, fline, expr);
+               debug_print("%s(%d) - invalid string %s\n", __FILE__, fline, expr?expr:"(null)");
                return 0;
        }
 }
@@ -274,7 +274,7 @@ static gboolean filteringaction_apply(FilteringAction * action, MsgInfo * info)
                        folder_find_item_from_identifier(action->destination);
                if (!dest_folder) {
                        debug_print("*** folder not found '%s'\n",
-                               action->destination ?action->destination :"");
+                               action->destination ?action->destination :"(null)");
                        return FALSE;
                }
                
@@ -296,7 +296,7 @@ static gboolean filteringaction_apply(FilteringAction * action, MsgInfo * info)
 
                if (!dest_folder) {
                        debug_print("*** folder not found '%s'\n",
-                               action->destination ?action->destination :"");
+                               action->destination ?action->destination :"(null)");
                        return FALSE;
                }
 
@@ -317,7 +317,7 @@ static gboolean filteringaction_apply(FilteringAction * action, MsgInfo * info)
                val = tags_get_id_for_str(action->destination);
                if (val == -1) {
                        debug_print("*** tag '%s' not found\n",
-                               action->destination ?action->destination :"");
+                               action->destination ?action->destination :"(null)");
                        return FALSE;
                }
                
index 302d948..8b18170 100644 (file)
@@ -2193,6 +2193,7 @@ static void folderview_selected(GtkCTree *ctree, GtkCTreeNode *row,
        }
 
        /* Open Folder */
+       /* TODO: wwp: avoid displaying (null) in the status bar */
        buf = g_strdup_printf(_("Opening Folder %s..."), item->path ? 
                                        item->path : "(null)");
        debug_print("%s\n", buf);
index 77104d3..33c47c3 100644 (file)
@@ -1699,7 +1699,7 @@ static GSList *gtkaspell_get_dictionary_list(const gchar *aspell_path, gint refr
        dlist = get_aspell_dict_info_list(config);
        delete_aspell_config(config);
 
-       debug_print("Aspell: checking for dictionaries in %s\n", aspell_path);
+       debug_print("Aspell: checking for dictionaries in %s\n", aspell_path?aspell_path:"(null)");
        dels = aspell_dict_info_list_elements(dlist);
        while ( (entry = aspell_dict_info_enumeration_next(dels)) != 0) 
        {
index d75071b..67223d0 100644 (file)
@@ -135,7 +135,7 @@ void menu_set_active(GtkItemFactory *ifactory, const gchar *path,
        g_return_if_fail(widget != NULL);
 
        if (!GTK_IS_CHECK_MENU_ITEM(widget)) {
-               debug_print("%s not check_menu_item\n", path);
+               debug_print("%s not check_menu_item\n", path?path:"(null)");
                return;
        }       
        gtk_check_menu_item_set_active(GTK_CHECK_MENU_ITEM(widget), is_active);
index ae8a1b2..cfda7b8 100644 (file)
--- a/src/inc.c
+++ b/src/inc.c
@@ -1282,17 +1282,22 @@ static gint inc_spool_account(PrefsAccount *account)
        } else
                inbox = folder_get_default_inbox();
 
-       if (is_file_exist(account->local_mbox))
-               mbox = g_strdup(account->local_mbox);
-       else if (is_dir_exist(account->local_mbox)) 
-               mbox = g_strconcat(account->local_mbox, G_DIR_SEPARATOR_S,
-                                  g_get_user_name(), NULL);
-       else {
-               debug_print("%s: local mailbox not found.\n", 
-                           account->local_mbox);
+       if (account->local_mbox) {
+               if (is_file_exist(account->local_mbox))
+                       mbox = g_strdup(account->local_mbox);
+               else if (is_dir_exist(account->local_mbox)) 
+                       mbox = g_strconcat(account->local_mbox, G_DIR_SEPARATOR_S,
+                                          g_get_user_name(), NULL);
+               else {
+                       debug_print("%s: local mailbox not found.\n", 
+                                   account->local_mbox);
+                       return -1;
+               }
+       } else {
+               debug_print("local mailbox not set in account info.\n");
                return -1;
-       }
-       
+       }       
+
        result = get_spool(inbox, mbox, account);
        g_free(mbox);
        
index f25d61c..2b0b673 100644 (file)
@@ -317,7 +317,7 @@ static gboolean match_with_addresses_in_addressbook
        g_return_val_if_fail(address_list != NULL, FALSE);
 
        debug_print("match_with_addresses_in_addressbook(%d, %s)\n",
-                               g_slist_length(address_list), folderpath);
+                               g_slist_length(address_list), folderpath?folderpath:"(null)");
 
        if (folderpath == NULL ||
                strcasecmp(folderpath, _("Any")) == 0 ||
index 000a282..3797996 100644 (file)
--- a/src/mh.c
+++ b/src/mh.c
@@ -218,7 +218,7 @@ gboolean mh_scan_required(Folder *folder, FolderItem *item)
        if ((s.st_mtime > item->mtime) &&
                (s.st_mtime - 3600 != item->mtime)) {
                debug_print("MH scan required, folder updated: %s (%ld > %ld)\n",
-                           path,
+                           path?path:"(null)",
                            (long int) s.st_mtime,
                            (long int) item->mtime);
                g_free(path);
@@ -226,7 +226,7 @@ gboolean mh_scan_required(Folder *folder, FolderItem *item)
        }
 
        debug_print("MH scan not required: %s (%ld <= %ld)\n",
-                   path,
+                   path?path:"(null)",
                    (long int) s.st_mtime,
                    (long int) item->mtime);
        g_free(path);
@@ -243,7 +243,7 @@ static void mh_get_last_num(Folder *folder, FolderItem *item)
 
        g_return_if_fail(item != NULL);
 
-       debug_print("mh_get_last_num(): Scanning %s ...\n", item->path);
+       debug_print("mh_get_last_num(): Scanning %s ...\n", item->path?item->path:"(null)");
 
        path = folder_item_get_path(item);
        g_return_if_fail(path != NULL);
@@ -269,7 +269,7 @@ static void mh_get_last_num(Folder *folder, FolderItem *item)
        }
        closedir(dp);
 
-       debug_print("Last number in dir %s = %d\n", item->path, max);
+       debug_print("Last number in dir %s = %d\n", item->path?item->path:"(null)", max);
        item->last_num = max;
 }
 
@@ -283,7 +283,7 @@ gint mh_get_num_list(Folder *folder, FolderItem *item, GSList **list, gboolean *
 
        g_return_val_if_fail(item != NULL, -1);
 
-       debug_print("mh_get_num_list(): Scanning %s ...\n", item->path);
+       debug_print("mh_get_num_list(): Scanning %s ...\n", item->path?item->path:"(null)");
 
        *old_uids_valid = TRUE;
 
@@ -997,7 +997,7 @@ static gboolean mh_remove_missing_folder_items_func(GNode *node, gpointer data)
 
        path = folder_item_get_path(item);
        if (!is_dir_exist(path)) {
-               debug_print("folder '%s' not found. removing...\n", path);
+               debug_print("folder '%s' not found. removing...\n", path?path:"(null)");
                folder_item_remove(item);
        }
        g_free(path);
@@ -1449,6 +1449,6 @@ void mh_set_mtime(FolderItem *item)
        }
 
        item->mtime = s.st_mtime;
-       debug_print("MH: forced mtime of %s to %ld\n", item->name, item->mtime);
+       debug_print("MH: forced mtime of %s to %ld\n", item->name?item->name:"(null)", item->mtime);
        g_free(path);
 }
index ad38c84..fac09d1 100644 (file)
@@ -309,7 +309,7 @@ void partial_delete_old(const gchar *file)
        int num = 0;
        FolderItem *item = NULL;
 
-       debug_print("too big message updated,should remove %s\n", file);
+       debug_print("too big message updated, should remove %s\n", file?file:"(null)");
 
        if (snum) {
                snum++;
index 7d5aff9..fc19440 100644 (file)
@@ -1022,7 +1022,7 @@ static int prefs_cache_sections(GHashTable *file_cache, const gchar *rcfile)
        GHashTable *section_cache = NULL;
 
        if (!fp) {
-               debug_print("cache: %s: %s", rcfile, strerror(errno));
+               debug_print("cache: %s: %s", rcfile?rcfile:"(null)", strerror(errno));
                return -1;
        }
        
@@ -1084,7 +1084,7 @@ static int prefs_cache(const gchar *rcfile)
        GHashTable *file_cache = g_hash_table_new_full(g_str_hash, g_str_equal, 
                                        g_free, prefs_destroy_file_cache);
        
-       debug_print("new file '%s'\n", rcfile);
+       debug_print("new file '%s'\n", rcfile?rcfile:"(null)");
        g_hash_table_insert(whole_cache, g_strdup(rcfile), file_cache);
        
        return prefs_cache_sections(file_cache, rcfile);
@@ -1145,13 +1145,13 @@ static gboolean prefs_read_config_from_cache(PrefParam *param, const gchar *labe
        sections_table = g_hash_table_lookup(whole_cache, rcfile);
        
        if (sections_table == NULL) {
-               g_warning("Can't find %s in the whole cache\n", rcfile);
+               g_warning("Can't find %s in the whole cache\n", rcfile?rcfile:"(null)");
                return FALSE;
        }
        values_table = g_hash_table_lookup(sections_table, label);
        
        if (values_table == NULL) {
-               debug_print("no '%s' section in '%s' cache\n", label, rcfile);
+               debug_print("no '%s' section in '%s' cache\n", label?label:"(null)", rcfile?rcfile:"(null)");
                return TRUE;
        }
        g_hash_table_foreach(values_table, prefs_parse_cache, param);
index 4f54ab7..c3e4f26 100644 (file)
@@ -810,7 +810,7 @@ parse_again:
        g_slist_free(orig);
        
        for (cur = result; cur; cur = cur->next)
-               debug_print("sort after  %s\n", ((MsgInfo *)cur->data)->from);
+               debug_print("sort after %s\n", ((MsgInfo *)cur->data)->from);
 
        debug_print("\n");
 
index dda4d16..11dde53 100644 (file)
@@ -502,7 +502,7 @@ static void stock_pixmap_find_themes_in_dir(GList **list, const gchar *dirname)
        DIR *dp;
        
        if ((dp = opendir(dirname)) == NULL) {
-               debug_print("dir %s not found, skipping theme scan", dirname);
+               debug_print("dir %s not found, skipping theme scan", dirname?dirname:"(null)");
                return;
        }
        
index b116357..741d302 100644 (file)
@@ -1177,7 +1177,7 @@ gboolean summary_show(SummaryView *summaryview, FolderItem *item)
                g_free(buf);
                debug_print("empty folder (%p %s %p %d)\n\n",
                                item, 
-                               item?item->path:"NULL",
+                               (item && item->path)?item->path:"(null)",
                                item?folder_item_parent(item):0x0,
                                item?item->no_select:FALSE);
                summary_set_hide_read_msgs_menu(summaryview, FALSE);