[gimp] libgimpbase: Avoid an assignment to self.



commit 58a557d8008fb4b5598fb9ce3be863dd3d21f3c7
Author: Murray Cumming <murrayc murrayc com>
Date:   Wed Dec 3 09:26:33 2014 +0100

    libgimpbase: Avoid an assignment to self.
    
    gimp_param_unit_value_validate() set a value to itself to not
    change the value, which was strange though not particularly wrong.
    Found by Coverity Scan.

 libgimpbase/gimpunit.c |    6 +-----
 1 files changed, 1 insertions(+), 5 deletions(-)
---
diff --git a/libgimpbase/gimpunit.c b/libgimpbase/gimpunit.c
index 1898fa6..1c1e778 100644
--- a/libgimpbase/gimpunit.c
+++ b/libgimpbase/gimpunit.c
@@ -558,11 +558,7 @@ gimp_param_unit_value_validate (GParamSpec *pspec,
   GimpParamSpecUnit *uspec = GIMP_PARAM_SPEC_UNIT (pspec);
   gint               oval  = value->data[0].v_int;
 
-  if (uspec->allow_percent && value->data[0].v_int == GIMP_UNIT_PERCENT)
-    {
-      value->data[0].v_int = value->data[0].v_int;
-    }
-  else
+  if (!(uspec->allow_percent && value->data[0].v_int == GIMP_UNIT_PERCENT))
     {
       value->data[0].v_int = CLAMP (value->data[0].v_int,
                                     ispec->minimum,


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