diff options
| author | Paul Eggert | 2012-07-07 12:23:41 -0700 |
|---|---|---|
| committer | Paul Eggert | 2012-07-07 12:23:41 -0700 |
| commit | 6045c4fdb88ee6bd84afcaac4a0b7e8a96f23050 (patch) | |
| tree | 86959a892e16b2947b794a6ad993f0090387fab3 /src/image.c | |
| parent | 41f9404e0cb421fcea07538bbd686d54200ed92d (diff) | |
| download | emacs-6045c4fdb88ee6bd84afcaac4a0b7e8a96f23050.tar.gz emacs-6045c4fdb88ee6bd84afcaac4a0b7e8a96f23050.zip | |
Improve static checking when configured --with-ns.
See Samuel Bronson's remarks in
<http://lists.gnu.org/archive/html/emacs-devel/2012-07/msg00146.html>.
* configure.in (WARN_CFLAGS): Omit -Wunreachable-code, as it's
a no-op with recent GCC and harmful in earlier ones.
Omit -Wsync-nand, as it's irrelevant to Emacs and provokes a
warning when compiling with ObjC. Always omit
-Wunsafe-loop-optimizations, as we don't mind when optimization is
being done correctly.
Fix some minor --with-ns problems found by static checking.
* src/frame.c (Ftool_bar_pixel_width) [!FRAME_TOOLBAR_WIDTH]:
(x_set_font) [!HAVE_X_WINDOWS]:
* src/image.c (xpm_load_image) [HAVE_NS]:
(x_to_xcolors) [!HAVE_X_WINDOWS && !HAVE_NTGUI]:
(x_disable_image) [!HAVE_NS && !HAVE_NTGUI]:
Remove unused local.
(Fx_parse_geometry) [HAVE_NS]: Don't return garbage.
(xpm_load_image) [HAVE_NS && !HAVE_XPM]: Remove unused label.
* src/image.c (x_create_bitmap_from_file) [HAVE_NS]:
(xpm_load_image, xpm_load) [HAVE_NS && !HAVE_XPM]:
* src/nsselect.m (symbol_to_nsstring, ns_string_to_pasteboard_internal):
* src/xfaces.c (Fx_load_color_file) [!HAVE_X_WINDOWS]:
Fix pointer signedness problem.
* src/xfaces.c (FRAME_X_FONT_TABLE):
* src/xterm.h (FRAME_X_FONT_TABLE): Remove unused, incompatible macros.
Diffstat (limited to 'src/image.c')
| -rw-r--r-- | src/image.c | 16 |
1 files changed, 6 insertions, 10 deletions
diff --git a/src/image.c b/src/image.c index 4877d262d00..0854d017163 100644 --- a/src/image.c +++ b/src/image.c | |||
| @@ -323,7 +323,7 @@ x_create_bitmap_from_file (struct frame *f, Lisp_Object file) | |||
| 323 | dpyinfo->bitmaps[id - 1].depth = 1; | 323 | dpyinfo->bitmaps[id - 1].depth = 1; |
| 324 | dpyinfo->bitmaps[id - 1].height = ns_image_width (bitmap); | 324 | dpyinfo->bitmaps[id - 1].height = ns_image_width (bitmap); |
| 325 | dpyinfo->bitmaps[id - 1].width = ns_image_height (bitmap); | 325 | dpyinfo->bitmaps[id - 1].width = ns_image_height (bitmap); |
| 326 | strcpy (dpyinfo->bitmaps[id - 1].file, SDATA (file)); | 326 | strcpy (dpyinfo->bitmaps[id - 1].file, SSDATA (file)); |
| 327 | return id; | 327 | return id; |
| 328 | #endif | 328 | #endif |
| 329 | 329 | ||
| @@ -3964,7 +3964,7 @@ xpm_load_image (struct frame *f, | |||
| 3964 | { | 3964 | { |
| 3965 | if (xstrcasecmp (SSDATA (XCDR (specified_color)), "None") == 0) | 3965 | if (xstrcasecmp (SSDATA (XCDR (specified_color)), "None") == 0) |
| 3966 | color_val = Qt; | 3966 | color_val = Qt; |
| 3967 | else if (x_defined_color (f, SDATA (XCDR (specified_color)), | 3967 | else if (x_defined_color (f, SSDATA (XCDR (specified_color)), |
| 3968 | &cdef, 0)) | 3968 | &cdef, 0)) |
| 3969 | color_val = make_number (cdef.pixel); | 3969 | color_val = make_number (cdef.pixel); |
| 3970 | } | 3970 | } |
| @@ -4039,7 +4039,6 @@ xpm_load_image (struct frame *f, | |||
| 4039 | 4039 | ||
| 4040 | failure: | 4040 | failure: |
| 4041 | image_error ("Invalid XPM file (%s)", img->spec, Qnil); | 4041 | image_error ("Invalid XPM file (%s)", img->spec, Qnil); |
| 4042 | error: | ||
| 4043 | x_destroy_x_image (ximg); | 4042 | x_destroy_x_image (ximg); |
| 4044 | x_destroy_x_image (mask_img); | 4043 | x_destroy_x_image (mask_img); |
| 4045 | x_clear_image (f, img); | 4044 | x_clear_image (f, img); |
| @@ -4072,7 +4071,7 @@ xpm_load (struct frame *f, | |||
| 4072 | return 0; | 4071 | return 0; |
| 4073 | } | 4072 | } |
| 4074 | 4073 | ||
| 4075 | contents = slurp_file (SDATA (file), &size); | 4074 | contents = slurp_file (SSDATA (file), &size); |
| 4076 | if (contents == NULL) | 4075 | if (contents == NULL) |
| 4077 | { | 4076 | { |
| 4078 | image_error ("Error loading XPM image `%s'", img->spec, Qnil); | 4077 | image_error ("Error loading XPM image `%s'", img->spec, Qnil); |
| @@ -4456,9 +4455,8 @@ x_to_xcolors (struct frame *f, struct image *img, int rgb_p) | |||
| 4456 | p = colors; | 4455 | p = colors; |
| 4457 | for (y = 0; y < img->height; ++y) | 4456 | for (y = 0; y < img->height; ++y) |
| 4458 | { | 4457 | { |
| 4459 | XColor *row = p; | ||
| 4460 | |||
| 4461 | #if defined (HAVE_X_WINDOWS) || defined (HAVE_NTGUI) | 4458 | #if defined (HAVE_X_WINDOWS) || defined (HAVE_NTGUI) |
| 4459 | XColor *row = p; | ||
| 4462 | for (x = 0; x < img->width; ++x, ++p) | 4460 | for (x = 0; x < img->width; ++x, ++p) |
| 4463 | p->pixel = GET_PIXEL (ximg, x, y); | 4461 | p->pixel = GET_PIXEL (ximg, x, y); |
| 4464 | if (rgb_p) | 4462 | if (rgb_p) |
| @@ -4741,14 +4739,12 @@ x_disable_image (struct frame *f, struct image *img) | |||
| 4741 | if (n_planes < 2 || cross_disabled_images) | 4739 | if (n_planes < 2 || cross_disabled_images) |
| 4742 | { | 4740 | { |
| 4743 | #ifndef HAVE_NTGUI | 4741 | #ifndef HAVE_NTGUI |
| 4744 | Display *dpy = FRAME_X_DISPLAY (f); | ||
| 4745 | GC gc; | ||
| 4746 | |||
| 4747 | #ifndef HAVE_NS /* TODO: NS support, however this not needed for toolbars */ | 4742 | #ifndef HAVE_NS /* TODO: NS support, however this not needed for toolbars */ |
| 4748 | 4743 | ||
| 4749 | #define MaskForeground(f) WHITE_PIX_DEFAULT (f) | 4744 | #define MaskForeground(f) WHITE_PIX_DEFAULT (f) |
| 4750 | 4745 | ||
| 4751 | gc = XCreateGC (dpy, img->pixmap, 0, NULL); | 4746 | Display *dpy = FRAME_X_DISPLAY (f); |
| 4747 | GC gc = XCreateGC (dpy, img->pixmap, 0, NULL); | ||
| 4752 | XSetForeground (dpy, gc, BLACK_PIX_DEFAULT (f)); | 4748 | XSetForeground (dpy, gc, BLACK_PIX_DEFAULT (f)); |
| 4753 | XDrawLine (dpy, img->pixmap, gc, 0, 0, | 4749 | XDrawLine (dpy, img->pixmap, gc, 0, 0, |
| 4754 | img->width - 1, img->height - 1); | 4750 | img->width - 1, img->height - 1); |