Commit da260ce8 authored by Matthias Clasen's avatar Matthias Clasen Committed by Matthias Clasen
Browse files

Make anchored patterns work as they did before.

2005-07-22  Matthias Clasen  <mclasen@redhat.com>

	* gdk-pixbuf-io.c (format_check): Make anchored patterns work
	as they did before.
parent fee54dfc
2005-07-22 Matthias Clasen <mclasen@redhat.com>
* gdk-pixbuf-io.c (format_check): Make anchored patterns work
as they did before.
2005-07-22 Matthias Clasen <mclasen@redhat.com> 2005-07-22 Matthias Clasen <mclasen@redhat.com>
* gdk-pixbuf-io.c (format_check): Interpret patterns where * gdk-pixbuf-io.c (format_check): Interpret patterns where
......
...@@ -51,21 +51,21 @@ format_check (GdkPixbufModule *module, guchar *buffer, int size) ...@@ -51,21 +51,21 @@ format_check (GdkPixbufModule *module, guchar *buffer, int size)
int i, j; int i, j;
gchar m; gchar m;
GdkPixbufModulePattern *pattern; GdkPixbufModulePattern *pattern;
gboolean unanchored; gboolean anchored;
guchar *prefix, *mask; guchar *prefix, *mask;
for (pattern = module->info->signature; pattern->prefix; pattern++) { for (pattern = module->info->signature; pattern->prefix; pattern++) {
if (pattern->mask && pattern->mask[0] == '*') { if (pattern->mask && pattern->mask[0] == '*') {
prefix = pattern->prefix + 1; prefix = pattern->prefix + 1;
mask = pattern->mask + 1; mask = pattern->mask + 1;
unanchored = TRUE; anchored = FALSE;
} }
else { else {
prefix = pattern->prefix; prefix = pattern->prefix;
mask = pattern->mask; 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++) { for (j = 0; i + j < size && prefix[j] != 0; j++) {
m = mask ? mask[j] : ' '; m = mask ? mask[j] : ' ';
if (m == ' ') { if (m == ' ') {
...@@ -85,8 +85,12 @@ format_check (GdkPixbufModule *module, guchar *buffer, int size) ...@@ -85,8 +85,12 @@ format_check (GdkPixbufModule *module, guchar *buffer, int size)
break; break;
} }
} }
if (prefix[j] == 0) if (prefix[j] == 0)
return pattern->relevance; return pattern->relevance;
if (anchored)
break;
} }
} }
return 0; return 0;
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment