create GHashTable with destroy notifiers.
2008-08-20 Sven Neumann <sven@gimp.org> * plug-ins/file-ico/ico-save.c: create GHashTable with destroy notifiers. svn path=/trunk/; revision=26668
This commit is contained in:

committed by
Sven Neumann

parent
3f26d82b62
commit
39571e1656
@ -1,3 +1,8 @@
|
|||||||
|
2008-08-20 Sven Neumann <sven@gimp.org>
|
||||||
|
|
||||||
|
* plug-ins/file-ico/ico-save.c: create GHashTable with destroy
|
||||||
|
notifiers.
|
||||||
|
|
||||||
2008-08-20 Sven Neumann <sven@gimp.org>
|
2008-08-20 Sven Neumann <sven@gimp.org>
|
||||||
|
|
||||||
* plug-ins/file-faxg3/faxg3.c
|
* plug-ins/file-faxg3/faxg3.c
|
||||||
|
@ -380,7 +380,9 @@ ico_create_color_to_palette_map (const guint32 *palette,
|
|||||||
GHashTable *hash;
|
GHashTable *hash;
|
||||||
gint i;
|
gint i;
|
||||||
|
|
||||||
hash = g_hash_table_new (g_int_hash, g_int_equal);
|
hash = g_hash_table_new_full (g_int_hash, g_int_equal,
|
||||||
|
(GDestroyNotify) g_free,
|
||||||
|
(GDestroyNotify) g_free);
|
||||||
|
|
||||||
for (i = 0; i < num_colors; i++)
|
for (i = 0; i < num_colors; i++)
|
||||||
{
|
{
|
||||||
@ -400,20 +402,6 @@ ico_create_color_to_palette_map (const guint32 *palette,
|
|||||||
return hash;
|
return hash;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
static void
|
|
||||||
ico_free_hash_item (gpointer data1,
|
|
||||||
gpointer data2,
|
|
||||||
gpointer data3)
|
|
||||||
{
|
|
||||||
g_free (data1);
|
|
||||||
g_free (data2);
|
|
||||||
|
|
||||||
/* Shut up warnings: */
|
|
||||||
data3 = NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
static gint
|
static gint
|
||||||
ico_get_palette_index (GHashTable *hash,
|
ico_get_palette_index (GHashTable *hash,
|
||||||
gint red,
|
gint red,
|
||||||
@ -809,7 +797,7 @@ ico_write_icon (FILE *fp,
|
|||||||
&palette, &buffer);
|
&palette, &buffer);
|
||||||
buffer32 = (guint32 *) buffer;
|
buffer32 = (guint32 *) buffer;
|
||||||
|
|
||||||
/* Set up colormap and andmap when necessary: */
|
/* Set up colormap and and_map when necessary: */
|
||||||
if (header.bpp <= 8)
|
if (header.bpp <= 8)
|
||||||
{
|
{
|
||||||
/* Create a colormap */
|
/* Create a colormap */
|
||||||
@ -953,10 +941,7 @@ ico_write_icon (FILE *fp,
|
|||||||
and_len, xor_len));
|
and_len, xor_len));
|
||||||
|
|
||||||
if (color_to_slot)
|
if (color_to_slot)
|
||||||
{
|
|
||||||
g_hash_table_foreach (color_to_slot, ico_free_hash_item, NULL);
|
|
||||||
g_hash_table_destroy (color_to_slot);
|
g_hash_table_destroy (color_to_slot);
|
||||||
}
|
|
||||||
|
|
||||||
g_free (palette);
|
g_free (palette);
|
||||||
g_free (buffer);
|
g_free (buffer);
|
||||||
|
Reference in New Issue
Block a user