[gimp/gimp-2-10] app: fix legacy .gpb parsing code in gimp_brush_load_brush()
- From: Michael Natterer <mitch src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gimp/gimp-2-10] app: fix legacy .gpb parsing code in gimp_brush_load_brush()
- Date: Tue, 9 Apr 2019 21:15:38 +0000 (UTC)
commit dd5c4458c995c8d37cfd5fb0c3e867beed346a4a
Author: Michael Natterer <mitch gimp org>
Date: Tue Apr 9 23:11:55 2019 +0200
app: fix legacy .gpb parsing code in gimp_brush_load_brush()
Only seek back to after the end of the actual brush if a following
pattern was *not* found. Got this logic wrong in the original port of
the plug-in code.
(cherry picked from commit 40863bffdd66c6402ce3c6be3d93fb82b9bfd5fe)
app/core/gimpbrush-load.c | 17 ++++++++++-------
1 file changed, 10 insertions(+), 7 deletions(-)
---
diff --git a/app/core/gimpbrush-load.c b/app/core/gimpbrush-load.c
index e6c4449d79..63a453ebc9 100644
--- a/app/core/gimpbrush-load.c
+++ b/app/core/gimpbrush-load.c
@@ -294,7 +294,7 @@ gimp_brush_load_brush (GimpContext *context,
{
case 1:
success = (g_input_stream_read_all (input, mask, size,
- &bytes_read, NULL, error) &&
+ &bytes_read, NULL, error) &&
bytes_read == size);
/* For backwards-compatibility, check if a pattern follows.
@@ -323,8 +323,8 @@ gimp_brush_load_brush (GimpContext *context,
ph.version == 1 &&
ph.header_size > sizeof (GimpPatternHeader) &&
ph.bytes == 3 &&
- ph.width == header.width &&
- ph.height == header.height &&
+ ph.width == header.width &&
+ ph.height == header.height &&
g_input_stream_skip (input,
ph.header_size -
sizeof (GimpPatternHeader),
@@ -348,11 +348,14 @@ gimp_brush_load_brush (GimpContext *context,
error) &&
bytes_read == pixmap_size);
}
+ else
+ {
+ /* seek back if pattern wasn't found */
+ success = g_seekable_seek (G_SEEKABLE (input),
+ rewind, G_SEEK_SET,
+ NULL, error);
+ }
}
-
- /* seek back unconditionally */
- g_seekable_seek (G_SEEKABLE (input), rewind, G_SEEK_SET,
- NULL, NULL);
}
break;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]