aboutsummaryrefslogtreecommitdiffstats
path: root/src/image.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/image.c')
-rw-r--r--src/image.c86
1 files changed, 53 insertions, 33 deletions
diff --git a/src/image.c b/src/image.c
index 15e835fef3b..462294b33b4 100644
--- a/src/image.c
+++ b/src/image.c
@@ -1972,7 +1972,8 @@ x_create_x_image_and_pixmap (f, width, height, depth, ximg, pixmap)
1972 and store its handle in *pixmap. */ 1972 and store its handle in *pixmap. */
1973 *pixmap = CreateDIBSection (hdc, &((*ximg)->info), 1973 *pixmap = CreateDIBSection (hdc, &((*ximg)->info),
1974 (depth < 16) ? DIB_PAL_COLORS : DIB_RGB_COLORS, 1974 (depth < 16) ? DIB_PAL_COLORS : DIB_RGB_COLORS,
1975 &((*ximg)->data), NULL, 0); 1975 /* casting avoids a GCC warning */
1976 (void **)&((*ximg)->data), NULL, 0);
1976 1977
1977 /* Realize display palette and garbage all frames. */ 1978 /* Realize display palette and garbage all frames. */
1978 release_frame_dc (f, hdc); 1979 release_frame_dc (f, hdc);
@@ -5517,7 +5518,8 @@ pbm_load (f, img)
5517 /* Maybe fill in the background field while we have ximg handy. */ 5518 /* Maybe fill in the background field while we have ximg handy. */
5518 5519
5519 if (NILP (image_spec_value (img->spec, QCbackground, NULL))) 5520 if (NILP (image_spec_value (img->spec, QCbackground, NULL)))
5520 IMAGE_BACKGROUND (img, f, ximg); 5521 /* Casting avoids a GCC warning. */
5522 IMAGE_BACKGROUND (img, f, (XImagePtr_or_DC)ximg);
5521 5523
5522 /* Put the image into a pixmap. */ 5524 /* Put the image into a pixmap. */
5523 x_put_x_image (f, ximg, img->pixmap, width, height); 5525 x_put_x_image (f, ximg, img->pixmap, width, height);
@@ -5843,9 +5845,11 @@ png_load (f, img)
5843 tbr.bytes += sizeof (sig); 5845 tbr.bytes += sizeof (sig);
5844 } 5846 }
5845 5847
5846 /* Initialize read and info structs for PNG lib. */ 5848 /* Initialize read and info structs for PNG lib. Casting return
5847 png_ptr = fn_png_create_read_struct (PNG_LIBPNG_VER_STRING, NULL, 5849 value avoids a GCC warning on W32. */
5848 my_png_error, my_png_warning); 5850 png_ptr = (png_structp)fn_png_create_read_struct (PNG_LIBPNG_VER_STRING,
5851 NULL, my_png_error,
5852 my_png_warning);
5849 if (!png_ptr) 5853 if (!png_ptr)
5850 { 5854 {
5851 if (fp) fclose (fp); 5855 if (fp) fclose (fp);
@@ -5853,7 +5857,8 @@ png_load (f, img)
5853 return 0; 5857 return 0;
5854 } 5858 }
5855 5859
5856 info_ptr = fn_png_create_info_struct (png_ptr); 5860 /* Casting return value avoids a GCC warning on W32. */
5861 info_ptr = (png_infop)fn_png_create_info_struct (png_ptr);
5857 if (!info_ptr) 5862 if (!info_ptr)
5858 { 5863 {
5859 fn_png_destroy_read_struct (&png_ptr, NULL, NULL); 5864 fn_png_destroy_read_struct (&png_ptr, NULL, NULL);
@@ -5862,7 +5867,8 @@ png_load (f, img)
5862 return 0; 5867 return 0;
5863 } 5868 }
5864 5869
5865 end_info = fn_png_create_info_struct (png_ptr); 5870 /* Casting return value avoids a GCC warning on W32. */
5871 end_info = (png_infop)fn_png_create_info_struct (png_ptr);
5866 if (!end_info) 5872 if (!end_info)
5867 { 5873 {
5868 fn_png_destroy_read_struct (&png_ptr, &info_ptr, NULL); 5874 fn_png_destroy_read_struct (&png_ptr, &info_ptr, NULL);
@@ -6135,8 +6141,9 @@ png_load (f, img)
6135 img->width = width; 6141 img->width = width;
6136 img->height = height; 6142 img->height = height;
6137 6143
6138 /* Maybe fill in the background field while we have ximg handy. */ 6144 /* Maybe fill in the background field while we have ximg handy.
6139 IMAGE_BACKGROUND (img, f, ximg); 6145 Casting avoids a GCC warning. */
6146 IMAGE_BACKGROUND (img, f, (XImagePtr_or_DC)ximg);
6140 6147
6141 /* Put the image into the pixmap, then free the X image and its buffer. */ 6148 /* Put the image into the pixmap, then free the X image and its buffer. */
6142 x_put_x_image (f, ximg, img->pixmap, width, height); 6149 x_put_x_image (f, ximg, img->pixmap, width, height);
@@ -6145,9 +6152,9 @@ png_load (f, img)
6145 /* Same for the mask. */ 6152 /* Same for the mask. */
6146 if (mask_img) 6153 if (mask_img)
6147 { 6154 {
6148 /* Fill in the background_transparent field while we have the mask 6155 /* Fill in the background_transparent field while we have the
6149 handy. */ 6156 mask handy. Casting avoids a GCC warning. */
6150 image_background_transparent (img, f, mask_img); 6157 image_background_transparent (img, f, (XImagePtr_or_DC)mask_img);
6151 6158
6152 x_put_x_image (f, mask_img, img->mask, img->width, img->height); 6159 x_put_x_image (f, mask_img, img->mask, img->width, img->height);
6153 x_destroy_x_image (mask_img); 6160 x_destroy_x_image (mask_img);
@@ -6265,8 +6272,8 @@ jpeg_image_p (object)
6265#endif /* HAVE_STLIB_H */ 6272#endif /* HAVE_STLIB_H */
6266 6273
6267#if defined (HAVE_NTGUI) && !defined (__WIN32__) 6274#if defined (HAVE_NTGUI) && !defined (__WIN32__)
6268/* jpeglib.h will define boolean differently depending on __WIN32__, 6275/* In older releases of the jpeg library, jpeglib.h will define boolean
6269 so make sure it is defined. */ 6276 differently depending on __WIN32__, so make sure it is defined. */
6270#define __WIN32__ 1 6277#define __WIN32__ 1
6271#endif 6278#endif
6272 6279
@@ -6494,8 +6501,9 @@ jpeg_load (f, img)
6494 } 6501 }
6495 6502
6496 /* Customize libjpeg's error handling to call my_error_exit when an 6503 /* Customize libjpeg's error handling to call my_error_exit when an
6497 error is detected. This function will perform a longjmp. */ 6504 error is detected. This function will perform a longjmp.
6498 cinfo.err = fn_jpeg_std_error (&mgr.pub); 6505 Casting return value avoids a GCC warning on W32. */
6506 cinfo.err = (struct jpeg_error_mgr *)fn_jpeg_std_error (&mgr.pub);
6499 mgr.pub.error_exit = my_error_exit; 6507 mgr.pub.error_exit = my_error_exit;
6500 6508
6501 if ((rc = setjmp (mgr.setjmp_buffer)) != 0) 6509 if ((rc = setjmp (mgr.setjmp_buffer)) != 0)
@@ -6606,7 +6614,8 @@ jpeg_load (f, img)
6606 6614
6607 /* Maybe fill in the background field while we have ximg handy. */ 6615 /* Maybe fill in the background field while we have ximg handy. */
6608 if (NILP (image_spec_value (img->spec, QCbackground, NULL))) 6616 if (NILP (image_spec_value (img->spec, QCbackground, NULL)))
6609 IMAGE_BACKGROUND (img, f, ximg); 6617 /* Casting avoids a GCC warning. */
6618 IMAGE_BACKGROUND (img, f, (XImagePtr_or_DC)ximg);
6610 6619
6611 /* Put the image into the pixmap. */ 6620 /* Put the image into the pixmap. */
6612 x_put_x_image (f, ximg, img->pixmap, width, height); 6621 x_put_x_image (f, ximg, img->pixmap, width, height);
@@ -6932,8 +6941,9 @@ tiff_load (f, img)
6932 return 0; 6941 return 0;
6933 } 6942 }
6934 6943
6935 /* Try to open the image file. */ 6944 /* Try to open the image file. Casting return value avoids a
6936 tiff = fn_TIFFOpen (SDATA (file), "r"); 6945 GCC warning on W32. */
6946 tiff = (TIFF *)fn_TIFFOpen (SDATA (file), "r");
6937 if (tiff == NULL) 6947 if (tiff == NULL)
6938 { 6948 {
6939 image_error ("Cannot open `%s'", file, Qnil); 6949 image_error ("Cannot open `%s'", file, Qnil);
@@ -6948,14 +6958,15 @@ tiff_load (f, img)
6948 memsrc.len = SBYTES (specified_data); 6958 memsrc.len = SBYTES (specified_data);
6949 memsrc.index = 0; 6959 memsrc.index = 0;
6950 6960
6951 tiff = fn_TIFFClientOpen ("memory_source", "r", &memsrc, 6961 /* Casting return value avoids a GCC warning on W32. */
6952 (TIFFReadWriteProc) tiff_read_from_memory, 6962 tiff = (TIFF *)fn_TIFFClientOpen ("memory_source", "r", &memsrc,
6953 (TIFFReadWriteProc) tiff_write_from_memory, 6963 (TIFFReadWriteProc) tiff_read_from_memory,
6954 tiff_seek_in_memory, 6964 (TIFFReadWriteProc) tiff_write_from_memory,
6955 tiff_close_memory, 6965 tiff_seek_in_memory,
6956 tiff_size_of_memory, 6966 tiff_close_memory,
6957 tiff_mmap_memory, 6967 tiff_size_of_memory,
6958 tiff_unmap_memory); 6968 tiff_mmap_memory,
6969 tiff_unmap_memory);
6959 6970
6960 if (!tiff) 6971 if (!tiff)
6961 { 6972 {
@@ -7018,7 +7029,8 @@ tiff_load (f, img)
7018 7029
7019 /* Maybe fill in the background field while we have ximg handy. */ 7030 /* Maybe fill in the background field while we have ximg handy. */
7020 if (NILP (image_spec_value (img->spec, QCbackground, NULL))) 7031 if (NILP (image_spec_value (img->spec, QCbackground, NULL)))
7021 IMAGE_BACKGROUND (img, f, ximg); 7032 /* Casting avoids a GCC warning on W32. */
7033 IMAGE_BACKGROUND (img, f, (XImagePtr_or_DC)ximg);
7022 7034
7023 /* Put the image into the pixmap, then free the X image and its buffer. */ 7035 /* Put the image into the pixmap, then free the X image and its buffer. */
7024 x_put_x_image (f, ximg, img->pixmap, width, height); 7036 x_put_x_image (f, ximg, img->pixmap, width, height);
@@ -7126,6 +7138,11 @@ gif_image_p (object)
7126#ifdef HAVE_GIF 7138#ifdef HAVE_GIF
7127 7139
7128#if defined (HAVE_NTGUI) || defined (MAC_OS) 7140#if defined (HAVE_NTGUI) || defined (MAC_OS)
7141/* winuser.h might define DrawText to DrawTextA or DrawTextW.
7142 Undefine before redefining to avoid a preprocessor warning. */
7143#ifdef DrawText
7144#undef DrawText
7145#endif
7129/* avoid conflict with QuickdrawText.h */ 7146/* avoid conflict with QuickdrawText.h */
7130#define DrawText gif_DrawText 7147#define DrawText gif_DrawText
7131#include <gif_lib.h> 7148#include <gif_lib.h>
@@ -7239,8 +7256,9 @@ gif_load (f, img)
7239 return 0; 7256 return 0;
7240 } 7257 }
7241 7258
7242 /* Open the GIF file. */ 7259 /* Open the GIF file. Casting return value avoids a GCC warning
7243 gif = fn_DGifOpenFileName (SDATA (file)); 7260 on W32. */
7261 gif = (GifFileType *)fn_DGifOpenFileName (SDATA (file));
7244 if (gif == NULL) 7262 if (gif == NULL)
7245 { 7263 {
7246 image_error ("Cannot open `%s'", file, Qnil); 7264 image_error ("Cannot open `%s'", file, Qnil);
@@ -7256,7 +7274,8 @@ gif_load (f, img)
7256 memsrc.len = SBYTES (specified_data); 7274 memsrc.len = SBYTES (specified_data);
7257 memsrc.index = 0; 7275 memsrc.index = 0;
7258 7276
7259 gif = fn_DGifOpen(&memsrc, gif_read_from_memory); 7277 /* Casting return value avoids a GCC warning on W32. */
7278 gif = (GifFileType *)fn_DGifOpen(&memsrc, gif_read_from_memory);
7260 if (!gif) 7279 if (!gif)
7261 { 7280 {
7262 image_error ("Cannot open memory source `%s'", img->spec, Qnil); 7281 image_error ("Cannot open memory source `%s'", img->spec, Qnil);
@@ -7390,7 +7409,8 @@ gif_load (f, img)
7390 7409
7391 /* Maybe fill in the background field while we have ximg handy. */ 7410 /* Maybe fill in the background field while we have ximg handy. */
7392 if (NILP (image_spec_value (img->spec, QCbackground, NULL))) 7411 if (NILP (image_spec_value (img->spec, QCbackground, NULL)))
7393 IMAGE_BACKGROUND (img, f, ximg); 7412 /* Casting avoids a GCC warning. */
7413 IMAGE_BACKGROUND (img, f, (XImagePtr_or_DC)ximg);
7394 7414
7395 /* Put the image into the pixmap, then free the X image and its buffer. */ 7415 /* Put the image into the pixmap, then free the X image and its buffer. */
7396 x_put_x_image (f, ximg, img->pixmap, width, height); 7416 x_put_x_image (f, ximg, img->pixmap, width, height);
@@ -7400,7 +7420,7 @@ gif_load (f, img)
7400 return 1; 7420 return 1;
7401} 7421}
7402 7422
7403#else 7423#else /* !HAVE_GIF */
7404 7424
7405#ifdef MAC_OS 7425#ifdef MAC_OS
7406static int 7426static int