[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Emacs-diffs] /srv/bzr/emacs/trunk r104556: Merge: Fix minor problems fo
From: |
Paul Eggert |
Subject: |
[Emacs-diffs] /srv/bzr/emacs/trunk r104556: Merge: Fix minor problems found by static checking. |
Date: |
Fri, 10 Jun 2011 13:38:18 -0700 |
User-agent: |
Bazaar (2.3.1) |
------------------------------------------------------------
revno: 104556 [merge]
committer: Paul Eggert <address@hidden>
branch nick: trunk
timestamp: Fri 2011-06-10 13:38:18 -0700
message:
Merge: Fix minor problems found by static checking.
* image.c (PixelGetMagickColor): Declare if ImageMagick headers don't.
Make identifiers static if they are not used in other modules.
* data.c (Qcompiled_function, Qframe, Qvector):
* image.c (QimageMagick, Qsvg):
* minibuf.c (Qmetadata):
* window.c (resize_window_check, resize_root_window): Now static.
* window.h (resize_window_check, resize_root_window): Remove decls.
* window.c (window_deletion_count, delete_deletable_window):
Remove; unused.
(window_body_lines): Now static.
(Fdelete_other_windows_internal): Mark vars as initialized.
Make sure 'resize_failed' is initialized.
(run_window_configuration_change_hook): Rename local to avoid shadowing.
(resize_window_apply): Remove unused local.
* window.h (delete_deletable_window): Remove decl.
* image.c (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.
(imagemagick_load_image): Don't use garbage pointer image_wand.
* ftfont.c (ftfont_get_metrics, ftfont_drive_otf): Remove unused locals.
modified:
src/ChangeLog
src/data.c
src/ftfont.c
src/image.c
src/minibuf.c
src/window.c
src/window.h
=== modified file 'src/ChangeLog'
--- a/src/ChangeLog 2011-06-10 15:46:48 +0000
+++ b/src/ChangeLog 2011-06-10 20:38:18 +0000
@@ -1,3 +1,36 @@
+2011-06-10 Paul Eggert <address@hidden>
+
+ Fix minor problems found by static checking.
+
+ * image.c (PixelGetMagickColor): Declare if ImageMagick headers don't.
+
+ Make identifiers static if they are not used in other modules.
+ * data.c (Qcompiled_function, Qframe, Qvector):
+ * image.c (QimageMagick, Qsvg):
+ * minibuf.c (Qmetadata):
+ * window.c (resize_window_check, resize_root_window): Now static.
+ * window.h (resize_window_check, resize_root_window): Remove decls.
+
+ * window.c (window_deletion_count, delete_deletable_window):
+ Remove; unused.
+ (window_body_lines): Now static.
+ (Fdelete_other_windows_internal): Mark vars as initialized.
+ Make sure 'resize_failed' is initialized.
+ (run_window_configuration_change_hook): Rename local to avoid shadowing.
+ (resize_window_apply): Remove unused local.
+ * window.h (delete_deletable_window): Remove decl.
+
+ * image.c (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.
+ (imagemagick_load_image): Don't use garbage pointer image_wand.
+
+ * ftfont.c (ftfont_get_metrics, ftfont_drive_otf): Remove unused locals.
+
2011-06-10 Chong Yidong <address@hidden>
* image.c (gif_load): Fix omitted cast error introduced by
=== modified file 'src/data.c'
--- a/src/data.c 2011-06-06 19:43:39 +0000
+++ b/src/data.c 2011-06-10 20:05:21 +0000
@@ -90,7 +90,8 @@
Lisp_Object Qwindow;
static Lisp_Object Qfloat, Qwindow_configuration;
static Lisp_Object Qprocess;
-Lisp_Object Qcompiled_function, Qbuffer, Qframe, Qvector;
+static Lisp_Object Qcompiled_function, Qframe, Qvector;
+Lisp_Object Qbuffer;
static Lisp_Object Qchar_table, Qbool_vector, Qhash_table;
static Lisp_Object Qsubrp, Qmany, Qunevalled;
Lisp_Object Qfont_spec, Qfont_entity, Qfont_object;
=== modified file 'src/ftfont.c'
--- a/src/ftfont.c 2011-06-01 02:49:12 +0000
+++ b/src/ftfont.c 2011-06-10 19:31:15 +0000
@@ -1612,7 +1612,6 @@
if (g->code != FONT_INVALID_CODE)
{
FT_Glyph_Metrics *m;
- int lbearing, rbearing, ascent, descent, xadv;
if (FT_Load_Glyph (ft_face, g->code, FT_LOAD_DEFAULT) != 0)
abort ();
@@ -1867,7 +1866,6 @@
{
MFLTGlyph *g;
int min_from, max_to;
- int j;
int feature_idx = otfg->positioning_type >> 4;
g = out->glyphs + out->used;
=== modified file 'src/image.c'
--- a/src/image.c 2011-06-10 15:46:48 +0000
+++ b/src/image.c 2011-06-10 20:34:05 +0000
@@ -7146,12 +7146,12 @@
/* Which sub-image are we to display? */
{
- Lisp_Object index = image_spec_value (img->spec, QCindex, NULL);
- idx = INTEGERP (index) ? XFASTINT (index) : 0;
+ Lisp_Object image_number = image_spec_value (img->spec, QCindex, NULL);
+ idx = INTEGERP (image_number) ? XFASTINT (image_number) : 0;
if (idx < 0 || idx >= gif->ImageCount)
{
image_error ("Invalid image number `%s' in image `%s'",
- index, img->spec);
+ image_number, img->spec);
fn_DGifCloseFile (gif);
return 0;
}
@@ -7365,7 +7365,7 @@
***********************************************************************/
#if defined (HAVE_IMAGEMAGICK)
-Lisp_Object Qimagemagick;
+static Lisp_Object Qimagemagick;
static int imagemagick_image_p (Lisp_Object);
static int imagemagick_load (struct frame *, struct image *);
@@ -7456,6 +7456,14 @@
#define DrawRectangle DrawRectangleGif
#include <wand/MagickWand.h>
+/* ImageMagick 6.5.3 through 6.6.5 hid PixelGetMagickColor for some reason.
+ Emacs seems to work fine with the hidden version, so unhide it. */
+#include <magick/version.h>
+#if 0x653 <= MagickLibVersion && MagickLibVersion <= 0x665
+extern WandExport void PixelGetMagickColor (const PixelWand *,
+ MagickPixelPacket *);
+#endif
+
/* Helper function for imagemagick_load, which does the actual loading
given contents and size, apart from frame and image structures,
passed from imagemagick_load. Uses librimagemagick to do most of
@@ -7471,7 +7479,7 @@
static int
imagemagick_load_image (struct frame *f, struct image *img,
unsigned char *contents, unsigned int size,
- unsigned char *filename)
+ char *filename)
{
unsigned long width;
unsigned long height;
@@ -7479,8 +7487,6 @@
MagickBooleanType status;
XImagePtr ximg;
- Lisp_Object specified_bg;
- XColor background;
int x;
int y;
@@ -7491,7 +7497,7 @@
MagickPixelPacket pixel;
Lisp_Object image;
Lisp_Object value;
- Lisp_Object crop, geometry;
+ Lisp_Object crop;
long ino;
int desired_width, desired_height;
double rotation;
@@ -7552,23 +7558,18 @@
im_image = ReadImage (image_info, exception);
DestroyExceptionInfo (exception);
- if (im_image != NULL)
- {
- image_wand = NewMagickWandFromImage (im_image);
- DestroyImage(im_image);
- status = MagickTrue;
- }
- else
- status = MagickFalse;
+ if (im_image == NULL)
+ goto imagemagick_no_wand;
+ image_wand = NewMagickWandFromImage (im_image);
+ DestroyImage(im_image);
}
else
{
image_wand = NewMagickWand ();
- status = MagickReadImageBlob (image_wand, contents, size);
+ if (MagickReadImageBlob (image_wand, contents, size) == MagickFalse)
+ goto imagemagick_error;
}
- if (status == MagickFalse) goto imagemagick_error;
-
/* If width and/or height is set in the display spec assume we want
to scale to those values. If either h or w is unspecified, the
unspecified should be calculated from the specified to preserve
@@ -7609,7 +7610,7 @@
than the alternatives, but it still reads the entire image into memory
before croping, which is aparently difficult to avoid when using
imagemagick. */
- int w, h, x, y;
+ int w, h;
w = XFASTINT (XCAR (crop));
crop = XCDR (crop);
if (CONSP (crop) && INTEGERP (XCAR (crop)))
@@ -7723,7 +7724,7 @@
method is also well tested. Some aspects of this method are
ad-hoc and needs to be more researched. */
int imagedepth = 24;/*MagickGetImageDepth(image_wand);*/
- char* exportdepth = imagedepth <= 8 ? "I" : "BGRP";/*"RGBP";*/
+ const char *exportdepth = imagedepth <= 8 ? "I" : "BGRP";/*"RGBP";*/
/* Try to create a x pixmap to hold the imagemagick pixmap. */
if (!x_create_x_image_and_pixmap (f, width, height, imagedepth,
&ximg, &img->pixmap))
@@ -7796,6 +7797,7 @@
imagemagick_error:
DestroyMagickWand (image_wand);
+ imagemagick_no_wand:
MagickWandTerminus ();
/* TODO more cleanup. */
image_error ("Error parsing IMAGEMAGICK image `%s'", img->spec, Qnil);
@@ -7825,7 +7827,7 @@
image_error ("Cannot find image file `%s'", file_name, Qnil);
return 0;
}
- success_p = imagemagick_load_image (f, img, 0, 0, SDATA (file));
+ success_p = imagemagick_load_image (f, img, 0, 0, SSDATA (file));
}
/* Else its not a file, its a lisp object. Load the image from a
lisp object rather than a file. */
@@ -7890,7 +7892,7 @@
/* The symbol `svg' identifying images of this type. */
-Lisp_Object Qsvg;
+static Lisp_Object Qsvg;
/* Indices of image specification fields in svg_format, below. */
@@ -7973,7 +7975,6 @@
DEF_IMGLIB_FN (gboolean, rsvg_handle_write);
DEF_IMGLIB_FN (gboolean, rsvg_handle_close);
DEF_IMGLIB_FN (GdkPixbuf *, rsvg_handle_get_pixbuf);
-DEF_IMGLIB_FN (void, rsvg_handle_free);
DEF_IMGLIB_FN (int, gdk_pixbuf_get_width);
DEF_IMGLIB_FN (int, gdk_pixbuf_get_height);
@@ -8006,7 +8007,6 @@
LOAD_IMGLIB_FN (library, rsvg_handle_write);
LOAD_IMGLIB_FN (library, rsvg_handle_close);
LOAD_IMGLIB_FN (library, rsvg_handle_get_pixbuf);
- LOAD_IMGLIB_FN (library, rsvg_handle_free);
LOAD_IMGLIB_FN (gdklib, gdk_pixbuf_get_width);
LOAD_IMGLIB_FN (gdklib, gdk_pixbuf_get_height);
@@ -8032,7 +8032,6 @@
#define fn_rsvg_handle_write rsvg_handle_write
#define fn_rsvg_handle_close rsvg_handle_close
#define fn_rsvg_handle_get_pixbuf rsvg_handle_get_pixbuf
-#define fn_rsvg_handle_free rsvg_handle_free
#define fn_gdk_pixbuf_get_width gdk_pixbuf_get_width
#define fn_gdk_pixbuf_get_height gdk_pixbuf_get_height
@@ -8074,7 +8073,7 @@
}
/* Read the entire file into memory. */
- contents = slurp_file (SDATA (file), &size);
+ contents = slurp_file (SSDATA (file), &size);
if (contents == NULL)
{
image_error ("Error loading SVG image `%s'", img->spec, Qnil);
@@ -8117,7 +8116,7 @@
{
RsvgHandle *rsvg_handle;
RsvgDimensionData dimension_data;
- GError *error = NULL;
+ GError *err = NULL;
GdkPixbuf *pixbuf;
int width;
int height;
@@ -8136,13 +8135,13 @@
rsvg_handle = fn_rsvg_handle_new ();
/* Parse the contents argument and fill in the rsvg_handle. */
- fn_rsvg_handle_write (rsvg_handle, contents, size, &error);
- if (error) goto rsvg_error;
+ fn_rsvg_handle_write (rsvg_handle, contents, size, &err);
+ if (err) goto rsvg_error;
/* The parsing is complete, rsvg_handle is ready to used, close it
for further writes. */
- fn_rsvg_handle_close (rsvg_handle, &error);
- if (error) goto rsvg_error;
+ fn_rsvg_handle_close (rsvg_handle, &err);
+ if (err) goto rsvg_error;
fn_rsvg_handle_get_dimensions (rsvg_handle, &dimension_data);
if (! check_image_size (f, dimension_data.width, dimension_data.height))
@@ -8182,7 +8181,7 @@
color. */
specified_bg = image_spec_value (img->spec, QCbackground, NULL);
if (!STRINGP (specified_bg)
- || !x_defined_color (f, SDATA (specified_bg), &background, 0))
+ || !x_defined_color (f, SSDATA (specified_bg), &background, 0))
{
#ifndef HAVE_NS
background.pixel = FRAME_BACKGROUND_PIXEL (f);
@@ -8257,7 +8256,7 @@
/* FIXME: Use error->message so the user knows what is the actual
problem with the image. */
image_error ("Error parsing SVG image `%s'", img->spec, Qnil);
- fn_g_error_free (error);
+ fn_g_error_free (err);
return 0;
}
=== modified file 'src/minibuf.c'
--- a/src/minibuf.c 2011-06-06 13:57:49 +0000
+++ b/src/minibuf.c 2011-06-10 20:05:21 +0000
@@ -1895,7 +1895,7 @@
return Qt;
}
-Lisp_Object Qmetadata;
+static Lisp_Object Qmetadata;
extern Lisp_Object Qbuffer;
DEFUN ("internal-complete-buffer", Finternal_complete_buffer,
Sinternal_complete_buffer, 3, 3, 0,
=== modified file 'src/window.c'
--- a/src/window.c 2011-06-10 10:16:15 +0000
+++ b/src/window.c 2011-06-10 20:05:21 +0000
@@ -82,6 +82,7 @@
int (* fn) (struct window *, void *),
void *);
static Lisp_Object window_list_1 (Lisp_Object, Lisp_Object, Lisp_Object);
+static int resize_window_check (struct window *, int);
static void resize_window_apply (struct window *, int);
static Lisp_Object select_window (Lisp_Object, Lisp_Object, int);
@@ -121,9 +122,6 @@
/* Hook to run when window config changes. */
static Lisp_Object Qwindow_configuration_change_hook;
-/* Incremented by 1 whenever a window is deleted. */
-static int window_deletion_count;
-
/* Used by the function window_scroll_pixel_based */
static int window_scroll_pixel_based_preserve_x;
static int window_scroll_pixel_based_preserve_y;
@@ -614,7 +612,7 @@
/* Return the number of lines of W's body. Don't count any mode or
header line of W. */
-int
+static int
window_body_lines (struct window *w)
{
int height = XFASTINT (w->total_lines);
@@ -1974,14 +1972,6 @@
}
}
}
-
-/* If WINDOW can be deleted, delete it. */
-Lisp_Object
-delete_deletable_window (Lisp_Object window)
-{
- if (!NILP (call1 (Qwindow_deletable_p, window)))
- call1 (Qdelete_window, window);
-}
/***********************************************************************
Window List
@@ -2643,7 +2633,7 @@
return Qnil;
}
-Lisp_Object
+static Lisp_Object
resize_root_window (Lisp_Object window, Lisp_Object delta, Lisp_Object
horizontal, Lisp_Object ignore)
{
return call4 (Qresize_root_window, window, delta, horizontal, ignore);
@@ -2669,9 +2659,9 @@
{
struct window *w, *r, *s;
struct frame *f;
- Lisp_Object sibling, pwindow, swindow, delta;
- EMACS_INT startpos;
- int top, new_top, resize_failed;
+ Lisp_Object sibling, pwindow, swindow IF_LINT (= Qnil), delta;
+ EMACS_INT startpos IF_LINT (= 0);
+ int top IF_LINT (= 0), new_top, resize_failed;
w = decode_any_window (window);
XSETWINDOW (window, w);
@@ -2757,10 +2747,10 @@
windows_or_buffers_changed++;
Vwindow_list = Qnil;
FRAME_WINDOW_SIZES_CHANGED (f) = 1;
+ resize_failed = 0;
if (NILP (w->buffer))
{
- resize_failed = 0;
/* Resize subwindows vertically. */
XSETINT (delta, XINT (r->total_lines) - XINT (w->total_lines));
w->top_line = r->top_line;
@@ -3078,12 +3068,12 @@
if (!NILP (Flocal_variable_p (Qwindow_configuration_change_hook,
buffer)))
{
- int count = SPECPDL_INDEX ();
+ int inner_count = SPECPDL_INDEX ();
record_unwind_protect (select_window_norecord, Fselected_window ());
select_window_norecord (window);
run_funs (Fbuffer_local_value (Qwindow_configuration_change_hook,
buffer));
- unbind_to (count, Qnil);
+ unbind_to (inner_count, Qnil);
}
}
}
@@ -3533,7 +3523,7 @@
Note: This function does not check any of `window-fixed-size-p',
`window-min-height' or `window-min-width'. It does check that window
sizes do not drop below one line (two columns). */
-int
+static int
resize_window_check (struct window *w, int horflag)
{
struct window *c;
@@ -3617,7 +3607,7 @@
static void
resize_window_apply (struct window *w, int horflag)
{
- struct window *c, *p;
+ struct window *c;
int pos;
/* Note: Assigning new_normal requires that the new total size of the
@@ -3809,7 +3799,7 @@
DEFUN ("split-window-internal", Fsplit_window_internal,
Ssplit_window_internal, 4, 4, 0,
doc: /* Split window OLD.
Second argument TOTAL-SIZE specifies the number of lines or columns of the
-new window. In any case TOTAL-SIZE must be a positive integer
+new window. In any case TOTAL-SIZE must be a positive integer
Third argument SIDE nil (or `below') specifies that the new window shall
be located below WINDOW. SIDE `above' means the new window shall be
=== modified file 'src/window.h'
--- a/src/window.h 2011-06-10 13:18:13 +0000
+++ b/src/window.h 2011-06-10 20:05:21 +0000
@@ -924,10 +924,6 @@
extern void syms_of_window (void);
extern void keys_of_window (void);
extern void resize_frame_windows (struct frame *, int, int);
-extern int resize_window_check (struct window *, int);
-extern Lisp_Object delete_deletable_window (Lisp_Object);
-extern Lisp_Object resize_root_window (Lisp_Object, Lisp_Object, Lisp_Object,
- Lisp_Object);
#endif /* not WINDOW_H_INCLUDED */
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Emacs-diffs] /srv/bzr/emacs/trunk r104556: Merge: Fix minor problems found by static checking.,
Paul Eggert <=