free the memory allocated for the GimpLut structure. Removed trailing

2003-09-05  Sven Neumann  <sven@gimp.org>

	* app/base/gimplut.[ch] (gimp_lut_free): free the memory allocated
	for the GimpLut structure. Removed trailing whitespace.

	* app/core/gimpbuffer.c: cosmetics.

	* app/core/gimpedit.[ch]: let gimp_edit_cut() and gimp_edit_copy()
	return a pointer to the global cut buffer instead of creating a
	GimpBuffer which was leaked by most callers.

	* app/gui/edit-commands.c: changed accordingly.

	* libgimpwidgets/gimpquerybox.[ch] (string_query_box_ok_callback):
	removed a superfluous g_strdup(); made GimpQueryStringCallback take
	a const gchar* pointer.

	* app/gui/edit-commands.c
	* app/gui/file-commands.c
	* app/gui/palettes-commands.c: changed accordingly.
This commit is contained in:
Sven Neumann
2003-09-05 01:40:29 +00:00
committed by Sven Neumann
parent 7dc961ad50
commit 8e38f70b96
16 changed files with 170 additions and 138 deletions

View File

@ -1,3 +1,24 @@
2003-09-05 Sven Neumann <sven@gimp.org>
* app/base/gimplut.[ch] (gimp_lut_free): free the memory allocated
for the GimpLut structure. Removed trailing whitespace.
* app/core/gimpbuffer.c: cosmetics.
* app/core/gimpedit.[ch]: let gimp_edit_cut() and gimp_edit_copy()
return a pointer to the global cut buffer instead of creating a
GimpBuffer which was leaked by most callers.
* app/gui/edit-commands.c: changed accordingly.
* libgimpwidgets/gimpquerybox.[ch] (string_query_box_ok_callback):
removed a superfluous g_strdup(); made GimpQueryStringCallback take
a const gchar* pointer.
* app/gui/edit-commands.c
* app/gui/file-commands.c
* app/gui/palettes-commands.c: changed accordingly.
2003-09-05 Sven Neumann <sven@gimp.org> 2003-09-05 Sven Neumann <sven@gimp.org>
* plug-ins/script-fu/script-fu-scripts.c (script_fu_interface): * plug-ins/script-fu/script-fu-scripts.c (script_fu_interface):

View File

