]> git.imager.perl.org - imager.git/commitdiff
return the real giflib version, rather than the dummy
authorTony Cook <tony@develop=help.com>
Mon, 23 Aug 2010 14:52:17 +0000 (14:52 +0000)
committerTony Cook <tony@develop=help.com>
Mon, 23 Aug 2010 14:52:17 +0000 (14:52 +0000)
Changes
GIF/GIF.xs
GIF/imgif.c
GIF/imgif.h

diff --git a/Changes b/Changes
index 53bdbcc9ce5d9d6c30ec3945633a52284c7ccee2..cf4b9188cc73f9db9703819a1918c50f78a737d7 100644 (file)
--- a/Changes
+++ b/Changes
@@ -3,8 +3,6 @@ Imager release history.  Older releases can be found in Changes.old
 Imager 0.78 - unreleased
 ===========
 
-TODO: fix i_giflib_version()
-
  - add each library-directory/pkgconfig/ to the pkg-config search path
    in Imager::Probe.
    Thanks to Justin Davis.
index 312c181f7068b16fba4d382392990ae092c74399..75687b8217fa585801bcc19b5a59b05f411a71bf 100644 (file)
@@ -15,7 +15,7 @@ DEFINE_IMAGER_PERL_CALLBACKS;
 
 MODULE = Imager::File::GIF  PACKAGE = Imager::File::GIF
 
-long
+double
 i_giflib_version()
 
 undef_int
index 056141971bc78f794cd36cf18f4b6e049e691bc7..20b4acd1c393c228a2e48a59c84b5474f0af9a5f 100644 (file)
@@ -7,11 +7,12 @@
 #endif
 #include <errno.h>
 #include <string.h>
+#include <stdlib.h>
 
 /*
 =head1 NAME
 
-gif.c - read and write gif files for Imager
+imgif.c - read and write gif files for Imager
 
 =head1 SYNOPSIS
 
@@ -91,9 +92,20 @@ i_colortable_copy(int **colour_table, int *colours, ColorMapObject *colourmap) {
   }
 }
 
-long
+static const
+char gif_version_str[] = GIF_LIB_VERSION;
+
+double
 i_giflib_version(void) {
-  return 10;
+  const char *p = gif_version_str;
+
+  while (*p && (*p < '0' || *p > '9'))
+    ++p;
+
+  if (!*p)
+    return 0;
+
+  return strtod(p, NULL);
 }
 
 /*
index e58d01355a7052b2b90e244e9e0140ba8dce8bdd..ca92af5d3fd1e6519bcba9b781388cf2327dfae2 100644 (file)
@@ -3,7 +3,7 @@
 
 #include "imext.h"
 
-long i_giflib_version(void);
+double i_giflib_version(void);
 i_img *i_readgif_wiol(io_glue *ig, int **colour_table, int *colours);
 i_img *i_readgif_single_wiol(io_glue *ig, int page);
 extern i_img **i_readgif_multi_wiol(io_glue *ig, int *count);