Mercurial > pidgin.yaz
changeset 25087:a946cffda321
Use g_direct_hash/equal instead of g_int_hash/equal for the hash table that
holds the saved statuses. The effect is that this will take into account
the different size of time_t across 32-bit and 64-bit systems. There
should not be any side effects because it is only used at runtime for the
hash key, and all the important data is stored in the value.
This should stop any mysterious infinite loop problems on big-endian
systems which were trying to use the MSB of the time as a hash key.
Fixes #5887.
author | Elliott Sales de Andrade <qulogic@pidgin.im> |
---|---|
date | Sun, 15 Feb 2009 07:19:59 +0000 |
parents | 6a0304f317cf |
children | e0dc8933ce26 8387f195c4af a3e3c6331e06 |
files | libpurple/savedstatuses.c |
diffstat | 1 files changed, 11 insertions(+), 11 deletions(-) [+] |
line wrap: on
line diff
--- a/libpurple/savedstatuses.c Sun Feb 15 02:11:58 2009 +0000 +++ b/libpurple/savedstatuses.c Sun Feb 15 07:19:59 2009 +0000 @@ -148,11 +148,11 @@ /* Avoid using 0 because it's an invalid hash key */ status->creation_time = creation_time != 0 ? creation_time : 1; - while (g_hash_table_lookup(creation_times, &status->creation_time) != NULL) + while (g_hash_table_lookup(creation_times, (gconstpointer)status->creation_time) != NULL) status->creation_time++; g_hash_table_insert(creation_times, - &status->creation_time, + (gpointer)status->creation_time, status); } @@ -217,7 +217,7 @@ { saved_statuses = g_list_remove(saved_statuses, saved_status); creation_time = purple_savedstatus_get_creation_time(saved_status); - g_hash_table_remove(creation_times, &creation_time); + g_hash_table_remove(creation_times, (gconstpointer)creation_time); free_saved_status(saved_status); } } @@ -713,7 +713,7 @@ saved_statuses = g_list_remove(saved_statuses, status); creation_time = purple_savedstatus_get_creation_time(status); - g_hash_table_remove(creation_times, &creation_time); + g_hash_table_remove(creation_times, (gconstpointer)creation_time); free_saved_status(status); schedule_save(); @@ -801,13 +801,13 @@ PurpleSavedStatus * purple_savedstatus_get_default() { - int creation_time; + time_t creation_time; PurpleSavedStatus *saved_status = NULL; creation_time = purple_prefs_get_int("/purple/savedstatus/default"); if (creation_time != 0) - saved_status = g_hash_table_lookup(creation_times, &creation_time); + saved_status = g_hash_table_lookup(creation_times, (gconstpointer)creation_time); if (saved_status == NULL) { @@ -828,13 +828,13 @@ PurpleSavedStatus * purple_savedstatus_get_idleaway() { - int creation_time; + time_t creation_time; PurpleSavedStatus *saved_status = NULL; creation_time = purple_prefs_get_int("/purple/savedstatus/idleaway"); if (creation_time != 0) - saved_status = g_hash_table_lookup(creation_times, &creation_time); + saved_status = g_hash_table_lookup(creation_times, (gconstpointer)creation_time); if (saved_status == NULL) { @@ -907,13 +907,13 @@ PurpleSavedStatus * purple_savedstatus_get_startup() { - int creation_time; + time_t creation_time; PurpleSavedStatus *saved_status = NULL; creation_time = purple_prefs_get_int("/purple/savedstatus/startup"); if (creation_time != 0) - saved_status = g_hash_table_lookup(creation_times, &creation_time); + saved_status = g_hash_table_lookup(creation_times, (gconstpointer)creation_time); if (saved_status == NULL) { @@ -1187,7 +1187,7 @@ { void *handle = purple_savedstatuses_get_handle(); - creation_times = g_hash_table_new(g_int_hash, g_int_equal); + creation_times = g_hash_table_new(g_direct_hash, g_direct_equal); /* * Using 0 as the creation_time is a special case.