emacs-diffs
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Emacs-diffs] trunk r113894: Fix minor problems found by static checking


From: Paul Eggert
Subject: [Emacs-diffs] trunk r113894: Fix minor problems found by static checking.
Date: Thu, 15 Aug 2013 16:29:29 +0000
User-agent: Bazaar (2.6b2)

------------------------------------------------------------
revno: 113894
revision-id: address@hidden
parent: address@hidden
committer: Paul Eggert <address@hidden>
branch nick: trunk
timestamp: Thu 2013-08-15 09:28:42 -0700
message:
  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.
modified:
  src/ChangeLog                  changelog-20091113204419-o5vbwnq5f7feedwu-1438
  src/frame.c                    frame.c-20091113204419-o5vbwnq5f7feedwu-243
  src/image.c                    image.c-20091113204419-o5vbwnq5f7feedwu-2969
  src/xdisp.c                    xdisp.c-20091113204419-o5vbwnq5f7feedwu-240
=== modified file 'src/ChangeLog'
--- a/src/ChangeLog     2013-08-15 16:01:13 +0000
+++ b/src/ChangeLog     2013-08-15 16:28:42 +0000
@@ -1,3 +1,14 @@
+2013-08-15  Paul Eggert  <address@hidden>
+
+       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  <address@hidden>
 
        Fix infinite frame selection loop (Bug#15025).

=== modified file 'src/frame.c'
--- a/src/frame.c       2013-08-15 15:37:03 +0000
+++ b/src/frame.c       2013-08-15 16:28:42 +0000
@@ -1197,7 +1197,8 @@
   /* 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.

=== modified file 'src/image.c'
--- a/src/image.c       2013-08-15 16:03:56 +0000
+++ b/src/image.c       2013-08-15 16:28:42 +0000
@@ -7877,6 +7877,7 @@
 static MagickWand *
 imagemagick_compute_animated_image (MagickWand *super_wand, int ino)
 {
+  int i;
   MagickWand *composite_wand;
 
   MagickSetIteratorIndex (super_wand, 0);
@@ -7886,57 +7887,60 @@
   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;
-
-    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;
-      }
-
-    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++)
-       {
-         /* Copy over non-transparent pixels. */
-         if (PixelGetAlpha (source[x]))
+  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);
+
+      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;
+       }
+
+      while ((source = PixelGetNextIteratorRow (source_iterator, 
&source_width))
+            != NULL)
+       {
+         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. */
   animation_cache = CloneMagickWand (composite_wand);

=== modified file 'src/xdisp.c'
--- a/src/xdisp.c       2013-08-15 15:28:53 +0000
+++ b/src/xdisp.c       2013-08-15 16:28:42 +0000
@@ -7507,6 +7507,7 @@
       /* 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 @@
                                            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


reply via email to

[Prev in Thread] Current Thread [Next in Thread]