From da260ce8356e69a553c2c4737c28da686b88fb4c Mon Sep 17 00:00:00 2001 From: Matthias Clasen Date: Fri, 22 Jul 2005 15:34:32 +0000 Subject: [PATCH] Make anchored patterns work as they did before. 2005-07-22 Matthias Clasen * gdk-pixbuf-io.c (format_check): Make anchored patterns work as they did before. --- gdk-pixbuf/ChangeLog | 5 +++++ gdk-pixbuf/gdk-pixbuf-io.c | 12 ++++++++---- 2 files changed, 13 insertions(+), 4 deletions(-) diff --git a/gdk-pixbuf/ChangeLog b/gdk-pixbuf/ChangeLog index c792284076..7d0be6bca0 100644 --- a/gdk-pixbuf/ChangeLog +++ b/gdk-pixbuf/ChangeLog @@ -1,3 +1,8 @@ +2005-07-22 Matthias Clasen + + * gdk-pixbuf-io.c (format_check): Make anchored patterns work + as they did before. + 2005-07-22 Matthias Clasen * gdk-pixbuf-io.c (format_check): Interpret patterns where diff --git a/gdk-pixbuf/gdk-pixbuf-io.c b/gdk-pixbuf/gdk-pixbuf-io.c index a8faa782f9..f67dd0355c 100644 --- a/gdk-pixbuf/gdk-pixbuf-io.c +++ b/gdk-pixbuf/gdk-pixbuf-io.c @@ -51,21 +51,21 @@ format_check (GdkPixbufModule *module, guchar *buffer, int size) int i, j; gchar m; GdkPixbufModulePattern *pattern; - gboolean unanchored; + gboolean anchored; guchar *prefix, *mask; for (pattern = module->info->signature; pattern->prefix; pattern++) { if (pattern->mask && pattern->mask[0] == '*') { prefix = pattern->prefix + 1; mask = pattern->mask + 1; - unanchored = TRUE; + anchored = FALSE; } else { prefix = pattern->prefix; mask = pattern->mask; - unanchored = FALSE; + anchored = TRUE; } - for (i = 0; unanchored && i < size; i++) { + for (i = 0; i < size; i++) { for (j = 0; i + j < size && prefix[j] != 0; j++) { m = mask ? mask[j] : ' '; if (m == ' ') { @@ -85,8 +85,12 @@ format_check (GdkPixbufModule *module, guchar *buffer, int size) break; } } + if (prefix[j] == 0) return pattern->relevance; + + if (anchored) + break; } } return 0;