aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorEli Zaretskii2014-06-18 18:15:52 +0300
committerEli Zaretskii2014-06-18 18:15:52 +0300
commitb86b15b22117e9aab6e6a033d9a541441acdecb4 (patch)
tree4385d0db3ccd09165883e57a1768aecc0a9f010f /src
parentd35b443a668c135c6cf5fbbd2417553c0f4ab9b8 (diff)
downloademacs-b86b15b22117e9aab6e6a033d9a541441acdecb4.tar.gz
emacs-b86b15b22117e9aab6e6a033d9a541441acdecb4.zip
Fix bug #17790 with compilation against giflib 5.1.0 and later.
src/image.c [5 < GIFLIB_MAJOR + (1 <= GIFLIB_MINOR)]: Declare the prototype of DGifCloseFile as appropriate for older and newer versions of giflib. (gif_close): New function, encapsulates the differences in the calling sequence of DGifCloseFile before v5.1.0 and after it. (gif_load): Call gif_close instead of DGifCloseFile. Divulge the error string where appropriate. lisp/term/w32-win.el (dynamic-library-alist): Support giflib 5.1.0 and later.
Diffstat (limited to 'src')
-rw-r--r--src/ChangeLog10
-rw-r--r--src/image.c42
2 files changed, 45 insertions, 7 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index 2c27be577a7..fb0cc471599 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,13 @@
12014-06-18 Eli Zaretskii <eliz@gnu.org>
2
3 * image.c [5 < GIFLIB_MAJOR + (1 <= GIFLIB_MINOR)]: Declare the
4 prototype of DGifCloseFile as appropriate for older and newer
5 versions of giflib.
6 (gif_close): New function, encapsulates the differences in the
7 calling sequence of DGifCloseFile before v5.1.0 and after it.
8 (gif_load): Call gif_close instead of DGifCloseFile. Divulge the
9 error string where appropriate. (Bug#17790)
10
12014-06-16 Eli Zaretskii <eliz@gnu.org> 112014-06-16 Eli Zaretskii <eliz@gnu.org>
2 12
3 * xdisp.c (Fmove_point_visually): Instead of testing for keyboard 13 * xdisp.c (Fmove_point_visually): Instead of testing for keyboard
diff --git a/src/image.c b/src/image.c
index 4133aaa7621..3255982a157 100644
--- a/src/image.c
+++ b/src/image.c
@@ -7255,7 +7255,11 @@ gif_image_p (Lisp_Object object)
7255#ifdef WINDOWSNT 7255#ifdef WINDOWSNT
7256 7256
7257/* GIF library details. */ 7257/* GIF library details. */
7258#if 5 < GIFLIB_MAJOR + (1 <= GIFLIB_MINOR)
7259DEF_IMGLIB_FN (int, DGifCloseFile, (GifFileType *, int *));
7260#else
7258DEF_IMGLIB_FN (int, DGifCloseFile, (GifFileType *)); 7261DEF_IMGLIB_FN (int, DGifCloseFile, (GifFileType *));
7262#endif
7259DEF_IMGLIB_FN (int, DGifSlurp, (GifFileType *)); 7263DEF_IMGLIB_FN (int, DGifSlurp, (GifFileType *));
7260#if GIFLIB_MAJOR < 5 7264#if GIFLIB_MAJOR < 5
7261DEF_IMGLIB_FN (GifFileType *, DGifOpen, (void *, InputFunc)); 7265DEF_IMGLIB_FN (GifFileType *, DGifOpen, (void *, InputFunc));
@@ -7325,6 +7329,19 @@ gif_read_from_memory (GifFileType *file, GifByteType *buf, int len)
7325 return len; 7329 return len;
7326} 7330}
7327 7331
7332static int
7333gif_close (GifFileType *gif, int *err)
7334{
7335 int retval;
7336
7337#if 5 < GIFLIB_MAJOR + (1 <= GIFLIB_MINOR)
7338 retval = fn_DGifCloseFile (gif, err);
7339#else
7340 retval = fn_DGifCloseFile (gif);
7341 if (err)
7342 *err = gif->Error;
7343#endif
7344}
7328 7345
7329/* Load GIF image IMG for use on frame F. Value is true if 7346/* Load GIF image IMG for use on frame F. Value is true if
7330 successful. */ 7347 successful. */
@@ -7419,7 +7436,7 @@ gif_load (struct frame *f, struct image *img)
7419 if (!check_image_size (f, gif->SWidth, gif->SHeight)) 7436 if (!check_image_size (f, gif->SWidth, gif->SHeight))
7420 { 7437 {
7421 image_error ("Invalid image size (see `max-image-size')", Qnil, Qnil); 7438 image_error ("Invalid image size (see `max-image-size')", Qnil, Qnil);
7422 fn_DGifCloseFile (gif); 7439 gif_close (gif, NULL);
7423 return 0; 7440 return 0;
7424 } 7441 }
7425 7442
@@ -7428,7 +7445,7 @@ gif_load (struct frame *f, struct image *img)
7428 if (rc == GIF_ERROR || gif->ImageCount <= 0) 7445 if (rc == GIF_ERROR || gif->ImageCount <= 0)
7429 { 7446 {
7430 image_error ("Error reading `%s'", img->spec, Qnil); 7447 image_error ("Error reading `%s'", img->spec, Qnil);
7431 fn_DGifCloseFile (gif); 7448 gif_close (gif, NULL);
7432 return 0; 7449 return 0;
7433 } 7450 }
7434 7451
@@ -7440,7 +7457,7 @@ gif_load (struct frame *f, struct image *img)
7440 { 7457 {
7441 image_error ("Invalid image number `%s' in image `%s'", 7458 image_error ("Invalid image number `%s' in image `%s'",
7442 image_number, img->spec); 7459 image_number, img->spec);
7443 fn_DGifCloseFile (gif); 7460 gif_close (gif, NULL);
7444 return 0; 7461 return 0;
7445 } 7462 }
7446 } 7463 }
@@ -7458,7 +7475,7 @@ gif_load (struct frame *f, struct image *img)
7458 if (!check_image_size (f, width, height)) 7475 if (!check_image_size (f, width, height))
7459 { 7476 {
7460 image_error ("Invalid image size (see `max-image-size')", Qnil, Qnil); 7477 image_error ("Invalid image size (see `max-image-size')", Qnil, Qnil);
7461 fn_DGifCloseFile (gif); 7478 gif_close (gif, NULL);
7462 return 0; 7479 return 0;
7463 } 7480 }
7464 7481
@@ -7476,7 +7493,7 @@ gif_load (struct frame *f, struct image *img)
7476 && 0 <= subimg_left && subimg_left <= width - subimg_width)) 7493 && 0 <= subimg_left && subimg_left <= width - subimg_width))
7477 { 7494 {
7478 image_error ("Subimage does not fit in image", Qnil, Qnil); 7495 image_error ("Subimage does not fit in image", Qnil, Qnil);
7479 fn_DGifCloseFile (gif); 7496 gif_close (gif, NULL);
7480 return 0; 7497 return 0;
7481 } 7498 }
7482 } 7499 }
@@ -7484,7 +7501,7 @@ gif_load (struct frame *f, struct image *img)
7484 /* Create the X image and pixmap. */ 7501 /* Create the X image and pixmap. */
7485 if (!image_create_x_image_and_pixmap (f, img, width, height, 0, &ximg, 0)) 7502 if (!image_create_x_image_and_pixmap (f, img, width, height, 0, &ximg, 0))
7486 { 7503 {
7487 fn_DGifCloseFile (gif); 7504 gif_close (gif, NULL);
7488 return 0; 7505 return 0;
7489 } 7506 }
7490 7507
@@ -7655,7 +7672,18 @@ gif_load (struct frame *f, struct image *img)
7655 Fcons (make_number (gif->ImageCount), 7672 Fcons (make_number (gif->ImageCount),
7656 img->lisp_data)); 7673 img->lisp_data));
7657 7674
7658 fn_DGifCloseFile (gif); 7675 if (gif_close (gif, &gif_err) == GIF_ERROR)
7676 {
7677#if 5 <= GIFLIB_MAJOR
7678 char *error_text = fn_GifErrorString (gif_err);
7679
7680 if (error_text)
7681 image_error ("Error closing `%s': %s",
7682 img->spec, build_string (error_text));
7683#else
7684 image_error ("Error closing `%s'", img->spec);
7685#endif
7686 }
7659 7687
7660 /* Maybe fill in the background field while we have ximg handy. */ 7688 /* Maybe fill in the background field while we have ximg handy. */
7661 if (NILP (image_spec_value (img->spec, QCbackground, NULL))) 7689 if (NILP (image_spec_value (img->spec, QCbackground, NULL)))