From 858b98de510eb229a98a367ff7b7a52d7d606fb0 Mon Sep 17 00:00:00 2001 From: Dirk Lemstra Date: Tue, 20 Aug 2019 20:17:10 +0200 Subject: [PATCH] Use switch to improve readability. --- coders/png.c | 52 ++++++++++++++++++++++++++++------------------------ 1 file changed, 28 insertions(+), 24 deletions(-) diff --git a/coders/png.c b/coders/png.c index de0e86091..0c04598bd 100644 --- a/coders/png.c +++ b/coders/png.c @@ -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; -- 2.40.0