]> granicus.if.org Git - imagemagick/commitdiff
cleanup identical conditions (#1339)
authorIlya Shipitsin <chipitsine@gmail.com>
Sun, 7 Oct 2018 12:02:46 +0000 (17:02 +0500)
committerImageMagick <urban-warrior@users.noreply.github.com>
Sun, 7 Oct 2018 12:02:46 +0000 (08:02 -0400)
[MagickCore/nt-base.c:1403] -> [MagickCore/nt-base.c:1408]: (warning) Identical inner 'if' condition is always true.
[MagickCore/prepress.c:139] -> [MagickCore/prepress.c:144]: (warning) Identical inner 'if' condition is always true.
[MagickCore/quantize.c:3382] -> [MagickCore/quantize.c:3387]: (warning) Identical inner 'if' condition is always true.
[MagickCore/xml-tree.c:449] -> [MagickCore/xml-tree.c:454]: (warning) Identical inner 'if' condition is always true.
[MagickCore/xml-tree.c:528] -> [MagickCore/xml-tree.c:530]: (warning) Identical inner 'if' condition is always true.
[coders/dds.c:1172] -> [coders/dds.c:1178]: (warning) Identical inner 'if' condition is always true.

MagickCore/nt-base.c
MagickCore/prepress.c
MagickCore/quantize.c
MagickCore/xml-tree.c
coders/dds.c

index 9edba4b3f64af70831ee032b5e5f78b70f890b5b..ae34a86a76f09ae04488f045ddde0bfd7ea46b31 100644 (file)
@@ -1405,22 +1405,19 @@ MagickPrivate int NTGhostscriptEXE(char *path,int length)
       if (ghost_semaphore == (SemaphoreInfo *) NULL)
         ActivateSemaphoreInfo(&ghost_semaphore);
       LockSemaphoreInfo(ghost_semaphore);
-      if (*program == '\0')
+      if (NTGhostscriptGetString("GS_DLL",&is_64_bit_version,program,
+          sizeof(program)) == FALSE)
         {
-          if (NTGhostscriptGetString("GS_DLL",&is_64_bit_version,program,
-              sizeof(program)) == FALSE)
-            {
-              UnlockSemaphoreInfo(ghost_semaphore);
-              return(FALSE);
-            }
-          p=strrchr(program,'\\');
-          if (p != (char *) NULL)
-            {
-              p++;
-              *p='\0';
-              (void) ConcatenateMagickString(program,is_64_bit_version ?
-                "gswin64c.exe" : "gswin32c.exe",sizeof(program));
-            }
+          UnlockSemaphoreInfo(ghost_semaphore);
+          return(FALSE);
+        }
+      p=strrchr(program,'\\');
+      if (p != (char *) NULL)
+        {
+          p++;
+          *p='\0';
+          (void) ConcatenateMagickString(program,is_64_bit_version ?
+            "gswin64c.exe" : "gswin32c.exe",sizeof(program));
         }
       UnlockSemaphoreInfo(ghost_semaphore);
     }
index 4b618090b7561b8fa7a795daf6d3e098eab5bbbb..50da1886b6255af258abf2329e413cc413fe6ca3 100644 (file)
@@ -141,8 +141,7 @@ MagickExport double GetImageTotalInkDensity(Image *image,
         #pragma omp critical (MagickCore_GetImageTotalInkDensity)
 #endif
         {
-          if (density > total_ink_density)
-            total_ink_density=density;
+          total_ink_density=density;
         }
       p+=GetPixelChannels(image);
     }
index dcb8cc9f528dc319900f0453025db2eeac974f65..e37f0464568099faf150c5d8dc772c21e80b83af 100644 (file)
@@ -3384,17 +3384,14 @@ static MagickBooleanType SetGrayscaleImage(Image *image,
 #if defined(MAGICKCORE_OPENMP_SUPPORT)
               #pragma omp critical (MagickCore_SetGrayscaleImage)
 #endif
-              if (colormap_index[intensity] < 0)
-                {
-                  colormap_index[intensity]=(ssize_t) image->colors;
-                  image->colormap[image->colors].red=(double)
-                    GetPixelRed(image,q);
-                  image->colormap[image->colors].green=(double)
-                    GetPixelGreen(image,q);
-                  image->colormap[image->colors].blue=(double)
-                    GetPixelBlue(image,q);
-                  image->colors++;
-               }
+              colormap_index[intensity]=(ssize_t) image->colors;
+              image->colormap[image->colors].red=(double)
+                GetPixelRed(image,q);
+              image->colormap[image->colors].green=(double)
+                GetPixelGreen(image,q);
+              image->colormap[image->colors].blue=(double)
+                GetPixelBlue(image,q);
+              image->colors++;
             }
           SetPixelIndex(image,(Quantum) colormap_index[intensity],q);
           q+=GetPixelChannels(image);
index e9b4a8a08606b3b885c6d99866855360098ed24c..a23b7228ba775b96da5f631bc586048ad6b68f6f 100644 (file)
@@ -451,8 +451,7 @@ static char **DestroyXMLTreeAttributes(char **attributes)
     /*
       Destroy attribute tag and value.
     */
-    if (attributes[i] != (char *) NULL)
-      attributes[i]=DestroyString(attributes[i]);
+    attributes[i]=DestroyString(attributes[i]);
     if (attributes[i+1] != (char *) NULL)
       attributes[i+1]=DestroyString(attributes[i+1]);
   }
@@ -527,8 +526,7 @@ static void DestroyXMLTreeRoot(XMLTreeInfo *xml_info)
       attributes[0]=DestroyString(attributes[0]);
     for (j=1; attributes[j] != (char *) NULL; j+=3)
     {
-      if (attributes[j] != (char *) NULL)
-        attributes[j]=DestroyString(attributes[j]);
+      attributes[j]=DestroyString(attributes[j]);
       if (attributes[j+1] != (char *) NULL)
         attributes[j+1]=DestroyString(attributes[j+1]);
       if (attributes[j+2] != (char *) NULL)
index d7e55d5d20c6cb3a21853a6888f3f7a4500ccd91..80f58320d4997aab508e6b2cc98081793d646eb1 100644 (file)
@@ -1175,16 +1175,13 @@ static void CompressClusterFit(const size_t count,
               #pragma omp critical (DDS_CompressClusterFit)
 #endif
               {
-                if (error < bestError)
-                  {
-                    VectorCopy43(a,start);
-                    VectorCopy43(b,end);
-                    bestError = error;
-                    besti = i;
-                    bestj = j;
-                    bestk = k;
-                    bestIteration = iterationIndex;
-                  }
+                VectorCopy43(a,start);
+                VectorCopy43(b,end);
+                bestError = error;
+                besti = i;
+                bestj = j;
+                bestk = k;
+                bestIteration = iterationIndex;
               }
             }