summaryrefslogtreecommitdiff
path: root/gdk-pixbuf/gdk-pixbuf-io.c
diff options
context:
space:
mode:
authorJonathan Blandford <jrb@redhat.com>1999-11-29 16:49:39 +0000
committerJonathan Blandford <jrb@src.gnome.org>1999-11-29 16:49:39 +0000
commit4aae90b5b134419eed3fcfea3c4ffeb0f6455ab7 (patch)
treea191feca68fe0d93ffd06fe16b5f0c0780194bb2 /gdk-pixbuf/gdk-pixbuf-io.c
parentf0e6c2b1f377323929b82c1ffd1ae7541c3369ad (diff)
downloadgtk+-4aae90b5b134419eed3fcfea3c4ffeb0f6455ab7.tar.gz
Added another loader from Arjan to handle .ico files. Cool.
1999-11-29 Jonathan Blandford <jrb@redhat.com> * src/Makefile.am (ICO_LIB): Added another loader from Arjan to handle .ico files. Cool.
Diffstat (limited to 'gdk-pixbuf/gdk-pixbuf-io.c')
-rw-r--r--gdk-pixbuf/gdk-pixbuf-io.c18
1 files changed, 18 insertions, 0 deletions
diff --git a/gdk-pixbuf/gdk-pixbuf-io.c b/gdk-pixbuf/gdk-pixbuf-io.c
index 698d15ed7a..6f09ec2fde 100644
--- a/gdk-pixbuf/gdk-pixbuf-io.c
+++ b/gdk-pixbuf/gdk-pixbuf-io.c
@@ -136,6 +136,23 @@ pixbuf_check_sunras (guchar *buffer, int size)
return TRUE;
}
+static gboolean
+pixbuf_check_ico (guchar *buffer, int size)
+{
+ /* Note that this may cause false positives, but .ico's don't
+ have a magic number.*/
+ if (size < 6)
+ return FALSE;
+ if (buffer [0] != 0x0 ||
+ buffer [1] != 0x0 ||
+ buffer [2] != 0x1 ||
+ buffer [3] != 0x0 ||
+ buffer [5] != 0x0 )
+ return FALSE;
+
+ return TRUE;
+}
+
static gboolean
pixbuf_check_bmp (guchar *buffer, int size)
@@ -159,6 +176,7 @@ GdkPixbufModule file_formats [] = {
{ "xpm", pixbuf_check_xpm, NULL, NULL, NULL, NULL, NULL, NULL },
{ "pnm", pixbuf_check_pnm, NULL, NULL, NULL, NULL, NULL, NULL },
{ "ras", pixbuf_check_sunras, NULL, NULL, NULL, NULL, NULL, NULL },
+ { "ico", pixbuf_check_ico, NULL, NULL, NULL, NULL, NULL, NULL },
{ "bmp", pixbuf_check_bmp, NULL, NULL, NULL, NULL, NULL, NULL },
{ NULL, NULL, NULL, NULL, NULL, NULL, NULL }
};