[gimp] Bug 676270 - cppcheck report



commit 47c987b09e21b460e3d7f5c9e706ffaef4f198a3
Author: Michael Natterer <mitch gimp org>
Date:   Sat Aug 4 03:20:36 2012 +0200

    Bug 676270 - cppcheck report
    
    Fix a couple of harmless stuff pointed out in the report, and one
    real bug: gimp_plug_in_close() was killing each process 10 times
    on windows.

 app/actions/image-actions.c    |    2 --
 app/display/gimpmotionbuffer.c |    4 ++--
 app/plug-in/gimpplugin.c       |    2 +-
 app/tools/gimpmovetool.c       |    7 +++----
 app/xcf/xcf-save.c             |    5 +++--
 5 files changed, 9 insertions(+), 11 deletions(-)
---
diff --git a/app/actions/image-actions.c b/app/actions/image-actions.c
index 55bdc3e..68d9cad 100644
--- a/app/actions/image-actions.c
+++ b/app/actions/image-actions.c
@@ -281,7 +281,6 @@ image_actions_update (GimpActionGroup *group,
         case GIMP_RGB:     action = "image-convert-rgb";       break;
         case GIMP_GRAY:    action = "image-convert-grayscale"; break;
         case GIMP_INDEXED: action = "image-convert-indexed";   break;
-          break;
         }
 
       gimp_action_group_set_action_active (group, action, TRUE);
@@ -293,7 +292,6 @@ image_actions_update (GimpActionGroup *group,
         case GIMP_PRECISION_U32:   action = "image-convert-u32";   break;
         case GIMP_PRECISION_HALF:  action = "image-convert-half";  break;
         case GIMP_PRECISION_FLOAT: action = "image-convert-float"; break;
-          break;
         }
 
       gimp_action_group_set_action_active (group, action, TRUE);
diff --git a/app/display/gimpmotionbuffer.c b/app/display/gimpmotionbuffer.c
index b8bd566..cb73a6c 100644
--- a/app/display/gimpmotionbuffer.c
+++ b/app/display/gimpmotionbuffer.c
@@ -264,8 +264,6 @@ gimp_motion_buffer_motion_event (GimpMotionBuffer *buffer,
   gdouble  delta_time  = 0.001;
   gdouble  delta_x     = 0.0;
   gdouble  delta_y     = 0.0;
-  gdouble  dir_delta_x = 0.0;
-  gdouble  dir_delta_y = 0.0;
   gdouble  distance    = 1.0;
 
   g_return_val_if_fail (GIMP_IS_MOTION_BUFFER (buffer), FALSE);
@@ -292,6 +290,8 @@ gimp_motion_buffer_motion_event (GimpMotionBuffer *buffer,
       gdouble    filter;
       gdouble    dist;
       gdouble    delta_dir;
+      gdouble    dir_delta_x = 0.0;
+      gdouble    dir_delta_y = 0.0;
 
       delta_x = last_dir_event.x - coords->x;
       delta_y = last_dir_event.y - coords->y;
diff --git a/app/plug-in/gimpplugin.c b/app/plug-in/gimpplugin.c
index b474584..12e7f76 100644
--- a/app/plug-in/gimpplugin.c
+++ b/app/plug-in/gimpplugin.c
@@ -478,7 +478,7 @@ gimp_plug_in_close (GimpPlugIn *plug_in,
           DWORD dwExitCode = STILL_ACTIVE;
           DWORD dwTries    = 10;
 
-          while (dwExitCode == dwExitCode &&
+          while (dwExitCode == STILL_ACTIVE &&
                  GetExitCodeProcess ((HANDLE) plug_in->pid, &dwExitCode) &&
                  (dwTries > 0))
             {
diff --git a/app/tools/gimpmovetool.c b/app/tools/gimpmovetool.c
index 39b9b5d..7ace036 100644
--- a/app/tools/gimpmovetool.c
+++ b/app/tools/gimpmovetool.c
@@ -725,14 +725,13 @@ gimp_move_tool_cursor_update (GimpTool         *tool,
     }
   else
     {
-      GimpGuide  *guide;
       GimpLayer  *layer;
       const gint  snap_distance = display->config->snap_distance;
 
       if (gimp_display_shell_get_show_guides (shell) &&
-          (guide = gimp_image_find_guide (image, coords->x, coords->y,
-                                          FUNSCALEX (shell, snap_distance),
-                                          FUNSCALEY (shell, snap_distance))))
+          gimp_image_find_guide (image, coords->x, coords->y,
+                                 FUNSCALEX (shell, snap_distance),
+                                 FUNSCALEY (shell, snap_distance)))
         {
           tool_cursor = GIMP_TOOL_CURSOR_HAND;
           modifier    = GIMP_CURSOR_MODIFIER_MOVE;
diff --git a/app/xcf/xcf-save.c b/app/xcf/xcf-save.c
index b8c60e0..b707fe3 100644
--- a/app/xcf/xcf-save.c
+++ b/app/xcf/xcf-save.c
@@ -958,13 +958,14 @@ xcf_save_prop (XcfInfo    *info,
     case PROP_PARASITES:
       {
         GimpParasiteList *list;
-        guint32           base, length;
-        long              pos;
 
         list = va_arg (args, GimpParasiteList *);
 
         if (gimp_parasite_list_persistent_length (list) > 0)
           {
+            guint32 base, length;
+            long    pos;
+
             xcf_write_prop_type_check_error (info, prop_type);
 
             /* because we don't know how much room the parasite list will take



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