Commit 140d3d5c authored by Michael Natterer's avatar Michael Natterer 😴 Committed by Michael Natterer

reordered parameters and members to be consistent with other places where

2004-06-25  Michael Natterer  <mitch@gimp.org>

	* app/core/gimpbrushgenerated.[ch]: reordered parameters and
	members to be consistent with other places where generated
	brushes are used. Check for errors when loading a brush and
	utf8-validate its name. Cleanup.

	* app/core/gimpbrush.c
	* app/core/gimpbrushpipe.c: cleanup.
parent 397626fc
2004-06-25 Michael Natterer <mitch@gimp.org>
* app/core/gimpbrushgenerated.[ch]: reordered parameters and
members to be consistent with other places where generated
brushes are used. Check for errors when loading a brush and
utf8-validate its name. Cleanup.
* app/core/gimpbrush.c
* app/core/gimpbrushpipe.c: cleanup.
2004-06-25 Michael Natterer <mitch@gimp.org>
* app/gui/preferences-dialog.c (prefs_dialog_new): work around
......
......@@ -108,19 +108,19 @@ gimp_brush_get_type (void)
static const GTypeInfo brush_info =
{
sizeof (GimpBrushClass),
(GBaseInitFunc) NULL,
(GBaseFinalizeFunc) NULL,
(GClassInitFunc) gimp_brush_class_init,
NULL, /* class_finalize */
NULL, /* class_data */
sizeof (GimpBrush),
0, /* n_preallocs */
(GInstanceInitFunc) gimp_brush_init,
(GBaseInitFunc) NULL,
(GBaseFinalizeFunc) NULL,
(GClassInitFunc) gimp_brush_class_init,
NULL, /* class_finalize */
NULL, /* class_data */
sizeof (GimpBrush),
0, /* n_preallocs */
(GInstanceInitFunc) gimp_brush_init,
};
brush_type = g_type_register_static (GIMP_TYPE_DATA,
"GimpBrush",
&brush_info, 0);
"GimpBrush",
&brush_info, 0);
}
return brush_type;
......@@ -129,26 +129,21 @@ gimp_brush_get_type (void)
static void
gimp_brush_class_init (GimpBrushClass *klass)
{
GObjectClass *object_class;
GimpObjectClass *gimp_object_class;
GimpViewableClass *viewable_class;
GimpDataClass *data_class;
object_class = G_OBJECT_CLASS (klass);
gimp_object_class = GIMP_OBJECT_CLASS (klass);
viewable_class = GIMP_VIEWABLE_CLASS (klass);
data_class = GIMP_DATA_CLASS (klass);
GObjectClass *object_class = G_OBJECT_CLASS (klass);
GimpObjectClass *gimp_object_class = GIMP_OBJECT_CLASS (klass);
GimpViewableClass *viewable_class = GIMP_VIEWABLE_CLASS (klass);
GimpDataClass *data_class = GIMP_DATA_CLASS (klass);
parent_class = g_type_class_peek_parent (klass);
brush_signals[SPACING_CHANGED] =
g_signal_new ("spacing_changed",
G_TYPE_FROM_CLASS (klass),
G_SIGNAL_RUN_FIRST,
G_STRUCT_OFFSET (GimpBrushClass, spacing_changed),
NULL, NULL,
gimp_marshal_VOID__VOID,
G_TYPE_NONE, 0);
G_TYPE_FROM_CLASS (klass),
G_SIGNAL_RUN_FIRST,
G_STRUCT_OFFSET (GimpBrushClass, spacing_changed),
NULL, NULL,
gimp_marshal_VOID__VOID,
G_TYPE_NONE, 0);
object_class->finalize = gimp_brush_finalize;
......@@ -239,8 +234,8 @@ gimp_brush_get_popup_size (GimpViewable *viewable,
static TempBuf *
gimp_brush_get_new_preview (GimpViewable *viewable,
gint width,
gint height)
gint width,
gint height)
{
GimpBrush *brush = GIMP_BRUSH (viewable);
gint brush_width;
......@@ -354,7 +349,7 @@ gimp_brush_new (const gchar *name,
{
g_return_val_if_fail (name != NULL, NULL);
return gimp_brush_generated_new (name, 5.0, 0.5, 0.0, 1.0,
return gimp_brush_generated_new (name, 5.0, 0.5, 1.0, 0.0,
stingy_memory_use);
}
......@@ -411,7 +406,7 @@ gimp_brush_load (const gchar *filename,
temp_buf_swap (brush->mask);
if (brush->pixmap)
temp_buf_swap (brush->pixmap);
temp_buf_swap (brush->pixmap);
}
return GIMP_DATA (brush);
......@@ -511,7 +506,7 @@ gimp_brush_spacing_changed (GimpBrush *brush)
GimpBrush *
gimp_brush_load_brush (gint fd,
const gchar *filename,
const gchar *filename,
GError **error)
{
GimpBrush *brush;
......
......@@ -108,19 +108,19 @@ gimp_brush_get_type (void)
static const GTypeInfo brush_info =
{
sizeof (GimpBrushClass),
(GBaseInitFunc) NULL,
(GBaseFinalizeFunc) NULL,
(GClassInitFunc) gimp_brush_class_init,
NULL, /* class_finalize */
NULL, /* class_data */
sizeof (GimpBrush),
0, /* n_preallocs */
(GInstanceInitFunc) gimp_brush_init,
(GBaseInitFunc) NULL,
(GBaseFinalizeFunc) NULL,
(GClassInitFunc) gimp_brush_class_init,
NULL, /* class_finalize */
NULL, /* class_data */
sizeof (GimpBrush),
0, /* n_preallocs */
(GInstanceInitFunc) gimp_brush_init,
};
brush_type = g_type_register_static (GIMP_TYPE_DATA,
"GimpBrush",
&brush_info, 0);
"GimpBrush",
&brush_info, 0);
}
return brush_type;
......@@ -129,26 +129,21 @@ gimp_brush_get_type (void)
static void
gimp_brush_class_init (GimpBrushClass *klass)
{
GObjectClass *object_class;
GimpObjectClass *gimp_object_class;
GimpViewableClass *viewable_class;
GimpDataClass *data_class;
object_class = G_OBJECT_CLASS (klass);
gimp_object_class = GIMP_OBJECT_CLASS (klass);
viewable_class = GIMP_VIEWABLE_CLASS (klass);
data_class = GIMP_DATA_CLASS (klass);
GObjectClass *object_class = G_OBJECT_CLASS (klass);
GimpObjectClass *gimp_object_class = GIMP_OBJECT_CLASS (klass);
GimpViewableClass *viewable_class = GIMP_VIEWABLE_CLASS (klass);
GimpDataClass *data_class = GIMP_DATA_CLASS (klass);
parent_class = g_type_class_peek_parent (klass);
brush_signals[SPACING_CHANGED] =
g_signal_new ("spacing_changed",
G_TYPE_FROM_CLASS (klass),
G_SIGNAL_RUN_FIRST,
G_STRUCT_OFFSET (GimpBrushClass, spacing_changed),
NULL, NULL,
gimp_marshal_VOID__VOID,
G_TYPE_NONE, 0);
G_TYPE_FROM_CLASS (klass),
G_SIGNAL_RUN_FIRST,
G_STRUCT_OFFSET (GimpBrushClass, spacing_changed),
NULL, NULL,
gimp_marshal_VOID__VOID,
G_TYPE_NONE, 0);
object_class->finalize = gimp_brush_finalize;
......@@ -239,8 +234,8 @@ gimp_brush_get_popup_size (GimpViewable *viewable,
static TempBuf *
gimp_brush_get_new_preview (GimpViewable *viewable,
gint width,
gint height)
gint width,
gint height)
{
GimpBrush *brush = GIMP_BRUSH (viewable);
gint brush_width;
......@@ -354,7 +349,7 @@ gimp_brush_new (const gchar *name,
{
g_return_val_if_fail (name != NULL, NULL);
return gimp_brush_generated_new (name, 5.0, 0.5, 0.0, 1.0,
return gimp_brush_generated_new (name, 5.0, 0.5, 1.0, 0.0,
stingy_memory_use);
}
......@@ -411,7 +406,7 @@ gimp_brush_load (const gchar *filename,
temp_buf_swap (brush->mask);
if (brush->pixmap)
temp_buf_swap (brush->pixmap);
temp_buf_swap (brush->pixmap);
}
return GIMP_DATA (brush);
......@@ -511,7 +506,7 @@ gimp_brush_spacing_changed (GimpBrush *brush)
GimpBrush *
gimp_brush_load_brush (gint fd,
const gchar *filename,
const gchar *filename,
GError **error)
{
GimpBrush *brush;
......
......@@ -50,8 +50,8 @@ enum
PROP_0,
PROP_RADIUS,
PROP_HARDNESS,
PROP_ANGLE,
PROP_ASPECT_RATIO
PROP_ASPECT_RATIO,
PROP_ANGLE
};
......@@ -60,11 +60,11 @@ enum
static void gimp_brush_generated_class_init (GimpBrushGeneratedClass *klass);
static void gimp_brush_generated_init (GimpBrushGenerated *brush);
static void gimp_brush_generated_set_property (GObject *object,
static void gimp_brush_generated_set_property (GObject *object,
guint property_id,
const GValue *value,
GParamSpec *pspec);
static void gimp_brush_generated_get_property (GObject *object,
static void gimp_brush_generated_get_property (GObject *object,
guint property_id,
GValue *value,
GParamSpec *pspec);
......@@ -133,17 +133,17 @@ gimp_brush_generated_class_init (GimpBrushGeneratedClass *klass)
0.0, 1.0, 0.0,
G_PARAM_READWRITE |
G_PARAM_CONSTRUCT));
g_object_class_install_property (object_class, PROP_ANGLE,
g_param_spec_double ("angle", NULL, NULL,
0.0, 180.0, 0.0,
G_PARAM_READWRITE |
G_PARAM_CONSTRUCT));
g_object_class_install_property (object_class, PROP_ASPECT_RATIO,
g_param_spec_double ("aspect-ratio",
NULL, NULL,
1.0, 20.0, 1.0,
G_PARAM_READWRITE |
G_PARAM_CONSTRUCT));
g_object_class_install_property (object_class, PROP_ANGLE,
g_param_spec_double ("angle", NULL, NULL,
0.0, 180.0, 0.0,
G_PARAM_READWRITE |
G_PARAM_CONSTRUCT));
}
static void
......@@ -151,8 +151,8 @@ gimp_brush_generated_init (GimpBrushGenerated *brush)
{
brush->radius = 5.0;
brush->hardness = 0.0;
brush->angle = 0.0;
brush->aspect_ratio = 1.0;
brush->angle = 0.0;
}
static void
......@@ -169,13 +169,13 @@ gimp_brush_generated_set_property (GObject *object,
gimp_brush_generated_set_radius (brush, g_value_get_double (value));
break;
case PROP_HARDNESS:
gimp_brush_generated_set_radius (brush, g_value_get_double (value));
break;
case PROP_ANGLE:
gimp_brush_generated_set_radius (brush, g_value_get_double (value));
gimp_brush_generated_set_hardness (brush, g_value_get_double (value));
break;
case PROP_ASPECT_RATIO:
gimp_brush_generated_set_radius (brush, g_value_get_double (value));
gimp_brush_generated_set_aspect_ratio (brush, g_value_get_double (value));
break;
case PROP_ANGLE:
gimp_brush_generated_set_angle (brush, g_value_get_double (value));
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
......@@ -199,12 +199,12 @@ gimp_brush_generated_get_property (GObject *object,
case PROP_HARDNESS:
g_value_set_double (value, brush->hardness);
break;
case PROP_ANGLE:
g_value_set_double (value, brush->angle);
break;
case PROP_ASPECT_RATIO:
g_value_set_double (value, brush->aspect_ratio);
break;
case PROP_ANGLE:
g_value_set_double (value, brush->angle);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
break;
......@@ -284,8 +284,8 @@ gimp_brush_generated_duplicate (GimpData *data,
return gimp_brush_generated_new (GIMP_OBJECT (brush)->name,
brush->radius,
brush->hardness,
brush->angle,
brush->aspect_ratio,
brush->angle,
stingy_memory_use);
}
......@@ -423,8 +423,8 @@ GimpData *
gimp_brush_generated_new (const gchar *name,
gfloat radius,
gfloat hardness,
gfloat angle,
gfloat aspect_ratio,
gfloat angle,
gboolean stingy_memory_use)
{
GimpBrushGenerated *brush;
......@@ -432,17 +432,15 @@ gimp_brush_generated_new (const gchar *name,
g_return_val_if_fail (name != NULL, NULL);
brush = g_object_new (GIMP_TYPE_BRUSH_GENERATED,
"name", name,
"name", name,
"radius", radius,
"hardness", hardness,
"aspect-ratio", aspect_ratio,
"angle", angle,
NULL);
GIMP_BRUSH (brush)->spacing = 20;
/* set up gimp_brush_generated data */
brush->radius = radius;
brush->hardness = hardness;
brush->angle = angle;
brush->aspect_ratio = aspect_ratio;
/* render brush mask */
gimp_data_dirty (GIMP_DATA (brush));
......@@ -460,6 +458,12 @@ gimp_brush_generated_load (const gchar *filename,
GimpBrushGenerated *brush;
FILE *file;
gchar string[256];
gchar *name = NULL;
gdouble spacing;
gdouble radius;
gdouble hardness;
gdouble aspect_ratio;
gdouble angle;
g_return_val_if_fail (filename != NULL, NULL);
g_return_val_if_fail (g_path_is_absolute (filename), NULL);
......@@ -476,7 +480,9 @@ gimp_brush_generated_load (const gchar *filename,
}
/* make sure the file we are reading is the right type */
fgets (string, 255, file);
errno = 0;
if (! fgets (string, sizeof (string), file))
goto failed;
if (strncmp (string, "GIMP-VBR", 8) != 0)
{
......@@ -488,7 +494,10 @@ gimp_brush_generated_load (const gchar *filename,
}
/* make sure we are reading a compatible version */
fgets (string, 255, file);
errno = 0;
if (! fgets (string, sizeof (string), file))
goto failed;
if (strncmp (string, "1.0", 3))
{
g_set_error (error, GIMP_DATA_ERROR, GIMP_DATA_ERROR_READ,
......@@ -499,46 +508,78 @@ gimp_brush_generated_load (const gchar *filename,
}
/* read name */
fgets (string, 255, file);
g_strstrip (string);
/* create new brush */
brush = g_object_new (GIMP_TYPE_BRUSH_GENERATED,
"name", string,
NULL);
errno = 0;
if (! fgets (string, sizeof (string), file))
goto failed;
gimp_data_freeze (GIMP_DATA (brush));
g_object_freeze_notify (G_OBJECT (brush));
g_strstrip (string);
name = gimp_any_to_utf8 (string, -1,
_("Invalid UTF-8 string in brush file '%s'."),
gimp_filename_to_utf8 (filename));
/* read brush spacing */
fgets (string, 255, file);
GIMP_BRUSH (brush)->spacing = g_ascii_strtod (string, NULL);
errno = 0;
if (! fgets (string, sizeof (string), file))
goto failed;
spacing = g_ascii_strtod (string, NULL);
/* read brush radius */
fgets (string, 255, file);
gimp_brush_generated_set_radius (brush, g_ascii_strtod (string, NULL));
errno = 0;
if (! fgets (string, sizeof (string), file))
goto failed;
radius = g_ascii_strtod (string, NULL);
/* read brush hardness */
fgets (string, 255, file);
gimp_brush_generated_set_hardness (brush, g_ascii_strtod (string, NULL));
errno = 0;
if (! fgets (string, sizeof (string), file))
goto failed;
hardness = g_ascii_strtod (string, NULL);
/* read brush aspect_ratio */
fgets (string, 255, file);
gimp_brush_generated_set_aspect_ratio (brush, g_ascii_strtod (string, NULL));
errno = 0;
if (! fgets (string, sizeof (string), file))
goto failed;
aspect_ratio = g_ascii_strtod (string, NULL);
/* read brush angle */
fgets (string, 255, file);
gimp_brush_generated_set_angle (brush, g_ascii_strtod (string, NULL));
errno = 0;
if (! fgets (string, sizeof (string), file))
goto failed;
angle = g_ascii_strtod (string, NULL);
fclose (file);
g_object_thaw_notify (G_OBJECT (brush));
gimp_data_thaw (GIMP_DATA (brush));
/* create new brush */
brush = g_object_new (GIMP_TYPE_BRUSH_GENERATED,
"name", name,
"radius", radius,
"hardness", hardness,
"aspect-ratio", aspect_ratio,
"angle", angle,
NULL);
g_free (name);
GIMP_BRUSH (brush)->spacing = spacing;
/* render brush mask */
gimp_data_dirty (GIMP_DATA (brush));
if (stingy_memory_use)
temp_buf_swap (GIMP_BRUSH (brush)->mask);
return GIMP_DATA (brush);
failed:
if (name)
g_free (name);
g_set_error (error, GIMP_DATA_ERROR, GIMP_DATA_ERROR_READ,
_("Error while reading brush file '%s': %s"),
gimp_filename_to_utf8 (filename),
errno ? g_strerror (errno) : _("File is truncated"));
return NULL;
}
gfloat
......@@ -580,44 +621,44 @@ gimp_brush_generated_set_hardness (GimpBrushGenerated *brush,
}
gfloat
gimp_brush_generated_set_angle (GimpBrushGenerated *brush,
gfloat angle)
gimp_brush_generated_set_aspect_ratio (GimpBrushGenerated *brush,
gfloat ratio)
{
g_return_val_if_fail (GIMP_IS_BRUSH_GENERATED (brush), -1.0);
if (angle < 0.0)
angle = -1.0 * fmod (angle, 180.0);
else if (angle > 180.0)
angle = fmod (angle, 180.0);
ratio = CLAMP (ratio, 1.0, 1000.0);
if (brush->angle != angle)
if (brush->aspect_ratio != ratio)
{
brush->angle = angle;
brush->aspect_ratio = ratio;
g_object_notify (G_OBJECT (brush), "angle");
g_object_notify (G_OBJECT (brush), "aspect-ratio");
gimp_data_dirty (GIMP_DATA (brush));
}
return brush->angle;
return brush->aspect_ratio;
}
gfloat
gimp_brush_generated_set_aspect_ratio (GimpBrushGenerated *brush,
gfloat ratio)
gimp_brush_generated_set_angle (GimpBrushGenerated *brush,
gfloat angle)
{
g_return_val_if_fail (GIMP_IS_BRUSH_GENERATED (brush), -1.0);
ratio = CLAMP (ratio, 1.0, 1000.0);
if (angle < 0.0)
angle = -1.0 * fmod (angle, 180.0);
else if (angle > 180.0)
angle = fmod (angle, 180.0);
if (brush->aspect_ratio != ratio)
if (brush->angle != angle)
{
brush->aspect_ratio = ratio;
brush->angle = angle;
g_object_notify (G_OBJECT (brush), "aspect-ratio");
g_object_notify (G_OBJECT (brush), "angle");
gimp_data_dirty (GIMP_DATA (brush));
}
return brush->aspect_ratio;
return brush->angle;
}
gfloat
......@@ -637,17 +678,17 @@ gimp_brush_generated_get_hardness (const GimpBrushGenerated *brush)
}
gfloat
gimp_brush_generated_get_angle (const GimpBrushGenerated *brush)
gimp_brush_generated_get_aspect_ratio (const GimpBrushGenerated *brush)
{
g_return_val_if_fail (GIMP_IS_BRUSH_GENERATED (brush), -1.0);
return brush->angle;
return brush->aspect_ratio;
}
gfloat
gimp_brush_generated_get_aspect_ratio (const GimpBrushGenerated *brush)
gimp_brush_generated_get_angle (const GimpBrushGenerated *brush)
{
g_return_val_if_fail (GIMP_IS_BRUSH_GENERATED (brush), -1.0);
return brush->aspect_ratio;
return brush->angle;
}
......@@ -50,8 +50,8 @@ enum
PROP_0,
PROP_RADIUS,
PROP_HARDNESS,
PROP_ANGLE,
PROP_ASPECT_RATIO
PROP_ASPECT_RATIO,
PROP_ANGLE
};
......@@ -60,11 +60,11 @@ enum
static void gimp_brush_generated_class_init (GimpBrushGeneratedClass *klass);
static void gimp_brush_generated_init (GimpBrushGenerated *brush);
static void gimp_brush_generated_set_property (GObject *object,
static void gimp_brush_generated_set_property (GObject *object,
guint property_id,
const GValue *value,
GParamSpec *pspec);
static void gimp_brush_generated_get_property (GObject *object,
static void gimp_brush_generated_get_property (GObject *object,
guint property_id,
GValue *value,
GParamSpec *pspec);
......@@ -133,17 +133,17 @@ gimp_brush_generated_class_init (GimpBrushGeneratedClass *klass)
0.0, 1.0, 0.0,
G_PARAM_READWRITE |
G_PARAM_CONSTRUCT));
g_object_class_install_property (object_class, PROP_ANGLE,
g_param_spec_double ("angle", NULL, NULL,
0.0, 180.0, 0.0,
G_PARAM_READWRITE |
G_PARAM_CONSTRUCT));
g_object_class_install_property (object_class, PROP_ASPECT_RATIO,
g_param_spec_double ("aspect-ratio",
NULL, NULL,
1.0, 20.0, 1.0,
G_PARAM_READWRITE |
G_PARAM_CONSTRUCT));
g_object_class_install_property (object_class, PROP_ANGLE,
g_param_spec_double ("angle", NULL, NULL,
0.0, 180.0, 0.0,
G_PARAM_READWRITE |
G_PARAM_CONSTRUCT));
}
static void
......@@ -151,8 +151,8 @@ gimp_brush_generated_init (GimpBrushGenerated *brush)
{
brush->radius = 5.0;
brush->hardness = 0.0;
brush->angle = 0.0;
brush->aspect_ratio = 1.0;
brush->angle = 0.0;
}
static void
......@@ -169,13 +169,13 @@ gimp_brush_generated_set_property (GObject *object,
gimp_brush_generated_set_radius (brush, g_value_get_double (value));
break;
case PROP_HARDNESS:
gimp_brush_generated_set_radius (brush, g_value_get_double (value));
break;
case PROP_ANGLE:
gimp_brush_generated_set_radius (brush, g_value_get_double (value));
gimp_brush_generated_set_hardness (brush, g_value_get_double (value));
break;
case PROP_ASPECT_RATIO:
gimp_brush_generated_set_radius (brush, g_value_get_double (value));
gimp_brush_generated_set_aspect_ratio (brush, g_value_get_double (value));
break;
case PROP_ANGLE:
gimp_brush_generated_set_angle (brush, g_value_get_double (value));
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
......@@ -199,12 +199,12 @@ gimp_brush_generated_get_property (GObject *object,
case PROP_HARDNESS:
g_value_set_double (value, brush->hardness);
break;
case PROP_ANGLE:
g_value_set_double (value, brush->angle);
break;
case PROP_ASPECT_RATIO:
g_value_set_double (value, brush->aspect_ratio);
break;
case PROP_ANGLE:
g_value_set_double (value, brush->angle);
break;
default:
G_OBJECT_WARN_INVALID_PROPERTY_ID (object, property_id, pspec);
break;
......@@ -284,8 +284,8 @@ gimp_brush_generated_duplicate (GimpData *data,
return gimp_brush_generated_new (GIMP_OBJECT (brush)->name,
brush->radius,
brush->hardness,
brush->angle,
brush->aspect_ratio,
brush->angle,
stingy_memory_use);
}
......@@ -423,8 +423,8 @@ GimpData *
gimp_brush_generated_new (const gchar *name,
gfloat radius,
gfloat hardness,
gfloat angle,
gfloat aspect_ratio,
gfloat angle,
gboolean stingy_memory_use)
{
GimpBrushGenerated *brush;
......@@ -432,17 +432,15 @@ gimp_brush_generated_new (const gchar *name,
g_return_val_if_fail (name != NULL, NULL);
brush = g_object_new (GIMP_TYPE_BRUSH_GENERATED,
"name", name,
"name", name,
"radius", radius,
"hardness", hardness,
"aspect-ratio", aspect_ratio,
"angle", angle,
NULL);
GIMP_BRUSH (brush)->spacing = 20;
/* set up gimp_brush_generated data */
brush->radius = radius;
brush->hardness = hardness;
brush->angle = angle;
brush->aspect_ratio = aspect_ratio;
/* render brush mask */
gimp_data_dirty (GIMP_DATA (brush));
......@@ -460,6 +458,12 @@ gimp_brush_generated_load (const gchar *filename,
GimpBrushGenerated *brush;
FILE *file;
gchar string[256];
gchar *name = NULL;
gdouble spacing;
gdouble radius;
gdouble hardness;
gdouble aspect_ratio;
gdouble angle;
g_return_val_if_fail (filename != NULL, NULL);
g_return_val_if_fail (g_path_is_absolute (filename), NULL);
......@@ -476,7 +480,9 @@ gimp_brush_generated_load (const gchar *filename,
}
/* make sure the file we are reading is the right type */
fgets (string, 255, file);
errno = 0;