From f3606ef766bcec86789316a05949f1e67a51e7c1 Mon Sep 17 00:00:00 2001 From: Barry Fishman Date: Wed, 9 Oct 2013 20:37:44 -0400 Subject: [PATCH] Handle giflib 5 changes (tiny change) * configure.ac: Update for giflib 5. * src/image.c (GIFLIB_MAJOR): Ensure it's defined. (DGifOpen, DGifOpenFileName): Handle giflib 5 syntax. (Bug#15531) --- ChangeLog | 4 ++++ configure.ac | 5 +++-- src/ChangeLog | 5 +++++ src/image.c | 16 ++++++++++++++++ 4 files changed, 28 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index b7f8c1e8ec0..6b783060bf9 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +2013-10-10 Barry Fishman (tiny change) + + * configure.ac: Update for giflib 5. (Bug#15531) + 2013-10-08 Eli Zaretskii * configure.ac (HAVE_MENUS): Define unconditionally. diff --git a/configure.ac b/configure.ac index 73185acac39..3bb1ee1e954 100644 --- a/configure.ac +++ b/configure.ac @@ -3106,8 +3106,9 @@ elif test "${HAVE_X11}" = "yes" && test "${with_gif}" != "no" \ || test "${HAVE_W32}" = "yes"; then AC_CHECK_HEADER(gif_lib.h, # EGifPutExtensionLast only exists from version libungif-4.1.0b1. -# Earlier versions can crash Emacs. - [AC_CHECK_LIB(gif, EGifPutExtensionLast, HAVE_GIF=yes, HAVE_GIF=maybe)]) +# Earlier versions can crash Emacs, but version 5.0 removes EGifPutExtensionLast. + [AC_CHECK_LIB(gif, GifMakeMapObject, HAVE_GIF=yes, + [AC_CHECK_LIB(gif, EGifPutExtensionLast, HAVE_GIF=yes, HAVE_GIF=maybe)])]) if test "$HAVE_GIF" = yes; then LIBGIF=-lgif diff --git a/src/ChangeLog b/src/ChangeLog index f46733d1ebe..7e196668796 100644 --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,8 @@ +2013-10-10 Barry Fishman (tiny change) + + * image.c (GIFLIB_MAJOR): Ensure it's defined. + (DGifOpen, DGifOpenFileName): Handle giflib 5 syntax. (Bug#15531) + 2013-10-09 Paul Eggert * fns.c (sxhash_bool_vector): Fix buffer read overrun. diff --git a/src/image.c b/src/image.c index e429830cc96..c414f5b91bd 100644 --- a/src/image.c +++ b/src/image.c @@ -7219,14 +7219,22 @@ gif_image_p (Lisp_Object object) #endif /* HAVE_NTGUI */ +#ifndef GIFLIB_MAJOR +#define GIFLIB_MAJOR 0 +#endif #ifdef WINDOWSNT /* GIF library details. */ DEF_IMGLIB_FN (int, DGifCloseFile, (GifFileType *)); DEF_IMGLIB_FN (int, DGifSlurp, (GifFileType *)); +#if GIFLIB_MAJOR < 5 DEF_IMGLIB_FN (GifFileType *, DGifOpen, (void *, InputFunc)); DEF_IMGLIB_FN (GifFileType *, DGifOpenFileName, (const char *)); +#else +DEF_IMGLIB_FN (GifFileType *, DGifOpen, (void *, InputFunc, int *)); +DEF_IMGLIB_FN (GifFileType *, DGifOpenFileName, (const char *, int *)); +#endif static bool init_gif_functions (void) @@ -7316,7 +7324,11 @@ gif_load (struct frame *f, struct image *img) } /* Open the GIF file. */ +#if GIFLIB_MAJOR < 5 gif = fn_DGifOpenFileName (SSDATA (file)); +#else + gif = fn_DGifOpenFileName (SSDATA (file), NULL); +#endif if (gif == NULL) { image_error ("Cannot open `%s'", file, Qnil); @@ -7337,7 +7349,11 @@ gif_load (struct frame *f, struct image *img) memsrc.len = SBYTES (specified_data); memsrc.index = 0; +#if GIFLIB_MAJOR < 5 gif = fn_DGifOpen (&memsrc, gif_read_from_memory); +#else + gif = fn_DGifOpen (&memsrc, gif_read_from_memory, NULL); +#endif if (!gif) { image_error ("Cannot open memory source `%s'", img->spec, Qnil); -- 2.39.2