aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorEli Zaretskii2013-10-10 18:30:21 +0300
committerEli Zaretskii2013-10-10 18:30:21 +0300
commita5dab1594a1bbd76ad7fe016268bb91007e5be39 (patch)
tree4bb93c7962e2084f7e09ff85621359a2335c9381 /src
parentdb1386987b5c2ccbfa28d4638b822afc5a8eedbb (diff)
downloademacs-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
Diffstat (limited to 'src')
-rw-r--r--src/ChangeLog10
-rw-r--r--src/image.c60
2 files changed, 59 insertions, 11 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index bdf3a9fb09f..40926622090 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,3 +1,13 @@
12013-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
12013-10-10 Dmitry Antipov <dmantipov@yandex.ru> 112013-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
93Lisp_Object Qlibpng_version; 93 image libraries. */
94Lisp_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
7235DEF_IMGLIB_FN (GifFileType *, DGifOpen, (void *, InputFunc, int *)); 7243DEF_IMGLIB_FN (GifFileType *, DGifOpen, (void *, InputFunc, int *));
7236DEF_IMGLIB_FN (GifFileType *, DGifOpenFileName, (const char *, int *)); 7244DEF_IMGLIB_FN (GifFileType *, DGifOpenFileName, (const char *, int *));
7245DEF_IMGLIB_FN (char *, GifErrorString, (int));
7237#endif 7246#endif
7238 7247
7239static bool 7248static 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");