mirror of
https://gitlab.gnome.org/GNOME/gimp
synced 2024-10-19 22:34:37 +00:00
don't choke on brush files with empty names (bug #343140).
2006-05-29 Sven Neumann <sven@gimp.org> * app/core/gimpbrushgenerated.c (gimp_brush_generated_load): don't choke on brush files with empty names (bug #343140). (gimp_brush_generated_save): warn about brushes with empty names.
This commit is contained in:
parent
ae0cfe3dc0
commit
6ce6160966
|
@ -1,7 +1,13 @@
|
|||
2006-05-29 Sven Neumann <sven@gimp.org>
|
||||
|
||||
* app/core/gimpbrushgenerated.c (gimp_brush_generated_load): don't
|
||||
choke on brush files with empty names (bug #343140).
|
||||
(gimp_brush_generated_save): warn about brushes with empty names.
|
||||
|
||||
2006-05-29 Michael Natterer <mitch@gimp.org>
|
||||
|
||||
* app/widgets/gimpdock.c (gimp_dock_key_press_event): make sure
|
||||
text widgets get all key events first. Fixes bug #301006.
|
||||
that text widgets get all key events first. Fixes bug #301006.
|
||||
|
||||
2006-05-29 Sven Neumann <sven@gimp.org>
|
||||
|
||||
|
|
|
@ -211,10 +211,13 @@ gimp_brush_generated_save (GimpData *data,
|
|||
GError **error)
|
||||
{
|
||||
GimpBrushGenerated *brush = GIMP_BRUSH_GENERATED (data);
|
||||
const gchar *name = gimp_object_get_name (GIMP_OBJECT (data));
|
||||
FILE *file;
|
||||
gchar buf[G_ASCII_DTOSTR_BUF_SIZE];
|
||||
gboolean have_shape = FALSE;
|
||||
|
||||
g_return_val_if_fail (name != NULL && *name != '\0', FALSE);
|
||||
|
||||
file = g_fopen (data->filename, "wb");
|
||||
|
||||
if (! file)
|
||||
|
@ -241,7 +244,7 @@ gimp_brush_generated_save (GimpData *data,
|
|||
}
|
||||
|
||||
/* write name */
|
||||
fprintf (file, "%.255s\n", GIMP_OBJECT (brush)->name);
|
||||
fprintf (file, "%.255s\n", name);
|
||||
|
||||
if (have_shape)
|
||||
{
|
||||
|
@ -602,6 +605,11 @@ gimp_brush_generated_load (const gchar *filename,
|
|||
goto failed;
|
||||
|
||||
g_strstrip (string);
|
||||
|
||||
/* the empty string is not an allowed name */
|
||||
if (strlen (string) < 1)
|
||||
g_strlcpy (string, _("Untitled"), sizeof (string));
|
||||
|
||||
name = gimp_any_to_utf8 (string, -1,
|
||||
_("Invalid UTF-8 string in brush file '%s'."),
|
||||
gimp_filename_to_utf8 (filename));
|
||||
|
|
|
@ -211,10 +211,13 @@ gimp_brush_generated_save (GimpData *data,
|
|||
GError **error)
|
||||
{
|
||||
GimpBrushGenerated *brush = GIMP_BRUSH_GENERATED (data);
|
||||
const gchar *name = gimp_object_get_name (GIMP_OBJECT (data));
|
||||
FILE *file;
|
||||
gchar buf[G_ASCII_DTOSTR_BUF_SIZE];
|
||||
gboolean have_shape = FALSE;
|
||||
|
||||
g_return_val_if_fail (name != NULL && *name != '\0', FALSE);
|
||||
|
||||
file = g_fopen (data->filename, "wb");
|
||||
|
||||
if (! file)
|
||||
|
@ -241,7 +244,7 @@ gimp_brush_generated_save (GimpData *data,
|
|||
}
|
||||
|
||||
/* write name */
|
||||
fprintf (file, "%.255s\n", GIMP_OBJECT (brush)->name);
|
||||
fprintf (file, "%.255s\n", name);
|
||||
|
||||
if (have_shape)
|
||||
{
|
||||
|
@ -602,6 +605,11 @@ gimp_brush_generated_load (const gchar *filename,
|
|||
goto failed;
|
||||
|
||||
g_strstrip (string);
|
||||
|
||||
/* the empty string is not an allowed name */
|
||||
if (strlen (string) < 1)
|
||||
g_strlcpy (string, _("Untitled"), sizeof (string));
|
||||
|
||||
name = gimp_any_to_utf8 (string, -1,
|
||||
_("Invalid UTF-8 string in brush file '%s'."),
|
||||
gimp_filename_to_utf8 (filename));
|
||||
|
|
|
@ -211,10 +211,13 @@ gimp_brush_generated_save (GimpData *data,
|
|||
GError **error)
|
||||
{
|
||||
GimpBrushGenerated *brush = GIMP_BRUSH_GENERATED (data);
|
||||
const gchar *name = gimp_object_get_name (GIMP_OBJECT (data));
|
||||
FILE *file;
|
||||
gchar buf[G_ASCII_DTOSTR_BUF_SIZE];
|
||||
gboolean have_shape = FALSE;
|
||||
|
||||
g_return_val_if_fail (name != NULL && *name != '\0', FALSE);
|
||||
|
||||
file = g_fopen (data->filename, "wb");
|
||||
|
||||
if (! file)
|
||||
|
@ -241,7 +244,7 @@ gimp_brush_generated_save (GimpData *data,
|
|||
}
|
||||
|
||||
/* write name */
|
||||
fprintf (file, "%.255s\n", GIMP_OBJECT (brush)->name);
|
||||
fprintf (file, "%.255s\n", name);
|
||||
|
||||
if (have_shape)
|
||||
{
|
||||
|
@ -602,6 +605,11 @@ gimp_brush_generated_load (const gchar *filename,
|
|||
goto failed;
|
||||
|
||||
g_strstrip (string);
|
||||
|
||||
/* the empty string is not an allowed name */
|
||||
if (strlen (string) < 1)
|
||||
g_strlcpy (string, _("Untitled"), sizeof (string));
|
||||
|
||||
name = gimp_any_to_utf8 (string, -1,
|
||||
_("Invalid UTF-8 string in brush file '%s'."),
|
||||
gimp_filename_to_utf8 (filename));
|
||||
|
|
Loading…
Reference in a new issue