From e8e6df4812607ebc8e5941ad5c6439681397b4f8 Mon Sep 17 00:00:00 2001 From: Sven Neumann Date: Tue, 8 Feb 2005 13:40:20 +0000 Subject: [PATCH] fixed bug in save routine for 256-slot palette (bug #162742). 2005-02-08 Sven Neumann * plug-ins/winicon/icosave.c (ico_image_get_reduced_buf): fixed bug in save routine for 256-slot palette (bug #162742). --- ChangeLog | 5 +++++ plug-ins/winicon/icosave.c | 7 +++++-- 2 files changed, 10 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 7e8de202b1..19b54238ad 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,8 @@ +2005-02-08 Sven Neumann + + * plug-ins/winicon/icosave.c (ico_image_get_reduced_buf): fixed + bug in save routine for 256-slot palette (bug #162742). + 2005-02-08 Sven Neumann * configure.in: added automake conditional GIMP_UNSTABLE. diff --git a/plug-ins/winicon/icosave.c b/plug-ins/winicon/icosave.c index a1e9c3d8e2..89b592f11f 100644 --- a/plug-ins/winicon/icosave.c +++ b/plug-ins/winicon/icosave.c @@ -353,6 +353,9 @@ ico_create_palette(guchar *cmap, guchar *palette; gint i; + g_return_val_if_fail (cmap != NULL, NULL); + g_return_val_if_fail (num_colors_used <= num_colors, NULL); + palette = g_new0 (guchar, num_colors * 4); *black_slot = -1; @@ -874,7 +877,7 @@ ico_image_get_reduced_buf (guint32 layer, cmap = gimp_image_get_colormap (tmp_image, num_colors); if (*num_colors == (1 << bpp) && - !ico_cmap_contains_black(cmap, *num_colors)) + !ico_cmap_contains_black (cmap, *num_colors)) { /* Windows icons with color maps need the color black. * We need to eliminate one more color to make room for black. @@ -897,9 +900,9 @@ ico_image_get_reduced_buf (guint32 layer, "dummy"); cmap = gimp_image_get_colormap (tmp_image, num_colors); - *cmap_out = g_memdup (cmap, *num_colors * 3); } + *cmap_out = g_memdup (cmap, *num_colors * 3); gimp_image_convert_rgb (tmp_image); }