diff options
| author | Eli Zaretskii | 2010-12-31 14:38:06 +0200 |
|---|---|---|
| committer | Eli Zaretskii | 2010-12-31 14:38:06 +0200 |
| commit | 5be1c984b7839d528cf9e83c68b9055c29bed751 (patch) | |
| tree | bd7d1c8021a0f2b48edb6e58beb3ce195cbea162 | |
| parent | 89dc29d9c8e7957d047e9e9abe95334d70982814 (diff) | |
| download | emacs-5be1c984b7839d528cf9e83c68b9055c29bed751.tar.gz emacs-5be1c984b7839d528cf9e83c68b9055c29bed751.zip | |
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.
| -rw-r--r-- | admin/ChangeLog | 5 | ||||
| -rw-r--r-- | admin/nt/README.W32 | 24 | ||||
| -rw-r--r-- | lisp/ChangeLog | 5 | ||||
| -rw-r--r-- | lisp/term/w32-win.el | 30 | ||||
| -rw-r--r-- | nt/ChangeLog | 5 | ||||
| -rw-r--r-- | nt/INSTALL | 17 | ||||
| -rw-r--r-- | src/ChangeLog | 8 | ||||
| -rw-r--r-- | src/image.c | 29 |
8 files changed, 104 insertions, 19 deletions
diff --git a/admin/ChangeLog b/admin/ChangeLog index 56166ffa7ce..de3fc5f52d3 100644 --- a/admin/ChangeLog +++ b/admin/ChangeLog | |||
| @@ -1,3 +1,8 @@ | |||
| 1 | 2010-12-31 Eli Zaretskii <eliz@gnu.org> | ||
| 2 | |||
| 3 | * nt/README.W32: Update the information about PNG support libraries. | ||
| 4 | (Bug#7716) | ||
| 5 | |||
| 1 | 2010-05-07 Chong Yidong <cyd@stupidchicken.com> | 6 | 2010-05-07 Chong Yidong <cyd@stupidchicken.com> |
| 2 | 7 | ||
| 3 | * Version 23.2 released. | 8 | * Version 23.2 released. |
diff --git a/admin/nt/README.W32 b/admin/nt/README.W32 index 9f1df8abd3a..b8d2610b655 100644 --- a/admin/nt/README.W32 +++ b/admin/nt/README.W32 | |||
| @@ -119,14 +119,19 @@ See the end of the file for license conditions. | |||
| 119 | libXpm library from X11R7.3. | 119 | libXpm library from X11R7.3. |
| 120 | 120 | ||
| 121 | Emacs can also support some other image formats with appropriate | 121 | Emacs can also support some other image formats with appropriate |
| 122 | libraries. These libraries are all available as part of GTK, or from | 122 | libraries. These libraries are all available as part of GTK |
| 123 | gnuwin32.sourceforge.net. Emacs will find them if the directory they | 123 | download for Windows (http://www.gtk.org/download-windows.html), or |
| 124 | are installed in is on the PATH. | 124 | from the GnuWin32 project. Emacs will find them if the directory |
| 125 | 125 | they are installed in is on the PATH. | |
| 126 | PNG: requires the PNG reference library 1.2 or later, which will | 126 | |
| 127 | be named libpng13d.dll, libpng13.dll, libpng12d.dll, libpng12.dll | 127 | PNG: requires the PNG reference library 1.4 or later, which will |
| 128 | or libpng.dll. LibPNG requires zlib, which should come from the same | 128 | be named libpng14.dll or libpng14-14.dll. LibPNG requires zlib, |
| 129 | source as you got libpng. | 129 | which should come from the same source as you got libpng. |
| 130 | Starting with Emacs 23.3, the precompiled Emacs binaries are | ||
| 131 | built with libpng 1.4.x and later, and are incompatible with | ||
| 132 | earlier versions of libpng DLLs. So if you have libpng 1.2.x, | ||
| 133 | the PNG support will not work, and you will have to download | ||
| 134 | newer versions. | ||
| 130 | 135 | ||
| 131 | JPEG: requires the Independant JPEG Group's libjpeg 6b or later, | 136 | JPEG: requires the Independant JPEG Group's libjpeg 6b or later, |
| 132 | which will be called jpeg62.dll, libjpeg.dll, jpeg-62.dll or jpeg.dll. | 137 | which will be called jpeg62.dll, libjpeg.dll, jpeg-62.dll or jpeg.dll. |
| @@ -137,6 +142,9 @@ See the end of the file for license conditions. | |||
| 137 | GIF: requires libungif or giflib 4.1 or later, which will be | 142 | GIF: requires libungif or giflib 4.1 or later, which will be |
| 138 | called giflib4.dll, libungif4.dll or libungif.dll. | 143 | called giflib4.dll, libungif4.dll or libungif.dll. |
| 139 | 144 | ||
| 145 | If you have image support DLLs under different names, customize the | ||
| 146 | value of `image-library-alist'. | ||
| 147 | |||
| 140 | In addition, Emacs can be compiled to support SVG. This precompiled | 148 | In addition, Emacs can be compiled to support SVG. This precompiled |
| 141 | distribution has not been compiled that way, since the SVG library | 149 | distribution has not been compiled that way, since the SVG library |
| 142 | or one or more of its extensive dependencies appear to be | 150 | or one or more of its extensive dependencies appear to be |
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index dad4c68cffa..c38f6a87b14 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,3 +1,8 @@ | |||
| 1 | 2010-12-31 Eli Zaretskii <eliz@gnu.org> | ||
| 2 | |||
| 3 | * term/w32-win.el (image-library-alist): Set up correctly for | ||
| 4 | libpng versions both before and after 1.4.0. (Bug#7716) | ||
| 5 | |||
| 1 | 2010-12-25 Eli Zaretskii <eliz@gnu.org> | 6 | 2010-12-25 Eli Zaretskii <eliz@gnu.org> |
| 2 | 7 | ||
| 3 | * time.el (display-time-mode): Mention display-time-interval in | 8 | * time.el (display-time-mode): Mention display-time-interval in |
diff --git a/lisp/term/w32-win.el b/lisp/term/w32-win.el index 1779d1025e0..7bded5b8758 100644 --- a/lisp/term/w32-win.el +++ b/lisp/term/w32-win.el | |||
| @@ -200,17 +200,25 @@ See the documentation of `create-fontset-from-fontset-spec' for the format.") | |||
| 200 | 200 | ||
| 201 | ;;; Set default known names for image libraries | 201 | ;;; Set default known names for image libraries |
| 202 | (setq image-library-alist | 202 | (setq image-library-alist |
| 203 | '((xpm "libxpm.dll" "xpm4.dll" "libXpm-nox4.dll") | 203 | (list |
| 204 | (png "libpng12d.dll" "libpng12.dll" "libpng.dll" | 204 | '(xpm "libxpm.dll" "xpm4.dll" "libXpm-nox4.dll") |
| 205 | ;; these are libpng 1.2.8 from GTK+ | 205 | ;; Versions of libpng 1.4.x and later are incompatible with |
| 206 | "libpng13d.dll" "libpng13.dll") | 206 | ;; earlier versions. Set up the list of libraries according to |
| 207 | (jpeg "jpeg62.dll" "libjpeg.dll" "jpeg-62.dll" "jpeg.dll") | 207 | ;; the version we were compiled against. (If we were compiled |
| 208 | (tiff "libtiff3.dll" "libtiff.dll") | 208 | ;; without PNG support, libpng-version's value is -1.) |
| 209 | (gif "giflib4.dll" "libungif4.dll" "libungif.dll") | 209 | (if (>= libpng-version 10400) |
| 210 | (svg "librsvg-2-2.dll") | 210 | ;; libpng14-14.dll is libpng 1.4.3 from GTK+ |
| 211 | (gdk-pixbuf "libgdk_pixbuf-2.0-0.dll") | 211 | '(png "libpng14-14.dll" "libpng14.dll") |
| 212 | (glib "libglib-2.0-0.dll") | 212 | '(png "libpng12d.dll" "libpng12.dll" "libpng3.dll" "libpng.dll" |
| 213 | (gobject "libgobject-2.0-0.dll"))) | 213 | ;; these are libpng 1.2.8 from GTK+ |
| 214 | "libpng13d.dll" "libpng13.dll")) | ||
| 215 | '(jpeg "jpeg62.dll" "libjpeg.dll" "jpeg-62.dll" "jpeg.dll") | ||
| 216 | '(tiff "libtiff3.dll" "libtiff.dll") | ||
| 217 | '(gif "giflib4.dll" "libungif4.dll" "libungif.dll") | ||
| 218 | '(svg "librsvg-2-2.dll") | ||
| 219 | '(gdk-pixbuf "libgdk_pixbuf-2.0-0.dll") | ||
| 220 | '(glib "libglib-2.0-0.dll") | ||
| 221 | '(gobject "libgobject-2.0-0.dll"))) | ||
| 214 | 222 | ||
| 215 | ;;; multi-tty support | 223 | ;;; multi-tty support |
| 216 | (defvar w32-initialized nil | 224 | (defvar w32-initialized nil |
diff --git a/nt/ChangeLog b/nt/ChangeLog index 24b421b4567..5ff3362ef96 100644 --- a/nt/ChangeLog +++ b/nt/ChangeLog | |||
| @@ -1,3 +1,8 @@ | |||
| 1 | 2010-12-31 Eli Zaretskii <eliz@gnu.org> | ||
| 2 | |||
| 3 | * INSTALL: Update the information about PNG support libraries. | ||
| 4 | (Bug#7716) | ||
| 5 | |||
| 1 | 2010-08-02 Óscar Fuentes <ofv@wanadoo.es> | 6 | 2010-08-02 Óscar Fuentes <ofv@wanadoo.es> |
| 2 | 7 | ||
| 3 | * cmdproxy.c (main): Use _snprintf instead of wsprintf, | 8 | * cmdproxy.c (main): Use _snprintf instead of wsprintf, |
diff --git a/nt/INSTALL b/nt/INSTALL index 83986c4e7c2..fafa9a97b6a 100644 --- a/nt/INSTALL +++ b/nt/INSTALL | |||
| @@ -279,6 +279,23 @@ | |||
| 279 | If GTK 2.0 is installed, addpm will arrange for its image libraries | 279 | If GTK 2.0 is installed, addpm will arrange for its image libraries |
| 280 | to be on the DLL search path for Emacs. | 280 | to be on the DLL search path for Emacs. |
| 281 | 281 | ||
| 282 | For PNG images, we recommend to use versions 1.4.x and later of | ||
| 283 | libpng, because previous versions had security issues. You can find | ||
| 284 | precompiled libraries and headers on the GTK download page for | ||
| 285 | Windows (http://www.gtk.org/download-windows.html). | ||
| 286 | |||
| 287 | Versions 1.4.0 and later of libpng are binary incompatible with | ||
| 288 | earlier versions, so Emacs will only look for libpng libraries which | ||
| 289 | are compatible with the version it was compiled against. That | ||
| 290 | version is given by the value of the Lisp variable `libpng-version'; | ||
| 291 | e.g., 10403 means version 1.4.3. The variable `image-library-alist' | ||
| 292 | is automatically set to name only those DLL names that are known to | ||
| 293 | be compatible with the version given by `libpng-version'. If PNG | ||
| 294 | support does not work for you even though you have the support DLL | ||
| 295 | installed, check the name of the installed DLL against | ||
| 296 | `image-library-alist' and the value of `libpng-version', and | ||
| 297 | download compatible DLLs if needed. | ||
| 298 | |||
| 282 | * Experimental SVG support | 299 | * Experimental SVG support |
| 283 | 300 | ||
| 284 | SVG support is currently experimental, and not built by default. | 301 | SVG support is currently experimental, and not built by default. |
diff --git a/src/ChangeLog b/src/ChangeLog index b4bafbce1b3..19cf253db7e 100644 --- a/src/ChangeLog +++ b/src/ChangeLog | |||
| @@ -1,3 +1,11 @@ | |||
| 1 | 2010-12-31 Eli Zaretskii <eliz@gnu.org> | ||
| 2 | |||
| 3 | * image.c <Qlibpng_version>: New variable. | ||
| 4 | (syms_of_image): Intern and staticpro it. Set its value to the | ||
| 5 | version of PNG library we were compiled with. | ||
| 6 | (my_png_error, png_load): Avoid GCC warnings about direct access | ||
| 7 | to png_ptr->jmpbuf. (Bug#7716) | ||
| 8 | |||
| 1 | 2010-12-27 Stefan Monnier <monnier@iro.umontreal.ca> | 9 | 2010-12-27 Stefan Monnier <monnier@iro.umontreal.ca> |
| 2 | 10 | ||
| 3 | * .gdbinit (xgetptr): Fix the union+lsb case. | 11 | * .gdbinit (xgetptr): Fix the union+lsb case. |
diff --git a/src/image.c b/src/image.c index 0fa0a0cd064..8fce8489bf7 100644 --- a/src/image.c +++ b/src/image.c | |||
| @@ -94,6 +94,11 @@ typedef struct w32_bitmap_record Bitmap_Record; | |||
| 94 | without modifying lots of files). */ | 94 | without modifying lots of files). */ |
| 95 | extern void x_query_colors (struct frame *f, XColor *colors, int ncolors); | 95 | extern void x_query_colors (struct frame *f, XColor *colors, int ncolors); |
| 96 | extern void x_query_color (struct frame *f, XColor *color); | 96 | extern void x_query_color (struct frame *f, XColor *color); |
| 97 | |||
| 98 | /* Version of libpng that we were compiled with, or -1 if no PNG | ||
| 99 | support was compiled in. This is tested by w32-win.el to correctly | ||
| 100 | set up the alist used to search for PNG libraries. */ | ||
| 101 | Lisp_Object Qlibpng_version; | ||
| 97 | #endif /* HAVE_NTGUI */ | 102 | #endif /* HAVE_NTGUI */ |
| 98 | 103 | ||
| 99 | #ifdef HAVE_NS | 104 | #ifdef HAVE_NS |
| @@ -5652,8 +5657,15 @@ my_png_error (png_ptr, msg) | |||
| 5652 | char *msg; | 5657 | char *msg; |
| 5653 | { | 5658 | { |
| 5654 | xassert (png_ptr != NULL); | 5659 | xassert (png_ptr != NULL); |
| 5660 | /* Avoid compiler warning about deprecated direct access to | ||
| 5661 | png_ptr's fields in libpng versions 1.4.x. */ | ||
| 5655 | image_error ("PNG error: %s", build_string (msg), Qnil); | 5662 | image_error ("PNG error: %s", build_string (msg), Qnil); |
| 5663 | #if PNG_LIBPNG_VER_MAJOR > 1 \ | ||
| 5664 | || (PNG_LIBPNG_VER_MAJOR == 1 && PNG_LIBPNG_VER_MINOR >= 4) | ||
| 5665 | longjmp (png_jmpbuf (png_ptr), 1); | ||
| 5666 | #else | ||
| 5656 | longjmp (png_ptr->jmpbuf, 1); | 5667 | longjmp (png_ptr->jmpbuf, 1); |
| 5668 | #endif | ||
| 5657 | } | 5669 | } |
| 5658 | 5670 | ||
| 5659 | 5671 | ||
| @@ -5827,9 +5839,16 @@ png_load (f, img) | |||
| 5827 | return 0; | 5839 | return 0; |
| 5828 | } | 5840 | } |
| 5829 | 5841 | ||
| 5842 | /* Avoid compiler warning about deprecated direct access to | ||
| 5843 | png_ptr's fields in libpng versions 1.4.x. */ | ||
| 5844 | #if PNG_LIBPNG_VER_MAJOR > 1 \ | ||
| 5845 | || (PNG_LIBPNG_VER_MAJOR == 1 && PNG_LIBPNG_VER_MINOR >= 4) | ||
| 5830 | /* Set error jump-back. We come back here when the PNG library | 5846 | /* Set error jump-back. We come back here when the PNG library |
| 5831 | detects an error. */ | 5847 | detects an error. */ |
| 5848 | if (setjmp (png_jmpbuf (png_ptr))) | ||
| 5849 | #else | ||
| 5832 | if (setjmp (png_ptr->jmpbuf)) | 5850 | if (setjmp (png_ptr->jmpbuf)) |
| 5851 | #endif | ||
| 5833 | { | 5852 | { |
| 5834 | error: | 5853 | error: |
| 5835 | if (png_ptr) | 5854 | if (png_ptr) |
| @@ -8453,6 +8472,16 @@ non-numeric, there is no explicit limit on the size of images. */); | |||
| 8453 | staticpro (&QCpt_height); | 8472 | staticpro (&QCpt_height); |
| 8454 | #endif /* HAVE_GHOSTSCRIPT */ | 8473 | #endif /* HAVE_GHOSTSCRIPT */ |
| 8455 | 8474 | ||
| 8475 | #ifdef HAVE_NTGUI | ||
| 8476 | Qlibpng_version = intern_c_string ("libpng-version"); | ||
| 8477 | staticpro (&Qlibpng_version); | ||
| 8478 | #if HAVE_PNG | ||
| 8479 | SET_SYMBOL_VAL (XSYMBOL (Qlibpng_version), make_number (PNG_LIBPNG_VER)); | ||
| 8480 | #else | ||
| 8481 | SET_SYMBOL_VAL (XSYMBOL (Qlibpng_version), make_number (-1)); | ||
| 8482 | #endif | ||
| 8483 | #endif | ||
| 8484 | |||
| 8456 | #if defined (HAVE_XPM) || defined (HAVE_NS) | 8485 | #if defined (HAVE_XPM) || defined (HAVE_NS) |
| 8457 | Qxpm = intern_c_string ("xpm"); | 8486 | Qxpm = intern_c_string ("xpm"); |
| 8458 | staticpro (&Qxpm); | 8487 | staticpro (&Qxpm); |