aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorPaul Eggert2011-06-10 12:35:58 -0700
committerPaul Eggert2011-06-10 12:35:58 -0700
commit332905285a095c175a18c19813923ead751cfaec (patch)
tree596a29684ba27a7d9e4eda87a9744a554defeb0c /src
parent3f754b86f836bf4cae6d746debfe0954441050a6 (diff)
downloademacs-332905285a095c175a18c19813923ead751cfaec.tar.gz
emacs-332905285a095c175a18c19813923ead751cfaec.zip
* image.c: Fix minor problems reported by GCC 4.6.0.
(gif_load, svg_load_image): Rename locals to avoid shadowing. (imagemagick_load_image): Fix pointer signedness problem by changing last arg from unsigned char * to char *. All uses changed. Also, fix a local for similar reasons. Remove unused locals. Remove locals to avoid shadowing. (fn_rsvg_handle_free): Remove; unused. (svg_load, svg_load_image): Fix pointer signedness problem.
Diffstat (limited to 'src')
-rw-r--r--src/ChangeLog9
-rw-r--r--src/image.c37
2 files changed, 25 insertions, 21 deletions
diff --git a/src/ChangeLog b/src/ChangeLog
index a3cc92d5152..18f06347c43 100644
--- a/src/ChangeLog
+++ b/src/ChangeLog
@@ -1,5 +1,14 @@
12011-06-10 Paul Eggert <eggert@cs.ucla.edu> 12011-06-10 Paul Eggert <eggert@cs.ucla.edu>
2 2
3 * image.c: Fix minor problems reported by GCC 4.6.0.
4 (gif_load, svg_load_image): Rename locals to avoid shadowing.
5 (imagemagick_load_image): Fix pointer signedness problem by changing
6 last arg from unsigned char * to char *. All uses changed.
7 Also, fix a local for similar reasons.
8 Remove unused locals. Remove locals to avoid shadowing.
9 (fn_rsvg_handle_free): Remove; unused.
10 (svg_load, svg_load_image): Fix pointer signedness problem.
11
3 * ftfont.c (ftfont_get_metrics, ftfont_drive_otf): Remove unused locals. 12 * ftfont.c (ftfont_get_metrics, ftfont_drive_otf): Remove unused locals.
4 13
52011-06-10 Chong Yidong <cyd@stupidchicken.com> 142011-06-10 Chong Yidong <cyd@stupidchicken.com>
diff --git a/src/image.c b/src/image.c
index b6f54f01e95..8fec98f2818 100644
--- a/src/image.c
+++ b/src/image.c
@@ -7146,12 +7146,12 @@ gif_load (struct frame *f, struct image *img)
7146 7146
7147 /* Which sub-image are we to display? */ 7147 /* Which sub-image are we to display? */
7148 { 7148 {
7149 Lisp_Object index = image_spec_value (img->spec, QCindex, NULL); 7149 Lisp_Object image_number = image_spec_value (img->spec, QCindex, NULL);
7150 idx = INTEGERP (index) ? XFASTINT (index) : 0; 7150 idx = INTEGERP (image_number) ? XFASTINT (image_number) : 0;
7151 if (idx < 0 || idx >= gif->ImageCount) 7151 if (idx < 0 || idx >= gif->ImageCount)
7152 { 7152 {
7153 image_error ("Invalid image number `%s' in image `%s'", 7153 image_error ("Invalid image number `%s' in image `%s'",
7154 index, img->spec); 7154 image_number, img->spec);
7155 fn_DGifCloseFile (gif); 7155 fn_DGifCloseFile (gif);
7156 return 0; 7156 return 0;
7157 } 7157 }
@@ -7471,7 +7471,7 @@ imagemagick_image_p (Lisp_Object object)
7471static int 7471static int
7472imagemagick_load_image (struct frame *f, struct image *img, 7472imagemagick_load_image (struct frame *f, struct image *img,
7473 unsigned char *contents, unsigned int size, 7473 unsigned char *contents, unsigned int size,
7474 unsigned char *filename) 7474 char *filename)
7475{ 7475{
7476 unsigned long width; 7476 unsigned long width;
7477 unsigned long height; 7477 unsigned long height;
@@ -7479,8 +7479,6 @@ imagemagick_load_image (struct frame *f, struct image *img,
7479 MagickBooleanType status; 7479 MagickBooleanType status;
7480 7480
7481 XImagePtr ximg; 7481 XImagePtr ximg;
7482 Lisp_Object specified_bg;
7483 XColor background;
7484 int x; 7482 int x;
7485 int y; 7483 int y;
7486 7484
@@ -7491,7 +7489,7 @@ imagemagick_load_image (struct frame *f, struct image *img,
7491 MagickPixelPacket pixel; 7489 MagickPixelPacket pixel;
7492 Lisp_Object image; 7490 Lisp_Object image;
7493 Lisp_Object value; 7491 Lisp_Object value;
7494 Lisp_Object crop, geometry; 7492 Lisp_Object crop;
7495 long ino; 7493 long ino;
7496 int desired_width, desired_height; 7494 int desired_width, desired_height;
7497 double rotation; 7495 double rotation;
@@ -7609,7 +7607,7 @@ imagemagick_load_image (struct frame *f, struct image *img,
7609 than the alternatives, but it still reads the entire image into memory 7607 than the alternatives, but it still reads the entire image into memory
7610 before croping, which is aparently difficult to avoid when using 7608 before croping, which is aparently difficult to avoid when using
7611 imagemagick. */ 7609 imagemagick. */
7612 int w, h, x, y; 7610 int w, h;
7613 w = XFASTINT (XCAR (crop)); 7611 w = XFASTINT (XCAR (crop));
7614 crop = XCDR (crop); 7612 crop = XCDR (crop);
7615 if (CONSP (crop) && INTEGERP (XCAR (crop))) 7613 if (CONSP (crop) && INTEGERP (XCAR (crop)))
@@ -7723,7 +7721,7 @@ imagemagick_load_image (struct frame *f, struct image *img,
7723 method is also well tested. Some aspects of this method are 7721 method is also well tested. Some aspects of this method are
7724 ad-hoc and needs to be more researched. */ 7722 ad-hoc and needs to be more researched. */
7725 int imagedepth = 24;/*MagickGetImageDepth(image_wand);*/ 7723 int imagedepth = 24;/*MagickGetImageDepth(image_wand);*/
7726 char* exportdepth = imagedepth <= 8 ? "I" : "BGRP";/*"RGBP";*/ 7724 const char *exportdepth = imagedepth <= 8 ? "I" : "BGRP";/*"RGBP";*/
7727 /* Try to create a x pixmap to hold the imagemagick pixmap. */ 7725 /* Try to create a x pixmap to hold the imagemagick pixmap. */
7728 if (!x_create_x_image_and_pixmap (f, width, height, imagedepth, 7726 if (!x_create_x_image_and_pixmap (f, width, height, imagedepth,
7729 &ximg, &img->pixmap)) 7727 &ximg, &img->pixmap))
@@ -7825,7 +7823,7 @@ imagemagick_load (struct frame *f, struct image *img)
7825 image_error ("Cannot find image file `%s'", file_name, Qnil); 7823 image_error ("Cannot find image file `%s'", file_name, Qnil);
7826 return 0; 7824 return 0;
7827 } 7825 }
7828 success_p = imagemagick_load_image (f, img, 0, 0, SDATA (file)); 7826 success_p = imagemagick_load_image (f, img, 0, 0, SSDATA (file));
7829 } 7827 }
7830 /* Else its not a file, its a lisp object. Load the image from a 7828 /* Else its not a file, its a lisp object. Load the image from a
7831 lisp object rather than a file. */ 7829 lisp object rather than a file. */
@@ -7973,7 +7971,6 @@ DEF_IMGLIB_FN (void, rsvg_handle_get_dimensions);
7973DEF_IMGLIB_FN (gboolean, rsvg_handle_write); 7971DEF_IMGLIB_FN (gboolean, rsvg_handle_write);
7974DEF_IMGLIB_FN (gboolean, rsvg_handle_close); 7972DEF_IMGLIB_FN (gboolean, rsvg_handle_close);
7975DEF_IMGLIB_FN (GdkPixbuf *, rsvg_handle_get_pixbuf); 7973DEF_IMGLIB_FN (GdkPixbuf *, rsvg_handle_get_pixbuf);
7976DEF_IMGLIB_FN (void, rsvg_handle_free);
7977 7974
7978DEF_IMGLIB_FN (int, gdk_pixbuf_get_width); 7975DEF_IMGLIB_FN (int, gdk_pixbuf_get_width);
7979DEF_IMGLIB_FN (int, gdk_pixbuf_get_height); 7976DEF_IMGLIB_FN (int, gdk_pixbuf_get_height);
@@ -8006,7 +8003,6 @@ init_svg_functions (Lisp_Object libraries)
8006 LOAD_IMGLIB_FN (library, rsvg_handle_write); 8003 LOAD_IMGLIB_FN (library, rsvg_handle_write);
8007 LOAD_IMGLIB_FN (library, rsvg_handle_close); 8004 LOAD_IMGLIB_FN (library, rsvg_handle_close);
8008 LOAD_IMGLIB_FN (library, rsvg_handle_get_pixbuf); 8005 LOAD_IMGLIB_FN (library, rsvg_handle_get_pixbuf);
8009 LOAD_IMGLIB_FN (library, rsvg_handle_free);
8010 8006
8011 LOAD_IMGLIB_FN (gdklib, gdk_pixbuf_get_width); 8007 LOAD_IMGLIB_FN (gdklib, gdk_pixbuf_get_width);
8012 LOAD_IMGLIB_FN (gdklib, gdk_pixbuf_get_height); 8008 LOAD_IMGLIB_FN (gdklib, gdk_pixbuf_get_height);
@@ -8032,7 +8028,6 @@ init_svg_functions (Lisp_Object libraries)
8032#define fn_rsvg_handle_write rsvg_handle_write 8028#define fn_rsvg_handle_write rsvg_handle_write
8033#define fn_rsvg_handle_close rsvg_handle_close 8029#define fn_rsvg_handle_close rsvg_handle_close
8034#define fn_rsvg_handle_get_pixbuf rsvg_handle_get_pixbuf 8030#define fn_rsvg_handle_get_pixbuf rsvg_handle_get_pixbuf
8035#define fn_rsvg_handle_free rsvg_handle_free
8036 8031
8037#define fn_gdk_pixbuf_get_width gdk_pixbuf_get_width 8032#define fn_gdk_pixbuf_get_width gdk_pixbuf_get_width
8038#define fn_gdk_pixbuf_get_height gdk_pixbuf_get_height 8033#define fn_gdk_pixbuf_get_height gdk_pixbuf_get_height
@@ -8074,7 +8069,7 @@ svg_load (struct frame *f, struct image *img)
8074 } 8069 }
8075 8070
8076 /* Read the entire file into memory. */ 8071 /* Read the entire file into memory. */
8077 contents = slurp_file (SDATA (file), &size); 8072 contents = slurp_file (SSDATA (file), &size);
8078 if (contents == NULL) 8073 if (contents == NULL)
8079 { 8074 {
8080 image_error ("Error loading SVG image `%s'", img->spec, Qnil); 8075 image_error ("Error loading SVG image `%s'", img->spec, Qnil);
@@ -8117,7 +8112,7 @@ svg_load_image (struct frame *f, /* Pointer to emacs frame structure. *
8117{ 8112{
8118 RsvgHandle *rsvg_handle; 8113 RsvgHandle *rsvg_handle;
8119 RsvgDimensionData dimension_data; 8114 RsvgDimensionData dimension_data;
8120 GError *error = NULL; 8115 GError *err = NULL;
8121 GdkPixbuf *pixbuf; 8116 GdkPixbuf *pixbuf;
8122 int width; 8117 int width;
8123 int height; 8118 int height;
@@ -8136,13 +8131,13 @@ svg_load_image (struct frame *f, /* Pointer to emacs frame structure. *
8136 rsvg_handle = fn_rsvg_handle_new (); 8131 rsvg_handle = fn_rsvg_handle_new ();
8137 8132
8138 /* Parse the contents argument and fill in the rsvg_handle. */ 8133 /* Parse the contents argument and fill in the rsvg_handle. */
8139 fn_rsvg_handle_write (rsvg_handle, contents, size, &error); 8134 fn_rsvg_handle_write (rsvg_handle, contents, size, &err);
8140 if (error) goto rsvg_error; 8135 if (err) goto rsvg_error;
8141 8136
8142 /* The parsing is complete, rsvg_handle is ready to used, close it 8137 /* The parsing is complete, rsvg_handle is ready to used, close it
8143 for further writes. */ 8138 for further writes. */
8144 fn_rsvg_handle_close (rsvg_handle, &error); 8139 fn_rsvg_handle_close (rsvg_handle, &err);
8145 if (error) goto rsvg_error; 8140 if (err) goto rsvg_error;
8146 8141
8147 fn_rsvg_handle_get_dimensions (rsvg_handle, &dimension_data); 8142 fn_rsvg_handle_get_dimensions (rsvg_handle, &dimension_data);
8148 if (! check_image_size (f, dimension_data.width, dimension_data.height)) 8143 if (! check_image_size (f, dimension_data.width, dimension_data.height))
@@ -8182,7 +8177,7 @@ svg_load_image (struct frame *f, /* Pointer to emacs frame structure. *
8182 color. */ 8177 color. */
8183 specified_bg = image_spec_value (img->spec, QCbackground, NULL); 8178 specified_bg = image_spec_value (img->spec, QCbackground, NULL);
8184 if (!STRINGP (specified_bg) 8179 if (!STRINGP (specified_bg)
8185 || !x_defined_color (f, SDATA (specified_bg), &background, 0)) 8180 || !x_defined_color (f, SSDATA (specified_bg), &background, 0))
8186 { 8181 {
8187#ifndef HAVE_NS 8182#ifndef HAVE_NS
8188 background.pixel = FRAME_BACKGROUND_PIXEL (f); 8183 background.pixel = FRAME_BACKGROUND_PIXEL (f);
@@ -8257,7 +8252,7 @@ svg_load_image (struct frame *f, /* Pointer to emacs frame structure. *
8257 /* FIXME: Use error->message so the user knows what is the actual 8252 /* FIXME: Use error->message so the user knows what is the actual
8258 problem with the image. */ 8253 problem with the image. */
8259 image_error ("Error parsing SVG image `%s'", img->spec, Qnil); 8254 image_error ("Error parsing SVG image `%s'", img->spec, Qnil);
8260 fn_g_error_free (error); 8255 fn_g_error_free (err);
8261 return 0; 8256 return 0;
8262} 8257}
8263 8258