From 4922fb3af8a9a1f4f594cab0bac45230ff270906 Mon Sep 17 00:00:00 2001 From: Tony Cook Date: Mon, 23 Aug 2010 14:52:17 +0000 Subject: [PATCH] return the real giflib version, rather than the dummy --- Changes | 2 -- GIF/GIF.xs | 2 +- GIF/imgif.c | 18 +++++++++++++++--- GIF/imgif.h | 2 +- 4 files changed, 17 insertions(+), 7 deletions(-) diff --git a/Changes b/Changes index 53bdbcc9..cf4b9188 100644 --- 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. diff --git a/GIF/GIF.xs b/GIF/GIF.xs index 312c181f..75687b82 100644 --- a/GIF/GIF.xs +++ b/GIF/GIF.xs @@ -15,7 +15,7 @@ DEFINE_IMAGER_PERL_CALLBACKS; MODULE = Imager::File::GIF PACKAGE = Imager::File::GIF -long +double i_giflib_version() undef_int diff --git a/GIF/imgif.c b/GIF/imgif.c index 05614197..20b4acd1 100644 --- a/GIF/imgif.c +++ b/GIF/imgif.c @@ -7,11 +7,12 @@ #endif #include #include +#include /* =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); } /* diff --git a/GIF/imgif.h b/GIF/imgif.h index e58d0135..ca92af5d 100644 --- a/GIF/imgif.h +++ b/GIF/imgif.h @@ -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); -- 2.39.5