mirror of https://github.com/GNOME/gimp.git
parent
f0fdd64fd3
commit
aa2358fb26
|
@ -1,3 +1,12 @@
|
|||
Thu Nov 4 00:59:01 MET 1999 Sven Neumann <sven.gimp.org>
|
||||
|
||||
* app/file_new_dialog.c
|
||||
* app/gimpbrush.c
|
||||
* app/gimpbrushpipe.c
|
||||
* app/gimprc.c
|
||||
* app/patterns.c
|
||||
* app/patterns.h: plugged mem-leaks
|
||||
|
||||
Wed Nov 3 22:36:21 GMT 1999 Austin Donnelly <austin@gimp.org>
|
||||
|
||||
* app/text_tool.c: tag text undo group with TEXT_UNDO rather than
|
||||
|
|
|
@ -149,7 +149,8 @@ gimp_brush_get_name (GimpBrush *brush)
|
|||
}
|
||||
|
||||
void
|
||||
gimp_brush_set_name (GimpBrush *brush, char *name)
|
||||
gimp_brush_set_name (GimpBrush *brush,
|
||||
char *name)
|
||||
{
|
||||
g_return_if_fail(GIMP_IS_BRUSH(brush));
|
||||
if (strcmp(brush->name, name) == 0)
|
||||
|
@ -180,7 +181,8 @@ gimp_brush_set_spacing (GimpBrush *brush,
|
|||
}
|
||||
|
||||
void
|
||||
gimp_brush_load(GimpBrush *brush, char *filename)
|
||||
gimp_brush_load (GimpBrush *brush,
|
||||
char *filename)
|
||||
{
|
||||
FILE * fp;
|
||||
|
||||
|
@ -205,7 +207,9 @@ gimp_brush_load(GimpBrush *brush, char *filename)
|
|||
|
||||
|
||||
int
|
||||
gimp_brush_load_brush(GimpBrush *brush, FILE* fp, char* filename)
|
||||
gimp_brush_load_brush (GimpBrush *brush,
|
||||
FILE *fp,
|
||||
char *filename)
|
||||
{
|
||||
int bn_size;
|
||||
unsigned char buf [sz_BrushHeader];
|
||||
|
|
|
@ -149,7 +149,8 @@ gimp_brush_get_name (GimpBrush *brush)
|
|||
}
|
||||
|
||||
void
|
||||
gimp_brush_set_name (GimpBrush *brush, char *name)
|
||||
gimp_brush_set_name (GimpBrush *brush,
|
||||
char *name)
|
||||
{
|
||||
g_return_if_fail(GIMP_IS_BRUSH(brush));
|
||||
if (strcmp(brush->name, name) == 0)
|
||||
|
@ -180,7 +181,8 @@ gimp_brush_set_spacing (GimpBrush *brush,
|
|||
}
|
||||
|
||||
void
|
||||
gimp_brush_load(GimpBrush *brush, char *filename)
|
||||
gimp_brush_load (GimpBrush *brush,
|
||||
char *filename)
|
||||
{
|
||||
FILE * fp;
|
||||
|
||||
|
@ -205,7 +207,9 @@ gimp_brush_load(GimpBrush *brush, char *filename)
|
|||
|
||||
|
||||
int
|
||||
gimp_brush_load_brush(GimpBrush *brush, FILE* fp, char* filename)
|
||||
gimp_brush_load_brush (GimpBrush *brush,
|
||||
FILE *fp,
|
||||
char *filename)
|
||||
{
|
||||
int bn_size;
|
||||
unsigned char buf [sz_BrushHeader];
|
||||
|
|
|
@ -370,10 +370,7 @@ gimp_brush_pipe_load (char *filename)
|
|||
}
|
||||
g_assert (pipe->stride[pipe->dimension-1] == 1);
|
||||
|
||||
pattern = (GPatternP) g_malloc (sizeof (GPattern));
|
||||
pattern->filename = NULL;
|
||||
pattern->name = NULL;
|
||||
pattern->mask = NULL;
|
||||
pattern = (GPattern*) g_malloc0 (sizeof (GPattern));
|
||||
|
||||
pipe->brushes =
|
||||
(GimpBrushPixmap **) g_new0 (GimpBrushPixmap *, num_of_brushes);
|
||||
|
@ -390,6 +387,7 @@ gimp_brush_pipe_load (char *filename)
|
|||
{
|
||||
pipe->brushes[pipe->nbrushes] =
|
||||
GIMP_BRUSH_PIXMAP (gimp_type_new (GIMP_TYPE_BRUSH_PIXMAP));
|
||||
g_free (GIMP_BRUSH (pipe->brushes[pipe->nbrushes])->name);
|
||||
GIMP_BRUSH (pipe->brushes[pipe->nbrushes])->name = NULL;
|
||||
}
|
||||
|
||||
|
@ -402,7 +400,7 @@ gimp_brush_pipe_load (char *filename)
|
|||
{
|
||||
g_message (_("failed to load one of the pixmap brushes in the pipe"));
|
||||
fclose (fp);
|
||||
g_free (pattern);
|
||||
pattern_free (pattern);
|
||||
gimp_object_destroy (pipe);
|
||||
return NULL;
|
||||
}
|
||||
|
@ -410,10 +408,11 @@ gimp_brush_pipe_load (char *filename)
|
|||
if (pipe->nbrushes == 0)
|
||||
{
|
||||
/* Replace name with the whole pipe's name */
|
||||
g_free (GIMP_BRUSH (pipe)->name);
|
||||
GIMP_BRUSH (pipe)->name = name;
|
||||
}
|
||||
pipe->brushes[pipe->nbrushes]->pixmap_mask = pattern->mask;
|
||||
|
||||
g_free (pattern->name);
|
||||
pipe->nbrushes++;
|
||||
}
|
||||
|
||||
|
@ -445,10 +444,7 @@ gimp_brush_pixmap_load (char *filename)
|
|||
pipe->index = g_new (int, 1);
|
||||
pipe->index[0] = 0;
|
||||
|
||||
pattern = (GPatternP) g_malloc (sizeof (GPattern));
|
||||
pattern->filename = NULL;
|
||||
pattern->name = NULL;
|
||||
pattern->mask = NULL;
|
||||
pattern = (GPatternP) g_malloc0 (sizeof (GPattern));
|
||||
|
||||
pipe->brushes = (GimpBrushPixmap **) g_new (GimpBrushPixmap *, 1);
|
||||
|
||||
|
@ -464,7 +460,7 @@ gimp_brush_pixmap_load (char *filename)
|
|||
{
|
||||
g_message (_("failed to load pixmap brush"));
|
||||
fclose (fp);
|
||||
g_free (pattern);
|
||||
pattern_free (pattern);
|
||||
gimp_object_destroy (pipe);
|
||||
return NULL;
|
||||
}
|
||||
|
@ -475,7 +471,8 @@ gimp_brush_pixmap_load (char *filename)
|
|||
/* Clean up */
|
||||
fclose (fp);
|
||||
|
||||
g_free(pattern);
|
||||
g_free (pattern->name);
|
||||
g_free (pattern);
|
||||
return pipe;
|
||||
}
|
||||
|
||||
|
|
|
@ -370,10 +370,7 @@ gimp_brush_pipe_load (char *filename)
|
|||
}
|
||||
g_assert (pipe->stride[pipe->dimension-1] == 1);
|
||||
|
||||
pattern = (GPatternP) g_malloc (sizeof (GPattern));
|
||||
pattern->filename = NULL;
|
||||
pattern->name = NULL;
|
||||
pattern->mask = NULL;
|
||||
pattern = (GPattern*) g_malloc0 (sizeof (GPattern));
|
||||
|
||||
pipe->brushes =
|
||||
(GimpBrushPixmap **) g_new0 (GimpBrushPixmap *, num_of_brushes);
|
||||
|
@ -390,6 +387,7 @@ gimp_brush_pipe_load (char *filename)
|
|||
{
|
||||
pipe->brushes[pipe->nbrushes] =
|
||||
GIMP_BRUSH_PIXMAP (gimp_type_new (GIMP_TYPE_BRUSH_PIXMAP));
|
||||
g_free (GIMP_BRUSH (pipe->brushes[pipe->nbrushes])->name);
|
||||
GIMP_BRUSH (pipe->brushes[pipe->nbrushes])->name = NULL;
|
||||
}
|
||||
|
||||
|
@ -402,7 +400,7 @@ gimp_brush_pipe_load (char *filename)
|
|||
{
|
||||
g_message (_("failed to load one of the pixmap brushes in the pipe"));
|
||||
fclose (fp);
|
||||
g_free (pattern);
|
||||
pattern_free (pattern);
|
||||
gimp_object_destroy (pipe);
|
||||
return NULL;
|
||||
}
|
||||
|
@ -410,10 +408,11 @@ gimp_brush_pipe_load (char *filename)
|
|||
if (pipe->nbrushes == 0)
|
||||
{
|
||||
/* Replace name with the whole pipe's name */
|
||||
g_free (GIMP_BRUSH (pipe)->name);
|
||||
GIMP_BRUSH (pipe)->name = name;
|
||||
}
|
||||
pipe->brushes[pipe->nbrushes]->pixmap_mask = pattern->mask;
|
||||
|
||||
g_free (pattern->name);
|
||||
pipe->nbrushes++;
|
||||
}
|
||||
|
||||
|
@ -445,10 +444,7 @@ gimp_brush_pixmap_load (char *filename)
|
|||
pipe->index = g_new (int, 1);
|
||||
pipe->index[0] = 0;
|
||||
|
||||
pattern = (GPatternP) g_malloc (sizeof (GPattern));
|
||||
pattern->filename = NULL;
|
||||
pattern->name = NULL;
|
||||
pattern->mask = NULL;
|
||||
pattern = (GPatternP) g_malloc0 (sizeof (GPattern));
|
||||
|
||||
pipe->brushes = (GimpBrushPixmap **) g_new (GimpBrushPixmap *, 1);
|
||||
|
||||
|
@ -464,7 +460,7 @@ gimp_brush_pixmap_load (char *filename)
|
|||
{
|
||||
g_message (_("failed to load pixmap brush"));
|
||||
fclose (fp);
|
||||
g_free (pattern);
|
||||
pattern_free (pattern);
|
||||
gimp_object_destroy (pipe);
|
||||
return NULL;
|
||||
}
|
||||
|
@ -475,7 +471,8 @@ gimp_brush_pixmap_load (char *filename)
|
|||
/* Clean up */
|
||||
fclose (fp);
|
||||
|
||||
g_free(pattern);
|
||||
g_free (pattern->name);
|
||||
g_free (pattern);
|
||||
return pipe;
|
||||
}
|
||||
|
||||
|
|
|
@ -91,6 +91,7 @@ file_new_ok_callback (GtkWidget *widget,
|
|||
gtk_widget_destroy (info->dlg);
|
||||
image_new_create_image (values);
|
||||
image_new_values_free (values);
|
||||
g_free (info);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -159,6 +160,8 @@ file_new_confirm_dialog_ok_callback (GtkWidget *widget,
|
|||
gtk_widget_destroy (info->confirm_dlg);
|
||||
gtk_widget_destroy (info->dlg);
|
||||
image_new_create_image (info->values);
|
||||
image_new_values_free (info->values);
|
||||
g_free (info);
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
|
@ -91,6 +91,7 @@ file_new_ok_callback (GtkWidget *widget,
|
|||
gtk_widget_destroy (info->dlg);
|
||||
image_new_create_image (values);
|
||||
image_new_values_free (values);
|
||||
g_free (info);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -159,6 +160,8 @@ file_new_confirm_dialog_ok_callback (GtkWidget *widget,
|
|||
gtk_widget_destroy (info->confirm_dlg);
|
||||
gtk_widget_destroy (info->dlg);
|
||||
image_new_create_image (info->values);
|
||||
image_new_values_free (info->values);
|
||||
g_free (info);
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
|
@ -149,7 +149,8 @@ gimp_brush_get_name (GimpBrush *brush)
|
|||
}
|
||||
|
||||
void
|
||||
gimp_brush_set_name (GimpBrush *brush, char *name)
|
||||
gimp_brush_set_name (GimpBrush *brush,
|
||||
char *name)
|
||||
{
|
||||
g_return_if_fail(GIMP_IS_BRUSH(brush));
|
||||
if (strcmp(brush->name, name) == 0)
|
||||
|
@ -180,7 +181,8 @@ gimp_brush_set_spacing (GimpBrush *brush,
|
|||
}
|
||||
|
||||
void
|
||||
gimp_brush_load(GimpBrush *brush, char *filename)
|
||||
gimp_brush_load (GimpBrush *brush,
|
||||
char *filename)
|
||||
{
|
||||
FILE * fp;
|
||||
|
||||
|
@ -205,7 +207,9 @@ gimp_brush_load(GimpBrush *brush, char *filename)
|
|||
|
||||
|
||||
int
|
||||
gimp_brush_load_brush(GimpBrush *brush, FILE* fp, char* filename)
|
||||
gimp_brush_load_brush (GimpBrush *brush,
|
||||
FILE *fp,
|
||||
char *filename)
|
||||
{
|
||||
int bn_size;
|
||||
unsigned char buf [sz_BrushHeader];
|
||||
|
|
|
@ -370,10 +370,7 @@ gimp_brush_pipe_load (char *filename)
|
|||
}
|
||||
g_assert (pipe->stride[pipe->dimension-1] == 1);
|
||||
|
||||
pattern = (GPatternP) g_malloc (sizeof (GPattern));
|
||||
pattern->filename = NULL;
|
||||
pattern->name = NULL;
|
||||
pattern->mask = NULL;
|
||||
pattern = (GPattern*) g_malloc0 (sizeof (GPattern));
|
||||
|
||||
pipe->brushes =
|
||||
(GimpBrushPixmap **) g_new0 (GimpBrushPixmap *, num_of_brushes);
|
||||
|
@ -390,6 +387,7 @@ gimp_brush_pipe_load (char *filename)
|
|||
{
|
||||
pipe->brushes[pipe->nbrushes] =
|
||||
GIMP_BRUSH_PIXMAP (gimp_type_new (GIMP_TYPE_BRUSH_PIXMAP));
|
||||
g_free (GIMP_BRUSH (pipe->brushes[pipe->nbrushes])->name);
|
||||
GIMP_BRUSH (pipe->brushes[pipe->nbrushes])->name = NULL;
|
||||
}
|
||||
|
||||
|
@ -402,7 +400,7 @@ gimp_brush_pipe_load (char *filename)
|
|||
{
|
||||
g_message (_("failed to load one of the pixmap brushes in the pipe"));
|
||||
fclose (fp);
|
||||
g_free (pattern);
|
||||
pattern_free (pattern);
|
||||
gimp_object_destroy (pipe);
|
||||
return NULL;
|
||||
}
|
||||
|
@ -410,10 +408,11 @@ gimp_brush_pipe_load (char *filename)
|
|||
if (pipe->nbrushes == 0)
|
||||
{
|
||||
/* Replace name with the whole pipe's name */
|
||||
g_free (GIMP_BRUSH (pipe)->name);
|
||||
GIMP_BRUSH (pipe)->name = name;
|
||||
}
|
||||
pipe->brushes[pipe->nbrushes]->pixmap_mask = pattern->mask;
|
||||
|
||||
g_free (pattern->name);
|
||||
pipe->nbrushes++;
|
||||
}
|
||||
|
||||
|
@ -445,10 +444,7 @@ gimp_brush_pixmap_load (char *filename)
|
|||
pipe->index = g_new (int, 1);
|
||||
pipe->index[0] = 0;
|
||||
|
||||
pattern = (GPatternP) g_malloc (sizeof (GPattern));
|
||||
pattern->filename = NULL;
|
||||
pattern->name = NULL;
|
||||
pattern->mask = NULL;
|
||||
pattern = (GPatternP) g_malloc0 (sizeof (GPattern));
|
||||
|
||||
pipe->brushes = (GimpBrushPixmap **) g_new (GimpBrushPixmap *, 1);
|
||||
|
||||
|
@ -464,7 +460,7 @@ gimp_brush_pixmap_load (char *filename)
|
|||
{
|
||||
g_message (_("failed to load pixmap brush"));
|
||||
fclose (fp);
|
||||
g_free (pattern);
|
||||
pattern_free (pattern);
|
||||
gimp_object_destroy (pipe);
|
||||
return NULL;
|
||||
}
|
||||
|
@ -475,7 +471,8 @@ gimp_brush_pixmap_load (char *filename)
|
|||
/* Clean up */
|
||||
fclose (fp);
|
||||
|
||||
g_free(pattern);
|
||||
g_free (pattern->name);
|
||||
g_free (pattern);
|
||||
return pipe;
|
||||
}
|
||||
|
||||
|
|
|
@ -373,7 +373,8 @@ parse_gimprc (void)
|
|||
{
|
||||
char libfilename[MAXPATHLEN];
|
||||
char filename[MAXPATHLEN];
|
||||
|
||||
gchar *personal_gimprc;
|
||||
|
||||
parse_add_directory_tokens ();
|
||||
|
||||
strcpy (libfilename, gimp_system_rc_file ());
|
||||
|
@ -385,7 +386,11 @@ parse_gimprc (void)
|
|||
if (alternate_gimprc != NULL)
|
||||
strncpy (filename, alternate_gimprc, MAXPATHLEN);
|
||||
else
|
||||
strncpy (filename, gimp_personal_rc_file ("gimprc"), MAXPATHLEN);
|
||||
{
|
||||
personal_gimprc = gimp_personal_rc_file ("gimprc");
|
||||
strncpy (filename, personal_gimprc, MAXPATHLEN);
|
||||
g_free (personal_gimprc);
|
||||
}
|
||||
|
||||
if (filename[0] != '\0' && strcmp (filename, libfilename) != 0)
|
||||
{
|
||||
|
|
|
@ -91,6 +91,7 @@ file_new_ok_callback (GtkWidget *widget,
|
|||
gtk_widget_destroy (info->dlg);
|
||||
image_new_create_image (values);
|
||||
image_new_values_free (values);
|
||||
g_free (info);
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -159,6 +160,8 @@ file_new_confirm_dialog_ok_callback (GtkWidget *widget,
|
|||
gtk_widget_destroy (info->confirm_dlg);
|
||||
gtk_widget_destroy (info->dlg);
|
||||
image_new_create_image (info->values);
|
||||
image_new_values_free (info->values);
|
||||
g_free (info);
|
||||
}
|
||||
|
||||
static void
|
||||
|
|
|
@ -52,8 +52,7 @@ static GPattern *standard_pattern = NULL;
|
|||
/* static function prototypes */
|
||||
static GSList * insert_pattern_in_list (GSList *, GPattern *);
|
||||
static void load_pattern (gchar *);
|
||||
static void free_pattern (GPattern *);
|
||||
static void pattern_free (gpointer, gpointer);
|
||||
static void pattern_free_func (gpointer, gpointer);
|
||||
static gint pattern_compare_func (gconstpointer,
|
||||
gconstpointer);
|
||||
|
||||
|
@ -85,7 +84,7 @@ patterns_free ()
|
|||
{
|
||||
if (pattern_list)
|
||||
{
|
||||
g_slist_foreach (pattern_list, pattern_free, NULL);
|
||||
g_slist_foreach (pattern_list, pattern_free_func, NULL);
|
||||
g_slist_free (pattern_list);
|
||||
}
|
||||
|
||||
|
@ -154,7 +153,7 @@ pattern_load (GPattern *pattern,
|
|||
if ((fread (buf, 1, sz_PatternHeader, fp)) < sz_PatternHeader)
|
||||
{
|
||||
fclose (fp);
|
||||
free_pattern (pattern);
|
||||
pattern_free (pattern);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
@ -171,7 +170,7 @@ pattern_load (GPattern *pattern,
|
|||
if (header.version != 1)
|
||||
{
|
||||
fclose (fp);
|
||||
free_pattern (pattern);
|
||||
pattern_free (pattern);
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
@ -181,7 +180,7 @@ pattern_load (GPattern *pattern,
|
|||
g_message (_("Unknown GIMP version #%d in \"%s\"\n"), header.version,
|
||||
filename);
|
||||
fclose (fp);
|
||||
free_pattern (pattern);
|
||||
pattern_free (pattern);
|
||||
return FALSE;
|
||||
}
|
||||
|
||||
|
@ -197,7 +196,7 @@ pattern_load (GPattern *pattern,
|
|||
{
|
||||
g_message (_("Error in GIMP pattern file...aborting."));
|
||||
fclose (fp);
|
||||
free_pattern (pattern);
|
||||
pattern_free (pattern);
|
||||
return FALSE;
|
||||
}
|
||||
}
|
||||
|
@ -215,13 +214,26 @@ pattern_load (GPattern *pattern,
|
|||
return TRUE;
|
||||
}
|
||||
|
||||
void
|
||||
pattern_free (GPattern *pattern)
|
||||
{
|
||||
if (pattern->mask)
|
||||
temp_buf_free (pattern->mask);
|
||||
if (pattern->filename)
|
||||
g_free (pattern->filename);
|
||||
if (pattern->name)
|
||||
g_free (pattern->name);
|
||||
|
||||
g_free (pattern);
|
||||
}
|
||||
|
||||
/* private functions */
|
||||
|
||||
static void
|
||||
pattern_free (gpointer data,
|
||||
gpointer dummy)
|
||||
pattern_free_func (gpointer data,
|
||||
gpointer dummy)
|
||||
{
|
||||
free_pattern ((GPattern *) data);
|
||||
pattern_free ((GPattern *) data);
|
||||
}
|
||||
|
||||
static gint
|
||||
|
@ -254,7 +266,7 @@ load_pattern (gchar *filename)
|
|||
/* Open the requested file */
|
||||
if (! (fp = fopen (filename, "rb")))
|
||||
{
|
||||
free_pattern (pattern);
|
||||
pattern_free (pattern);
|
||||
return;
|
||||
}
|
||||
|
||||
|
@ -271,16 +283,3 @@ load_pattern (gchar *filename)
|
|||
|
||||
pattern_list = insert_pattern_in_list (pattern_list, pattern);
|
||||
}
|
||||
|
||||
static void
|
||||
free_pattern (GPattern *pattern)
|
||||
{
|
||||
if (pattern->mask)
|
||||
temp_buf_free (pattern->mask);
|
||||
if (pattern->filename)
|
||||
g_free (pattern->filename);
|
||||
if (pattern->name)
|
||||
g_free (pattern->name);
|
||||
|
||||
g_free (pattern);
|
||||
}
|
||||
|
|
|
@ -50,5 +50,6 @@ GPattern * pattern_list_get_pattern (GSList *list,
|
|||
gboolean pattern_load (GPattern *pattern,
|
||||
FILE *fp,
|
||||
gchar *filename);
|
||||
void pattern_free (GPattern *pattern);
|
||||
|
||||
#endif /* __PATTERNS_H__ */
|
||||
|
|
Loading…
Reference in New Issue