diff options
| author | Eli Zaretskii | 2013-10-10 18:30:21 +0300 |
|---|---|---|
| committer | Eli Zaretskii | 2013-10-10 18:30:21 +0300 |
| commit | a5dab1594a1bbd76ad7fe016268bb91007e5be39 (patch) | |
| tree | 4bb93c7962e2084f7e09ff85621359a2335c9381 | |
| parent | db1386987b5c2ccbfa28d4638b822afc5a8eedbb (diff) | |
| download | emacs-a5dab1594a1bbd76ad7fe016268bb91007e5be39.tar.gz emacs-a5dab1594a1bbd76ad7fe016268bb91007e5be39.zip | |
MS-Windows follow-up to 2013-10-10T01:03:11Z!rgm@gnu.org: 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.
Fixes: debbugs:15531
| -rw-r--r-- | lisp/ChangeLog | 6 | ||||
| -rw-r--r-- | lisp/term/w32-win.el | 14 | ||||
| -rw-r--r-- | src/ChangeLog | 10 | ||||
| -rw-r--r-- | src/image.c | 60 |
4 files changed, 78 insertions, 12 deletions
diff --git a/lisp/ChangeLog b/lisp/ChangeLog index bb675ce5088..a06055ddb9b 100644 --- a/lisp/ChangeLog +++ b/lisp/ChangeLog | |||
| @@ -1,3 +1,9 @@ | |||
| 1 | 2013-10-10 Eli Zaretskii <eliz@gnu.org> | ||
| 2 | |||
| 3 | * term/w32-win.el (dynamic-library-alist): Define separate lists | ||
| 4 | of GIF DLLs for versions before and after 5.0.0 of giflib. | ||
| 5 | (Bug#15531) | ||
| 6 | |||
| 1 | 2013-10-10 João Távora <joaotavora@gmail.com> | 7 | 2013-10-10 João Távora <joaotavora@gmail.com> |
| 2 | 8 | ||
| 3 | * vc/vc.el (vc-diff-build-argument-list-internal): If the file is | 9 | * vc/vc.el (vc-diff-build-argument-list-internal): If the file is |
diff --git a/lisp/term/w32-win.el b/lisp/term/w32-win.el index 892ac9749d6..9690a5a7d75 100644 --- a/lisp/term/w32-win.el +++ b/lisp/term/w32-win.el | |||
| @@ -223,7 +223,19 @@ See the documentation of `create-fontset-from-fontset-spec' for the format.") | |||
| 223 | "libpng13d.dll" "libpng13.dll")) | 223 | "libpng13d.dll" "libpng13.dll")) |
| 224 | '(jpeg "jpeg62.dll" "libjpeg.dll" "jpeg-62.dll" "jpeg.dll") | 224 | '(jpeg "jpeg62.dll" "libjpeg.dll" "jpeg-62.dll" "jpeg.dll") |
| 225 | '(tiff "libtiff3.dll" "libtiff.dll") | 225 | '(tiff "libtiff3.dll" "libtiff.dll") |
| 226 | '(gif "giflib4.dll" "libungif4.dll" "libungif.dll") | 226 | ;; Versions of giflib 5.0.0 and later changed signatures of |
| 227 | ;; several functions used by Emacs, which makes those versions | ||
| 228 | ;; incompatible with previous ones. We select the correct | ||
| 229 | ;; libraries according to the version of giflib we were | ||
| 230 | ;; compiled against. (If we were compiled without GIF support, | ||
| 231 | ;; libgif-version's value is -1.) | ||
| 232 | (if (>= libgif-version 50000) | ||
| 233 | ;; Yes, giflib 5.x uses 6 as the major version of the API, | ||
| 234 | ;; thus "libgif-6.dll" below (giflib 4.x used 5 as the | ||
| 235 | ;; major API version). | ||
| 236 | ;; giflib5.dll is from the lua-files project. | ||
| 237 | '(gif "libgif-6.dll" "giflib5.dll") | ||
| 238 | '(gif "libgif-5.dll" "giflib4.dll" "libungif4.dll" "libungif.dll")) | ||
| 227 | '(svg "librsvg-2-2.dll") | 239 | '(svg "librsvg-2-2.dll") |
| 228 | '(gdk-pixbuf "libgdk_pixbuf-2.0-0.dll") | 240 | '(gdk-pixbuf "libgdk_pixbuf-2.0-0.dll") |
| 229 | '(glib "libglib-2.0-0.dll") | 241 | '(glib "libglib-2.0-0.dll") |
diff --git a/src/ChangeLog b/src/ChangeLog index bdf3a9fb09f..40926622090 100644 --- a/src/ChangeLog +++ b/src/ChangeLog | |||
| @@ -1,3 +1,13 @@ | |||
| 1 | 2013-10-10 Eli Zaretskii <eliz@gnu.org> | ||
| 2 | |||
| 3 | * image.c (GIFLIB_MAJOR): Define to 4 if undefined. | ||
| 4 | (GIFLIB_MINOR, GIFLIB_RELEASE): Define to zero if undefined. | ||
| 5 | (GifErrorString) [GIFLIB_MAJOR >= 5]: Define a function pointer. | ||
| 6 | (gif_load): For giflib v5.x and later, display the error message | ||
| 7 | produced by giflib when its functions fail. | ||
| 8 | (syms_of_image) <Qlibgif_version> [HAVE_NTGUI]: New DEFSYM. | ||
| 9 | (Bug#15531) | ||
| 10 | |||
| 1 | 2013-10-10 Dmitry Antipov <dmantipov@yandex.ru> | 11 | 2013-10-10 Dmitry Antipov <dmantipov@yandex.ru> |
| 2 | 12 | ||
| 3 | * keyboard.c (last_event_timestamp): Remove. For X selection and | 13 | * keyboard.c (last_event_timestamp): Remove. For X selection and |
diff --git a/src/image.c b/src/image.c index c414f5b91bd..86da6116533 100644 --- a/src/image.c +++ b/src/image.c | |||
| @@ -87,10 +87,11 @@ typedef struct w32_bitmap_record Bitmap_Record; | |||
| 87 | #define x_defined_color w32_defined_color | 87 | #define x_defined_color w32_defined_color |
| 88 | #define DefaultDepthOfScreen(screen) (one_w32_display_info.n_cbits) | 88 | #define DefaultDepthOfScreen(screen) (one_w32_display_info.n_cbits) |
| 89 | 89 | ||
| 90 | /* Version of libpng that we were compiled with, or -1 if no PNG | 90 | /* Versions of libpng and libgif that we were compiled with, or -1 if |
| 91 | support was compiled in. This is tested by w32-win.el to correctly | 91 | no PNG/GIF support was compiled in. This is tested by w32-win.el |
| 92 | set up the alist used to search for PNG libraries. */ | 92 | to correctly set up the alist used to search for the respective |
| 93 | Lisp_Object Qlibpng_version; | 93 | image libraries. */ |
| 94 | Lisp_Object Qlibpng_version, Qlibgif_version; | ||
| 94 | #endif /* HAVE_NTGUI */ | 95 | #endif /* HAVE_NTGUI */ |
| 95 | 96 | ||
| 96 | #ifdef HAVE_NS | 97 | #ifdef HAVE_NS |
| @@ -7219,8 +7220,15 @@ gif_image_p (Lisp_Object object) | |||
| 7219 | 7220 | ||
| 7220 | #endif /* HAVE_NTGUI */ | 7221 | #endif /* HAVE_NTGUI */ |
| 7221 | 7222 | ||
| 7223 | /* Giflib before 5.0 didn't define these macros. */ | ||
| 7222 | #ifndef GIFLIB_MAJOR | 7224 | #ifndef GIFLIB_MAJOR |
| 7223 | #define GIFLIB_MAJOR 0 | 7225 | #define GIFLIB_MAJOR 4 |
| 7226 | #endif | ||
| 7227 | #ifndef GIFLIB_MINOR | ||
| 7228 | #define GIFLIB_MINOR 0 | ||
| 7229 | #endif | ||
| 7230 | #ifndef GIFLIB_RELEASE | ||
| 7231 | #define GIFLIB_RELEASE 0 | ||
| 7224 | #endif | 7232 | #endif |
| 7225 | 7233 | ||
| 7226 | #ifdef WINDOWSNT | 7234 | #ifdef WINDOWSNT |
| @@ -7234,6 +7242,7 @@ DEF_IMGLIB_FN (GifFileType *, DGifOpenFileName, (const char *)); | |||
| 7234 | #else | 7242 | #else |
| 7235 | DEF_IMGLIB_FN (GifFileType *, DGifOpen, (void *, InputFunc, int *)); | 7243 | DEF_IMGLIB_FN (GifFileType *, DGifOpen, (void *, InputFunc, int *)); |
| 7236 | DEF_IMGLIB_FN (GifFileType *, DGifOpenFileName, (const char *, int *)); | 7244 | DEF_IMGLIB_FN (GifFileType *, DGifOpenFileName, (const char *, int *)); |
| 7245 | DEF_IMGLIB_FN (char *, GifErrorString, (int)); | ||
| 7237 | #endif | 7246 | #endif |
| 7238 | 7247 | ||
| 7239 | static bool | 7248 | static bool |
| @@ -7248,6 +7257,9 @@ init_gif_functions (void) | |||
| 7248 | LOAD_IMGLIB_FN (library, DGifSlurp); | 7257 | LOAD_IMGLIB_FN (library, DGifSlurp); |
| 7249 | LOAD_IMGLIB_FN (library, DGifOpen); | 7258 | LOAD_IMGLIB_FN (library, DGifOpen); |
| 7250 | LOAD_IMGLIB_FN (library, DGifOpenFileName); | 7259 | LOAD_IMGLIB_FN (library, DGifOpenFileName); |
| 7260 | #if GIFLIB_MAJOR >= 5 | ||
| 7261 | LOAD_IMGLIB_FN (library, GifErrorString); | ||
| 7262 | #endif | ||
| 7251 | return 1; | 7263 | return 1; |
| 7252 | } | 7264 | } |
| 7253 | 7265 | ||
| @@ -7257,6 +7269,7 @@ init_gif_functions (void) | |||
| 7257 | #define fn_DGifSlurp DGifSlurp | 7269 | #define fn_DGifSlurp DGifSlurp |
| 7258 | #define fn_DGifOpen DGifOpen | 7270 | #define fn_DGifOpen DGifOpen |
| 7259 | #define fn_DGifOpenFileName DGifOpenFileName | 7271 | #define fn_DGifOpenFileName DGifOpenFileName |
| 7272 | #define fn_GifErrorString GifErrorString | ||
| 7260 | 7273 | ||
| 7261 | #endif /* WINDOWSNT */ | 7274 | #endif /* WINDOWSNT */ |
| 7262 | 7275 | ||
| @@ -7313,6 +7326,9 @@ gif_load (struct frame *f, struct image *img) | |||
| 7313 | Lisp_Object specified_data = image_spec_value (img->spec, QCdata, NULL); | 7326 | Lisp_Object specified_data = image_spec_value (img->spec, QCdata, NULL); |
| 7314 | unsigned long bgcolor = 0; | 7327 | unsigned long bgcolor = 0; |
| 7315 | EMACS_INT idx; | 7328 | EMACS_INT idx; |
| 7329 | #if GIFLIB_MAJOR >= 5 | ||
| 7330 | int gif_err; | ||
| 7331 | #endif | ||
| 7316 | 7332 | ||
| 7317 | if (NILP (specified_data)) | 7333 | if (NILP (specified_data)) |
| 7318 | { | 7334 | { |
| @@ -7326,14 +7342,20 @@ gif_load (struct frame *f, struct image *img) | |||
| 7326 | /* Open the GIF file. */ | 7342 | /* Open the GIF file. */ |
| 7327 | #if GIFLIB_MAJOR < 5 | 7343 | #if GIFLIB_MAJOR < 5 |
| 7328 | gif = fn_DGifOpenFileName (SSDATA (file)); | 7344 | gif = fn_DGifOpenFileName (SSDATA (file)); |
| 7329 | #else | ||
| 7330 | gif = fn_DGifOpenFileName (SSDATA (file), NULL); | ||
| 7331 | #endif | ||
| 7332 | if (gif == NULL) | 7345 | if (gif == NULL) |
| 7333 | { | 7346 | { |
| 7334 | image_error ("Cannot open `%s'", file, Qnil); | 7347 | image_error ("Cannot open `%s'", file, Qnil); |
| 7335 | return 0; | 7348 | return 0; |
| 7336 | } | 7349 | } |
| 7350 | #else | ||
| 7351 | gif = fn_DGifOpenFileName (SSDATA (file), &gif_err); | ||
| 7352 | if (gif == NULL) | ||
| 7353 | { | ||
| 7354 | image_error ("Cannot open `%s': %s", | ||
| 7355 | file, build_string (fn_GifErrorString (gif_err))); | ||
| 7356 | return 0; | ||
| 7357 | } | ||
| 7358 | #endif | ||
| 7337 | } | 7359 | } |
| 7338 | else | 7360 | else |
| 7339 | { | 7361 | { |
| @@ -7351,14 +7373,20 @@ gif_load (struct frame *f, struct image *img) | |||
| 7351 | 7373 | ||
| 7352 | #if GIFLIB_MAJOR < 5 | 7374 | #if GIFLIB_MAJOR < 5 |
| 7353 | gif = fn_DGifOpen (&memsrc, gif_read_from_memory); | 7375 | gif = fn_DGifOpen (&memsrc, gif_read_from_memory); |
| 7354 | #else | ||
| 7355 | gif = fn_DGifOpen (&memsrc, gif_read_from_memory, NULL); | ||
| 7356 | #endif | ||
| 7357 | if (!gif) | 7376 | if (!gif) |
| 7358 | { | 7377 | { |
| 7359 | image_error ("Cannot open memory source `%s'", img->spec, Qnil); | 7378 | image_error ("Cannot open memory source `%s'", img->spec, Qnil); |
| 7360 | return 0; | 7379 | return 0; |
| 7361 | } | 7380 | } |
| 7381 | #else | ||
| 7382 | gif = fn_DGifOpen (&memsrc, gif_read_from_memory, &gif_err); | ||
| 7383 | if (!gif) | ||
| 7384 | { | ||
| 7385 | image_error ("Cannot open memory source `%s': %s", | ||
| 7386 | img->spec, build_string (fn_GifErrorString (gif_err))); | ||
| 7387 | return 0; | ||
| 7388 | } | ||
| 7389 | #endif | ||
| 7362 | } | 7390 | } |
| 7363 | 7391 | ||
| 7364 | /* Before reading entire contents, check the declared image size. */ | 7392 | /* Before reading entire contents, check the declared image size. */ |
| @@ -9372,6 +9400,16 @@ non-numeric, there is no explicit limit on the size of images. */); | |||
| 9372 | make_number (-1) | 9400 | make_number (-1) |
| 9373 | #endif | 9401 | #endif |
| 9374 | ); | 9402 | ); |
| 9403 | DEFSYM (Qlibgif_version, "libgif-version"); | ||
| 9404 | Fset (Qlibgif_version, | ||
| 9405 | #ifdef HAVE_GIF | ||
| 9406 | make_number (GIFLIB_MAJOR * 10000 | ||
| 9407 | + GIFLIB_MINOR * 100 | ||
| 9408 | + GIFLIB_RELEASE) | ||
| 9409 | #else | ||
| 9410 | make_number (-1) | ||
| 9411 | #endif | ||
| 9412 | ); | ||
| 9375 | #endif | 9413 | #endif |
| 9376 | 9414 | ||
| 9377 | DEFSYM (Qpbm, "pbm"); | 9415 | DEFSYM (Qpbm, "pbm"); |