]> granicus.if.org Git - imagemagick/commitdiff
Use switch to improve readability.
authorDirk Lemstra <dirk@lemstra.org>
Tue, 20 Aug 2019 18:17:10 +0000 (20:17 +0200)
committerDirk Lemstra <dirk@lemstra.org>
Tue, 20 Aug 2019 20:04:36 +0000 (22:04 +0200)
coders/png.c

index de0e860916bbd93e3e6eefe718e1bf8fde7ba90d..0c04598bd831e9cb1e71bf78c4ee925d304d3bfe 100644 (file)
@@ -12523,31 +12523,35 @@ static MagickBooleanType WritePNGImage(const ImageInfo *image_info,
 
   for (source=0; source<8; source++)
   {
-    value = NULL;
+    value = (const char *) NULL;
 
-    if (source == 0)
-      value=GetImageOption(image_info,"png:exclude-chunks");
-
-    if (source == 1)
-      value=GetImageArtifact(image,"png:exclude-chunks");
-
-    if (source == 2)
-      value=GetImageOption(image_info,"png:exclude-chunk");
-
-    if (source == 3)
-      value=GetImageArtifact(image,"png:exclude-chunk");
-
-    if (source == 4)
-      value=GetImageOption(image_info,"png:include-chunks");
-
-    if (source == 5)
-      value=GetImageArtifact(image,"png:include-chunks");
-
-    if (source == 6)
-      value=GetImageOption(image_info,"png:include-chunk");
-
-    if (source == 7)
-      value=GetImageArtifact(image,"png:include-chunk");
+    switch(source)
+    {
+      case 0:
+        value=GetImageOption(image_info,"png:exclude-chunks");
+        break;
+      case 1:
+        value=GetImageArtifact(image,"png:exclude-chunks");
+        break;
+      case 2:
+        value=GetImageOption(image_info,"png:exclude-chunk");
+        break;
+      case 3:
+        value=GetImageArtifact(image,"png:exclude-chunk");
+        break;
+      case 4:
+        value=GetImageOption(image_info,"png:include-chunks");
+        break;
+      case 5:
+        value=GetImageArtifact(image,"png:include-chunks");
+        break;
+      case 6:
+        value=GetImageOption(image_info,"png:include-chunk");
+        break;
+      case 7:
+        value=GetImageArtifact(image,"png:include-chunk");
+        break;
+    }
 
     if (value == NULL)
        continue;