@ -72,10 +72,10 @@
/* local function prototypes */ /* local function prototypes */
static void cut_named_buffer_callback (GtkWidget *widget, static void cut_named_buffer_callback (GtkWidget *widget,
gchar *name, const gchar *name,
gpointer data); gpointer data);
static void copy_named_buffer_callback (GtkWidget *widget, static void copy_named_buffer_callback (GtkWidget *widget,
gchar *name, const gchar *name,
gpointer data); gpointer data);
@ -288,7 +288,7 @@ cut_named_buffer_callback (GtkWidget *widget,
gchar *name, gchar *name,
gpointer data) gpointer data)
{ {
GimpBuffer *cut_buffer; const GimpBuffer *cut_buffer;
GimpImage *gimage; GimpImage *gimage;
gimage = (GimpImage *) data; gimage = (GimpImage *) data;
@ -314,10 +314,10 @@ cut_named_buffer_callback (GtkWidget *widget,
static void static void
copy_named_buffer_callback (GtkWidget *widget, copy_named_buffer_callback (GtkWidget *widget,
gchar *name, const gchar *name,
gpointer data) gpointer data)
{ {
GimpBuffer *copy_buffer; const GimpBuffer *copy_buffer;
GimpImage *gimage; GimpImage *gimage;
gimage = (GimpImage *) data; gimage = (GimpImage *) data;

View File

@ -85,7 +85,7 @@
/* local function prototypes */ /* local function prototypes */
static void file_new_template_callback (GtkWidget *widget, static void file_new_template_callback (GtkWidget *widget,
gchar *name, const gchar *name,
gpointer data); gpointer data);
static void file_revert_confirm_callback (GtkWidget *widget, static void file_revert_confirm_callback (GtkWidget *widget,
gboolean revert, gboolean revert,
@ -392,7 +392,7 @@ file_file_open_dialog (Gimp *gimp,
static void static void
file_new_template_callback (GtkWidget *widget, file_new_template_callback (GtkWidget *widget,
gchar *name, const gchar *name,
gpointer data) gpointer data)
{ {
GimpTemplate *template; GimpTemplate *template;

View File

@ -43,7 +43,7 @@
static void palettes_merge_palettes_query (GimpContainerEditor *editor); static void palettes_merge_palettes_query (GimpContainerEditor *editor);
static void palettes_merge_palettes_callback (GtkWidget *widget, static void palettes_merge_palettes_callback (GtkWidget *widget,
gchar *palette_name, const gchar *palette_name,
gpointer data); gpointer data);
@ -92,7 +92,7 @@ palettes_merge_palettes_query (GimpContainerEditor *editor)
static void static void
palettes_merge_palettes_callback (GtkWidget *widget, palettes_merge_palettes_callback (GtkWidget *widget,
gchar *palette_name, const gchar *palette_name,
gpointer data) gpointer data)
{ {
#ifdef __GNUC__ #ifdef __GNUC__

View File

@ -52,6 +52,7 @@ gimp_lut_free (GimpLut *lut)
g_free (lut->luts[i]); g_free (lut->luts[i]);
g_free (lut->luts); g_free (lut->luts);
g_free (lut);
} }
void void
@ -88,6 +89,7 @@ gimp_lut_setup (GimpLut *lut,
} }
} }
/* see comment in gimplut.h */
void void
gimp_lut_setup_exact (GimpLut *lut, gimp_lut_setup_exact (GimpLut *lut,
GimpLutFunc func, GimpLutFunc func,

View File

@ -28,8 +28,8 @@ struct _GimpLut
gint nchannels; gint nchannels;
}; };
/* TODO: the GimpLutFunc should really be passed the ColorModel of the region, /* TODO: the GimpLutFunc should really be passed the ColorModel of the
* not just the number of channels * region, not just the number of channels
*/ */
/* GimpLutFuncs should assume that the input and output gamma are 1.0 /* GimpLutFuncs should assume that the input and output gamma are 1.0

View File

@ -45,7 +45,7 @@
#include "gimp-intl.h" #include "gimp-intl.h"
GimpBuffer * const GimpBuffer *
gimp_edit_cut (GimpImage *gimage, gimp_edit_cut (GimpImage *gimage,
GimpDrawable *drawable) GimpDrawable *drawable)
{ {
@ -97,13 +97,15 @@ gimp_edit_cut (GimpImage *gimage,
/* Set the global edit buffer */ /* Set the global edit buffer */
gimage->gimp->global_buffer = gimp_buffer_new (cropped_cut, gimage->gimp->global_buffer = gimp_buffer_new (cropped_cut,
"Global Buffer", "Global Buffer",
TRUE); FALSE);
return gimage->gimp->global_buffer;
} }
return gimp_buffer_new (cropped_cut, "Cut Pixels", FALSE); return NULL;
} }
GimpBuffer * const GimpBuffer *
gimp_edit_copy (GimpImage *gimage, gimp_edit_copy (GimpImage *gimage,
GimpDrawable *drawable) GimpDrawable *drawable)
{ {
@ -155,10 +157,12 @@ gimp_edit_copy (GimpImage *gimage,
/* Set the global edit buffer */ /* Set the global edit buffer */
gimage->gimp->global_buffer = gimp_buffer_new (cropped_copy, gimage->gimp->global_buffer = gimp_buffer_new (cropped_copy,
"Global Buffer", "Global Buffer",
TRUE); FALSE);
return gimage->gimp->global_buffer;
} }
return gimp_buffer_new (cropped_copy, "Copied Pixels", FALSE); return NULL;
} }
GimpLayer * GimpLayer *

View File

@ -20,9 +20,9 @@
#define __GIMP_EDIT_H__ #define __GIMP_EDIT_H__
GimpBuffer * gimp_edit_cut (GimpImage *gimage, const GimpBuffer * gimp_edit_cut (GimpImage *gimage,
GimpDrawable *drawable); GimpDrawable *drawable);
GimpBuffer * gimp_edit_copy (GimpImage *gimage, const GimpBuffer * gimp_edit_copy (GimpImage *gimage,
GimpDrawable *drawable); GimpDrawable *drawable);
GimpLayer * gimp_edit_paste (GimpImage *gimage, GimpLayer * gimp_edit_paste (GimpImage *gimage,
GimpDrawable *drawable, GimpDrawable *drawable,

View File

@ -316,7 +316,8 @@ gimp_buffer_new (TileManager *tiles,
if (copy_pixels) if (copy_pixels)
{ {
buffer->tiles = tile_manager_new (width, height, tile_manager_bpp (tiles)); buffer->tiles = tile_manager_new (width, height,
tile_manager_bpp (tiles));
pixel_region_init (&srcPR, tiles, 0, 0, width, height, FALSE); pixel_region_init (&srcPR, tiles, 0, 0, width, height, FALSE);
pixel_region_init (&destPR, buffer->tiles, 0, 0, width, height, TRUE); pixel_region_init (&destPR, buffer->tiles, 0, 0, width, height, TRUE);
@ -327,7 +328,7 @@ gimp_buffer_new (TileManager *tiles,
buffer->tiles = tiles; buffer->tiles = tiles;
} }
return GIMP_BUFFER (buffer); return buffer;
} }
gint gint

View File

@ -45,7 +45,7 @@
#include "gimp-intl.h" #include "gimp-intl.h"
GimpBuffer * const GimpBuffer *
gimp_edit_cut (GimpImage *gimage, gimp_edit_cut (GimpImage *gimage,
GimpDrawable *drawable) GimpDrawable *drawable)
{ {
@ -97,13 +97,15 @@ gimp_edit_cut (GimpImage *gimage,
/* Set the global edit buffer */ /* Set the global edit buffer */
gimage->gimp->global_buffer = gimp_buffer_new (cropped_cut, gimage->gimp->global_buffer = gimp_buffer_new (cropped_cut,
"Global Buffer", "Global Buffer",
TRUE); FALSE);
return gimage->gimp->global_buffer;
} }
return gimp_buffer_new (cropped_cut, "Cut Pixels", FALSE); return NULL;
} }
GimpBuffer * const GimpBuffer *
gimp_edit_copy (GimpImage *gimage, gimp_edit_copy (GimpImage *gimage,
GimpDrawable *drawable) GimpDrawable *drawable)
{ {
@ -155,10 +157,12 @@ gimp_edit_copy (GimpImage *gimage,
/* Set the global edit buffer */ /* Set the global edit buffer */
gimage->gimp->global_buffer = gimp_buffer_new (cropped_copy, gimage->gimp->global_buffer = gimp_buffer_new (cropped_copy,
"Global Buffer", "Global Buffer",
TRUE); FALSE);
return gimage->gimp->global_buffer;
} }
return gimp_buffer_new (cropped_copy, "Copied Pixels", FALSE); return NULL;
} }
GimpLayer * GimpLayer *

View File

@ -20,9 +20,9 @@
#define __GIMP_EDIT_H__ #define __GIMP_EDIT_H__
GimpBuffer * gimp_edit_cut (GimpImage *gimage, const GimpBuffer * gimp_edit_cut (GimpImage *gimage,
GimpDrawable *drawable); GimpDrawable *drawable);
GimpBuffer * gimp_edit_copy (GimpImage *gimage, const GimpBuffer * gimp_edit_copy (GimpImage *gimage,
GimpDrawable *drawable); GimpDrawable *drawable);
GimpLayer * gimp_edit_paste (GimpImage *gimage, GimpLayer * gimp_edit_paste (GimpImage *gimage,
GimpDrawable *drawable, GimpDrawable *drawable,

View File

@ -72,10 +72,10 @@
/* local function prototypes */ /* local function prototypes */
static void cut_named_buffer_callback (GtkWidget *widget, static void cut_named_buffer_callback (GtkWidget *widget,
gchar *name, const gchar *name,
gpointer data); gpointer data);
static void copy_named_buffer_callback (GtkWidget *widget, static void copy_named_buffer_callback (GtkWidget *widget,
gchar *name, const gchar *name,
gpointer data); gpointer data);
@ -288,7 +288,7 @@ cut_named_buffer_callback (GtkWidget *widget,
gchar *name, gchar *name,
gpointer data) gpointer data)
{ {
GimpBuffer *cut_buffer; const GimpBuffer *cut_buffer;
GimpImage *gimage; GimpImage *gimage;
gimage = (GimpImage *) data; gimage = (GimpImage *) data;
@ -314,10 +314,10 @@ cut_named_buffer_callback (GtkWidget *widget,
static void static void
copy_named_buffer_callback (GtkWidget *widget, copy_named_buffer_callback (GtkWidget *widget,
gchar *name, const gchar *name,
gpointer data) gpointer data)
{ {
GimpBuffer *copy_buffer; const GimpBuffer *copy_buffer;
GimpImage *gimage; GimpImage *gimage;
gimage = (GimpImage *) data; gimage = (GimpImage *) data;

View File

@ -85,7 +85,7 @@
/* local function prototypes */ /* local function prototypes */
static void file_new_template_callback (GtkWidget *widget, static void file_new_template_callback (GtkWidget *widget,
gchar *name, const gchar *name,
gpointer data); gpointer data);
static void file_revert_confirm_callback (GtkWidget *widget, static void file_revert_confirm_callback (GtkWidget *widget,
gboolean revert, gboolean revert,
@ -392,7 +392,7 @@ file_file_open_dialog (Gimp *gimp,
static void static void
file_new_template_callback (GtkWidget *widget, file_new_template_callback (GtkWidget *widget,
gchar *name, const gchar *name,
gpointer data) gpointer data)
{ {
GimpTemplate *template; GimpTemplate *template;

View File

@ -43,7 +43,7 @@
static void palettes_merge_palettes_query (GimpContainerEditor *editor); static void palettes_merge_palettes_query (GimpContainerEditor *editor);
static void palettes_merge_palettes_callback (GtkWidget *widget, static void palettes_merge_palettes_callback (GtkWidget *widget,
gchar *palette_name, const gchar *palette_name,
gpointer data); gpointer data);
@ -92,7 +92,7 @@ palettes_merge_palettes_query (GimpContainerEditor *editor)
static void static void
palettes_merge_palettes_callback (GtkWidget *widget, palettes_merge_palettes_callback (GtkWidget *widget,
gchar *palette_name, const gchar *palette_name,
gpointer data) gpointer data)
{ {
#ifdef __GNUC__ #ifdef __GNUC__

View File

@ -532,12 +532,12 @@ string_query_box_ok_callback (GtkWidget *widget,
gpointer data) gpointer data)
{ {
QueryBox *query_box; QueryBox *query_box;
gchar *string; const gchar *string;
query_box = query_box_disconnect (data); query_box = query_box_disconnect (data);
/* Get the entry data */ /* Get the entry data */
string = g_strdup (gtk_entry_get_text (GTK_ENTRY (query_box->entry))); string = gtk_entry_get_text (GTK_ENTRY (query_box->entry));
/* Call the user defined callback */ /* Call the user defined callback */
(* (GimpQueryStringCallback) query_box->callback) (query_box->qbox, (* (GimpQueryStringCallback) query_box->callback) (query_box->qbox,

View File

@ -30,7 +30,7 @@ G_BEGIN_DECLS
/* query box callback prototypes */ /* query box callback prototypes */
typedef void (* GimpQueryStringCallback) (GtkWidget *query_box, typedef void (* GimpQueryStringCallback) (GtkWidget *query_box,
gchar *string, const gchar *string,
gpointer data); gpointer data);
typedef void (* GimpQueryIntCallback) (GtkWidget *query_box, typedef void (* GimpQueryIntCallback) (GtkWidget *query_box,