From c68c91c94de0559a5c95f313549b81470e6f298d Mon Sep 17 00:00:00 2001 From: Sven Neumann Date: Thu, 12 Apr 2007 14:48:04 +0000 Subject: [PATCH] app/tools/gimplevelstool.c app/tools/gimpcurvestool.c app/xcf/xcf-save.c 2007-04-12 Sven Neumann * app/tools/gimplevelstool.c * app/tools/gimpcurvestool.c * app/xcf/xcf-save.c * app/xcf/xcf-load.c * app/widgets/gimppaletteeditor.c * app/widgets/gimpcolormapeditor.c * app/widgets/gimpcolorframe.c: get rid of compiler warnings about dereferencing type-punned pointers. svn path=/trunk/; revision=22238 --- ChangeLog | 11 +++++++++++ app/tools/gimpcurvestool.c | 24 ++++++++++++++---------- app/tools/gimplevelstool.c | 19 +++++++++++-------- app/widgets/gimpcolorframe.c | 10 +++++++--- app/widgets/gimpcolormapeditor.c | 7 ++++--- app/widgets/gimppaletteeditor.c | 5 +++-- app/xcf/xcf-load.c | 4 +++- app/xcf/xcf-save.c | 20 ++++++++++++-------- 8 files changed, 65 insertions(+), 35 deletions(-) diff --git a/ChangeLog b/ChangeLog index d7ea561440..236f86dc3f 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,14 @@ +2007-04-12 Sven Neumann + + * app/tools/gimplevelstool.c + * app/tools/gimpcurvestool.c + * app/xcf/xcf-save.c + * app/xcf/xcf-load.c + * app/widgets/gimppaletteeditor.c + * app/widgets/gimpcolormapeditor.c + * app/widgets/gimpcolorframe.c: get rid of compiler warnings about + dereferencing type-punned pointers. + 2007-04-12 Sven Neumann * libgimpbase/gimpprotocol.[ch] (struct _GPParam): don't redefine diff --git a/app/tools/gimpcurvestool.c b/app/tools/gimpcurvestool.c index 1cbb2bf123..4353dfb910 100644 --- a/app/tools/gimpcurvestool.c +++ b/app/tools/gimpcurvestool.c @@ -895,19 +895,23 @@ static void curves_channel_callback (GtkWidget *widget, GimpCurvesTool *tool) { - gimp_int_combo_box_get_active (GIMP_INT_COMBO_BOX (widget), - (gint *) &tool->channel); - gimp_histogram_view_set_channel (GIMP_HISTOGRAM_VIEW (tool->graph), - tool->channel); + gint value; - /* FIXME: hack */ - if (! tool->color) - tool->channel = (tool->channel == GIMP_HISTOGRAM_ALPHA) ? 1 : 0; + if (gimp_int_combo_box_get_active (GIMP_INT_COMBO_BOX (widget), &value)) + { + tool->channel = value; + gimp_histogram_view_set_channel (GIMP_HISTOGRAM_VIEW (tool->graph), + tool->channel); - gimp_int_radio_group_set_active (GTK_RADIO_BUTTON (tool->curve_type), - tool->curves->curve_type[tool->channel]); + /* FIXME: hack */ + if (! tool->color) + tool->channel = (tool->channel == GIMP_HISTOGRAM_ALPHA) ? 1 : 0; - curves_update (tool, ALL); + gimp_int_radio_group_set_active (GTK_RADIO_BUTTON (tool->curve_type), + tool->curves->curve_type[tool->channel]); + + curves_update (tool, ALL); + } } static void diff --git a/app/tools/gimplevelstool.c b/app/tools/gimplevelstool.c index 9c85351ac8..66da890c49 100644 --- a/app/tools/gimplevelstool.c +++ b/app/tools/gimplevelstool.c @@ -857,17 +857,20 @@ static void levels_channel_callback (GtkWidget *widget, GimpLevelsTool *tool) { - gimp_int_combo_box_get_active (GIMP_INT_COMBO_BOX (widget), - (gint *) &tool->channel); + gint value; - gimp_histogram_view_set_channel (GIMP_HISTOGRAM_VIEW (tool->hist_view), - tool->channel); + if (gimp_int_combo_box_get_active (GIMP_INT_COMBO_BOX (widget), &value)) + { + tool->channel = value; + gimp_histogram_view_set_channel (GIMP_HISTOGRAM_VIEW (tool->hist_view), + tool->channel); - /* FIXME: hack */ - if (! tool->color) - tool->channel = (tool->channel == GIMP_HISTOGRAM_ALPHA) ? 1 : 0; + /* FIXME: hack */ + if (! tool->color) + tool->channel = (tool->channel == GIMP_HISTOGRAM_ALPHA) ? 1 : 0; - levels_update (tool, ALL); + levels_update (tool, ALL); + } } static void diff --git a/app/widgets/gimpcolorframe.c b/app/widgets/gimpcolorframe.c index c4bccfe00e..11d9312739 100644 --- a/app/widgets/gimpcolorframe.c +++ b/app/widgets/gimpcolorframe.c @@ -385,9 +385,13 @@ static void gimp_color_frame_menu_callback (GtkWidget *widget, GimpColorFrame *frame) { - gimp_int_combo_box_get_active (GIMP_INT_COMBO_BOX (widget), - (gint *) &frame->frame_mode); - gimp_color_frame_update (frame); + gint value; + + if (gimp_int_combo_box_get_active (GIMP_INT_COMBO_BOX (widget), &value)) + { + frame->frame_mode = value; + gimp_color_frame_update (frame); + } } static void diff --git a/app/widgets/gimpcolormapeditor.c b/app/widgets/gimpcolormapeditor.c index 96efe508f1..3427a61084 100644 --- a/app/widgets/gimpcolormapeditor.c +++ b/app/widgets/gimpcolormapeditor.c @@ -158,6 +158,7 @@ gimp_colormap_editor_init (GimpColormapEditor *editor) { GtkWidget *frame; GtkWidget *table; + GtkObject *adj; editor->col_index = 0; editor->dnd_col_index = 0; @@ -198,9 +199,9 @@ gimp_colormap_editor_init (GimpColormapEditor *editor) gtk_box_pack_end (GTK_BOX (editor), table, FALSE, FALSE, 0); gtk_widget_show (table); - editor->index_spinbutton = - gimp_spin_button_new ((GtkObject **) &editor->index_adjustment, - 0, 0, 0, 1, 10, 10, 1.0, 0); + editor->index_spinbutton = gimp_spin_button_new (&adj, + 0, 0, 0, 1, 10, 10, 1.0, 0); + editor->index_adjustment = GTK_ADJUSTMENT (adj); gimp_table_attach_aligned (GTK_TABLE (table), 0, 0, _("Color index:"), 0.0, 0.5, editor->index_spinbutton, 1, TRUE); diff --git a/app/widgets/gimppaletteeditor.c b/app/widgets/gimppaletteeditor.c index 576b540662..51cf279a93 100644 --- a/app/widgets/gimppaletteeditor.c +++ b/app/widgets/gimppaletteeditor.c @@ -177,6 +177,7 @@ gimp_palette_editor_init (GimpPaletteEditor *editor) GtkWidget *hbox; GtkWidget *label; GtkWidget *spinbutton; + GtkObject *adj; editor->zoom_factor = 1.0; editor->col_width = 0; @@ -263,8 +264,8 @@ gimp_palette_editor_init (GimpPaletteEditor *editor) gtk_box_pack_start (GTK_BOX (hbox), label, FALSE, FALSE, 0); gtk_widget_show (label); - spinbutton = gimp_spin_button_new ((GtkObject **) &editor->columns_data, - 0, 0, 64, 1, 4, 4, 1, 0); + spinbutton = gimp_spin_button_new (&adj, 0, 0, 64, 1, 4, 4, 1, 0); + editor->columns_data = GTK_ADJUSTMENT (adj); gtk_box_pack_start (GTK_BOX (hbox), spinbutton, FALSE, FALSE, 0); gtk_widget_show (spinbutton); diff --git a/app/xcf/xcf-load.c b/app/xcf/xcf-load.c index b32aaff6a3..eafc1a2293 100644 --- a/app/xcf/xcf-load.c +++ b/app/xcf/xcf-load.c @@ -620,6 +620,7 @@ xcf_load_layer_props (XcfInfo *info, { PropType prop_type; guint32 prop_size; + guint32 value; while (TRUE) { @@ -700,7 +701,8 @@ xcf_load_layer_props (XcfInfo *info, break; case PROP_MODE: - info->cp += xcf_read_int32 (info->fp, (guint32 *) &layer->mode, 1); + info->cp += xcf_read_int32 (info->fp, &value, 1); + layer->mode = value; break; case PROP_TATTOO: diff --git a/app/xcf/xcf-save.c b/app/xcf/xcf-save.c index 0b656351cc..be2687ced5 100644 --- a/app/xcf/xcf-save.c +++ b/app/xcf/xcf-save.c @@ -282,13 +282,14 @@ xcf_save_image (XcfInfo *info, GimpLayer *layer; GimpLayer *floating_layer; GimpChannel *channel; + GList *list; guint32 saved_pos; guint32 offset; + guint32 value; guint nlayers; guint nchannels; guint progress = 0; guint max_progress; - GList *list; gboolean have_selection; gint t1, t2, t3, t4; gchar version_tag[16]; @@ -313,7 +314,9 @@ xcf_save_image (XcfInfo *info, /* write out the width, height and image type information for the image */ xcf_write_int32_print_error (info, (guint32 *) &image->width, 1); xcf_write_int32_print_error (info, (guint32 *) &image->height, 1); - xcf_write_int32_print_error (info, (guint32 *) &image->base_type, 1); + + value = image->base_type; + xcf_write_int32_print_error (info, &value, 1); /* determine the number of layers and channels in the image */ nlayers = (guint) gimp_container_num_children (image->layers); @@ -1133,10 +1136,10 @@ xcf_save_layer (XcfInfo *info, GimpLayer *layer, GError **error) { - guint32 saved_pos; - guint32 offset; - - GError *tmp_error = NULL; + guint32 saved_pos; + guint32 offset; + guint32 value; + GError *tmp_error = NULL; /* check and see if this is the drawable that the floating * selection is attached to. @@ -1154,8 +1157,9 @@ xcf_save_layer (XcfInfo *info, (guint32 *) &GIMP_ITEM (layer)->width, 1); xcf_write_int32_check_error (info, (guint32 *) &GIMP_ITEM (layer)->height, 1); - xcf_write_int32_check_error (info, - (guint32 *) &GIMP_DRAWABLE (layer)->type, 1); + + value = gimp_drawable_type (GIMP_DRAWABLE (layer)); + xcf_write_int32_check_error (info, &value, 1); /* write out the layers name */ xcf_write_string_check_error (info, &GIMP_OBJECT (layer)->name, 1);