diff --git a/ChangeLog b/ChangeLog index 83d7925a26..299799f3bd 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,16 @@ +Thu Nov 4 20:46:25 MET 1999 Sven Neumann + + * app/channel.c: get rid of compiler warnings + + * app/histogram_tool.c + * app/histogram_tool.h: added a gradient below the histogram so + it looks more like the curves and levels tool + + * app/gimpbrushpipe.c + * libgimp/parasiteio.c + * libgimp/parasiteio.h: plugged another mem-leaks. At least + The GIMP now starts without leaking memory... + Thu Nov 4 00:59:01 MET 1999 Sven Neumann * app/file_new_dialog.c diff --git a/app/channel.c b/app/channel.c index 52fabbf3e0..8b2b08f708 100644 --- a/app/channel.c +++ b/app/channel.c @@ -103,12 +103,6 @@ gimp_channel_init (GimpChannel *channel) { } -/**********************/ -/* Static variables */ -/**********************/ - -static gint channel_get_count = 0; - /**************************/ /* Function definitions */ /**************************/ @@ -1064,6 +1058,9 @@ channel_combine_ellipse (Channel *mask, case SUB : channel_sub_segment (mask, x1, i, (x2 - x1), 255); break; + default: + g_warning ("Only ADD, REPLACE and SUB are valid for channel_combine!"); + break; } } /* antialiasing */ @@ -1104,6 +1101,9 @@ channel_combine_ellipse (Channel *mask, case SUB: channel_sub_segment (mask, x0, i, j - x0, last); break; + default: + g_warning ("Only ADD, REPLACE and SUB are valid for channel_combine!"); + break; } } @@ -1124,6 +1124,8 @@ channel_combine_ellipse (Channel *mask, channel_add_segment (mask, x0, i, j - x0, last); else if (op == SUB) channel_sub_segment (mask, x0, i, j - x0, last); + else + g_warning ("Only ADD, REPLACE and SUB are valid for channel_combine!"); } } diff --git a/app/core/gimpbrushpipe-load.c b/app/core/gimpbrushpipe-load.c index 242072d215..7bc2c17ff3 100644 --- a/app/core/gimpbrushpipe-load.c +++ b/app/core/gimpbrushpipe-load.c @@ -55,6 +55,7 @@ static void paint_line_pixmap_mask(GImage *dest, int width, int mode); + static void gimp_brush_pixmap_destroy (GtkObject *object) { @@ -324,6 +325,9 @@ gimp_brush_pipe_load (char *filename) pipe->rank = g_new (int, pipe->dimension); pipe->select = g_new (PipeSelectModes, pipe->dimension); pipe->index = g_new (int, pipe->dimension); + /* placement is not used at all ?? */ + if (params.free_placement_string) + g_free (params.placement); for (i = 0; i < pipe->dimension; i++) { pipe->rank[i] = params.rank[i]; @@ -343,6 +347,8 @@ gimp_brush_pipe_load (char *filename) pipe->select[i] = PIPE_SELECT_TILT_Y; else pipe->select[i] = PIPE_SELECT_CONSTANT; + if (params.free_selection_string) + g_free (params.selection[i]); pipe->index[i] = 0; } } diff --git a/app/core/gimpbrushpipe.c b/app/core/gimpbrushpipe.c index 242072d215..7bc2c17ff3 100644 --- a/app/core/gimpbrushpipe.c +++ b/app/core/gimpbrushpipe.c @@ -55,6 +55,7 @@ static void paint_line_pixmap_mask(GImage *dest, int width, int mode); + static void gimp_brush_pixmap_destroy (GtkObject *object) { @@ -324,6 +325,9 @@ gimp_brush_pipe_load (char *filename) pipe->rank = g_new (int, pipe->dimension); pipe->select = g_new (PipeSelectModes, pipe->dimension); pipe->index = g_new (int, pipe->dimension); + /* placement is not used at all ?? */ + if (params.free_placement_string) + g_free (params.placement); for (i = 0; i < pipe->dimension; i++) { pipe->rank[i] = params.rank[i]; @@ -343,6 +347,8 @@ gimp_brush_pipe_load (char *filename) pipe->select[i] = PIPE_SELECT_TILT_Y; else pipe->select[i] = PIPE_SELECT_CONSTANT; + if (params.free_selection_string) + g_free (params.selection[i]); pipe->index[i] = 0; } } diff --git a/app/core/gimpchannel-combine.c b/app/core/gimpchannel-combine.c index 52fabbf3e0..8b2b08f708 100644 --- a/app/core/gimpchannel-combine.c +++ b/app/core/gimpchannel-combine.c @@ -103,12 +103,6 @@ gimp_channel_init (GimpChannel *channel) { } -/**********************/ -/* Static variables */ -/**********************/ - -static gint channel_get_count = 0; - /**************************/ /* Function definitions */ /**************************/ @@ -1064,6 +1058,9 @@ channel_combine_ellipse (Channel *mask, case SUB : channel_sub_segment (mask, x1, i, (x2 - x1), 255); break; + default: + g_warning ("Only ADD, REPLACE and SUB are valid for channel_combine!"); + break; } } /* antialiasing */ @@ -1104,6 +1101,9 @@ channel_combine_ellipse (Channel *mask, case SUB: channel_sub_segment (mask, x0, i, j - x0, last); break; + default: + g_warning ("Only ADD, REPLACE and SUB are valid for channel_combine!"); + break; } } @@ -1124,6 +1124,8 @@ channel_combine_ellipse (Channel *mask, channel_add_segment (mask, x0, i, j - x0, last); else if (op == SUB) channel_sub_segment (mask, x0, i, j - x0, last); + else + g_warning ("Only ADD, REPLACE and SUB are valid for channel_combine!"); } } diff --git a/app/core/gimpchannel.c b/app/core/gimpchannel.c index 52fabbf3e0..8b2b08f708 100644 --- a/app/core/gimpchannel.c +++ b/app/core/gimpchannel.c @@ -103,12 +103,6 @@ gimp_channel_init (GimpChannel *channel) { } -/**********************/ -/* Static variables */ -/**********************/ - -static gint channel_get_count = 0; - /**************************/ /* Function definitions */ /**************************/ @@ -1064,6 +1058,9 @@ channel_combine_ellipse (Channel *mask, case SUB : channel_sub_segment (mask, x1, i, (x2 - x1), 255); break; + default: + g_warning ("Only ADD, REPLACE and SUB are valid for channel_combine!"); + break; } } /* antialiasing */ @@ -1104,6 +1101,9 @@ channel_combine_ellipse (Channel *mask, case SUB: channel_sub_segment (mask, x0, i, j - x0, last); break; + default: + g_warning ("Only ADD, REPLACE and SUB are valid for channel_combine!"); + break; } } @@ -1124,6 +1124,8 @@ channel_combine_ellipse (Channel *mask, channel_add_segment (mask, x0, i, j - x0, last); else if (op == SUB) channel_sub_segment (mask, x0, i, j - x0, last); + else + g_warning ("Only ADD, REPLACE and SUB are valid for channel_combine!"); } } diff --git a/app/gimpbrushpipe.c b/app/gimpbrushpipe.c index 242072d215..7bc2c17ff3 100644 --- a/app/gimpbrushpipe.c +++ b/app/gimpbrushpipe.c @@ -55,6 +55,7 @@ static void paint_line_pixmap_mask(GImage *dest, int width, int mode); + static void gimp_brush_pixmap_destroy (GtkObject *object) { @@ -324,6 +325,9 @@ gimp_brush_pipe_load (char *filename) pipe->rank = g_new (int, pipe->dimension); pipe->select = g_new (PipeSelectModes, pipe->dimension); pipe->index = g_new (int, pipe->dimension); + /* placement is not used at all ?? */ + if (params.free_placement_string) + g_free (params.placement); for (i = 0; i < pipe->dimension; i++) { pipe->rank[i] = params.rank[i]; @@ -343,6 +347,8 @@ gimp_brush_pipe_load (char *filename) pipe->select[i] = PIPE_SELECT_TILT_Y; else pipe->select[i] = PIPE_SELECT_CONSTANT; + if (params.free_selection_string) + g_free (params.selection[i]); pipe->index[i] = 0; } } diff --git a/app/gimpchannel.c b/app/gimpchannel.c index 52fabbf3e0..8b2b08f708 100644 --- a/app/gimpchannel.c +++ b/app/gimpchannel.c @@ -103,12 +103,6 @@ gimp_channel_init (GimpChannel *channel) { } -/**********************/ -/* Static variables */ -/**********************/ - -static gint channel_get_count = 0; - /**************************/ /* Function definitions */ /**************************/ @@ -1064,6 +1058,9 @@ channel_combine_ellipse (Channel *mask, case SUB : channel_sub_segment (mask, x1, i, (x2 - x1), 255); break; + default: + g_warning ("Only ADD, REPLACE and SUB are valid for channel_combine!"); + break; } } /* antialiasing */ @@ -1104,6 +1101,9 @@ channel_combine_ellipse (Channel *mask, case SUB: channel_sub_segment (mask, x0, i, j - x0, last); break; + default: + g_warning ("Only ADD, REPLACE and SUB are valid for channel_combine!"); + break; } } @@ -1124,6 +1124,8 @@ channel_combine_ellipse (Channel *mask, channel_add_segment (mask, x0, i, j - x0, last); else if (op == SUB) channel_sub_segment (mask, x0, i, j - x0, last); + else + g_warning ("Only ADD, REPLACE and SUB are valid for channel_combine!"); } } diff --git a/app/histogram_tool.c b/app/histogram_tool.c index 2169ca4225..5af5cbeefb 100644 --- a/app/histogram_tool.c +++ b/app/histogram_tool.c @@ -29,7 +29,8 @@ #include "libgimp/gimpintl.h" -#define TEXT_WIDTH 45 +#define TEXT_WIDTH 45 +#define GRADIENT_HEIGHT 15 /* the histogram structures */ @@ -57,6 +58,7 @@ static void histogram_tool_value_callback (GtkWidget *, gpointer); static void histogram_tool_red_callback (GtkWidget *, gpointer); static void histogram_tool_green_callback (GtkWidget *, gpointer); static void histogram_tool_blue_callback (GtkWidget *, gpointer); +static void histogram_tool_gradient_draw (GtkWidget *, gint); static void histogram_tool_dialog_update (HistogramToolDialog *, gint, gint); @@ -332,6 +334,15 @@ histogram_tool_new_dialog () gtk_container_add (GTK_CONTAINER (frame), GTK_WIDGET(htd->histogram)); gtk_widget_show (GTK_WIDGET(htd->histogram)); gtk_widget_show (frame); + + /* The gradient below the histogram */ + htd->gradient = gtk_preview_new (GTK_PREVIEW_COLOR); + gtk_preview_size (GTK_PREVIEW (htd->gradient), + HISTOGRAM_WIDTH, GRADIENT_HEIGHT); + gtk_box_pack_start (GTK_BOX (vbox2), htd->gradient, FALSE, FALSE, 0); + gtk_widget_show (htd->gradient); + histogram_tool_gradient_draw (htd->gradient, HISTOGRAM_VALUE); + gtk_widget_show (vbox2); /* The table containing histogram information */ @@ -390,6 +401,7 @@ histogram_tool_value_callback (GtkWidget *widget, { htd->channel = HISTOGRAM_VALUE; histogram_widget_channel (htd->histogram, htd->channel); + histogram_tool_gradient_draw (htd->gradient, HISTOGRAM_VALUE); } } @@ -405,6 +417,7 @@ histogram_tool_red_callback (GtkWidget *widget, { htd->channel = HISTOGRAM_RED; histogram_widget_channel (htd->histogram, htd->channel); + histogram_tool_gradient_draw (htd->gradient, HISTOGRAM_RED); } } @@ -420,6 +433,7 @@ histogram_tool_green_callback (GtkWidget *widget, { htd->channel = HISTOGRAM_GREEN; histogram_widget_channel (htd->histogram, htd->channel); + histogram_tool_gradient_draw (htd->gradient, HISTOGRAM_GREEN); } } @@ -435,5 +449,47 @@ histogram_tool_blue_callback (GtkWidget *widget, { htd->channel = HISTOGRAM_BLUE; histogram_widget_channel (htd->histogram, htd->channel); + histogram_tool_gradient_draw (htd->gradient, HISTOGRAM_BLUE); } } + +static void +histogram_tool_gradient_draw (GtkWidget *gradient, + gint channel) +{ + guchar buf[HISTOGRAM_WIDTH * 3]; + guchar r, g, b; + gint i; + + r = g = b = 0; + switch (channel) + { + case HISTOGRAM_VALUE: + case HISTOGRAM_ALPHA: r = g = b = 1; + break; + case HISTOGRAM_RED: r = 1; + break; + case HISTOGRAM_GREEN: g = 1; + break; + case HISTOGRAM_BLUE: b = 1; + break; + default: + g_warning ("unknown channel type, can't happen\n"); + break; + } + + for (i = 0; i < HISTOGRAM_WIDTH; i++) + { + buf[3*i+0] = i*r; + buf[3*i+1] = i*g; + buf[3*i+2] = i*b; + } + + for (i = 0; i < GRADIENT_HEIGHT; i++) + gtk_preview_draw_row (GTK_PREVIEW (gradient), + buf, 0, i, HISTOGRAM_WIDTH); + + gtk_widget_queue_draw (gradient); +} + + diff --git a/app/histogram_tool.h b/app/histogram_tool.h index a43edf7c5d..c73a669495 100644 --- a/app/histogram_tool.h +++ b/app/histogram_tool.h @@ -33,6 +33,7 @@ struct _HistogramToolDialog GtkWidget *channel_menu; HistogramWidget *histogram; GimpHistogram *hist; + GtkWidget *gradient; gdouble mean; gdouble std_dev; diff --git a/app/tools/gimphistogramtool.c b/app/tools/gimphistogramtool.c index 2169ca4225..5af5cbeefb 100644 --- a/app/tools/gimphistogramtool.c +++ b/app/tools/gimphistogramtool.c @@ -29,7 +29,8 @@ #include "libgimp/gimpintl.h" -#define TEXT_WIDTH 45 +#define TEXT_WIDTH 45 +#define GRADIENT_HEIGHT 15 /* the histogram structures */ @@ -57,6 +58,7 @@ static void histogram_tool_value_callback (GtkWidget *, gpointer); static void histogram_tool_red_callback (GtkWidget *, gpointer); static void histogram_tool_green_callback (GtkWidget *, gpointer); static void histogram_tool_blue_callback (GtkWidget *, gpointer); +static void histogram_tool_gradient_draw (GtkWidget *, gint); static void histogram_tool_dialog_update (HistogramToolDialog *, gint, gint); @@ -332,6 +334,15 @@ histogram_tool_new_dialog () gtk_container_add (GTK_CONTAINER (frame), GTK_WIDGET(htd->histogram)); gtk_widget_show (GTK_WIDGET(htd->histogram)); gtk_widget_show (frame); + + /* The gradient below the histogram */ + htd->gradient = gtk_preview_new (GTK_PREVIEW_COLOR); + gtk_preview_size (GTK_PREVIEW (htd->gradient), + HISTOGRAM_WIDTH, GRADIENT_HEIGHT); + gtk_box_pack_start (GTK_BOX (vbox2), htd->gradient, FALSE, FALSE, 0); + gtk_widget_show (htd->gradient); + histogram_tool_gradient_draw (htd->gradient, HISTOGRAM_VALUE); + gtk_widget_show (vbox2); /* The table containing histogram information */ @@ -390,6 +401,7 @@ histogram_tool_value_callback (GtkWidget *widget, { htd->channel = HISTOGRAM_VALUE; histogram_widget_channel (htd->histogram, htd->channel); + histogram_tool_gradient_draw (htd->gradient, HISTOGRAM_VALUE); } } @@ -405,6 +417,7 @@ histogram_tool_red_callback (GtkWidget *widget, { htd->channel = HISTOGRAM_RED; histogram_widget_channel (htd->histogram, htd->channel); + histogram_tool_gradient_draw (htd->gradient, HISTOGRAM_RED); } } @@ -420,6 +433,7 @@ histogram_tool_green_callback (GtkWidget *widget, { htd->channel = HISTOGRAM_GREEN; histogram_widget_channel (htd->histogram, htd->channel); + histogram_tool_gradient_draw (htd->gradient, HISTOGRAM_GREEN); } } @@ -435,5 +449,47 @@ histogram_tool_blue_callback (GtkWidget *widget, { htd->channel = HISTOGRAM_BLUE; histogram_widget_channel (htd->histogram, htd->channel); + histogram_tool_gradient_draw (htd->gradient, HISTOGRAM_BLUE); } } + +static void +histogram_tool_gradient_draw (GtkWidget *gradient, + gint channel) +{ + guchar buf[HISTOGRAM_WIDTH * 3]; + guchar r, g, b; + gint i; + + r = g = b = 0; + switch (channel) + { + case HISTOGRAM_VALUE: + case HISTOGRAM_ALPHA: r = g = b = 1; + break; + case HISTOGRAM_RED: r = 1; + break; + case HISTOGRAM_GREEN: g = 1; + break; + case HISTOGRAM_BLUE: b = 1; + break; + default: + g_warning ("unknown channel type, can't happen\n"); + break; + } + + for (i = 0; i < HISTOGRAM_WIDTH; i++) + { + buf[3*i+0] = i*r; + buf[3*i+1] = i*g; + buf[3*i+2] = i*b; + } + + for (i = 0; i < GRADIENT_HEIGHT; i++) + gtk_preview_draw_row (GTK_PREVIEW (gradient), + buf, 0, i, HISTOGRAM_WIDTH); + + gtk_widget_queue_draw (gradient); +} + + diff --git a/app/tools/gimphistogramtool.h b/app/tools/gimphistogramtool.h index a43edf7c5d..c73a669495 100644 --- a/app/tools/gimphistogramtool.h +++ b/app/tools/gimphistogramtool.h @@ -33,6 +33,7 @@ struct _HistogramToolDialog GtkWidget *channel_menu; HistogramWidget *histogram; GimpHistogram *hist; + GtkWidget *gradient; gdouble mean; gdouble std_dev; diff --git a/app/tools/histogram_tool.c b/app/tools/histogram_tool.c index 2169ca4225..5af5cbeefb 100644 --- a/app/tools/histogram_tool.c +++ b/app/tools/histogram_tool.c @@ -29,7 +29,8 @@ #include "libgimp/gimpintl.h" -#define TEXT_WIDTH 45 +#define TEXT_WIDTH 45 +#define GRADIENT_HEIGHT 15 /* the histogram structures */ @@ -57,6 +58,7 @@ static void histogram_tool_value_callback (GtkWidget *, gpointer); static void histogram_tool_red_callback (GtkWidget *, gpointer); static void histogram_tool_green_callback (GtkWidget *, gpointer); static void histogram_tool_blue_callback (GtkWidget *, gpointer); +static void histogram_tool_gradient_draw (GtkWidget *, gint); static void histogram_tool_dialog_update (HistogramToolDialog *, gint, gint); @@ -332,6 +334,15 @@ histogram_tool_new_dialog () gtk_container_add (GTK_CONTAINER (frame), GTK_WIDGET(htd->histogram)); gtk_widget_show (GTK_WIDGET(htd->histogram)); gtk_widget_show (frame); + + /* The gradient below the histogram */ + htd->gradient = gtk_preview_new (GTK_PREVIEW_COLOR); + gtk_preview_size (GTK_PREVIEW (htd->gradient), + HISTOGRAM_WIDTH, GRADIENT_HEIGHT); + gtk_box_pack_start (GTK_BOX (vbox2), htd->gradient, FALSE, FALSE, 0); + gtk_widget_show (htd->gradient); + histogram_tool_gradient_draw (htd->gradient, HISTOGRAM_VALUE); + gtk_widget_show (vbox2); /* The table containing histogram information */ @@ -390,6 +401,7 @@ histogram_tool_value_callback (GtkWidget *widget, { htd->channel = HISTOGRAM_VALUE; histogram_widget_channel (htd->histogram, htd->channel); + histogram_tool_gradient_draw (htd->gradient, HISTOGRAM_VALUE); } } @@ -405,6 +417,7 @@ histogram_tool_red_callback (GtkWidget *widget, { htd->channel = HISTOGRAM_RED; histogram_widget_channel (htd->histogram, htd->channel); + histogram_tool_gradient_draw (htd->gradient, HISTOGRAM_RED); } } @@ -420,6 +433,7 @@ histogram_tool_green_callback (GtkWidget *widget, { htd->channel = HISTOGRAM_GREEN; histogram_widget_channel (htd->histogram, htd->channel); + histogram_tool_gradient_draw (htd->gradient, HISTOGRAM_GREEN); } } @@ -435,5 +449,47 @@ histogram_tool_blue_callback (GtkWidget *widget, { htd->channel = HISTOGRAM_BLUE; histogram_widget_channel (htd->histogram, htd->channel); + histogram_tool_gradient_draw (htd->gradient, HISTOGRAM_BLUE); } } + +static void +histogram_tool_gradient_draw (GtkWidget *gradient, + gint channel) +{ + guchar buf[HISTOGRAM_WIDTH * 3]; + guchar r, g, b; + gint i; + + r = g = b = 0; + switch (channel) + { + case HISTOGRAM_VALUE: + case HISTOGRAM_ALPHA: r = g = b = 1; + break; + case HISTOGRAM_RED: r = 1; + break; + case HISTOGRAM_GREEN: g = 1; + break; + case HISTOGRAM_BLUE: b = 1; + break; + default: + g_warning ("unknown channel type, can't happen\n"); + break; + } + + for (i = 0; i < HISTOGRAM_WIDTH; i++) + { + buf[3*i+0] = i*r; + buf[3*i+1] = i*g; + buf[3*i+2] = i*b; + } + + for (i = 0; i < GRADIENT_HEIGHT; i++) + gtk_preview_draw_row (GTK_PREVIEW (gradient), + buf, 0, i, HISTOGRAM_WIDTH); + + gtk_widget_queue_draw (gradient); +} + + diff --git a/app/tools/histogram_tool.h b/app/tools/histogram_tool.h index a43edf7c5d..c73a669495 100644 --- a/app/tools/histogram_tool.h +++ b/app/tools/histogram_tool.h @@ -33,6 +33,7 @@ struct _HistogramToolDialog GtkWidget *channel_menu; HistogramWidget *histogram; GimpHistogram *hist; + GtkWidget *gradient; gdouble mean; gdouble std_dev; diff --git a/libgimp/gimpparasiteio.c b/libgimp/gimpparasiteio.c index 05650b6b5a..c1187aaeb1 100644 --- a/libgimp/gimpparasiteio.c +++ b/libgimp/gimpparasiteio.c @@ -41,8 +41,12 @@ pixpipeparams_init (PixPipeParams *params) params->cols = 1; params->rows = 1; params->placement = "constant"; + params->free_placement_string = FALSE; for (i = 0; i < PIXPIPE_MAXDIM; i++) - params->selection[i] = "random"; + { + params->selection[i] = "random"; + params->free_selection_string = FALSE; + } params->rank[0] = 1; for (i = 1; i < PIXPIPE_MAXDIM; i++) params->rank[i] = 0; @@ -53,7 +57,7 @@ pixpipeparams_parse (gchar *string, PixPipeParams *params) { guchar *p, *q, *r; /* Don't you love single-char identifiers? */ - gint i; + gint i; /* No, we don't!! */ q = string; while ((p = strtok (q, " \r\n")) != NULL) @@ -101,7 +105,10 @@ pixpipeparams_parse (gchar *string, else if (strcmp (p, "placement") == 0) { if (r) - params->placement = g_strdup (r + 1); + { + params->placement = g_strdup (r + 1); + params->free_placement_string = TRUE; + } } else if (strncmp (p, "rank", strlen ("rank")) == 0 && r) { @@ -118,7 +125,10 @@ pixpipeparams_parse (gchar *string, { i = atoi (p + strlen ("sel")); if (i >= 0 && i < params->dim) - params->selection[i] = g_strdup (r + 1); + { + params->selection[i] = g_strdup (r + 1); + params->free_selection_string = TRUE; + } } } if (r) diff --git a/libgimp/gimpparasiteio.h b/libgimp/gimpparasiteio.h index d3bc67ff67..332b8458b9 100644 --- a/libgimp/gimpparasiteio.h +++ b/libgimp/gimpparasiteio.h @@ -40,8 +40,10 @@ typedef struct { gint cellwidth; gint cellheight; gchar *placement; + gboolean free_placement_string; gint rank[PIXPIPE_MAXDIM]; gchar *selection[PIXPIPE_MAXDIM]; + gboolean free_selection_string; } PixPipeParams; /* Initalize with dummy values */ diff --git a/libgimp/parasiteio.c b/libgimp/parasiteio.c index 05650b6b5a..c1187aaeb1 100644 --- a/libgimp/parasiteio.c +++ b/libgimp/parasiteio.c @@ -41,8 +41,12 @@ pixpipeparams_init (PixPipeParams *params) params->cols = 1; params->rows = 1; params->placement = "constant"; + params->free_placement_string = FALSE; for (i = 0; i < PIXPIPE_MAXDIM; i++) - params->selection[i] = "random"; + { + params->selection[i] = "random"; + params->free_selection_string = FALSE; + } params->rank[0] = 1; for (i = 1; i < PIXPIPE_MAXDIM; i++) params->rank[i] = 0; @@ -53,7 +57,7 @@ pixpipeparams_parse (gchar *string, PixPipeParams *params) { guchar *p, *q, *r; /* Don't you love single-char identifiers? */ - gint i; + gint i; /* No, we don't!! */ q = string; while ((p = strtok (q, " \r\n")) != NULL) @@ -101,7 +105,10 @@ pixpipeparams_parse (gchar *string, else if (strcmp (p, "placement") == 0) { if (r) - params->placement = g_strdup (r + 1); + { + params->placement = g_strdup (r + 1); + params->free_placement_string = TRUE; + } } else if (strncmp (p, "rank", strlen ("rank")) == 0 && r) { @@ -118,7 +125,10 @@ pixpipeparams_parse (gchar *string, { i = atoi (p + strlen ("sel")); if (i >= 0 && i < params->dim) - params->selection[i] = g_strdup (r + 1); + { + params->selection[i] = g_strdup (r + 1); + params->free_selection_string = TRUE; + } } } if (r) diff --git a/libgimp/parasiteio.h b/libgimp/parasiteio.h index d3bc67ff67..332b8458b9 100644 --- a/libgimp/parasiteio.h +++ b/libgimp/parasiteio.h @@ -40,8 +40,10 @@ typedef struct { gint cellwidth; gint cellheight; gchar *placement; + gboolean free_placement_string; gint rank[PIXPIPE_MAXDIM]; gchar *selection[PIXPIPE_MAXDIM]; + gboolean free_selection_string; } PixPipeParams; /* Initalize with dummy values */ diff --git a/libgimpbase/gimpparasiteio.c b/libgimpbase/gimpparasiteio.c index 05650b6b5a..c1187aaeb1 100644 --- a/libgimpbase/gimpparasiteio.c +++ b/libgimpbase/gimpparasiteio.c @@ -41,8 +41,12 @@ pixpipeparams_init (PixPipeParams *params) params->cols = 1; params->rows = 1; params->placement = "constant"; + params->free_placement_string = FALSE; for (i = 0; i < PIXPIPE_MAXDIM; i++) - params->selection[i] = "random"; + { + params->selection[i] = "random"; + params->free_selection_string = FALSE; + } params->rank[0] = 1; for (i = 1; i < PIXPIPE_MAXDIM; i++) params->rank[i] = 0; @@ -53,7 +57,7 @@ pixpipeparams_parse (gchar *string, PixPipeParams *params) { guchar *p, *q, *r; /* Don't you love single-char identifiers? */ - gint i; + gint i; /* No, we don't!! */ q = string; while ((p = strtok (q, " \r\n")) != NULL) @@ -101,7 +105,10 @@ pixpipeparams_parse (gchar *string, else if (strcmp (p, "placement") == 0) { if (r) - params->placement = g_strdup (r + 1); + { + params->placement = g_strdup (r + 1); + params->free_placement_string = TRUE; + } } else if (strncmp (p, "rank", strlen ("rank")) == 0 && r) { @@ -118,7 +125,10 @@ pixpipeparams_parse (gchar *string, { i = atoi (p + strlen ("sel")); if (i >= 0 && i < params->dim) - params->selection[i] = g_strdup (r + 1); + { + params->selection[i] = g_strdup (r + 1); + params->free_selection_string = TRUE; + } } } if (r) diff --git a/libgimpbase/gimpparasiteio.h b/libgimpbase/gimpparasiteio.h index d3bc67ff67..332b8458b9 100644 --- a/libgimpbase/gimpparasiteio.h +++ b/libgimpbase/gimpparasiteio.h @@ -40,8 +40,10 @@ typedef struct { gint cellwidth; gint cellheight; gchar *placement; + gboolean free_placement_string; gint rank[PIXPIPE_MAXDIM]; gchar *selection[PIXPIPE_MAXDIM]; + gboolean free_selection_string; } PixPipeParams; /* Initalize with dummy values */