diff options
| author | Chong Yidong | 2011-01-31 18:54:50 -0500 |
|---|---|---|
| committer | Chong Yidong | 2011-01-31 18:54:50 -0500 |
| commit | 14beddf4711854b01d400f36166dc71eb39435bb (patch) | |
| tree | 04fd96bb0f5dcf5f3aa4e9f39a537edc61038f83 /src/image.c | |
| parent | 2a4466ca2001c29fd654420b081b780981333dc5 (diff) | |
| parent | 113ef437f21c6ea1b65abe668feb86f1622a9f2e (diff) | |
| download | emacs-14beddf4711854b01d400f36166dc71eb39435bb.tar.gz emacs-14beddf4711854b01d400f36166dc71eb39435bb.zip | |
Merge changes from emacs-23 branch
Diffstat (limited to 'src/image.c')
| -rw-r--r-- | src/image.c | 220 |
1 files changed, 119 insertions, 101 deletions
diff --git a/src/image.c b/src/image.c index d533d7edee6..3b846bcc400 100644 --- a/src/image.c +++ b/src/image.c | |||
| @@ -1896,7 +1896,7 @@ mark_image_cache (struct image_cache *c) | |||
| 1896 | #ifdef HAVE_NTGUI | 1896 | #ifdef HAVE_NTGUI |
| 1897 | 1897 | ||
| 1898 | /* Macro for defining functions that will be loaded from image DLLs. */ | 1898 | /* Macro for defining functions that will be loaded from image DLLs. */ |
| 1899 | #define DEF_IMGLIB_FN(func,args) int (FAR CDECL *fn_##func)args | 1899 | #define DEF_IMGLIB_FN(rettype,func,args) rettype (FAR CDECL *fn_##func)args |
| 1900 | 1900 | ||
| 1901 | /* Macro for loading those image functions from the library. */ | 1901 | /* Macro for loading those image functions from the library. */ |
| 1902 | #define LOAD_IMGLIB_FN(lib,func) { \ | 1902 | #define LOAD_IMGLIB_FN(lib,func) { \ |
| @@ -3251,12 +3251,12 @@ xpm_free_colors (Display *dpy, Colormap cmap, Pixel *pixels, int npixels, void * | |||
| 3251 | 3251 | ||
| 3252 | /* XPM library details. */ | 3252 | /* XPM library details. */ |
| 3253 | 3253 | ||
| 3254 | DEF_IMGLIB_FN (XpmFreeAttributes, (XpmAttributes *)); | 3254 | DEF_IMGLIB_FN (void, XpmFreeAttributes, (XpmAttributes *)); |
| 3255 | DEF_IMGLIB_FN (XpmCreateImageFromBuffer, (Display *, char *, xpm_XImage **, | 3255 | DEF_IMGLIB_FN (int, XpmCreateImageFromBuffer, (Display *, char *, xpm_XImage **, |
| 3256 | xpm_XImage **, XpmAttributes *)); | 3256 | xpm_XImage **, XpmAttributes *)); |
| 3257 | DEF_IMGLIB_FN (XpmReadFileToImage, (Display *, char *, xpm_XImage **, | 3257 | DEF_IMGLIB_FN (int, XpmReadFileToImage, (Display *, char *, xpm_XImage **, |
| 3258 | xpm_XImage **, XpmAttributes *)); | 3258 | xpm_XImage **, XpmAttributes *)); |
| 3259 | DEF_IMGLIB_FN (XImageFree, (xpm_XImage *)); | 3259 | DEF_IMGLIB_FN (void, XImageFree, (xpm_XImage *)); |
| 3260 | 3260 | ||
| 3261 | static int | 3261 | static int |
| 3262 | init_xpm_functions (Lisp_Object libraries) | 3262 | init_xpm_functions (Lisp_Object libraries) |
| @@ -5419,31 +5419,36 @@ png_image_p (Lisp_Object object) | |||
| 5419 | #ifdef HAVE_NTGUI | 5419 | #ifdef HAVE_NTGUI |
| 5420 | /* PNG library details. */ | 5420 | /* PNG library details. */ |
| 5421 | 5421 | ||
| 5422 | DEF_IMGLIB_FN (png_get_io_ptr, (png_structp)); | 5422 | DEF_IMGLIB_FN (png_voidp, png_get_io_ptr, (png_structp)); |
| 5423 | DEF_IMGLIB_FN (png_sig_cmp, (png_bytep, png_size_t, png_size_t)); | 5423 | DEF_IMGLIB_FN (int, png_sig_cmp, (png_bytep, png_size_t, png_size_t)); |
| 5424 | DEF_IMGLIB_FN (png_create_read_struct, (png_const_charp, png_voidp, | 5424 | DEF_IMGLIB_FN (png_structp, png_create_read_struct, (png_const_charp, png_voidp, |
| 5425 | png_error_ptr, png_error_ptr)); | 5425 | png_error_ptr, png_error_ptr)); |
| 5426 | DEF_IMGLIB_FN (png_create_info_struct, (png_structp)); | 5426 | DEF_IMGLIB_FN (png_infop, png_create_info_struct, (png_structp)); |
| 5427 | DEF_IMGLIB_FN (png_destroy_read_struct, (png_structpp, png_infopp, png_infopp)); | 5427 | DEF_IMGLIB_FN (void, png_destroy_read_struct, (png_structpp, png_infopp, png_infopp)); |
| 5428 | DEF_IMGLIB_FN (png_set_read_fn, (png_structp, png_voidp, png_rw_ptr)); | 5428 | DEF_IMGLIB_FN (void, png_set_read_fn, (png_structp, png_voidp, png_rw_ptr)); |
| 5429 | DEF_IMGLIB_FN (png_set_sig_bytes, (png_structp, int)); | 5429 | DEF_IMGLIB_FN (void, png_set_sig_bytes, (png_structp, int)); |
| 5430 | DEF_IMGLIB_FN (png_read_info, (png_structp, png_infop)); | 5430 | DEF_IMGLIB_FN (void, png_read_info, (png_structp, png_infop)); |
| 5431 | DEF_IMGLIB_FN (png_get_IHDR, (png_structp, png_infop, | 5431 | DEF_IMGLIB_FN (png_uint_32, png_get_IHDR, (png_structp, png_infop, |
| 5432 | png_uint_32 *, png_uint_32 *, | 5432 | png_uint_32 *, png_uint_32 *, |
| 5433 | int *, int *, int *, int *, int *)); | 5433 | int *, int *, int *, int *, int *)); |
| 5434 | DEF_IMGLIB_FN (png_get_valid, (png_structp, png_infop, png_uint_32)); | 5434 | DEF_IMGLIB_FN (png_uint_32, png_get_valid, (png_structp, png_infop, png_uint_32)); |
| 5435 | DEF_IMGLIB_FN (png_set_strip_16, (png_structp)); | 5435 | DEF_IMGLIB_FN (void, png_set_strip_16, (png_structp)); |
| 5436 | DEF_IMGLIB_FN (png_set_expand, (png_structp)); | 5436 | DEF_IMGLIB_FN (void, png_set_expand, (png_structp)); |
| 5437 | DEF_IMGLIB_FN (png_set_gray_to_rgb, (png_structp)); | 5437 | DEF_IMGLIB_FN (void, png_set_gray_to_rgb, (png_structp)); |
| 5438 | DEF_IMGLIB_FN (png_set_background, (png_structp, png_color_16p, | 5438 | DEF_IMGLIB_FN (void, png_set_background, (png_structp, png_color_16p, |
| 5439 | int, int, double)); | 5439 | int, int, double)); |
| 5440 | DEF_IMGLIB_FN (png_get_bKGD, (png_structp, png_infop, png_color_16p *)); | 5440 | DEF_IMGLIB_FN (png_uint_32, png_get_bKGD, (png_structp, png_infop, png_color_16p *)); |
| 5441 | DEF_IMGLIB_FN (png_read_update_info, (png_structp, png_infop)); | 5441 | DEF_IMGLIB_FN (void, png_read_update_info, (png_structp, png_infop)); |
| 5442 | DEF_IMGLIB_FN (png_get_channels, (png_structp, png_infop)); | 5442 | DEF_IMGLIB_FN (png_byte, png_get_channels, (png_structp, png_infop)); |
| 5443 | DEF_IMGLIB_FN (png_get_rowbytes, (png_structp, png_infop)); | 5443 | DEF_IMGLIB_FN (png_size_t, png_get_rowbytes, (png_structp, png_infop)); |
| 5444 | DEF_IMGLIB_FN (png_read_image, (png_structp, png_bytepp)); | 5444 | DEF_IMGLIB_FN (void, png_read_image, (png_structp, png_bytepp)); |
| 5445 | DEF_IMGLIB_FN (png_read_end, (png_structp, png_infop)); | 5445 | DEF_IMGLIB_FN (void, png_read_end, (png_structp, png_infop)); |
| 5446 | DEF_IMGLIB_FN (png_error, (png_structp, png_const_charp)); | 5446 | DEF_IMGLIB_FN (void, png_error, (png_structp, png_const_charp)); |
| 5447 | |||
| 5448 | #if (PNG_LIBPNG_VER >= 10500) | ||
| 5449 | DEF_IMGLIB_FN (void, png_longjmp, (png_structp, int)); | ||
| 5450 | DEF_IMGLIB_FN (jmp_buf *, png_set_longjmp_fn, (png_structp, png_longjmp_ptr, size_t)); | ||
| 5451 | #endif /* libpng version >= 1.5 */ | ||
| 5447 | 5452 | ||
| 5448 | static int | 5453 | static int |
| 5449 | init_png_functions (Lisp_Object libraries) | 5454 | init_png_functions (Lisp_Object libraries) |
| @@ -5475,6 +5480,12 @@ init_png_functions (Lisp_Object libraries) | |||
| 5475 | LOAD_IMGLIB_FN (library, png_read_image); | 5480 | LOAD_IMGLIB_FN (library, png_read_image); |
| 5476 | LOAD_IMGLIB_FN (library, png_read_end); | 5481 | LOAD_IMGLIB_FN (library, png_read_end); |
| 5477 | LOAD_IMGLIB_FN (library, png_error); | 5482 | LOAD_IMGLIB_FN (library, png_error); |
| 5483 | |||
| 5484 | #if (PNG_LIBPNG_VER >= 10500) | ||
| 5485 | LOAD_IMGLIB_FN (library, png_longjmp); | ||
| 5486 | LOAD_IMGLIB_FN (library, png_set_longjmp_fn); | ||
| 5487 | #endif /* libpng version >= 1.5 */ | ||
| 5488 | |||
| 5478 | return 1; | 5489 | return 1; |
| 5479 | } | 5490 | } |
| 5480 | #else | 5491 | #else |
| @@ -5501,8 +5512,24 @@ init_png_functions (Lisp_Object libraries) | |||
| 5501 | #define fn_png_read_end png_read_end | 5512 | #define fn_png_read_end png_read_end |
| 5502 | #define fn_png_error png_error | 5513 | #define fn_png_error png_error |
| 5503 | 5514 | ||
| 5515 | #if (PNG_LIBPNG_VER >= 10500) | ||
| 5516 | #define fn_png_longjmp png_longjmp | ||
| 5517 | #define fn_png_set_longjmp_fn png_set_longjmp_fn | ||
| 5518 | #endif /* libpng version >= 1.5 */ | ||
| 5519 | |||
| 5504 | #endif /* HAVE_NTGUI */ | 5520 | #endif /* HAVE_NTGUI */ |
| 5505 | 5521 | ||
| 5522 | |||
| 5523 | #if (PNG_LIBPNG_VER < 10500) | ||
| 5524 | #define PNG_LONGJMP(ptr) (longjmp ((ptr)->jmpbuf, 1)) | ||
| 5525 | #define PNG_JMPBUF(ptr) ((ptr)->jmpbuf) | ||
| 5526 | #else | ||
| 5527 | /* In libpng version 1.5, the jmpbuf member is hidden. (Bug#7908) */ | ||
| 5528 | #define PNG_LONGJMP(ptr) (fn_png_longjmp ((ptr), 1)) | ||
| 5529 | #define PNG_JMPBUF(ptr) \ | ||
| 5530 | (*fn_png_set_longjmp_fn((ptr), longjmp, sizeof (jmp_buf))) | ||
| 5531 | #endif | ||
| 5532 | |||
| 5506 | /* Error and warning handlers installed when the PNG library | 5533 | /* Error and warning handlers installed when the PNG library |
| 5507 | is initialized. */ | 5534 | is initialized. */ |
| 5508 | 5535 | ||
| @@ -5513,7 +5540,7 @@ my_png_error (png_struct *png_ptr, const char *msg) | |||
| 5513 | /* Avoid compiler warning about deprecated direct access to | 5540 | /* Avoid compiler warning about deprecated direct access to |
| 5514 | png_ptr's fields in libpng versions 1.4.x. */ | 5541 | png_ptr's fields in libpng versions 1.4.x. */ |
| 5515 | image_error ("PNG error: %s", build_string (msg), Qnil); | 5542 | image_error ("PNG error: %s", build_string (msg), Qnil); |
| 5516 | longjmp (png_ptr->jmpbuf, 1); | 5543 | PNG_LONGJMP (png_ptr); |
| 5517 | } | 5544 | } |
| 5518 | 5545 | ||
| 5519 | 5546 | ||
| @@ -5644,19 +5671,17 @@ png_load (struct frame *f, struct image *img) | |||
| 5644 | tbr.bytes += sizeof (sig); | 5671 | tbr.bytes += sizeof (sig); |
| 5645 | } | 5672 | } |
| 5646 | 5673 | ||
| 5647 | /* Initialize read and info structs for PNG lib. Casting return | 5674 | /* Initialize read and info structs for PNG lib. */ |
| 5648 | value avoids a GCC warning on W32. */ | 5675 | png_ptr = fn_png_create_read_struct (PNG_LIBPNG_VER_STRING, |
| 5649 | png_ptr = (png_structp)fn_png_create_read_struct (PNG_LIBPNG_VER_STRING, | 5676 | NULL, my_png_error, |
| 5650 | NULL, my_png_error, | 5677 | my_png_warning); |
| 5651 | my_png_warning); | ||
| 5652 | if (!png_ptr) | 5678 | if (!png_ptr) |
| 5653 | { | 5679 | { |
| 5654 | if (fp) fclose (fp); | 5680 | if (fp) fclose (fp); |
| 5655 | return 0; | 5681 | return 0; |
| 5656 | } | 5682 | } |
| 5657 | 5683 | ||
| 5658 | /* Casting return value avoids a GCC warning on W32. */ | 5684 | info_ptr = fn_png_create_info_struct (png_ptr); |
| 5659 | info_ptr = (png_infop)fn_png_create_info_struct (png_ptr); | ||
| 5660 | if (!info_ptr) | 5685 | if (!info_ptr) |
| 5661 | { | 5686 | { |
| 5662 | fn_png_destroy_read_struct (&png_ptr, NULL, NULL); | 5687 | fn_png_destroy_read_struct (&png_ptr, NULL, NULL); |
| @@ -5664,8 +5689,7 @@ png_load (struct frame *f, struct image *img) | |||
| 5664 | return 0; | 5689 | return 0; |
| 5665 | } | 5690 | } |
| 5666 | 5691 | ||
| 5667 | /* Casting return value avoids a GCC warning on W32. */ | 5692 | end_info = fn_png_create_info_struct (png_ptr); |
| 5668 | end_info = (png_infop)fn_png_create_info_struct (png_ptr); | ||
| 5669 | if (!end_info) | 5693 | if (!end_info) |
| 5670 | { | 5694 | { |
| 5671 | fn_png_destroy_read_struct (&png_ptr, &info_ptr, NULL); | 5695 | fn_png_destroy_read_struct (&png_ptr, &info_ptr, NULL); |
| @@ -5675,7 +5699,7 @@ png_load (struct frame *f, struct image *img) | |||
| 5675 | 5699 | ||
| 5676 | /* Set error jump-back. We come back here when the PNG library | 5700 | /* Set error jump-back. We come back here when the PNG library |
| 5677 | detects an error. */ | 5701 | detects an error. */ |
| 5678 | if (setjmp (png_ptr->jmpbuf)) | 5702 | if (setjmp (PNG_JMPBUF (png_ptr))) |
| 5679 | { | 5703 | { |
| 5680 | error: | 5704 | error: |
| 5681 | if (png_ptr) | 5705 | if (png_ptr) |
| @@ -6028,14 +6052,14 @@ jpeg_image_p (Lisp_Object object) | |||
| 6028 | #ifdef HAVE_NTGUI | 6052 | #ifdef HAVE_NTGUI |
| 6029 | 6053 | ||
| 6030 | /* JPEG library details. */ | 6054 | /* JPEG library details. */ |
| 6031 | DEF_IMGLIB_FN (jpeg_CreateDecompress, (j_decompress_ptr, int, size_t)); | 6055 | DEF_IMGLIB_FN (void, jpeg_CreateDecompress, (j_decompress_ptr, int, size_t)); |
| 6032 | DEF_IMGLIB_FN (jpeg_start_decompress, (j_decompress_ptr)); | 6056 | DEF_IMGLIB_FN (boolean, jpeg_start_decompress, (j_decompress_ptr)); |
| 6033 | DEF_IMGLIB_FN (jpeg_finish_decompress, (j_decompress_ptr)); | 6057 | DEF_IMGLIB_FN (boolean, jpeg_finish_decompress, (j_decompress_ptr)); |
| 6034 | DEF_IMGLIB_FN (jpeg_destroy_decompress, (j_decompress_ptr)); | 6058 | DEF_IMGLIB_FN (void, jpeg_destroy_decompress, (j_decompress_ptr)); |
| 6035 | DEF_IMGLIB_FN (jpeg_read_header, (j_decompress_ptr, boolean)); | 6059 | DEF_IMGLIB_FN (int, jpeg_read_header, (j_decompress_ptr, boolean)); |
| 6036 | DEF_IMGLIB_FN (jpeg_read_scanlines, (j_decompress_ptr, JSAMPARRAY, JDIMENSION)); | 6060 | DEF_IMGLIB_FN (JDIMENSION, jpeg_read_scanlines, (j_decompress_ptr, JSAMPARRAY, JDIMENSION)); |
| 6037 | DEF_IMGLIB_FN (jpeg_std_error, (struct jpeg_error_mgr *)); | 6061 | DEF_IMGLIB_FN (struct jpeg_error_mgr *, jpeg_std_error, (struct jpeg_error_mgr *)); |
| 6038 | DEF_IMGLIB_FN (jpeg_resync_to_restart, (j_decompress_ptr, int)); | 6062 | DEF_IMGLIB_FN (boolean, jpeg_resync_to_restart, (j_decompress_ptr, int)); |
| 6039 | 6063 | ||
| 6040 | static int | 6064 | static int |
| 6041 | init_jpeg_functions (Lisp_Object libraries) | 6065 | init_jpeg_functions (Lisp_Object libraries) |
| @@ -6335,9 +6359,8 @@ jpeg_load (struct frame *f, struct image *img) | |||
| 6335 | } | 6359 | } |
| 6336 | 6360 | ||
| 6337 | /* Customize libjpeg's error handling to call my_error_exit when an | 6361 | /* Customize libjpeg's error handling to call my_error_exit when an |
| 6338 | error is detected. This function will perform a longjmp. | 6362 | error is detected. This function will perform a longjmp. */ |
| 6339 | Casting return value avoids a GCC warning on W32. */ | 6363 | cinfo.err = fn_jpeg_std_error (&mgr.pub); |
| 6340 | cinfo.err = (struct jpeg_error_mgr *)fn_jpeg_std_error (&mgr.pub); | ||
| 6341 | mgr.pub.error_exit = my_error_exit; | 6364 | mgr.pub.error_exit = my_error_exit; |
| 6342 | 6365 | ||
| 6343 | if ((rc = setjmp (mgr.setjmp_buffer)) != 0) | 6366 | if ((rc = setjmp (mgr.setjmp_buffer)) != 0) |
| @@ -6561,17 +6584,17 @@ tiff_image_p (Lisp_Object object) | |||
| 6561 | #ifdef HAVE_NTGUI | 6584 | #ifdef HAVE_NTGUI |
| 6562 | 6585 | ||
| 6563 | /* TIFF library details. */ | 6586 | /* TIFF library details. */ |
| 6564 | DEF_IMGLIB_FN (TIFFSetErrorHandler, (TIFFErrorHandler)); | 6587 | DEF_IMGLIB_FN (TIFFErrorHandler, TIFFSetErrorHandler, (TIFFErrorHandler)); |
| 6565 | DEF_IMGLIB_FN (TIFFSetWarningHandler, (TIFFErrorHandler)); | 6588 | DEF_IMGLIB_FN (TIFFErrorHandler, TIFFSetWarningHandler, (TIFFErrorHandler)); |
| 6566 | DEF_IMGLIB_FN (TIFFOpen, (const char *, const char *)); | 6589 | DEF_IMGLIB_FN (TIFF *, TIFFOpen, (const char *, const char *)); |
| 6567 | DEF_IMGLIB_FN (TIFFClientOpen, (const char *, const char *, thandle_t, | 6590 | DEF_IMGLIB_FN (TIFF *, TIFFClientOpen, (const char *, const char *, thandle_t, |
| 6568 | TIFFReadWriteProc, TIFFReadWriteProc, | 6591 | TIFFReadWriteProc, TIFFReadWriteProc, |
| 6569 | TIFFSeekProc, TIFFCloseProc, TIFFSizeProc, | 6592 | TIFFSeekProc, TIFFCloseProc, TIFFSizeProc, |
| 6570 | TIFFMapFileProc, TIFFUnmapFileProc)); | 6593 | TIFFMapFileProc, TIFFUnmapFileProc)); |
| 6571 | DEF_IMGLIB_FN (TIFFGetField, (TIFF *, ttag_t, ...)); | 6594 | DEF_IMGLIB_FN (int, TIFFGetField, (TIFF *, ttag_t, ...)); |
| 6572 | DEF_IMGLIB_FN (TIFFReadRGBAImage, (TIFF *, uint32, uint32, uint32 *, int)); | 6595 | DEF_IMGLIB_FN (int, TIFFReadRGBAImage, (TIFF *, uint32, uint32, uint32 *, int)); |
| 6573 | DEF_IMGLIB_FN (TIFFClose, (TIFF *)); | 6596 | DEF_IMGLIB_FN (void, TIFFClose, (TIFF *)); |
| 6574 | DEF_IMGLIB_FN (TIFFSetDirectory, (TIFF *, tdir_t)); | 6597 | DEF_IMGLIB_FN (int, TIFFSetDirectory, (TIFF *, tdir_t)); |
| 6575 | 6598 | ||
| 6576 | static int | 6599 | static int |
| 6577 | init_tiff_functions (Lisp_Object libraries) | 6600 | init_tiff_functions (Lisp_Object libraries) |
| @@ -6754,9 +6777,8 @@ tiff_load (struct frame *f, struct image *img) | |||
| 6754 | return 0; | 6777 | return 0; |
| 6755 | } | 6778 | } |
| 6756 | 6779 | ||
| 6757 | /* Try to open the image file. Casting return value avoids a | 6780 | /* Try to open the image file. */ |
| 6758 | GCC warning on W32. */ | 6781 | tiff = fn_TIFFOpen (SDATA (file), "r"); |
| 6759 | tiff = (TIFF *)fn_TIFFOpen (SSDATA (file), "r"); | ||
| 6760 | if (tiff == NULL) | 6782 | if (tiff == NULL) |
| 6761 | { | 6783 | { |
| 6762 | image_error ("Cannot open `%s'", file, Qnil); | 6784 | image_error ("Cannot open `%s'", file, Qnil); |
| @@ -6776,16 +6798,14 @@ tiff_load (struct frame *f, struct image *img) | |||
| 6776 | memsrc.len = SBYTES (specified_data); | 6798 | memsrc.len = SBYTES (specified_data); |
| 6777 | memsrc.index = 0; | 6799 | memsrc.index = 0; |
| 6778 | 6800 | ||
| 6779 | /* Casting arguments return value avoids a GCC warning on W32. */ | 6801 | tiff = fn_TIFFClientOpen ("memory_source", "r", &memsrc, |
| 6780 | tiff = (TIFF *)fn_TIFFClientOpen ("memory_source", "r", | 6802 | (TIFFReadWriteProc) tiff_read_from_memory, |
| 6781 | (thandle_t) &memsrc, | 6803 | (TIFFReadWriteProc) tiff_write_from_memory, |
| 6782 | (TIFFReadWriteProc) tiff_read_from_memory, | 6804 | tiff_seek_in_memory, |
| 6783 | (TIFFReadWriteProc) tiff_write_from_memory, | 6805 | tiff_close_memory, |
| 6784 | tiff_seek_in_memory, | 6806 | tiff_size_of_memory, |
| 6785 | tiff_close_memory, | 6807 | tiff_mmap_memory, |
| 6786 | tiff_size_of_memory, | 6808 | tiff_unmap_memory); |
| 6787 | tiff_mmap_memory, | ||
| 6788 | tiff_unmap_memory); | ||
| 6789 | 6809 | ||
| 6790 | if (!tiff) | 6810 | if (!tiff) |
| 6791 | { | 6811 | { |
| @@ -7014,10 +7034,10 @@ gif_image_p (Lisp_Object object) | |||
| 7014 | #ifdef HAVE_NTGUI | 7034 | #ifdef HAVE_NTGUI |
| 7015 | 7035 | ||
| 7016 | /* GIF library details. */ | 7036 | /* GIF library details. */ |
| 7017 | DEF_IMGLIB_FN (DGifCloseFile, (GifFileType *)); | 7037 | DEF_IMGLIB_FN (int, DGifCloseFile, (GifFileType *)); |
| 7018 | DEF_IMGLIB_FN (DGifSlurp, (GifFileType *)); | 7038 | DEF_IMGLIB_FN (int, DGifSlurp, (GifFileType *)); |
| 7019 | DEF_IMGLIB_FN (DGifOpen, (void *, InputFunc)); | 7039 | DEF_IMGLIB_FN (GifFileType *, DGifOpen, (void *, InputFunc)); |
| 7020 | DEF_IMGLIB_FN (DGifOpenFileName, (const char *)); | 7040 | DEF_IMGLIB_FN (GifFileType *, DGifOpenFileName, (const char *)); |
| 7021 | 7041 | ||
| 7022 | static int | 7042 | static int |
| 7023 | init_gif_functions (Lisp_Object libraries) | 7043 | init_gif_functions (Lisp_Object libraries) |
| @@ -7110,9 +7130,8 @@ gif_load (struct frame *f, struct image *img) | |||
| 7110 | return 0; | 7130 | return 0; |
| 7111 | } | 7131 | } |
| 7112 | 7132 | ||
| 7113 | /* Open the GIF file. Casting return value avoids a GCC warning | 7133 | /* Open the GIF file. */ |
| 7114 | on W32. */ | 7134 | gif = fn_DGifOpenFileName (SDATA (file)); |
| 7115 | gif = (GifFileType *)fn_DGifOpenFileName (SDATA (file)); | ||
| 7116 | if (gif == NULL) | 7135 | if (gif == NULL) |
| 7117 | { | 7136 | { |
| 7118 | image_error ("Cannot open `%s'", file, Qnil); | 7137 | image_error ("Cannot open `%s'", file, Qnil); |
| @@ -7133,8 +7152,7 @@ gif_load (struct frame *f, struct image *img) | |||
| 7133 | memsrc.len = SBYTES (specified_data); | 7152 | memsrc.len = SBYTES (specified_data); |
| 7134 | memsrc.index = 0; | 7153 | memsrc.index = 0; |
| 7135 | 7154 | ||
| 7136 | /* Casting return value avoids a GCC warning on W32. */ | 7155 | gif = fn_DGifOpen (&memsrc, gif_read_from_memory); |
| 7137 | gif = (GifFileType *) fn_DGifOpen (&memsrc, gif_read_from_memory); | ||
| 7138 | if (!gif) | 7156 | if (!gif) |
| 7139 | { | 7157 | { |
| 7140 | image_error ("Cannot open memory source `%s'", img->spec, Qnil); | 7158 | image_error ("Cannot open memory source `%s'", img->spec, Qnil); |
| @@ -7982,25 +8000,25 @@ svg_image_p (Lisp_Object object) | |||
| 7982 | #ifdef HAVE_NTGUI | 8000 | #ifdef HAVE_NTGUI |
| 7983 | 8001 | ||
| 7984 | /* SVG library functions. */ | 8002 | /* SVG library functions. */ |
| 7985 | DEF_IMGLIB_FN (rsvg_handle_new); | 8003 | DEF_IMGLIB_FN (RsvgHandle *, rsvg_handle_new); |
| 7986 | DEF_IMGLIB_FN (rsvg_handle_get_dimensions); | 8004 | DEF_IMGLIB_FN (void, rsvg_handle_get_dimensions); |
| 7987 | DEF_IMGLIB_FN (rsvg_handle_write); | 8005 | DEF_IMGLIB_FN (gboolean, rsvg_handle_write); |
| 7988 | DEF_IMGLIB_FN (rsvg_handle_close); | 8006 | DEF_IMGLIB_FN (gboolean, rsvg_handle_close); |
| 7989 | DEF_IMGLIB_FN (rsvg_handle_get_pixbuf); | 8007 | DEF_IMGLIB_FN (GdkPixbuf *, rsvg_handle_get_pixbuf); |
| 7990 | DEF_IMGLIB_FN (rsvg_handle_free); | 8008 | DEF_IMGLIB_FN (void, rsvg_handle_free); |
| 7991 | 8009 | ||
| 7992 | DEF_IMGLIB_FN (gdk_pixbuf_get_width); | 8010 | DEF_IMGLIB_FN (int, gdk_pixbuf_get_width); |
| 7993 | DEF_IMGLIB_FN (gdk_pixbuf_get_height); | 8011 | DEF_IMGLIB_FN (int, gdk_pixbuf_get_height); |
| 7994 | DEF_IMGLIB_FN (gdk_pixbuf_get_pixels); | 8012 | DEF_IMGLIB_FN (guchar *, gdk_pixbuf_get_pixels); |
| 7995 | DEF_IMGLIB_FN (gdk_pixbuf_get_rowstride); | 8013 | DEF_IMGLIB_FN (int, gdk_pixbuf_get_rowstride); |
| 7996 | DEF_IMGLIB_FN (gdk_pixbuf_get_colorspace); | 8014 | DEF_IMGLIB_FN (GdkColorspace, gdk_pixbuf_get_colorspace); |
| 7997 | DEF_IMGLIB_FN (gdk_pixbuf_get_n_channels); | 8015 | DEF_IMGLIB_FN (int, gdk_pixbuf_get_n_channels); |
| 7998 | DEF_IMGLIB_FN (gdk_pixbuf_get_has_alpha); | 8016 | DEF_IMGLIB_FN (gboolean, gdk_pixbuf_get_has_alpha); |
| 7999 | DEF_IMGLIB_FN (gdk_pixbuf_get_bits_per_sample); | 8017 | DEF_IMGLIB_FN (int, gdk_pixbuf_get_bits_per_sample); |
| 8000 | 8018 | ||
| 8001 | DEF_IMGLIB_FN (g_type_init); | 8019 | DEF_IMGLIB_FN (void, g_type_init); |
| 8002 | DEF_IMGLIB_FN (g_object_unref); | 8020 | DEF_IMGLIB_FN (void, g_object_unref); |
| 8003 | DEF_IMGLIB_FN (g_error_free); | 8021 | DEF_IMGLIB_FN (void, g_error_free); |
| 8004 | 8022 | ||
| 8005 | Lisp_Object Qgdk_pixbuf, Qglib, Qgobject; | 8023 | Lisp_Object Qgdk_pixbuf, Qglib, Qgobject; |
| 8006 | 8024 | ||
| @@ -8147,7 +8165,7 @@ svg_load_image (struct frame *f, /* Pointer to emacs frame structure. * | |||
| 8147 | gnome type library functions. */ | 8165 | gnome type library functions. */ |
| 8148 | fn_g_type_init (); | 8166 | fn_g_type_init (); |
| 8149 | /* Make a handle to a new rsvg object. */ | 8167 | /* Make a handle to a new rsvg object. */ |
| 8150 | rsvg_handle = (RsvgHandle *) fn_rsvg_handle_new (); | 8168 | rsvg_handle = fn_rsvg_handle_new (); |
| 8151 | 8169 | ||
| 8152 | /* Parse the contents argument and fill in the rsvg_handle. */ | 8170 | /* Parse the contents argument and fill in the rsvg_handle. */ |
| 8153 | fn_rsvg_handle_write (rsvg_handle, contents, size, &error); | 8171 | fn_rsvg_handle_write (rsvg_handle, contents, size, &error); |
| @@ -8167,14 +8185,14 @@ svg_load_image (struct frame *f, /* Pointer to emacs frame structure. * | |||
| 8167 | 8185 | ||
| 8168 | /* We can now get a valid pixel buffer from the svg file, if all | 8186 | /* We can now get a valid pixel buffer from the svg file, if all |
| 8169 | went ok. */ | 8187 | went ok. */ |
| 8170 | pixbuf = (GdkPixbuf *) fn_rsvg_handle_get_pixbuf (rsvg_handle); | 8188 | pixbuf = fn_rsvg_handle_get_pixbuf (rsvg_handle); |
| 8171 | if (!pixbuf) goto rsvg_error; | 8189 | if (!pixbuf) goto rsvg_error; |
| 8172 | fn_g_object_unref (rsvg_handle); | 8190 | fn_g_object_unref (rsvg_handle); |
| 8173 | 8191 | ||
| 8174 | /* Extract some meta data from the svg handle. */ | 8192 | /* Extract some meta data from the svg handle. */ |
| 8175 | width = fn_gdk_pixbuf_get_width (pixbuf); | 8193 | width = fn_gdk_pixbuf_get_width (pixbuf); |
| 8176 | height = fn_gdk_pixbuf_get_height (pixbuf); | 8194 | height = fn_gdk_pixbuf_get_height (pixbuf); |
| 8177 | pixels = (const guint8 *) fn_gdk_pixbuf_get_pixels (pixbuf); | 8195 | pixels = fn_gdk_pixbuf_get_pixels (pixbuf); |
| 8178 | rowstride = fn_gdk_pixbuf_get_rowstride (pixbuf); | 8196 | rowstride = fn_gdk_pixbuf_get_rowstride (pixbuf); |
| 8179 | 8197 | ||
| 8180 | /* Validate the svg meta data. */ | 8198 | /* Validate the svg meta data. */ |