emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] trunk r114613: MS-Windows follow-up to revision 114603: su


From: Eli Zaretskii
Subject: [Emacs-diffs] trunk r114613: MS-Windows follow-up to revision 114603: support giflib 5.x.
Date: Thu, 10 Oct 2013 15:31:52 +0000
User-agent: Bazaar (2.6b2)

------------------------------------------------------------
revno: 114613
revision-id: address@hidden
parent: address@hidden
fixes bug: http://debbugs.gnu.org/15531
committer: Eli Zaretskii <address@hidden>
branch nick: trunk
timestamp: Thu 2013-10-10 18:30:21 +0300
message:
  MS-Windows follow-up to revision 114603: 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.
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    2013-10-10 14:59:09 +0000
+++ b/lisp/ChangeLog    2013-10-10 15:30:21 +0000
@@ -1,3 +1,9 @@
+2013-10-10  Eli Zaretskii  <address@hidden>
+
+       * 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 <address@hidden>
 
        * vc/vc.el (vc-diff-build-argument-list-internal): If the file is

=== modified file 'lisp/term/w32-win.el'
--- a/lisp/term/w32-win.el      2013-09-18 04:32:01 +0000
+++ b/lisp/term/w32-win.el      2013-10-10 15:30:21 +0000
@@ -223,7 +223,19 @@
               "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")

=== modified file 'src/ChangeLog'
--- a/src/ChangeLog     2013-10-10 10:06:17 +0000
+++ b/src/ChangeLog     2013-10-10 15:30:21 +0000
@@ -1,3 +1,13 @@
+2013-10-10  Eli Zaretskii  <address@hidden>
+
+       * 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  <address@hidden>
 
        * keyboard.c (last_event_timestamp): Remove.  For X selection and

=== modified file 'src/image.c'
--- a/src/image.c       2013-10-10 00:37:44 +0000
+++ b/src/image.c       2013-10-10 15:30:21 +0000
@@ -87,10 +87,11 @@
 #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 @@
 
 #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 @@
 #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 @@
   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 @@
 #define fn_DGifSlurp           DGifSlurp
 #define fn_DGifOpen            DGifOpen
 #define fn_DGifOpenFileName    DGifOpenFileName
+#define fn_GifErrorString      GifErrorString
 
 #endif /* WINDOWSNT */
 
@@ -7313,6 +7326,9 @@
   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 @@
       /* Open the GIF file.  */
 #if GIFLIB_MAJOR < 5
       gif = fn_DGifOpenFileName (SSDATA (file));
+      if (gif == NULL)
+       {
+         image_error ("Cannot open `%s'", file, Qnil);
+         return 0;
+       }
 #else
-      gif = fn_DGifOpenFileName (SSDATA (file), NULL);
+      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
-      if (gif == NULL)
-       {
-         image_error ("Cannot open `%s'", file, Qnil);
-         return 0;
-       }
     }
   else
     {
@@ -7351,14 +7373,20 @@
 
 #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. */
@@ -9372,6 +9400,16 @@
        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
 
   DEFSYM (Qpbm, "pbm");


reply via email to

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