]> git.imager.perl.org - imager.git/commitdiff
support giflib 4.2
authorTony Cook <tony@develop-help.com>
Thu, 12 Jul 2012 14:23:53 +0000 (00:23 +1000)
committerTony Cook <tony@develop-help.com>
Thu, 12 Jul 2012 14:23:53 +0000 (00:23 +1000)
4.2 eliminated the GIF_LIB_VERSION macro.

GIF/Makefile.PL
GIF/imgif.c

index 9a746962f5046565f8dd697349202ebb33205df2..0640ba326df8a3908e587b354deed92a0bbc62aa 100644 (file)
@@ -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;
index a9875c2adc79a70ab646d36d52c32acfce98aac5..55b577a6c5d4c877894845813ef6b0e21ca179ad 100644 (file)
@@ -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)