]> git.imager.perl.org - imager.git/blobdiff - image.c
add detection of BZIP2 and gzip data
[imager.git] / image.c
diff --git a/image.c b/image.c
index a96a383abdf81525c1074b62064e80bbd4b2ad6b..18a9796b2f90d9cb62eae8080dd391ad9a60093f 100644 (file)
--- a/image.c
+++ b/image.c
@@ -2152,7 +2152,7 @@ Check the beginning of the supplied file for a 'magic number'
 #define FORMAT_ENTRY(magic, type) \
   { (unsigned char *)(magic ""), sizeof(magic)-1, type }
 #define FORMAT_ENTRY2(magic, type, mask) \
-  { (unsigned char *)(magic ""), sizeof(magic)-1, type, mask }
+  { (unsigned char *)(magic ""), sizeof(magic)-1, type, (unsigned char *)(mask) }
 
 const char *
 i_test_format_probe(io_glue *data, int length) {
@@ -2205,12 +2205,20 @@ i_test_format_probe(io_glue *data, int length) {
 
     /* Utah RLE */
     FORMAT_ENTRY("\x52\xCC", "utah"),
+
+    /* GZIP compressed, only matching deflate for now */
+    FORMAT_ENTRY("\x1F\x8B\x08", "gzip"),
+
+    /* bzip2 compressed */
+    FORMAT_ENTRY("BZh", "bzip2"),
   };
   static const struct magic_entry more_formats[] = {
     /* these were originally both listed as ico, but cur files can
        include hotspot information */
     FORMAT_ENTRY("\x00\x00\x01\x00", "ico"), /* Windows icon */
     FORMAT_ENTRY("\x00\x00\x02\x00", "cur"), /* Windows cursor */
+    FORMAT_ENTRY2("\x00\x00\x00\x00\x00\x00\x00\x07", 
+                 "xwd", "    xxxx"), /* X Windows Dump */
   };
 
   unsigned int i;