From: Tony Cook <tony@develop-help.com>
Date: Fri, 23 Nov 2018 00:14:43 +0000 (+1100)
Subject: add probe support for FLIF files
X-Git-Tag: v1.007~4
X-Git-Url: http://git.imager.perl.org/imager.git/commitdiff_plain/1facb3575fe6775d0176eb6fa0b74fa87df9042a?ds=inline

add probe support for FLIF files

(this doesn't add support for the file format, just detection of
the file's "magic number")
---

diff --git a/image.c b/image.c
index cbd1b38a..3329003f 100644
--- a/image.c
+++ b/image.c
@@ -1716,6 +1716,9 @@ i_test_format_probe(io_glue *data, int length) {
     /* JPEG 2000 
        This might match a little loosely */
     FORMAT_ENTRY("\x00\x00\x00\x0CjP  \x0D\x0A\x87\x0A", "jp2"),
+
+    /* FLIF - Free Lossless Image Format - https://flif.info/spec.html */
+    FORMAT_ENTRY("FLIF", "flif")
   };
   static const struct magic_entry more_formats[] = {
     /* these were originally both listed as ico, but cur files can
diff --git a/t/200-file/100-files.t b/t/200-file/100-files.t
index bc602f1c..a4c66a44 100644
--- a/t/200-file/100-files.t
+++ b/t/200-file/100-files.t
@@ -4,7 +4,7 @@
 # the file format
 
 use strict;
-use Test::More tests => 93;
+use Test::More tests => 94;
 use Imager;
 
 -d "testout" or mkdir "testout";
@@ -287,6 +287,13 @@ probe_ok(<<JPEG2K, "jp2", "JPEG 2000");
 00 6A 70 32 63 FF 4F FF 51 00 2F 00 00 00 00 01
 JPEG2K
 
+probe_ok(<<FLIF, "flif", "FLIF");
+46 4C 49 46 44 31 83 7F 83 7F 00 A0 03 AF B0 B1
+E8 03 37 FF F7 D5 C2 D8 B7 D5 58 59 6E D9 71 8C
+0F A9 88 B4 1C B1 7F C0 2E FB 8C 7D 90 B6 04 DF
+CF 3A FF 56 5D FF 67 87 CE 9C 0E D6 69 CD 1F EF
+FLIF
+
 { # RT 72475
   # check error messages from read/read_multi
   my $data = "nothing useful";