Commit 691a357f authored by Paul Eggert's avatar Paul Eggert

Fix minor problems found by static checking.

* frame.c (delete_frame):
* xdisp.c (next_element_from_display_vector):
Avoid uninitialized local.
* image.c (imagemagick_compute_animated_image): Port to C89.
Prefer usual GNU indentation style for loops.
Be more careful about bizarrely large sizes, by using ptrdiff_t
instead of int.
parent f196836b
2013-08-15 Paul Eggert <eggert@cs.ucla.edu>
Fix minor problems found by static checking.
* frame.c (delete_frame):
* xdisp.c (next_element_from_display_vector):
Avoid uninitialized local.
* image.c (imagemagick_compute_animated_image): Port to C89.
Prefer usual GNU indentation style for loops.
Be more careful about bizarrely large sizes, by using ptrdiff_t
instead of int.
2013-08-15 Dmitry Antipov <dmantipov@yandex.ru>
Fix infinite frame selection loop (Bug#15025).
......
......@@ -1197,7 +1197,8 @@ delete_frame (Lisp_Object frame, Lisp_Object force)
/* Don't let the frame remain selected. */
if (f == sf)
{
Lisp_Object tail, frame1;
Lisp_Object tail;
Lisp_Object frame1 = Qnil;
/* Look for another visible frame on the same terminal.
Do not call next_frame here because it may loop forever.
......
......@@ -7877,6 +7877,7 @@ static int animation_index = 0;
static MagickWand *
imagemagick_compute_animated_image (MagickWand *super_wand, int ino)
{
int i;
MagickWand *composite_wand;
MagickSetIteratorIndex (super_wand, 0);
......@@ -7886,56 +7887,59 @@ imagemagick_compute_animated_image (MagickWand *super_wand, int ino)
else
composite_wand = animation_cache;
for (int i = max (1, animation_index); i <= ino; i++) {
MagickWand *sub_wand;
PixelIterator *source_iterator, *dest_iterator;
PixelWand **source, **dest;
size_t source_width, dest_width;
MagickPixelPacket pixel;
for (i = max (1, animation_index); i <= ino; i++)
{
MagickWand *sub_wand;
PixelIterator *source_iterator, *dest_iterator;
PixelWand **source, **dest;
size_t source_width, dest_width;
MagickPixelPacket pixel;
MagickSetIteratorIndex (super_wand, i);
sub_wand = MagickGetImage (super_wand);
MagickSetIteratorIndex (super_wand, i);
sub_wand = MagickGetImage (super_wand);
source_iterator = NewPixelIterator (sub_wand);
if (! source_iterator)
{
DestroyMagickWand (composite_wand);
DestroyMagickWand (sub_wand);
image_error ("Imagemagick pixel iterator creation failed",
Qnil, Qnil);
return NULL;
}
source_iterator = NewPixelIterator (sub_wand);
if (! source_iterator)
{
DestroyMagickWand (composite_wand);
DestroyMagickWand (sub_wand);
image_error ("Imagemagick pixel iterator creation failed",
Qnil, Qnil);
return NULL;
}
dest_iterator = NewPixelIterator (composite_wand);
if (! dest_iterator)
{
DestroyMagickWand (composite_wand);
DestroyMagickWand (sub_wand);
DestroyPixelIterator (source_iterator);
image_error ("Imagemagick pixel iterator creation failed",
Qnil, Qnil);
return NULL;
}
dest_iterator = NewPixelIterator (composite_wand);
if (! dest_iterator)
{
DestroyMagickWand (composite_wand);
DestroyMagickWand (sub_wand);
DestroyPixelIterator (source_iterator);
image_error ("Imagemagick pixel iterator creation failed",
Qnil, Qnil);
return NULL;
}
while ((source = PixelGetNextIteratorRow (source_iterator, &source_width))
!= NULL) {
dest = PixelGetNextIteratorRow (dest_iterator, &dest_width);
for (int x = 0; x < source_width; x++)
while ((source = PixelGetNextIteratorRow (source_iterator, &source_width))
!= NULL)
{
/* Copy over non-transparent pixels. */
if (PixelGetAlpha (source[x]))
ptrdiff_t x;
dest = PixelGetNextIteratorRow (dest_iterator, &dest_width);
for (x = 0; x < source_width; x++)
{
PixelGetMagickColor (source[x], &pixel);
PixelSetMagickColor (dest[x], &pixel);
/* Copy over non-transparent pixels. */
if (PixelGetAlpha (source[x]))
{
PixelGetMagickColor (source[x], &pixel);
PixelSetMagickColor (dest[x], &pixel);
}
}
PixelSyncIterator(dest_iterator);
}
PixelSyncIterator(dest_iterator);
}
DestroyPixelIterator (source_iterator);
DestroyPixelIterator (dest_iterator);
DestroyMagickWand (sub_wand);
}
DestroyPixelIterator (source_iterator);
DestroyPixelIterator (dest_iterator);
DestroyMagickWand (sub_wand);
}
/* Cache a copy for the next iteration. The current wand will be
destroyed by the caller. */
......
......@@ -7507,6 +7507,7 @@ next_element_from_display_vector (struct it *it)
/* For the last character of the box-face run, we need to look
either at the next glyph from the display vector, or at the
face we saw before the display vector. */
next_face_id = it->saved_face_id;
if (it->current.dpvec_index < it->dpend - it->dpvec - 1)
{
if (it->dpvec_face_id >= 0)
......@@ -7521,8 +7522,6 @@ next_element_from_display_vector (struct it *it)
it->saved_face_id);
}
}
else
next_face_id = it->saved_face_id;
next_face = FACE_FROM_ID (it->f, next_face_id);
it->end_of_box_run_p = (this_face && this_face->box != FACE_NO_BOX
&& (!next_face
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment