emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] emacs-24 r117254: Fix bug #17790 with compilation against


From: Eli Zaretskii
Subject: [Emacs-diffs] emacs-24 r117254: Fix bug #17790 with compilation against giflib 5.1.0 and later.
Date: Wed, 18 Jun 2014 15:16:58 +0000
User-agent: Bazaar (2.6b2)

------------------------------------------------------------
revno: 117254
revision-id: address@hidden
parent: address@hidden
fixes bug: http://debbugs.gnu.org/17790
committer: Eli Zaretskii <address@hidden>
branch nick: emacs-24
timestamp: Wed 2014-06-18 18:15:52 +0300
message:
  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.
modified:
  lisp/ChangeLog                 changelog-20091113204419-o5vbwnq5f7feedwu-1432
  lisp/term/w32-win.el           w32win.el-20091113204419-o5vbwnq5f7feedwu-943
  src/ChangeLog                  changelog-20091113204419-o5vbwnq5f7feedwu-1438
  src/image.c                    image.c-20091113204419-o5vbwnq5f7feedwu-2969
=== modified file 'lisp/ChangeLog'
--- a/lisp/ChangeLog    2014-06-18 07:57:27 +0000
+++ b/lisp/ChangeLog    2014-06-18 15:15:52 +0000
@@ -1,3 +1,8 @@
+2014-06-18  Eli Zaretskii  <address@hidden>
+
+       * term/w32-win.el (dynamic-library-alist): Support giflib 5.1.0
+       and later.  (Bug#17790)
+
 2014-06-18  Juri Linkov  <address@hidden>
 
        * dired.el (dired-mark-pop-up): Let-bind display-buffer-mark-dedicated

=== modified file 'lisp/term/w32-win.el'
--- a/lisp/term/w32-win.el      2014-04-11 07:02:28 +0000
+++ b/lisp/term/w32-win.el      2014-06-18 15:15:52 +0000
@@ -251,13 +251,16 @@
        ;; 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"))
+       (if (>= libgif-version 50100)
+          ;; Yes, giflib 5.0 uses 6 as the major version of the API,
+          ;; and giflib 5.1 uses 7, thus "libgif-7.dll" and
+          ;; "libgif-6.dll" below (giflib 4.x used 5 as the major API
+          ;; version).  giflib5.dll is from the lua-files project,
+          ;; and gif.dll is from luapower.
+          '(gif "libgif-7.dll")
+        (if (>= libgif-version 50000)
+            '(gif "libgif-6.dll" "giflib5.dll" "gif.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")

=== modified file 'src/ChangeLog'
--- a/src/ChangeLog     2014-06-16 19:38:28 +0000
+++ b/src/ChangeLog     2014-06-18 15:15:52 +0000
@@ -1,3 +1,13 @@
+2014-06-18  Eli Zaretskii  <address@hidden>
+
+       * 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.  (Bug#17790)
+
 2014-06-16  Eli Zaretskii  <address@hidden>
 
        * xdisp.c (Fmove_point_visually): Instead of testing for keyboard

=== modified file 'src/image.c'
--- a/src/image.c       2014-05-04 18:51:32 +0000
+++ b/src/image.c       2014-06-18 15:15:52 +0000
@@ -7255,7 +7255,11 @@
 #ifdef WINDOWSNT
 
 /* GIF library details.  */
+#if 5 < GIFLIB_MAJOR + (1 <= GIFLIB_MINOR)
+DEF_IMGLIB_FN (int, DGifCloseFile, (GifFileType *, int *));
+#else
 DEF_IMGLIB_FN (int, DGifCloseFile, (GifFileType *));
+#endif
 DEF_IMGLIB_FN (int, DGifSlurp, (GifFileType *));
 #if GIFLIB_MAJOR < 5
 DEF_IMGLIB_FN (GifFileType *, DGifOpen, (void *, InputFunc));
@@ -7325,6 +7329,19 @@
   return len;
 }
 
+static int
+gif_close (GifFileType *gif, int *err)
+{
+  int retval;
+
+#if 5 < GIFLIB_MAJOR + (1 <= GIFLIB_MINOR)
+  retval = fn_DGifCloseFile (gif, err);
+#else
+  retval = fn_DGifCloseFile (gif);
+  if (err)
+    *err = gif->Error;
+#endif
+}
 
 /* Load GIF image IMG for use on frame F.  Value is true if
    successful.  */
@@ -7419,7 +7436,7 @@
   if (!check_image_size (f, gif->SWidth, gif->SHeight))
     {
       image_error ("Invalid image size (see `max-image-size')", Qnil, Qnil);
-      fn_DGifCloseFile (gif);
+      gif_close (gif, NULL);
       return 0;
     }
 
@@ -7428,7 +7445,7 @@
   if (rc == GIF_ERROR || gif->ImageCount <= 0)
     {
       image_error ("Error reading `%s'", img->spec, Qnil);
-      fn_DGifCloseFile (gif);
+      gif_close (gif, NULL);
       return 0;
     }
 
@@ -7440,7 +7457,7 @@
       {
        image_error ("Invalid image number `%s' in image `%s'",
                     image_number, img->spec);
-       fn_DGifCloseFile (gif);
+       gif_close (gif, NULL);
        return 0;
       }
   }
@@ -7458,7 +7475,7 @@
   if (!check_image_size (f, width, height))
     {
       image_error ("Invalid image size (see `max-image-size')", Qnil, Qnil);
-      fn_DGifCloseFile (gif);
+      gif_close (gif, NULL);
       return 0;
     }
 
@@ -7476,7 +7493,7 @@
             && 0 <= subimg_left && subimg_left <= width - subimg_width))
        {
          image_error ("Subimage does not fit in image", Qnil, Qnil);
-         fn_DGifCloseFile (gif);
+         gif_close (gif, NULL);
          return 0;
        }
     }
@@ -7484,7 +7501,7 @@
   /* Create the X image and pixmap.  */
   if (!image_create_x_image_and_pixmap (f, img, width, height, 0, &ximg, 0))
     {
-      fn_DGifCloseFile (gif);
+      gif_close (gif, NULL);
       return 0;
     }
 
@@ -7655,7 +7672,18 @@
                            Fcons (make_number (gif->ImageCount),
                                   img->lisp_data));
 
-  fn_DGifCloseFile (gif);
+  if (gif_close (gif, &gif_err) == GIF_ERROR)
+    {
+#if 5 <= GIFLIB_MAJOR
+      char *error_text = fn_GifErrorString (gif_err);
+
+      if (error_text)
+       image_error ("Error closing `%s': %s",
+                    img->spec, build_string (error_text));
+#else
+      image_error ("Error closing `%s'", img->spec);
+#endif
+    }
 
   /* Maybe fill in the background field while we have ximg handy. */
   if (NILP (image_spec_value (img->spec, QCbackground, NULL)))


reply via email to

[Prev in Thread] Current Thread [Next in Thread]