Commit 8e38f70b authored by Sven Neumann's avatar Sven Neumann Committed by Sven Neumann

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.
parent 7dc961ad
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>
* plug-ins/script-fu/script-fu-scripts.c (script_fu_interface):
......@@ -71,12 +71,12 @@
/* local function prototypes */
static void cut_named_buffer_callback (GtkWidget *widget,
gchar *name,
gpointer data);
static void copy_named_buffer_callback (GtkWidget *widget,
gchar *name,
gpointer data);
static void cut_named_buffer_callback (GtkWidget *widget,
const gchar *name,
gpointer data);
static void copy_named_buffer_callback (GtkWidget *widget,
const gchar *name,
gpointer data);
/* public functions */
......@@ -288,8 +288,8 @@ cut_named_buffer_callback (GtkWidget *widget,
gchar *name,
gpointer data)
{
GimpBuffer *cut_buffer;
GimpImage *gimage;
const GimpBuffer *cut_buffer;
GimpImage *gimage;
gimage = (GimpImage *) data;
......@@ -313,12 +313,12 @@ cut_named_buffer_callback (GtkWidget *widget,
}
static void
copy_named_buffer_callback (GtkWidget *widget,
gchar *name,
gpointer data)
copy_named_buffer_callback (GtkWidget *widget,
const gchar *name,
gpointer data)
{
GimpBuffer *copy_buffer;
GimpImage *gimage;
const GimpBuffer *copy_buffer;
GimpImage *gimage;
gimage = (GimpImage *) data;
......
......@@ -84,12 +84,12 @@
/* local function prototypes */
static void file_new_template_callback (GtkWidget *widget,
gchar *name,
gpointer data);
static void file_revert_confirm_callback (GtkWidget *widget,
gboolean revert,
gpointer data);
static void file_new_template_callback (GtkWidget *widget,
const gchar *name,
gpointer data);
static void file_revert_confirm_callback (GtkWidget *widget,
gboolean revert,
gpointer data);
/* public functions */
......@@ -391,9 +391,9 @@ file_file_open_dialog (Gimp *gimp,
/* private functions */
static void
file_new_template_callback (GtkWidget *widget,
gchar *name,
gpointer data)
file_new_template_callback (GtkWidget *widget,
const gchar *name,
gpointer data)
{
GimpTemplate *template;
GimpImage *gimage;
......
......@@ -43,7 +43,7 @@
static void palettes_merge_palettes_query (GimpContainerEditor *editor);
static void palettes_merge_palettes_callback (GtkWidget *widget,
gchar *palette_name,
const gchar *palette_name,
gpointer data);
......@@ -91,9 +91,9 @@ palettes_merge_palettes_query (GimpContainerEditor *editor)
}
static void
palettes_merge_palettes_callback (GtkWidget *widget,
gchar *palette_name,
gpointer data)
palettes_merge_palettes_callback (GtkWidget *widget,
const gchar *palette_name,
gpointer data)
{
#ifdef __GNUC__
#warning FIXME: reimplement palettes_merge_palettes_callback()
......
......@@ -52,12 +52,13 @@ gimp_lut_free (GimpLut *lut)
g_free (lut->luts[i]);
g_free (lut->luts);
g_free (lut);
}
void
gimp_lut_setup (GimpLut *lut,
gimp_lut_setup (GimpLut *lut,
GimpLutFunc func,
void *user_data,
void *user_data,
gint nchannels)
{
guint i, v;
......@@ -88,10 +89,11 @@ gimp_lut_setup (GimpLut *lut,
}
}
/* see comment in gimplut.h */
void
gimp_lut_setup_exact (GimpLut *lut,
gimp_lut_setup_exact (GimpLut *lut,
GimpLutFunc func,
void *user_data,
void *user_data,
gint nchannels)
{
gimp_lut_setup (lut, func, user_data, nchannels);
......
......@@ -28,23 +28,23 @@ struct _GimpLut
gint nchannels;
};
/* TODO: the GimpLutFunc should really be passed the ColorModel of the region,
* not just the number of channels
/* TODO: the GimpLutFunc should really be passed the ColorModel of the
* region, not just the number of channels
*/
/* GimpLutFuncs should assume that the input and output gamma are 1.0
* and do no correction as this will be handled by gimp_lut_setup
*/
typedef gfloat (*GimpLutFunc) (gpointer user_data,
typedef gfloat (*GimpLutFunc) (gpointer user_data,
gint nchannels,
gint channel,
gint channel,
gfloat value);
GimpLut * gimp_lut_new (void);
void gimp_lut_free (GimpLut *lut);
void gimp_lut_setup (GimpLut *lut,
void gimp_lut_setup (GimpLut *lut,
GimpLutFunc func,
gpointer user_data,
gint nchannels);
......@@ -53,7 +53,7 @@ void gimp_lut_setup (GimpLut *lut,
* however is guaranteed to never perform any interpolation or gamma
* correction on the lut
*/
void gimp_lut_setup_exact (GimpLut *lut,
void gimp_lut_setup_exact (GimpLut *lut,
GimpLutFunc func,
gpointer user_data,
gint nchannels);
......
......@@ -45,7 +45,7 @@
#include "gimp-intl.h"
GimpBuffer *
const GimpBuffer *
gimp_edit_cut (GimpImage *gimage,
GimpDrawable *drawable)
{
......@@ -97,13 +97,15 @@ gimp_edit_cut (GimpImage *gimage,
/* Set the global edit buffer */
gimage->gimp->global_buffer = gimp_buffer_new (cropped_cut,
"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,
GimpDrawable *drawable)
{
......@@ -155,10 +157,12 @@ gimp_edit_copy (GimpImage *gimage,
/* Set the global edit buffer */
gimage->gimp->global_buffer = gimp_buffer_new (cropped_copy,
"Global Buffer",
TRUE);
FALSE);
return gimage->gimp->global_buffer;
}
return gimp_buffer_new (cropped_copy, "Copied Pixels", FALSE);
return NULL;
}
GimpLayer *
......
......@@ -20,22 +20,22 @@
#define __GIMP_EDIT_H__
GimpBuffer * gimp_edit_cut (GimpImage *gimage,
GimpDrawable *drawable);
GimpBuffer * gimp_edit_copy (GimpImage *gimage,
GimpDrawable *drawable);
GimpLayer * gimp_edit_paste (GimpImage *gimage,
GimpDrawable *drawable,
GimpBuffer *paste,
gboolean paste_into);
GimpImage * gimp_edit_paste_as_new (Gimp *gimp,
GimpImage *gimage,
GimpBuffer *paste);
gboolean gimp_edit_clear (GimpImage *gimage,
GimpDrawable *drawable);
gboolean gimp_edit_fill (GimpImage *gimage,
GimpDrawable *drawable,
GimpFillType fill_type);
const GimpBuffer * gimp_edit_cut (GimpImage *gimage,
GimpDrawable *drawable);
const GimpBuffer * gimp_edit_copy (GimpImage *gimage,
GimpDrawable *drawable);
GimpLayer * gimp_edit_paste (GimpImage *gimage,
GimpDrawable *drawable,
GimpBuffer *paste,
gboolean paste_into);
GimpImage * gimp_edit_paste_as_new (Gimp *gimp,
GimpImage *gimage,
GimpBuffer *paste);
gboolean gimp_edit_clear (GimpImage *gimage,
GimpDrawable *drawable);
gboolean gimp_edit_fill (GimpImage *gimage,
GimpDrawable *drawable,
GimpFillType fill_type);
#endif /* __GIMP_EDIT_H__ */
......@@ -316,9 +316,10 @@ gimp_buffer_new (TileManager *tiles,
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);
copy_region (&srcPR, &destPR);
}
......@@ -327,7 +328,7 @@ gimp_buffer_new (TileManager *tiles,
buffer->tiles = tiles;
}
return GIMP_BUFFER (buffer);
return buffer;
}
gint
......
......@@ -45,7 +45,7 @@
#include "gimp-intl.h"
GimpBuffer *
const GimpBuffer *
gimp_edit_cut (GimpImage *gimage,
GimpDrawable *drawable)
{
......@@ -97,13 +97,15 @@ gimp_edit_cut (GimpImage *gimage,
/* Set the global edit buffer */
gimage->gimp->global_buffer = gimp_buffer_new (cropped_cut,
"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,
GimpDrawable *drawable)
{
......@@ -155,10 +157,12 @@ gimp_edit_copy (GimpImage *gimage,
/* Set the global edit buffer */
gimage->gimp->global_buffer = gimp_buffer_new (cropped_copy,
"Global Buffer",
TRUE);
FALSE);
return gimage->gimp->global_buffer;
}
return gimp_buffer_new (cropped_copy, "Copied Pixels", FALSE);
return NULL;
}
GimpLayer *
......
......@@ -20,22 +20,22 @@
#define __GIMP_EDIT_H__
GimpBuffer * gimp_edit_cut (GimpImage *gimage,
GimpDrawable *drawable);
GimpBuffer * gimp_edit_copy (GimpImage *gimage,
GimpDrawable *drawable);
GimpLayer * gimp_edit_paste (GimpImage *gimage,
GimpDrawable *drawable,
GimpBuffer *paste,
gboolean paste_into);
GimpImage * gimp_edit_paste_as_new (Gimp *gimp,
GimpImage *gimage,
GimpBuffer *paste);
gboolean gimp_edit_clear (GimpImage *gimage,
GimpDrawable *drawable);
gboolean gimp_edit_fill (GimpImage *gimage,
GimpDrawable *drawable,
GimpFillType fill_type);
const GimpBuffer * gimp_edit_cut (GimpImage *gimage,
GimpDrawable *drawable);
const GimpBuffer * gimp_edit_copy (GimpImage *gimage,
GimpDrawable *drawable);
GimpLayer * gimp_edit_paste (GimpImage *gimage,
GimpDrawable *drawable,
GimpBuffer *paste,
gboolean paste_into);
GimpImage * gimp_edit_paste_as_new (Gimp *gimp,
GimpImage *gimage,
GimpBuffer *paste);
gboolean gimp_edit_clear (GimpImage *gimage,
GimpDrawable *drawable);
gboolean gimp_edit_fill (GimpImage *gimage,
GimpDrawable *drawable,
GimpFillType fill_type);
#endif /* __GIMP_EDIT_H__ */
......@@ -71,12 +71,12 @@
/* local function prototypes */
static void cut_named_buffer_callback (GtkWidget *widget,
gchar *name,
gpointer data);
static void copy_named_buffer_callback (GtkWidget *widget,
gchar *name,
gpointer data);
static void cut_named_buffer_callback (GtkWidget *widget,
const gchar *name,
gpointer data);
static void copy_named_buffer_callback (GtkWidget *widget,
const gchar *name,
gpointer data);
/* public functions */
......@@ -288,8 +288,8 @@ cut_named_buffer_callback (GtkWidget *widget,
gchar *name,
gpointer data)
{
GimpBuffer *cut_buffer;
GimpImage *gimage;
const GimpBuffer *cut_buffer;
GimpImage *gimage;
gimage = (GimpImage *) data;
......@@ -313,12 +313,12 @@ cut_named_buffer_callback (GtkWidget *widget,
}
static void
copy_named_buffer_callback (GtkWidget *widget,
gchar *name,
gpointer data)
copy_named_buffer_callback (GtkWidget *widget,
const gchar *name,
gpointer data)
{
GimpBuffer *copy_buffer;
GimpImage *gimage;
const GimpBuffer *copy_buffer;
GimpImage *gimage;
gimage = (GimpImage *) data;
......
......@@ -84,12 +84,12 @@
/* local function prototypes */
static void file_new_template_callback (GtkWidget *widget,
gchar *name,
gpointer data);
static void file_revert_confirm_callback (GtkWidget *widget,
gboolean revert,
gpointer data);
static void file_new_template_callback (GtkWidget *widget,
const gchar *name,
gpointer data);
static void file_revert_confirm_callback (GtkWidget *widget,
gboolean revert,
gpointer data);
/* public functions */
......@@ -391,9 +391,9 @@ file_file_open_dialog (Gimp *gimp,
/* private functions */
static void
file_new_template_callback (GtkWidget *widget,
gchar *name,
gpointer data)
file_new_template_callback (GtkWidget *widget,
const gchar *name,
gpointer data)
{
GimpTemplate *template;
GimpImage *gimage;
......
......@@ -43,7 +43,7 @@
static void palettes_merge_palettes_query (GimpContainerEditor *editor);
static void palettes_merge_palettes_callback (GtkWidget *widget,
gchar *palette_name,
const gchar *palette_name,
gpointer data);
......@@ -91,9 +91,9 @@ palettes_merge_palettes_query (GimpContainerEditor *editor)
}
static void
palettes_merge_palettes_callback (GtkWidget *widget,
gchar *palette_name,
gpointer data)
palettes_merge_palettes_callback (GtkWidget *widget,
const gchar *palette_name,
gpointer data)
{
#ifdef __GNUC__
#warning FIXME: reimplement palettes_merge_palettes_callback()
......
......@@ -2,15 +2,15 @@
* Copyright (C) 1995-1997 Peter Mattis and Spencer Kimball
*
* gimpquerybox.c
* Copyright (C) 1999-2000 Michael Natterer <mitch@gimp.org>
* Copyright (C) 1999-2000 Michael Natterer <mitch@gimp.org>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
......@@ -531,13 +531,13 @@ static void
string_query_box_ok_callback (GtkWidget *widget,
gpointer data)
{
QueryBox *query_box;
gchar *string;
QueryBox *query_box;
const gchar *string;
query_box = query_box_disconnect (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 */
(* (GimpQueryStringCallback) query_box->callback) (query_box->qbox,
......
/* LIBGIMP - The GIMP Library
/* LIBGIMP - The GIMP Library
* Copyright (C) 1995-1997 Peter Mattis and Spencer Kimball
*
* gimpquerybox.h
* Copyright (C) 1999-2000 Michael Natterer <mitch@gimp.org>
*
* Copyright (C) 1999-2000 Michael Natterer <mitch@gimp.org>
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
* License as published by the Free Software Foundation; either
* version 2 of the License, or (at your option) any later version.
*
*
* This library is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
* Lesser General Public License for more details.
*
......@@ -18,7 +18,7 @@
* License along with this library; if not, write to the
* Free Software Foundation, Inc., 59 Temple Place - Suite 330,
* Boston, MA 02111-1307, USA.
*/
*/
#ifndef __GIMP_QUERY_BOX_H__
#define __GIMP_QUERY_BOX_H__
......@@ -29,26 +29,26 @@ G_BEGIN_DECLS
/* query box callback prototypes */
typedef void (* GimpQueryStringCallback) (GtkWidget *query_box,
gchar *string,
gpointer data);
typedef void (* GimpQueryIntCallback) (GtkWidget *query_box,
gint value,
gpointer data);
typedef void (* GimpQueryDoubleCallback) (GtkWidget *query_box,
gdouble value,
gpointer data);
typedef void (* GimpQuerySizeCallback) (GtkWidget *query_box,
gdouble size,
GimpUnit unit,
gpointer data);
typedef void (* GimpQueryBooleanCallback) (GtkWidget *query_box,
gboolean value,
gpointer data);
typedef void (* GimpQueryStringCallback) (GtkWidget *query_box,
const gchar *string,
gpointer data);
typedef void (* GimpQueryIntCallback) (GtkWidget *query_box,
gint value,
gpointer data);
typedef void (* GimpQueryDoubleCallback) (GtkWidget *query_box,
gdouble value,
gpointer data);
typedef void (* GimpQuerySizeCallback) (GtkWidget *query_box,
gdouble size,
GimpUnit unit,
gpointer data);
typedef void (* GimpQueryBooleanCallback) (GtkWidget *query_box,
gboolean value,
gpointer data);
#define GIMP_QUERY_BOX_VBOX(qbox) g_object_get_data (G_OBJECT (qbox), \
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment