Use macro casts from int to pointer.
authorJeffrey Stedfast <fejj@ximian.com>
Wed, 4 Feb 2004 04:07:39 +0000 (04:07 +0000)
committerJeffrey Stedfast <fejj@src.gnome.org>
Wed, 4 Feb 2004 04:07:39 +0000 (04:07 +0000)
2004-02-03  Jeffrey Stedfast  <fejj@ximian.com>

* camel-vee-folder.c (vee_folder_build_folder): Use macro casts
from int to pointer.

* camel-folder.c (camel_folder_change_info_add_source): Same as below.
(camel_folder_change_info_add_source_list): Same.

* camel-folder-search.c (camel_folder_search_execute_expression):
Use GINT_TO_POINTER() to cast 1 to a pointer for
g_hash_table_insert().

* camel-vee-folder.c (vee_folder_remove_folder): 64bit fixes.
(folder_added_uid): Same.
(vee_folder_build_folder): Here too.
(folder_changed_add_uid): And here.
(folder_changed_remove_uid): Same.

camel/ChangeLog
camel/camel-folder-search.c
camel/camel-folder.c
camel/camel-text-index.c
camel/camel-vee-folder.c

index 0a90be5..061e0dc 100644 (file)
@@ -1,5 +1,23 @@
 2004-02-03  Jeffrey Stedfast  <fejj@ximian.com>
 
+       * camel-vee-folder.c (vee_folder_build_folder): Use macro casts
+       from int to pointer.
+
+       * camel-folder.c (camel_folder_change_info_add_source): Same as below.
+       (camel_folder_change_info_add_source_list): Same.
+
+       * camel-folder-search.c (camel_folder_search_execute_expression):
+       Use GINT_TO_POINTER() to cast 1 to a pointer for
+       g_hash_table_insert().
+
+       * camel-vee-folder.c (vee_folder_remove_folder): 64bit fixes.
+       (folder_added_uid): Same.
+       (vee_folder_build_folder): Here too.
+       (folder_changed_add_uid): And here.
+       (folder_changed_remove_uid): Same.
+
+2004-02-03  Jeffrey Stedfast  <fejj@ximian.com>
+
        * tests/misc/url-scan.c: New test suite for url scanning.
 
        * camel-url-scanner.c: Added single/double quotes to url_braces[]
index 8262ee3..e50c2ac 100644 (file)
@@ -374,7 +374,7 @@ camel_folder_search_execute_expression(CamelFolderSearch *search, const char *ex
                        results = g_hash_table_new(g_str_hash, g_str_equal);
                        for (i=0;i<r->value.ptrarray->len;i++) {
                                d(printf("adding match: %s\n", (char *)g_ptr_array_index(r->value.ptrarray, i)));
-                               g_hash_table_insert(results, g_ptr_array_index(r->value.ptrarray, i), (void *)1);
+                               g_hash_table_insert(results, g_ptr_array_index(r->value.ptrarray, i), GINT_TO_POINTER (1));
                        }
                        for (i=0;i<search->summary->len;i++) {
                                CamelMessageInfo *info = g_ptr_array_index(search->summary, i);
index 3bf6db5..b3a7b93 100644 (file)
@@ -1819,7 +1819,7 @@ camel_folder_change_info_add_source(CamelFolderChangeInfo *info, const char *uid
                p->uid_source = g_hash_table_new(g_str_hash, g_str_equal);
 
        if (g_hash_table_lookup(p->uid_source, uid) == NULL)
-               g_hash_table_insert(p->uid_source, e_mempool_strdup(p->uid_pool, uid), (void *)1);
+               g_hash_table_insert(p->uid_source, e_mempool_strdup(p->uid_pool, uid), GINT_TO_POINTER (1));
 }
 
 /**
@@ -1847,7 +1847,7 @@ camel_folder_change_info_add_source_list(CamelFolderChangeInfo *info, const GPtr
                char *uid = list->pdata[i];
 
                if (g_hash_table_lookup(p->uid_source, uid) == NULL)
-                       g_hash_table_insert(p->uid_source, e_mempool_strdup(p->uid_pool, uid), (void *)1);
+                       g_hash_table_insert(p->uid_source, e_mempool_strdup(p->uid_pool, uid), GINT_TO_POINTER (1));
        }
 }
 
index 0e8b1ca..4867bac 100644 (file)
@@ -1015,7 +1015,7 @@ add_type(GHashTable *map, camel_block_t id, int type)
 
        if (old != 0 && old != type)
                g_warning("block %x redefined as type %d, already type %d\n", id, type, old);
-       g_hash_table_insert(map, id, type|old);
+       g_hash_table_insert(map, id, GINT_TO_POINTER (type|old));
 }
 
 static void
@@ -1269,7 +1269,7 @@ camel_text_index_validate(CamelTextIndex *idx)
                        printf("Warning, name '%s' duplicates key (%x) with name '%s'\n", word, keyid, oldword);
                        g_free(word);
                } else {
-                       g_hash_table_insert(name_word, word, (void *)1);
+                       g_hash_table_insert(name_word, word, GINT_TO_POINTER (1));
                        if ((flags & 1) == 0) {
                                g_hash_table_insert(names, GINT_TO_POINTER(keyid), word);
                        } else {
index f7ceb12..e9f6e14 100644 (file)
@@ -895,7 +895,8 @@ vee_folder_remove_folder(CamelVeeFolder *vf, CamelFolder *source, int killun)
        char hash[8];
        /*struct _CamelVeeFolderPrivate *p = _PRIVATE(vf);*/
        CamelFolderChangeInfo *vf_changes = NULL, *unmatched_changes = NULL;
-
+       gpointer oldval;
+       
        if (vf == folder_unmatched)
                return;
 
@@ -962,7 +963,8 @@ vee_folder_remove_folder(CamelVeeFolder *vf, CamelFolder *source, int killun)
                                }
                                if ((vf->flags & CAMEL_STORE_FOLDER_PRIVATE) == 0) {
                                        if (still) {
-                                               if (g_hash_table_lookup_extended(unmatched_uids, uid, (void **)&oldkey, (void **)&n)) {
+                                               if (g_hash_table_lookup_extended(unmatched_uids, uid, (void **)&oldkey, &oldval)) {
+                                                       n = GPOINTER_TO_INT (oldval);
                                                        if (n == 1) {
                                                                g_hash_table_remove(unmatched_uids, oldkey);
                                                                if (vee_folder_add_uid(folder_unmatched, source, oldkey+8, hash))
@@ -973,7 +975,7 @@ vee_folder_remove_folder(CamelVeeFolder *vf, CamelFolder *source, int killun)
                                                        }
                                                }
                                        } else {
-                                               if (g_hash_table_lookup_extended(unmatched_uids, camel_message_info_uid(mi), (void **)&oldkey, (void **)&n)) {
+                                               if (g_hash_table_lookup_extended(unmatched_uids, camel_message_info_uid(mi), (void **)&oldkey, &oldval)) {
                                                        g_hash_table_remove(unmatched_uids, oldkey);
                                                        g_free(oldkey);
                                                }
@@ -1044,6 +1046,7 @@ static void
 folder_added_uid(char *uidin, void *value, struct _update_data *u)
 {
        CamelVeeMessageInfo *mi;
+       gpointer oldval;
        char *oldkey;
        int n;
 
@@ -1051,7 +1054,8 @@ folder_added_uid(char *uidin, void *value, struct _update_data *u)
                camel_folder_change_info_add_uid(u->vf->changes, camel_message_info_uid(mi));
 
                if (!CAMEL_IS_VEE_FOLDER(u->source)) {
-                       if (g_hash_table_lookup_extended(unmatched_uids, camel_message_info_uid(mi), (void **)&oldkey, (void **)&n)) {
+                       if (g_hash_table_lookup_extended(unmatched_uids, camel_message_info_uid(mi), (void **)&oldkey, &oldval)) {
+                               n = GPOINTER_TO_INT (oldval);
                                g_hash_table_insert(unmatched_uids, oldkey, GINT_TO_POINTER(n+1));
                        } else {
                                g_hash_table_insert(unmatched_uids, g_strdup(camel_message_info_uid(mi)), GINT_TO_POINTER(1));
@@ -1094,13 +1098,13 @@ vee_folder_build_folder(CamelVeeFolder *vf, CamelFolder *source, CamelException
           we just ref the real memory */
        matchhash = g_hash_table_new(g_str_hash, g_str_equal);
        for (i=0;i<match->len;i++)
-               g_hash_table_insert(matchhash, match->pdata[i], (void *)1);
+               g_hash_table_insert(matchhash, match->pdata[i], GINT_TO_POINTER (1));
 
        allhash = g_hash_table_new(g_str_hash, g_str_equal);
        all = camel_folder_get_uids(f);
        for (i=0;i<all->len;i++)
                if (g_hash_table_lookup(matchhash, all->pdata[i]) == NULL)
-                       g_hash_table_insert(allhash, all->pdata[i], (void *)1);
+                       g_hash_table_insert(allhash, all->pdata[i], GINT_TO_POINTER (1));
 
        CAMEL_VEE_FOLDER_LOCK(folder_unmatched, summary_lock);
 
@@ -1114,7 +1118,8 @@ vee_folder_build_folder(CamelVeeFolder *vf, CamelFolder *source, CamelException
                if (mi) {
                        if (mi->folder == source) {
                                char *uid = (char *)camel_message_info_uid(mi), *oldkey;
-
+                               gpointer oldval;
+                               
                                if (g_hash_table_lookup(matchhash, uid+8) == NULL) {
                                        if (last == -1) {
                                                last = start = i;
@@ -1127,7 +1132,8 @@ vee_folder_build_folder(CamelVeeFolder *vf, CamelFolder *source, CamelException
                                        }
                                        camel_folder_change_info_remove_uid(vf->changes, camel_message_info_uid(mi));
                                        if (!CAMEL_IS_VEE_FOLDER(source)
-                                           && g_hash_table_lookup_extended(unmatched_uids, uid, (void **)&oldkey, (void **)&n)) {
+                                           && g_hash_table_lookup_extended(unmatched_uids, uid, (void **)&oldkey, &oldval)) {
+                                               n = GPOINTER_TO_INT (oldval);
                                                if (n == 1) {
                                                        g_hash_table_remove(unmatched_uids, oldkey);
                                                        g_free(oldkey);
@@ -1223,6 +1229,7 @@ folder_changed_add_uid(CamelFolder *sub, const char *uid, const char hash[8], Ca
 {
        CamelVeeMessageInfo *vinfo;
        const char *vuid;
+       gpointer oldval;
        char *oldkey;
        int n;
 
@@ -1234,10 +1241,11 @@ folder_changed_add_uid(CamelFolder *sub, const char *uid, const char hash[8], Ca
        camel_folder_change_info_add_uid(vf->changes,  vuid);
 
        if ((vf->flags & CAMEL_STORE_FOLDER_PRIVATE) == 0 && !CAMEL_IS_VEE_FOLDER(sub)) {
-               if (g_hash_table_lookup_extended(unmatched_uids, vuid, (void **)&oldkey, (void **)&n)) {
+               if (g_hash_table_lookup_extended(unmatched_uids, vuid, (void **)&oldkey, &oldval)) {
+                       n = GPOINTER_TO_INT (oldval);
                        g_hash_table_insert(unmatched_uids, oldkey, GINT_TO_POINTER(n+1));
                } else {
-                       g_hash_table_insert(unmatched_uids, g_strdup(vuid), (void *)1);
+                       g_hash_table_insert(unmatched_uids, g_strdup(vuid), GINT_TO_POINTER (1));
                }
                vinfo = (CamelVeeMessageInfo *)camel_folder_get_message_info((CamelFolder *)folder_unmatched, vuid);
                if (vinfo) {
@@ -1253,6 +1261,7 @@ folder_changed_remove_uid(CamelFolder *sub, const char *uid, const char hash[8],
 {
        CamelFolder *folder = (CamelFolder *)vf;
        char *vuid, *oldkey;
+       gpointer oldval;
        int n;
        CamelVeeMessageInfo *vinfo;
 
@@ -1269,7 +1278,8 @@ folder_changed_remove_uid(CamelFolder *sub, const char *uid, const char hash[8],
 
        if ((vf->flags & CAMEL_STORE_FOLDER_PRIVATE) == 0 && !CAMEL_IS_VEE_FOLDER(sub)) {
                if (keep) {
-                       if (g_hash_table_lookup_extended(unmatched_uids, vuid, (void **)&oldkey, (void **)&n)) {
+                       if (g_hash_table_lookup_extended(unmatched_uids, vuid, (void **)&oldkey, &oldval)) {
+                               n = GPOINTER_TO_INT (oldval);
                                if (n == 1) {
                                        g_hash_table_remove(unmatched_uids, oldkey);
                                        if (vee_folder_add_uid(folder_unmatched, sub, uid, hash))
@@ -1283,7 +1293,7 @@ folder_changed_remove_uid(CamelFolder *sub, const char *uid, const char hash[8],
                                        camel_folder_change_info_add_uid(folder_unmatched->changes, oldkey);
                        }
                } else {
-                       if (g_hash_table_lookup_extended(unmatched_uids, vuid, (void **)&oldkey, (void **)&n)) {
+                       if (g_hash_table_lookup_extended(unmatched_uids, vuid, (void **)&oldkey, &oldval)) {
                                g_hash_table_remove(unmatched_uids, oldkey);
                                g_free(oldkey);
                        }