From 0dfd57ded652d7b4fb2069484e58e735976f7abc Mon Sep 17 00:00:00 2001 From: Tony Cook Date: Fri, 13 Jul 2012 00:23:53 +1000 Subject: [PATCH] support giflib 4.2 4.2 eliminated the GIF_LIB_VERSION macro. --- GIF/Makefile.PL | 7 +++++++ GIF/imgif.c | 11 +++++++++++ 2 files changed, 18 insertions(+) diff --git a/GIF/Makefile.PL b/GIF/Makefile.PL index 9a746962..0640ba32 100644 --- a/GIF/Makefile.PL +++ b/GIF/Makefile.PL @@ -111,10 +111,15 @@ sub _gif_test_code { return <<'CODE'; /* TODO: test DGifOpen() and processing with callbacks */ GifFileType *gf; +#ifdef GIF_LIB_VERSION const char vers[] = GIF_LIB_VERSION; const char *versp = vers; int ver_maj; int ver_min; +#else +int ver_maj = GIFLIB_MAJOR; +int ver_min = GIFLIB_MINOR; +#endif gf=DGifOpenFileName("testimg/expected.gif"); if (!gf) { fprintf(stderr, "GIF: Cannot open testimg/expected.gif\n"); @@ -128,6 +133,7 @@ if (gf->SWidth != 16 || gf->SHeight != 16) { EGifSetGifVersion("89a"); EGifSetGifVersion("87a"); +#ifdef GIF_LIB_VERSION /* skip the " Version " */ while (*versp && (*versp < '0' || *versp > '9')) ++versp; @@ -150,6 +156,7 @@ while (*versp && *versp >= '0' && *versp <= '9') { ver_min *= 10; ver_min += *versp++ - '0'; } +#endif if (ver_maj < 4) { fprintf(stderr, "GIF: gif lib version 3 is no longer supported\n"); return 1; diff --git a/GIF/imgif.c b/GIF/imgif.c index a9875c2a..55b577a6 100644 --- a/GIF/imgif.c +++ b/GIF/imgif.c @@ -91,6 +91,8 @@ i_colortable_copy(int **colour_table, int *colours, ColorMapObject *colourmap) { } } +#ifdef GIF_LIB_VERSION + static const char gif_version_str[] = GIF_LIB_VERSION; @@ -107,6 +109,15 @@ i_giflib_version(void) { return strtod(p, NULL); } +#else + +double +i_giflib_version(void) { + return GIFLIB_MAJOR + GIFLIB_MINOR * 0.1; +} + +#endif + /* =item i_readgif_low(GifFileType *GifFile, int **colour_table, int *colours) -- 2.39.5