mirror of
https://gitlab.gnome.org/GNOME/gtk.git
synced 2024-11-10 10:50:10 +00:00
Check that the mask is NULL or a string of the same length consisting
Sat Nov 15 00:26:19 2003 Matthias Clasen <maclas@gmx.de> * queryloaders.c (loader_sanity_check): Check that the mask is NULL or a string of the same length consisting entirely of ' ', '!', 'x', 'z', 'n'.
This commit is contained in:
parent
5df65643e2
commit
41ee5267cb
@ -1,3 +1,8 @@
|
|||||||
|
Sat Nov 15 00:25:39 2003 Matthias Clasen <maclas@gmx.de>
|
||||||
|
|
||||||
|
* gdk-pixbuf/tmpl/module_interface.sgml: Add an example
|
||||||
|
for GdkPixbufModulePattern.
|
||||||
|
|
||||||
Wed Nov 12 21:52:35 2003 Matthias Clasen <maclas@gmx.de>
|
Wed Nov 12 21:52:35 2003 Matthias Clasen <maclas@gmx.de>
|
||||||
|
|
||||||
* gtk/gtk-sections.txt: Add gtk_menu_set_monitor.
|
* gtk/gtk-sections.txt: Add gtk_menu_set_monitor.
|
||||||
|
@ -18,8 +18,8 @@ a #GdkPixbufModuleFillVtableFunc function named
|
|||||||
In order to make format-checking work before actually loading the modules
|
In order to make format-checking work before actually loading the modules
|
||||||
(which may require dlopening image libraries), modules export their
|
(which may require dlopening image libraries), modules export their
|
||||||
signatures (and other information) via the <function>fill_info</function>
|
signatures (and other information) via the <function>fill_info</function>
|
||||||
function. An external utility, <command>gdk-pixbuf-query-loaders</command>, uses
|
function. An external utility, <command>gdk-pixbuf-query-loaders</command>,
|
||||||
this to create a text file containing a list of all available loaders and
|
uses this to create a text file containing a list of all available loaders and
|
||||||
their signatures. This file is then read at runtime by &gdk-pixbuf; to obtain
|
their signatures. This file is then read at runtime by &gdk-pixbuf; to obtain
|
||||||
the list of available loaders and their signatures.
|
the list of available loaders and their signatures.
|
||||||
</para>
|
</para>
|
||||||
@ -158,18 +158,30 @@ operations.
|
|||||||
<!-- ##### STRUCT GdkPixbufModulePattern ##### -->
|
<!-- ##### STRUCT GdkPixbufModulePattern ##### -->
|
||||||
<para>
|
<para>
|
||||||
The signature of a module is a set of prefixes. Prefixes are encoded as
|
The signature of a module is a set of prefixes. Prefixes are encoded as
|
||||||
pairs of ordinary strings, where the second string, if not %NULL,
|
pairs of ordinary strings, where the second string, if not %NULL, must be
|
||||||
may contain ' ', '!', 'x', 'z', and 'n' to indicate bytes that must be
|
of the same length as the first one and may contain ' ', '!', 'x', 'z',
|
||||||
matched, not matched, "don't-care"-bytes, zeros and non-zeros.
|
and 'n' to indicate bytes that must be matched, not matched,
|
||||||
|
"don't-care"-bytes, zeros and non-zeros.
|
||||||
Each prefix has an associated integer that describes the relevance of
|
Each prefix has an associated integer that describes the relevance of
|
||||||
the prefix, with 0 meaning a mismatch and 100 a "perfect match".
|
the prefix, with 0 meaning a mismatch and 100 a "perfect match".
|
||||||
</para>
|
</para>
|
||||||
|
|
||||||
<para>
|
<para>
|
||||||
The signature of a module is stored as an array of
|
The signature of a module is stored as an array of
|
||||||
#GdkPixbufModulePattern<!-- -->s.
|
#GdkPixbufModulePattern<!-- -->s. The array is terminated by a pattern
|
||||||
|
where the @prefix is %NULL.
|
||||||
</para>
|
</para>
|
||||||
|
|
||||||
|
<informalexample><programlisting>
|
||||||
|
GdkPixbufModulePattern *signature[] = {
|
||||||
|
{ "abcdx", " !x z", 100 },
|
||||||
|
{ "bla", NULL, 90 },
|
||||||
|
{ NULL, NULL, 0 }
|
||||||
|
};
|
||||||
|
</programlisting>
|
||||||
|
The example matches e.g. "auud\0" with relevance 100, and "blau" with
|
||||||
|
relevance 90.</informalexample>
|
||||||
|
|
||||||
@prefix: the prefix for this pattern
|
@prefix: the prefix for this pattern
|
||||||
@mask: mask containing bytes which modify how the prefix is matched against
|
@mask: mask containing bytes which modify how the prefix is matched against
|
||||||
test data
|
test data
|
||||||
|
@ -1,3 +1,9 @@
|
|||||||
|
Sat Nov 15 00:26:19 2003 Matthias Clasen <maclas@gmx.de>
|
||||||
|
|
||||||
|
* queryloaders.c (loader_sanity_check): Check that the mask
|
||||||
|
is NULL or a string of the same length consisting entirely of
|
||||||
|
' ', '!', 'x', 'z', 'n'.
|
||||||
|
|
||||||
Mon Nov 10 00:17:52 2003 Matthias Clasen <maclas@gmx.de>
|
Mon Nov 10 00:17:52 2003 Matthias Clasen <maclas@gmx.de>
|
||||||
|
|
||||||
* Makefile.am (install-data-local): Typo fix in warning.
|
* Makefile.am (install-data-local): Typo fix in warning.
|
||||||
|
@ -59,13 +59,32 @@ loader_sanity_check (const char *path, GdkPixbufFormat *info, GdkPixbufModule *v
|
|||||||
const GdkPixbufModulePattern *pattern;
|
const GdkPixbufModulePattern *pattern;
|
||||||
const char *error = "";
|
const char *error = "";
|
||||||
|
|
||||||
for (pattern = info->signature; pattern->prefix; pattern++)
|
for (pattern = info->signature; pattern->prefix; pattern++)
|
||||||
if (strlen (pattern->prefix) == 0)
|
{
|
||||||
|
int prefix_len = strlen (pattern->prefix);
|
||||||
|
if (prefix_len == 0)
|
||||||
{
|
{
|
||||||
error = "empty pattern";
|
error = "empty pattern";
|
||||||
|
|
||||||
goto error;
|
goto error;
|
||||||
}
|
}
|
||||||
|
if (pattern->mask)
|
||||||
|
{
|
||||||
|
int mask_len = strlen (pattern->mask);
|
||||||
|
if (mask_len != prefix_len)
|
||||||
|
{
|
||||||
|
error = "mask length mismatch";
|
||||||
|
|
||||||
|
goto error;
|
||||||
|
}
|
||||||
|
if (strspn (pattern->mask, " !xzn") < mask_len)
|
||||||
|
{
|
||||||
|
error = "bad char in mask";
|
||||||
|
|
||||||
|
goto error;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (!vtable->load && !vtable->begin_load && !vtable->load_animation)
|
if (!vtable->load && !vtable->begin_load && !vtable->load_animation)
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user