aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJeffrey Stedfast <fejj@ximian.com>2004-02-04 12:07:39 +0800
committerJeffrey Stedfast <fejj@src.gnome.org>2004-02-04 12:07:39 +0800
commit81ea466c6ae4b3d465f9921257a16cf584676f1b (patch)
treeaf5b61e6c81524865cdec644910fafe53069206e
parentc16b5e3a40e4624db26826dfa6d4f3506278305b (diff)
downloadgsoc2013-evolution-81ea466c6ae4b3d465f9921257a16cf584676f1b.tar.gz
gsoc2013-evolution-81ea466c6ae4b3d465f9921257a16cf584676f1b.tar.zst
gsoc2013-evolution-81ea466c6ae4b3d465f9921257a16cf584676f1b.zip
Use macro casts from int to pointer.
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. svn path=/trunk/; revision=24597
-rw-r--r--camel/ChangeLog18
-rw-r--r--camel/camel-folder-search.c2
-rw-r--r--camel/camel-folder.c4
-rw-r--r--camel/camel-text-index.c4
-rw-r--r--camel/camel-vee-folder.c34
5 files changed, 45 insertions, 17 deletions
diff --git a/camel/ChangeLog b/camel/ChangeLog
index 0a90be539a..061e0dc865 100644
--- a/camel/ChangeLog
+++ b/camel/ChangeLog
@@ -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[]
diff --git a/camel/camel-folder-search.c b/camel/camel-folder-search.c
index 8262ee3c3a..e50c2acd0f 100644
--- a/camel/camel-folder-search.c
+++ b/camel/camel-folder-search.c
@@ -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);
diff --git a/camel/camel-folder.c b/camel/camel-folder.c
index 3bf6db50a0..b3a7b93713 100644
--- a/camel/camel-folder.c
+++ b/camel/camel-folder.c
@@ -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));
}
}
diff --git a/camel/camel-text-index.c b/camel/camel-text-index.c
index 0e8b1ca96f..4867bac4cd 100644
--- a/camel/camel-text-index.c
+++ b/camel/camel-text-index.c
@@ -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 {
diff --git a/camel/camel-vee-folder.c b/camel/camel-vee-folder.c
index f7ceb12d59..e9f6e145f9 100644
--- a/camel/camel-vee-folder.c
+++ b/camel/camel-vee-folder.c
@@ -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);
}