emacs-diffs
[Top][All Lists]
Advanced

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

[Emacs-diffs] /srv/bzr/emacs/emacs-23 r100339: Fix bug #7716 with PNG im


From: Eli Zaretskii
Subject: [Emacs-diffs] /srv/bzr/emacs/emacs-23 r100339: Fix bug #7716 with PNG image support libraries on Windows.
Date: Fri, 31 Dec 2010 14:38:06 +0200
User-agent: Bazaar (2.0.3)

------------------------------------------------------------
revno: 100339
committer: Eli Zaretskii <address@hidden>
branch nick: emacs-23
timestamp: Fri 2010-12-31 14:38:06 +0200
message:
  Fix bug #7716 with PNG image support libraries on Windows.
  
   src/image.c <Qlibpng_version>: New variable.
   (syms_of_image): Intern and staticpro it.  Set its value to the
   version of PNG library we were compiled with.
   (my_png_error, png_load): Avoid GCC warnings about direct access
   to png_ptr->jmpbuf.
   lisp/term/w32-win.el (image-library-alist): Set up correctly for
   libpng versions both before and after 1.4.0.
   admin/nt/README.W32: Update the information about PNG support libraries.
   nt/INSTALL: Update the information about PNG support libraries.
modified:
  admin/ChangeLog
  admin/nt/README.W32
  lisp/ChangeLog
  lisp/term/w32-win.el
  nt/ChangeLog
  nt/INSTALL
  src/ChangeLog
  src/image.c
