From 74b2743351953c0be233429a7c627dd4614c8616 Mon Sep 17 00:00:00 2001 From: Colin Leroy Date: Mon, 20 Dec 2010 13:17:42 +0000 Subject: [PATCH] 2010-12-20 [colin] 3.7.8cvs15 * src/addrcindex.c * src/addrcindex.h Removed. Dead code since ages! * src/addr_compl.c * src/gtk/gtkcmclist.c * src/gtk/gtkcmctree.c * src/gtk/gtksctree.c undefine *_DISABLE_DEPRECATED in the files that use deprecated interfaces. Implicit declarations can lead to crashes as prototypes are unknown, as evidenced by bug #2315. --- ChangeLog | 14 ++ PATCHSETS | 1 + configure.ac | 2 +- src/addr_compl.c | 5 + src/addrcindex.c | 380 ------------------------------------------- src/addrcindex.h | 62 ------- src/gtk/gtkcmclist.c | 5 + src/gtk/gtkcmctree.c | 6 + src/gtk/gtksctree.c | 5 + 9 files changed, 37 insertions(+), 443 deletions(-) delete mode 100644 src/addrcindex.c delete mode 100644 src/addrcindex.h diff --git a/ChangeLog b/ChangeLog index 6f03a09cc..25e80940c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,17 @@ +2010-12-20 [colin] 3.7.8cvs15 + + * src/addrcindex.c + * src/addrcindex.h + Removed. Dead code since ages! + * src/addr_compl.c + * src/gtk/gtkcmclist.c + * src/gtk/gtkcmctree.c + * src/gtk/gtksctree.c + undefine *_DISABLE_DEPRECATED in the files that + use deprecated interfaces. Implicit declarations + can lead to crashes as prototypes are unknown, as + evidenced by bug #2315. + 2010-12-20 [colin] 3.7.8cvs14 * src/compose.c diff --git a/PATCHSETS b/PATCHSETS index 04d1c06be..bd744c245 100644 --- a/PATCHSETS +++ b/PATCHSETS @@ -4088,3 +4088,4 @@ ( cvs diff -u -r 1.1.4.10 -r 1.1.4.11 src/common/base64.c; ) > 3.7.8cvs12.patchset ( cvs diff -u -r 1.274.2.319 -r 1.274.2.320 src/mainwindow.c; ) > 3.7.8cvs13.patchset ( cvs diff -u -r 1.382.2.562 -r 1.382.2.563 src/compose.c; ) > 3.7.8cvs14.patchset +( cvs diff -u -r 1.27.2.48 -r 1.27.2.49 src/addr_compl.c; cvs diff -u -r -1.1.4.10 -r -1.1.4.11 src/addrcindex.c; cvs diff -u -r -1.1.4.6 -r -1.1.4.7 src/addrcindex.h; cvs diff -u -r 1.1.2.14 -r 1.1.2.15 src/gtk/gtkcmclist.c; cvs diff -u -r 1.1.2.16 -r 1.1.2.17 src/gtk/gtkcmctree.c; cvs diff -u -r 1.1.4.58 -r 1.1.4.59 src/gtk/gtksctree.c; ) > 3.7.8cvs15.patchset diff --git a/configure.ac b/configure.ac index 076f44855..b45e427e1 100644 --- a/configure.ac +++ b/configure.ac @@ -12,7 +12,7 @@ MINOR_VERSION=7 MICRO_VERSION=8 INTERFACE_AGE=0 BINARY_AGE=0 -EXTRA_VERSION=14 +EXTRA_VERSION=15 EXTRA_RELEASE= EXTRA_GTK2_VERSION= diff --git a/src/addr_compl.c b/src/addr_compl.c index 7ff56ec15..7abbc7211 100644 --- a/src/addr_compl.c +++ b/src/addr_compl.c @@ -23,6 +23,11 @@ #endif #include "defs.h" +/* We know this file uses some deprecated stuff. */ +#undef G_DISABLE_DEPRECATED +#undef GTK_DISABLE_DEPRECATED +#undef GDK_DISABLE_DEPRECATED + #include #include #include diff --git a/src/addrcindex.c b/src/addrcindex.c deleted file mode 100644 index eaaa07795..000000000 --- a/src/addrcindex.c +++ /dev/null @@ -1,380 +0,0 @@ -/* - * Sylpheed -- a GTK+ based, lightweight, and fast e-mail client - * Copyright (C) 2002-2009 Match Grun and the Claws Mail team - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - * - */ - -/* - * Functions to maintain address completion index. - */ - -#include -#include - -#include "mgutils.h" -#include "addritem.h" -#include "addrcindex.h" - -/* -static gint _n_created = 0; -static gint _n_freed = 0; -*/ - -typedef struct { - gchar *name; - ItemEMail *address; -} -AddrIndexEntry; - -static gchar *addrcindex_function( gpointer data ) { - return ( ( AddrIndexEntry * ) data )->name; -} - -/* -* Create new completion index. -*/ -AddrCacheIndex *addrcindex_create( void ) { - AddrCacheIndex *index; - - /* - ++_n_created; - g_print( "addrcindex_create/1/%d\n", _n_created ); - */ - index = g_new0( AddrCacheIndex, 1 ); - index->completion = g_completion_new( addrcindex_function ); - index->addressList = NULL; - index->invalid = TRUE; - - return index; -} - -/* -* Clear the completion index. -*/ -void addrcindex_clear( AddrCacheIndex *index ) { - if( index ) { - /* Clear completion index */ - g_completion_clear_items( index->completion ); - - /* Clear address list */ - g_list_free( index->addressList ); - index->addressList = NULL; - index->invalid = TRUE; - } -} - -/* -* Free completion index. -*/ -void addrcindex_free( AddrCacheIndex *index ) { - if( index ) { - /* - ++_n_freed; - g_print( "addrcindex_free/2/%d\n", _n_freed ); - */ - /* Clear out */ - addrcindex_clear( index ); - - /* Free up */ - g_completion_free( index->completion ); - index->completion = NULL; - index->invalid = FALSE; - - g_free( index ); - } -} - -/** - * Mark index as invalid. Will need to be rebuilt. - * \param index Address completion index. - */ -void addrcindex_invalidate( AddrCacheIndex *index ) { - cm_return_if_fail( index != NULL ); - index->invalid = TRUE; -} - -/** - * Mark index as valid. - * \param index Address completion index. - */ -void addrcindex_validate( AddrCacheIndex *index ) { - cm_return_if_fail( index != NULL ); - index->invalid = FALSE; -} - -/* - * Add completion entry to index. - * Enter: index Index. - * name Name. - * email EMail entry to add. - */ -void addrcindex_add_entry( - AddrCacheIndex *index, gchar *name, ItemEMail *email ) -{ - AddrIndexEntry *entry; - - entry = g_new0( AddrIndexEntry, 1 ); - entry->address = email; - entry->name = g_utf8_strdown( name, -1 ); - index->addressList = g_list_append( index->addressList, entry ); -} - -/* -* Add an email entry into index. The index will also include all name fields -* for the person. -* -* Add address into index. -* Enter: index Index. -* email E-Mail to add. -*/ -void addrcindex_add_email( AddrCacheIndex *index, ItemEMail *email ) { - ItemPerson *person; - gchar *name; - GSList *uniqName; - GSList *node; - gboolean flag; - - cm_return_if_fail( index != NULL ); - cm_return_if_fail( email != NULL ); - - flag = FALSE; - uniqName = NULL; - name = ADDRITEM_NAME( email ); - if( name != NULL ) { - if( strlen( name ) > 0 ) { - uniqName = g_slist_append( uniqName, name ); - } - } - name = email->address; - if( mgu_slist_test_unq_nc( uniqName, name ) ) { - uniqName = g_slist_append( uniqName, name ); - } - if( name ) { - if( strlen( name ) > 0 ) flag = TRUE; - } - - /* Bail if no email address */ - if( ! flag ) { - g_slist_free( uniqName ); - return; - } - - person = ( ItemPerson * ) ADDRITEM_PARENT( email ); - if( person != NULL ) { - name = ADDRITEM_NAME( person ); - if( mgu_slist_test_unq_nc( uniqName, name ) ) { - uniqName = g_slist_append( uniqName, name ); - } - - name = person->nickName; - if( mgu_slist_test_unq_nc( uniqName, name ) ) { - uniqName = g_slist_append( uniqName, name ); - } - - name = person->firstName; - if( mgu_slist_test_unq_nc( uniqName, name ) ) { - uniqName = g_slist_append( uniqName, name ); - } - - name = person->lastName; - if( mgu_slist_test_unq_nc( uniqName, name ) ) { - uniqName = g_slist_append( uniqName, name ); - } - } - - /* Create a completion entry for each unique name */ - node = uniqName; - while( node ) { - addrcindex_add_entry( index, node->data, email ); - node = g_slist_next( node ); - } - g_slist_free( uniqName ); - -} - -/* - * Process email address entry, checking for unique alias and address. If the - * address field is empty, no entries will be generated. - * Enter: index Index. - * uniqName List of unique names to examine. - * email EMail address item to process. - * Return: List of entries from email object to add to index. - */ -static GSList *addrcindex_proc_mail( - AddrCacheIndex *index, GSList *uniqName, ItemEMail *email ) -{ - GSList *list; - gchar *name; - - /* Test for address */ - list = NULL; - name = email->address; - if( name ) { - if( strlen( name ) > 0 ) { - /* Address was supplied */ - /* Append alias if unique */ - name = ADDRITEM_NAME( email ); - if( mgu_slist_test_unq_nc( uniqName, name ) ) { - list = g_slist_append( list, name ); - } - /* Then append the address if unique */ - /* Note is possible that the address has already */ - /* been entered into one of the name fields. */ - if( mgu_slist_test_unq_nc( uniqName, email->address ) ) { - list = g_slist_append( list, email->address ); - } - } - } - return list; -} - -/* -* Add person's address entries into index. Each email address is processed. -* If the address field has been supplied, entries will be made. The index -* will include the address, alias and all name fields for the person. -* -* Enter: index Index. -* person Person to add. -*/ -void addrcindex_add_person( AddrCacheIndex *index, ItemPerson *person ) { - gchar *name; - GSList *uniqName; - GSList *node; - GSList *listMail; - GList *listEMail; - ItemEMail *email; - - cm_return_if_fail( index != NULL ); - cm_return_if_fail( person != NULL ); - - /* Build list of all unique names in person's name fields */ - uniqName = NULL; - name = ADDRITEM_NAME( person ); - if( mgu_slist_test_unq_nc( uniqName, name ) ) { - uniqName = g_slist_append( uniqName, name ); - } - - name = person->nickName; - if( mgu_slist_test_unq_nc( uniqName, name ) ) { - uniqName = g_slist_append( uniqName, name ); - } - - name = person->firstName; - if( mgu_slist_test_unq_nc( uniqName, name ) ) { - uniqName = g_slist_append( uniqName, name ); - } - - name = person->lastName; - if( mgu_slist_test_unq_nc( uniqName, name ) ) { - uniqName = g_slist_append( uniqName, name ); - } - - /* Process each email address entry */ - listEMail = person->listEMail; - while( listEMail ) { - email = listEMail->data; - listMail = addrcindex_proc_mail( index, uniqName, email ); - if( listMail ) { - /* Create a completion entry for the address item */ - node = listMail; - while( node ) { - /* g_print( "\tname-m::%s::\n", node->data ); */ - addrcindex_add_entry( index, node->data, email ); - node = g_slist_next( node ); - } - /* ... and all person's name entries */ - node = uniqName; - while( node ) { - /* g_print( "\tname-p::%s::\n", node->data ); */ - addrcindex_add_entry( index, node->data, email ); - node = g_slist_next( node ); - } - g_slist_free( listMail ); - } - listEMail = g_list_next( listEMail ); - } - - /* Free up the list */ - g_slist_free( uniqName ); -} - -/* -* Print index to stream. -* Enter: index Index. -* stream Output stream. -*/ -void addrcindex_print( AddrCacheIndex *index, FILE *stream ) { - GList *node; - AddrIndexEntry *entry; - ItemEMail *email; - - cm_return_if_fail( index != NULL ); - fprintf( stream, "AddressSearchIndex:\n" ); - node = index->addressList; - while( node ) { - entry = node->data; - email = entry->address; - fprintf( stream, "\tname: '%s'\t'%s'\n", entry->name, email->address ); - node = g_list_next( node ); - } -} - -/* -* Perform search for specified search term. -* Enter: index Completion index. -* search Search string. -* Return: List of references to ItemEMail objects meeting search criteria. The -* list should be g_list_free() when no longer required. -*/ -GList *addrcindex_search( AddrCacheIndex *index, const gchar *search ) { - AddrIndexEntry *entry; - gchar *prefix; - GList *list; - GList *node; - GList *listEMail; - - cm_return_if_fail( index != NULL ); - cm_return_if_fail( search != NULL ); - - listEMail = NULL; - if( index->addressList != NULL ) { - /* Add items to list */ - g_completion_add_items( index->completion, index->addressList ); - - /* Perform the search */ - prefix = g_utf8_strdown( search, -1 ); - list = g_completion_complete( index->completion, prefix, NULL ); - g_free( prefix ); - - /* Build list of unique EMail objects */ - node = list; - while( node ) { - entry = node->data; - /* g_print( "\tname ::%s::\n", entry->name ); */ - if( NULL == g_list_find( listEMail, entry->address ) ) { - listEMail = g_list_append( - listEMail, entry->address ); - } - node = g_list_next( node ); - } - } - - return listEMail; -} - -/* -* End of Source. -*/ diff --git a/src/addrcindex.h b/src/addrcindex.h deleted file mode 100644 index f09d4bd2c..000000000 --- a/src/addrcindex.h +++ /dev/null @@ -1,62 +0,0 @@ -/* - * Sylpheed -- a GTK+ based, lightweight, and fast e-mail client - * Copyright (C) 2002-2009 Match Grun and the Claws Mail team - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 3 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program. If not, see . - * - */ - -/* - * Functions to maintain address completion index. - */ - -#ifndef __ADDRCINDEX_H__ -#define __ADDRCINDEX_H__ - -#include -#include - -#include "addritem.h" - -/* - * Constants. - */ - -/* Data structures */ -typedef struct { - GCompletion *completion; - GList *addressList; - gboolean invalid; -} -AddrCacheIndex; - -/* Function prototypes */ -AddrCacheIndex *addrcindex_create ( void ); -void addrcindex_clear ( AddrCacheIndex *index ); -void addrcindex_free ( AddrCacheIndex *index ); -void addrcindex_invalidate ( AddrCacheIndex *index ); -void addrcindex_validate ( AddrCacheIndex *index ); -void addrcindex_add_entry ( AddrCacheIndex *index, - gchar *name, - ItemEMail *email ); -void addrcindex_add_email ( AddrCacheIndex *index, ItemEMail *email ); -void addrcindex_add_person ( AddrCacheIndex *index, ItemPerson *person ); -void addrcindex_print ( AddrCacheIndex *index, FILE *stream ); -GList *addrcindex_search ( AddrCacheIndex *index, const gchar *search ); - -#endif /* __ADDRCINDEX_H__ */ - -/* -* End of Source. -*/ diff --git a/src/gtk/gtkcmclist.c b/src/gtk/gtkcmclist.c index bc2118f56..7e8ba9e11 100644 --- a/src/gtk/gtkcmclist.c +++ b/src/gtk/gtkcmclist.c @@ -30,6 +30,11 @@ #include #include +/* We know this file uses some deprecated stuff. */ +#undef G_DISABLE_DEPRECATED +#undef GTK_DISABLE_DEPRECATED +#undef GDK_DISABLE_DEPRECATED + #include #include "claws-marshal.h" #include "gtkcmclist.h" diff --git a/src/gtk/gtkcmctree.c b/src/gtk/gtkcmctree.c index ecc72f06b..c984057f0 100644 --- a/src/gtk/gtkcmctree.c +++ b/src/gtk/gtkcmctree.c @@ -30,6 +30,12 @@ #include #include + +/* We know this file uses some deprecated stuff. */ +#undef G_DISABLE_DEPRECATED +#undef GTK_DISABLE_DEPRECATED +#undef GDK_DISABLE_DEPRECATED + #include #include #include "gtkcmctree.h" diff --git a/src/gtk/gtksctree.c b/src/gtk/gtksctree.c index 368d162d8..e411130a5 100644 --- a/src/gtk/gtksctree.c +++ b/src/gtk/gtksctree.c @@ -28,6 +28,11 @@ #include +/* We know this file uses some deprecated stuff. */ +#undef G_DISABLE_DEPRECATED +#undef GTK_DISABLE_DEPRECATED +#undef GDK_DISABLE_DEPRECATED + #include "gtksctree.h" #include "claws-marshal.h" #include "prefs_common.h" -- 2.25.1