1
Fork 0
mirror of git://git.sv.gnu.org/emacs.git synced 2025-12-29 08:31:35 -08:00

MS-Windows follow-up to 2013-10-10T01:03:11Z!rgm@gnu.org: support giflib 5.x.

src/image.c (GIFLIB_MAJOR): Define to 4 if undefined.
 (GIFLIB_MINOR, GIFLIB_RELEASE): Define to zero if undefined.
 (GifErrorString) [GIFLIB_MAJOR >= 5]: Define a function pointer.
 (gif_load): For giflib v5.x and later, display the error message
 produced by giflib when its functions fail.
 (syms_of_image) <Qlibgif_version> [HAVE_NTGUI]: New DEFSYM.

 lisp/term/w32-win.el (dynamic-library-alist): Define separate lists
 of GIF DLLs for versions before and after 5.0.0 of giflib.

Fixes: debbugs:15531
This commit is contained in:
Eli Zaretskii 2013-10-10 18:30:21 +03:00
parent db1386987b
commit a5dab1594a
4 changed files with 78 additions and 12 deletions

View file

@ -1,3 +1,9 @@
2013-10-10 Eli Zaretskii <eliz@gnu.org>
* term/w32-win.el (dynamic-library-alist): Define separate lists
of GIF DLLs for versions before and after 5.0.0 of giflib.
(Bug#15531)
2013-10-10 João Távora <joaotavora@gmail.com>
* vc/vc.el (vc-diff-build-argument-list-internal): If the file is

View file

@ -223,7 +223,19 @@ See the documentation of `create-fontset-from-fontset-spec' for the format.")
"libpng13d.dll" "libpng13.dll"))
'(jpeg "jpeg62.dll" "libjpeg.dll" "jpeg-62.dll" "jpeg.dll")
'(tiff "libtiff3.dll" "libtiff.dll")
'(gif "giflib4.dll" "libungif4.dll" "libungif.dll")
;; Versions of giflib 5.0.0 and later changed signatures of
;; several functions used by Emacs, which makes those versions
;; incompatible with previous ones. We select the correct
;; libraries according to the version of giflib we were
;; compiled against. (If we were compiled without GIF support,
;; libgif-version's value is -1.)
(if (>= libgif-version 50000)
;; Yes, giflib 5.x uses 6 as the major version of the API,
;; thus "libgif-6.dll" below (giflib 4.x used 5 as the
;; major API version).
;; giflib5.dll is from the lua-files project.
'(gif "libgif-6.dll" "giflib5.dll")
'(gif "libgif-5.dll" "giflib4.dll" "libungif4.dll" "libungif.dll"))
'(svg "librsvg-2-2.dll")
'(gdk-pixbuf "libgdk_pixbuf-2.0-0.dll")
'(glib "libglib-2.0-0.dll")

View file

@ -1,3 +1,13 @@
2013-10-10 Eli Zaretskii <eliz@gnu.org>
* image.c (GIFLIB_MAJOR): Define to 4 if undefined.
(GIFLIB_MINOR, GIFLIB_RELEASE): Define to zero if undefined.
(GifErrorString) [GIFLIB_MAJOR >= 5]: Define a function pointer.
(gif_load): For giflib v5.x and later, display the error message
produced by giflib when its functions fail.
(syms_of_image) <Qlibgif_version> [HAVE_NTGUI]: New DEFSYM.
(Bug#15531)
2013-10-10 Dmitry Antipov <dmantipov@yandex.ru>
* keyboard.c (last_event_timestamp): Remove. For X selection and

View file

@ -87,10 +87,11 @@ typedef struct w32_bitmap_record Bitmap_Record;
#define x_defined_color w32_defined_color
#define DefaultDepthOfScreen(screen) (one_w32_display_info.n_cbits)
/* Version of libpng that we were compiled with, or -1 if no PNG
support was compiled in. This is tested by w32-win.el to correctly
set up the alist used to search for PNG libraries. */
Lisp_Object Qlibpng_version;
/* Versions of libpng and libgif that we were compiled with, or -1 if
no PNG/GIF support was compiled in. This is tested by w32-win.el
to correctly set up the alist used to search for the respective
image libraries. */
Lisp_Object Qlibpng_version, Qlibgif_version;
#endif /* HAVE_NTGUI */
#ifdef HAVE_NS
@ -7219,8 +7220,15 @@ gif_image_p (Lisp_Object object)
#endif /* HAVE_NTGUI */
/* Giflib before 5.0 didn't define these macros. */
#ifndef GIFLIB_MAJOR
#define GIFLIB_MAJOR 0
#define GIFLIB_MAJOR 4
#endif
#ifndef GIFLIB_MINOR
#define GIFLIB_MINOR 0
#endif
#ifndef GIFLIB_RELEASE
#define GIFLIB_RELEASE 0
#endif
#ifdef WINDOWSNT
@ -7234,6 +7242,7 @@ DEF_IMGLIB_FN (GifFileType *, DGifOpenFileName, (const char *));
#else
DEF_IMGLIB_FN (GifFileType *, DGifOpen, (void *, InputFunc, int *));
DEF_IMGLIB_FN (GifFileType *, DGifOpenFileName, (const char *, int *));
DEF_IMGLIB_FN (char *, GifErrorString, (int));
#endif
static bool
@ -7248,6 +7257,9 @@ init_gif_functions (void)
LOAD_IMGLIB_FN (library, DGifSlurp);
LOAD_IMGLIB_FN (library, DGifOpen);
LOAD_IMGLIB_FN (library, DGifOpenFileName);
#if GIFLIB_MAJOR >= 5
LOAD_IMGLIB_FN (library, GifErrorString);
#endif
return 1;
}
@ -7257,6 +7269,7 @@ init_gif_functions (void)
#define fn_DGifSlurp DGifSlurp
#define fn_DGifOpen DGifOpen
#define fn_DGifOpenFileName DGifOpenFileName
#define fn_GifErrorString GifErrorString
#endif /* WINDOWSNT */
@ -7313,6 +7326,9 @@ gif_load (struct frame *f, struct image *img)
Lisp_Object specified_data = image_spec_value (img->spec, QCdata, NULL);
unsigned long bgcolor = 0;
EMACS_INT idx;
#if GIFLIB_MAJOR >= 5
int gif_err;
#endif
if (NILP (specified_data))
{
@ -7326,14 +7342,20 @@ 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);
return 0;
}
#else
gif = fn_DGifOpenFileName (SSDATA (file), &gif_err);
if (gif == NULL)
{
image_error ("Cannot open `%s': %s",
file, build_string (fn_GifErrorString (gif_err)));
return 0;
}
#endif
}
else
{
@ -7351,14 +7373,20 @@ gif_load (struct frame *f, struct image *img)
#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);
return 0;
}
#else
gif = fn_DGifOpen (&memsrc, gif_read_from_memory, &gif_err);
if (!gif)
{
image_error ("Cannot open memory source `%s': %s",
img->spec, build_string (fn_GifErrorString (gif_err)));
return 0;
}
#endif
}
/* Before reading entire contents, check the declared image size. */
@ -9370,6 +9398,16 @@ non-numeric, there is no explicit limit on the size of images. */);
make_number (PNG_LIBPNG_VER)
#else
make_number (-1)
#endif
);
DEFSYM (Qlibgif_version, "libgif-version");
Fset (Qlibgif_version,
#ifdef HAVE_GIF
make_number (GIFLIB_MAJOR * 10000
+ GIFLIB_MINOR * 100
+ GIFLIB_RELEASE)
#else
make_number (-1)
#endif
);
#endif