=== modified file 'admin/ChangeLog'
--- a/admin/ChangeLog   2010-05-08 03:28:26 +0000
+++ b/admin/ChangeLog   2010-12-31 12:38:06 +0000
@@ -1,3 +1,8 @@
+2010-12-31  Eli Zaretskii  <address@hidden>
+
+       * nt/README.W32: Update the information about PNG support libraries.
+       (Bug#7716)
+
 2010-05-07  Chong Yidong  <address@hidden>
 
        * Version 23.2 released.

=== modified file 'admin/nt/README.W32'
--- a/admin/nt/README.W32       2010-01-13 08:35:10 +0000
+++ b/admin/nt/README.W32       2010-12-31 12:38:06 +0000
@@ -119,14 +119,19 @@
   libXpm library from X11R7.3.
 
   Emacs can also support some other image formats with appropriate
-  libraries.  These libraries are all available as part of GTK, or from
-  gnuwin32.sourceforge.net.  Emacs will find them if the directory they
-  are installed in is on the PATH.
+  libraries.  These libraries are all available as part of GTK
+  download for Windows (http://www.gtk.org/download-windows.html), or
+  from the GnuWin32 project.  Emacs will find them if the directory
+  they are installed in is on the PATH.
 
-      PNG: requires the PNG reference library 1.2 or later, which will
-      be named libpng13d.dll, libpng13.dll, libpng12d.dll, libpng12.dll
-      or libpng.dll.  LibPNG requires zlib, which should come from the same
-      source as you got libpng.
+      PNG: requires the PNG reference library 1.4 or later, which will
+      be named libpng14.dll or libpng14-14.dll.  LibPNG requires zlib,
+      which should come from the same source as you got libpng.
+      Starting with Emacs 23.3, the precompiled Emacs binaries are
+      built with libpng 1.4.x and later, and are incompatible with
+      earlier versions of libpng DLLs.  So if you have libpng 1.2.x,
+      the PNG support will not work, and you will have to download
+      newer versions.
 
       JPEG: requires the Independant JPEG Group's libjpeg 6b or later,
       which will be called jpeg62.dll, libjpeg.dll, jpeg-62.dll or jpeg.dll.
@@ -137,6 +142,9 @@
       GIF: requires libungif or giflib 4.1 or later, which will be
       called giflib4.dll, libungif4.dll or libungif.dll.
 
+   If you have image support DLLs under different names, customize the
+   value of `image-library-alist'.
+
    In addition, Emacs can be compiled to support SVG.  This precompiled
    distribution has not been compiled that way, since the SVG library
    or one or more of its extensive dependencies appear to be

=== modified file 'lisp/ChangeLog'
--- a/lisp/ChangeLog    2010-12-25 11:50:34 +0000
+++ b/lisp/ChangeLog    2010-12-31 12:38:06 +0000
@@ -1,3 +1,8 @@
+2010-12-31  Eli Zaretskii  <address@hidden>
+
+       * term/w32-win.el (image-library-alist): Set up correctly for
+       libpng versions both before and after 1.4.0.  (Bug#7716)
+
 2010-12-25  Eli Zaretskii  <address@hidden>
 
        * time.el (display-time-mode): Mention display-time-interval in

=== modified file 'lisp/term/w32-win.el'
--- a/lisp/term/w32-win.el      2010-01-13 08:35:10 +0000
+++ b/lisp/term/w32-win.el      2010-12-31 12:38:06 +0000
@@ -200,17 +200,25 @@
 
 ;;; Set default known names for image libraries
 (setq image-library-alist
-      '((xpm "libxpm.dll" "xpm4.dll" "libXpm-nox4.dll")
-        (png "libpng12d.dll" "libpng12.dll" "libpng.dll"
-        ;; these are libpng 1.2.8 from GTK+
-        "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")
-        (svg "librsvg-2-2.dll")
-        (gdk-pixbuf "libgdk_pixbuf-2.0-0.dll")
-        (glib "libglib-2.0-0.dll")
-       (gobject "libgobject-2.0-0.dll")))
+      (list
+       '(xpm "libxpm.dll" "xpm4.dll" "libXpm-nox4.dll")
+       ;; Versions of libpng 1.4.x and later are incompatible with
+       ;; earlier versions.  Set up the list of libraries according to
+       ;; the version we were compiled against.  (If we were compiled
+       ;; without PNG support, libpng-version's value is -1.)
+       (if (>= libpng-version 10400)
+          ;; libpng14-14.dll is libpng 1.4.3 from GTK+
+          '(png "libpng14-14.dll" "libpng14.dll")
+        '(png "libpng12d.dll" "libpng12.dll" "libpng3.dll" "libpng.dll"
+              ;; these are libpng 1.2.8 from GTK+
+              "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")
+        '(svg "librsvg-2-2.dll")
+        '(gdk-pixbuf "libgdk_pixbuf-2.0-0.dll")
+        '(glib "libglib-2.0-0.dll")
+       '(gobject "libgobject-2.0-0.dll")))
 
 ;;; multi-tty support
 (defvar w32-initialized nil

=== modified file 'nt/ChangeLog'
--- a/nt/ChangeLog      2010-08-02 19:35:28 +0000
+++ b/nt/ChangeLog      2010-12-31 12:38:06 +0000
@@ -1,3 +1,8 @@
+2010-12-31  Eli Zaretskii  <address@hidden>
+
+       * INSTALL: Update the information about PNG support libraries.
+       (Bug#7716)
+
 2010-08-02  Óscar Fuentes  <address@hidden>
 
        * cmdproxy.c (main): Use _snprintf instead of wsprintf,

=== modified file 'nt/INSTALL'
--- a/nt/INSTALL        2010-11-10 13:39:17 +0000
+++ b/nt/INSTALL        2010-12-31 12:38:06 +0000
@@ -279,6 +279,23 @@
   If GTK 2.0 is installed, addpm will arrange for its image libraries
   to be on the DLL search path for Emacs.
 
+  For PNG images, we recommend to use versions 1.4.x and later of
+  libpng, because previous versions had security issues.  You can find
+  precompiled libraries and headers on the GTK download page for
+  Windows (http://www.gtk.org/download-windows.html).
+
+  Versions 1.4.0 and later of libpng are binary incompatible with
+  earlier versions, so Emacs will only look for libpng libraries which
+  are compatible with the version it was compiled against.  That
+  version is given by the value of the Lisp variable `libpng-version';
+  e.g., 10403 means version 1.4.3.  The variable `image-library-alist'
+  is automatically set to name only those DLL names that are known to
+  be compatible with the version given by `libpng-version'.  If PNG
+  support does not work for you even though you have the support DLL
+  installed, check the name of the installed DLL against
+  `image-library-alist' and the value of `libpng-version', and
+  download compatible DLLs if needed.
+
 * Experimental SVG support
 
   SVG support is currently experimental, and not built by default.

=== modified file 'src/ChangeLog'
--- a/src/ChangeLog     2010-12-27 15:27:52 +0000
+++ b/src/ChangeLog     2010-12-31 12:38:06 +0000
@@ -1,3 +1,11 @@
+2010-12-31  Eli Zaretskii  <address@hidden>
+
+       * image.c <Qlibpng_version>: New variable.
+       (syms_of_image): Intern and staticpro it.  Set its value to the
+       version of PNG library we were compiled with.
+       (my_png_error, png_load): Avoid GCC warnings about direct access
+       to png_ptr->jmpbuf.  (Bug#7716)
+
 2010-12-27  Stefan Monnier  <address@hidden>
 
        * .gdbinit (xgetptr): Fix the union+lsb case.

=== modified file 'src/image.c'
--- a/src/image.c       2010-11-05 18:28:19 +0000
+++ b/src/image.c       2010-12-31 12:38:06 +0000
@@ -94,6 +94,11 @@
    without modifying lots of files).  */
 extern void x_query_colors (struct frame *f, XColor *colors, int ncolors);
 extern void x_query_color (struct frame *f, XColor *color);
+
+/* 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;
 #endif /* HAVE_NTGUI */
 
 #ifdef HAVE_NS
@@ -5652,8 +5657,15 @@
      char *msg;
 {
   xassert (png_ptr != NULL);
+  /* Avoid compiler warning about deprecated direct access to
+     png_ptr's fields in libpng versions 1.4.x.  */
   image_error ("PNG error: %s", build_string (msg), Qnil);
+#if PNG_LIBPNG_VER_MAJOR > 1                                   \
+  || (PNG_LIBPNG_VER_MAJOR == 1 && PNG_LIBPNG_VER_MINOR >= 4)
+  longjmp (png_jmpbuf (png_ptr), 1);
+#else
   longjmp (png_ptr->jmpbuf, 1);
+#endif
 }
 
 
@@ -5827,9 +5839,16 @@
       return 0;
     }
 
+  /* Avoid compiler warning about deprecated direct access to
+     png_ptr's fields in libpng versions 1.4.x.  */
+#if PNG_LIBPNG_VER_MAJOR > 1                                   \
+  || (PNG_LIBPNG_VER_MAJOR == 1 && PNG_LIBPNG_VER_MINOR >= 4)
   /* Set error jump-back.  We come back here when the PNG library
      detects an error.  */
+  if (setjmp (png_jmpbuf (png_ptr)))
+#else
   if (setjmp (png_ptr->jmpbuf))
+#endif
     {
     error:
       if (png_ptr)
@@ -8453,6 +8472,16 @@
   staticpro (&QCpt_height);
 #endif /* HAVE_GHOSTSCRIPT */
 
+#ifdef HAVE_NTGUI
+  Qlibpng_version = intern_c_string ("libpng-version");
+  staticpro (&Qlibpng_version);
+#if HAVE_PNG
+  SET_SYMBOL_VAL (XSYMBOL (Qlibpng_version), make_number (PNG_LIBPNG_VER));
+#else
+  SET_SYMBOL_VAL (XSYMBOL (Qlibpng_version), make_number (-1));
+#endif
+#endif
+
 #if defined (HAVE_XPM) || defined (HAVE_NS)
   Qxpm = intern_c_string ("xpm");
   staticpro (&Qxpm);


reply via email to

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