comparison libpurple/imgstore.c @ 16515:e340dc515178

disapproval of revision 'a999246dfcbd33c9494afa445d9562aee5e5457c'
author Richard Laager <rlaager@wiktel.com>
date Fri, 27 Apr 2007 14:36:42 +0000
parents e4a1980c0090
children 1d3d54e964ce
comparison
equal deleted inserted replaced
16514:e4a1980c0090 16515:e340dc515178
69 purple_imgstore_add_with_id(gpointer data, size_t size, const char *filename) 69 purple_imgstore_add_with_id(gpointer data, size_t size, const char *filename)
70 { 70 {
71 PurpleStoredImage *img = purple_imgstore_add(data, size, filename); 71 PurpleStoredImage *img = purple_imgstore_add(data, size, filename);
72 img->id = ++nextid; 72 img->id = ++nextid;
73 73
74 g_hash_table_insert(imgstore, GINT_TO_POINTER(img->id), img); 74 g_hash_table_insert(imgstore, &(img->id), img);
75 75
76 return img->id; 76 return img->id;
77 } 77 }
78 78
79 PurpleStoredImage *purple_imgstore_find_by_id(int id) { 79 PurpleStoredImage *purple_imgstore_find_by_id(int id) {
80 PurpleStoredImage *img = g_hash_table_lookup(imgstore, GINT_TO_POINTER(id)); 80 PurpleStoredImage *img = g_hash_table_lookup(imgstore, &id);
81 81
82 if (img != NULL) 82 if (img != NULL)
83 purple_debug_misc("imgstore", "retrieved image id %d\n", img->id); 83 purple_debug_misc("imgstore", "retrieved image id %d\n", img->id);
84 84
85 return img; 85 return img;
153 if (img->refcount == 0) 153 if (img->refcount == 0)
154 { 154 {
155 purple_signal_emit(purple_imgstore_get_handle(), 155 purple_signal_emit(purple_imgstore_get_handle(),
156 "image-deleting", img); 156 "image-deleting", img);
157 if (img->id) 157 if (img->id)
158 g_hash_table_remove(imgstore, GINT_TO_POINTER(img->id)); 158 g_hash_table_remove(imgstore, &img->id);
159 159
160 g_free(img->data); 160 g_free(img->data);
161 g_free(img->filename); 161 g_free(img->filename);
162 g_free(img); 162 g_free(img);
163 } 163 }