]> granicus.if.org Git - imagemagick/commitdiff
Fixed some indentations and added lots of blank lines in coders/png.c
authorglennrp <glennrp@git.imagemagick.org>
Wed, 24 Nov 2010 18:12:06 +0000 (18:12 +0000)
committerglennrp <glennrp@git.imagemagick.org>
Wed, 24 Nov 2010 18:12:06 +0000 (18:12 +0000)
coders/png.c

index 63480715b373a090a520e3825fa08b8379792780..f567c12e5ad98d029fcacbe3a85faa0eb3771d24 100644 (file)
@@ -2631,6 +2631,7 @@ static Image *ReadOnePNGImage(MngInfo *mng_info,
 
             break;
           }
+
           case 2:
           {
             for (x=(ssize_t) image->columns-3; x > 0; x-=4)
@@ -2649,6 +2650,7 @@ static Image *ReadOnePNGImage(MngInfo *mng_info,
 
             break;
           }
+
           case 4:
           {
             for (x=(ssize_t) image->columns-1; x > 0; x-=2)
@@ -2662,6 +2664,7 @@ static Image *ReadOnePNGImage(MngInfo *mng_info,
 
             break;
           }
+
           case 8:
           {
             if (ping_color_type == 4)
@@ -2683,6 +2686,7 @@ static Image *ReadOnePNGImage(MngInfo *mng_info,
 
             break;
           }
+
           case 16:
           {
             for (x=(ssize_t) image->columns-1; x >= 0; x--)
@@ -2701,6 +2705,7 @@ static Image *ReadOnePNGImage(MngInfo *mng_info,
               quantum|=(*p++);
               *r=(Quantum) quantum;
               r++;
+
               if (ping_color_type == 4)
                 {
                   quantum=((*p++) << 8);
@@ -2732,9 +2737,11 @@ static Image *ReadOnePNGImage(MngInfo *mng_info,
                   p+=2;
                   q++;
                 }
+
 #else /* MAGICKCORE_QUANTUM_DEPTH == 8 */
               *r++=(*p++);
               p++; /* strip low byte */
+
               if (ping_color_type == 4)
                 {
                   q->opacity=(Quantum) (QuantumRange-(*p++));
@@ -2744,8 +2751,10 @@ static Image *ReadOnePNGImage(MngInfo *mng_info,
 #endif
 #endif
             }
+
             break;
           }
+
           default:
             break;
         }
@@ -2764,6 +2773,7 @@ static Image *ReadOnePNGImage(MngInfo *mng_info,
           {
             status=SetImageProgress(image,LoadImageTag,(MagickOffsetType) y,
                 image->rows);
+
             if (status == MagickFalse)
               break;
           }
@@ -2771,6 +2781,7 @@ static Image *ReadOnePNGImage(MngInfo *mng_info,
       if ((image->previous == (Image *) NULL) && (num_passes != 1))
         {
           status=SetImageProgress(image,LoadImageTag,pass,num_passes);
+
           if (status == MagickFalse)
             break;
         }
@@ -2789,6 +2800,7 @@ static Image *ReadOnePNGImage(MngInfo *mng_info,
       (void) SyncImage(image);
       image->matte=matte;
     }
+
   png_read_end(ping,ping_info);
 
   if (image_info->number_scenes != 0 && mng_info->scenes_found-1 <
@@ -2806,6 +2818,7 @@ static Image *ReadOnePNGImage(MngInfo *mng_info,
           "  exit ReadOnePNGImage() early.");
       return(image);
     }
+
   if (png_get_valid(ping,ping_info,PNG_INFO_tRNS))
     {
       ClassType
@@ -2830,6 +2843,7 @@ static Image *ReadOnePNGImage(MngInfo *mng_info,
                    ScaleCharToQuantum((unsigned char)(255-ping_trans_alpha[x]));
               }
             }
+
           else if (ping_color_type == PNG_COLOR_TYPE_GRAY)
             {
               for (x=0; x < (int) image->colors; x++)
@@ -2843,6 +2857,7 @@ static Image *ReadOnePNGImage(MngInfo *mng_info,
             }
           (void) SyncImage(image);
         }
+
       else
         {
           for (y=0; y < (ssize_t) image->rows; y++)
@@ -2904,6 +2919,7 @@ static Image *ReadOnePNGImage(MngInfo *mng_info,
 
                 q++;
               }
+
             else if (ping_color_type == PNG_COLOR_TYPE_GRAY)
               for (x=0; x < (ssize_t) image->columns; x++)
               {
@@ -2934,6 +2950,7 @@ static Image *ReadOnePNGImage(MngInfo *mng_info,
 
             q++;
           }
+
         if (SyncAuthenticPixels(image,exception) == MagickFalse)
           break;
       }
@@ -2943,6 +2960,7 @@ static Image *ReadOnePNGImage(MngInfo *mng_info,
   if ((ping_color_type == PNG_COLOR_TYPE_GRAY) ||
       (ping_color_type == PNG_COLOR_TYPE_GRAY_ALPHA))
     image->colorspace=GRAYColorspace;
+
   if (png_get_text(ping,ping_info,&text,&num_text) != 0)
     for (i=0; i < (ssize_t) num_text; i++)
     {
@@ -3001,6 +3019,7 @@ static Image *ReadOnePNGImage(MngInfo *mng_info,
               mng_info->ob[object_id]->reference_count=1;
             }
         }
+
       if ((mng_info->ob[object_id] == (MngBuffer *) NULL) ||
           mng_info->ob[object_id]->frozen)
         {
@@ -3063,6 +3082,7 @@ static Image *ReadOnePNGImage(MngInfo *mng_info,
                 mng_info->ob[object_id]->plte[i]=plte[i];
               }
             }
+
           else
               mng_info->ob[object_id]->plte_length=0;
         }
@@ -3114,30 +3134,38 @@ static Image *ReadPNGImage(const ImageInfo *image_info,ExceptionInfo *exception)
   */
   assert(image_info != (const ImageInfo *) NULL);
   assert(image_info->signature == MagickSignature);
+
   if (image_info->debug != MagickFalse)
     (void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",
       image_info->filename);
+
   assert(exception != (ExceptionInfo *) NULL);
   assert(exception->signature == MagickSignature);
   logging=LogMagickEvent(CoderEvent,GetMagickModule(),"enter ReadPNGImage()");
   image=AcquireImage(image_info);
   mng_info=(MngInfo *) NULL;
   status=OpenBlob(image_info,image,ReadBinaryBlobMode,exception);
+
   if (status == MagickFalse)
     ThrowReaderException(FileOpenError,"UnableToOpenFile");
+
   /*
     Verify PNG signature.
   */
   count=ReadBlob(image,8,(unsigned char *) magic_number);
+
   if (memcmp(magic_number,"\211PNG\r\n\032\n",8) != 0)
     ThrowReaderException(CorruptImageError,"ImproperImageHeader");
+
   /*
     Allocate a MngInfo structure.
   */
   have_mng_structure=MagickFalse;
   mng_info=(MngInfo *) AcquireMagickMemory(sizeof(MngInfo));
+
   if (mng_info == (MngInfo *) NULL)
     ThrowReaderException(ResourceLimitError,"MemoryAllocationFailed");
+
   /*
     Initialize members of the MngInfo structure.
   */
@@ -3148,6 +3176,7 @@ static Image *ReadPNGImage(const ImageInfo *image_info,ExceptionInfo *exception)
   previous=image;
   image=ReadOnePNGImage(mng_info,image_info,exception);
   MngInfoFreeStruct(mng_info,&have_mng_structure);
+
   if (image == (Image *) NULL)
     {
       if (previous != (Image *) NULL)
@@ -3165,7 +3194,9 @@ static Image *ReadPNGImage(const ImageInfo *image_info,ExceptionInfo *exception)
 
       return((Image *) NULL);
     }
+
   (void) CloseBlob(image);
+
   if ((image->columns == 0) || (image->rows == 0))
     {
       if (logging != MagickFalse)
@@ -3174,6 +3205,7 @@ static Image *ReadPNGImage(const ImageInfo *image_info,ExceptionInfo *exception)
 
       ThrowReaderException(CorruptImageError,"CorruptImage");
     }
+
   if (LocaleCompare(image_info->magick,"PNG8") == 0)
     {
       (void) SetImageType(image,PaletteType);
@@ -3183,6 +3215,7 @@ static Image *ReadPNGImage(const ImageInfo *image_info,ExceptionInfo *exception)
           /* To do: Reduce to binary transparency */
         }
     }
+
   if (LocaleCompare(image_info->magick,"PNG24") == 0)
     {
       (void) SetImageType(image,TrueColorType);
@@ -3363,6 +3396,7 @@ static Image *ReadOneJNGImage(MngInfo *mng_info,
 
     p=NULL;
     chunk=(unsigned char *) NULL;
+
     if (length)
       {
         chunk=(unsigned char *) AcquireQuantumMemory(length,sizeof(*chunk));
@@ -3375,12 +3409,14 @@ static Image *ReadOneJNGImage(MngInfo *mng_info,
 
         p=chunk;
       }
+
     (void) ReadBlobMSBLong(image);  /* read crc word */
 
     if (skip_to_iend)
       {
         if (length)
           chunk=(unsigned char *) RelinquishMagickMemory(chunk);
+
         continue;
       }
 
@@ -3396,45 +3432,59 @@ static Image *ReadOneJNGImage(MngInfo *mng_info,
             jng_image_sample_depth=p[9];
             jng_image_compression_method=p[10];
             jng_image_interlace_method=p[11];
+
             image->interlace=jng_image_interlace_method != 0 ? PNGInterlace :
               NoInterlace;
+
             jng_alpha_sample_depth=p[12];
             jng_alpha_compression_method=p[13];
             jng_alpha_filter_method=p[14];
             jng_alpha_interlace_method=p[15];
+
             if (logging != MagickFalse)
               {
                 (void) LogMagickEvent(CoderEvent,GetMagickModule(),
                   "    jng_width:      %16lu",(unsigned long) jng_width);
+
                 (void) LogMagickEvent(CoderEvent,GetMagickModule(),
                   "    jng_width:      %16lu",(unsigned long) jng_height);
+
                 (void) LogMagickEvent(CoderEvent,GetMagickModule(),
                   "    jng_color_type: %16d",jng_color_type);
+
                 (void) LogMagickEvent(CoderEvent,GetMagickModule(),
                   "    jng_image_sample_depth:      %3d",
                   jng_image_sample_depth);
+
                 (void) LogMagickEvent(CoderEvent,GetMagickModule(),
                   "    jng_image_compression_method:%3d",
                   jng_image_compression_method);
+
                 (void) LogMagickEvent(CoderEvent,GetMagickModule(),
                   "    jng_image_interlace_method:  %3d",
                   jng_image_interlace_method);
+
                 (void) LogMagickEvent(CoderEvent,GetMagickModule(),
                   "    jng_alpha_sample_depth:      %3d",
                   jng_alpha_sample_depth);
+
                 (void) LogMagickEvent(CoderEvent,GetMagickModule(),
                   "    jng_alpha_compression_method:%3d",
                   jng_alpha_compression_method);
+
                 (void) LogMagickEvent(CoderEvent,GetMagickModule(),
                   "    jng_alpha_filter_method:     %3d",
                   jng_alpha_filter_method);
+
                 (void) LogMagickEvent(CoderEvent,GetMagickModule(),
                   "    jng_alpha_interlace_method:  %3d",
                   jng_alpha_interlace_method);
               }
           }
+
         if (length)
           chunk=(unsigned char *) RelinquishMagickMemory(chunk);
+
         continue;
       }
 
@@ -3451,8 +3501,10 @@ static Image *ReadOneJNGImage(MngInfo *mng_info,
         */
 
         color_image_info=(ImageInfo *)AcquireMagickMemory(sizeof(ImageInfo));
+
         if (color_image_info == (ImageInfo *) NULL)
           ThrowReaderException(ResourceLimitError,"MemoryAllocationFailed");
+
         GetImageInfo(color_image_info);
         color_image=AcquireImage(color_image_info);
 
@@ -3530,17 +3582,17 @@ static Image *ReadOneJNGImage(MngInfo *mng_info,
 
     if (memcmp(type,mng_JDAT,4) == 0)
       {
-        /*
-           Copy chunk to color_image->blob
-        */
+        /* Copy chunk to color_image->blob */
 
         if (logging != MagickFalse)
           (void) LogMagickEvent(CoderEvent,GetMagickModule(),
             "    Copying JDAT chunk data to color_blob.");
 
         (void) WriteBlob(color_image,length,chunk);
+
         if (length)
           chunk=(unsigned char *) RelinquishMagickMemory(chunk);
+
         continue;
       }
 
@@ -3549,9 +3601,7 @@ static Image *ReadOneJNGImage(MngInfo *mng_info,
         png_byte
            data[5];
 
-        /*
-           Copy IDAT header and chunk data to alpha_image->blob
-        */
+        /* Copy IDAT header and chunk data to alpha_image->blob */
 
         if (image_info->ping == MagickFalse)
           {
@@ -3576,9 +3626,7 @@ static Image *ReadOneJNGImage(MngInfo *mng_info,
 
     if ((memcmp(type,mng_JDAA,4) == 0) || (memcmp(type,mng_JdAA,4) == 0))
       {
-        /*
-           Copy chunk data to alpha_image->blob
-        */
+        /* Copy chunk data to alpha_image->blob */
 
         if (image_info->ping == MagickFalse)
           {
@@ -3647,6 +3695,7 @@ static Image *ReadOneJNGImage(MngInfo *mng_info,
             image->chromaticity.blue_primary.x=0.00001*mng_get_long(&p[24]);
             image->chromaticity.blue_primary.y=0.00001*mng_get_long(&p[28]);
           }
+
         chunk=(unsigned char *) RelinquishMagickMemory(chunk);
         continue;
       }
@@ -3667,6 +3716,7 @@ static Image *ReadOneJNGImage(MngInfo *mng_info,
             image->chromaticity.white_point.x=0.3127f;
             image->chromaticity.white_point.y=0.3290f;
           }
+
         chunk=(unsigned char *) RelinquishMagickMemory(chunk);
         continue;
       }
@@ -3684,6 +3734,7 @@ static Image *ReadOneJNGImage(MngInfo *mng_info,
                 image->page.y/=10000;
               }
           }
+
         if (length)
           chunk=(unsigned char *) RelinquishMagickMemory(chunk);
 
@@ -3753,6 +3804,7 @@ static Image *ReadOneJNGImage(MngInfo *mng_info,
   */
 
   (void) CloseBlob(color_image);
+
   if (logging != MagickFalse)
     (void) LogMagickEvent(CoderEvent,GetMagickModule(),
       "    Reading jng_image from color_blob.");
@@ -3786,6 +3838,7 @@ static Image *ReadOneJNGImage(MngInfo *mng_info,
     s=GetVirtualPixels(jng_image,0,y,image->columns,1,&image->exception);
     q=GetAuthenticPixels(image,0,y,image->columns,1,exception);
     (void) CopyMagickMemory(q,s,length);
+
     if (SyncAuthenticPixels(image,exception) == MagickFalse)
       break;
   }
@@ -3824,6 +3877,7 @@ static Image *ReadOneJNGImage(MngInfo *mng_info,
              s=GetVirtualPixels(jng_image,0,y,image->columns,1,
                 &image->exception);
              q=GetAuthenticPixels(image,0,y,image->columns,1,exception);
+
              if (image->matte != MagickFalse)
                for (x=(ssize_t) image->columns; x != 0; x--,q++,s++)
                   q->opacity=(Quantum) QuantumRange-s->red;
@@ -3847,9 +3901,8 @@ static Image *ReadOneJNGImage(MngInfo *mng_info,
        }
     }
 
-  /*
-    Read the JNG image.
-  */
+  /* Read the JNG image.  */
+
   if (mng_info->mng_type == 0)
     {
       mng_info->mng_width=jng_width;
@@ -3956,25 +4009,23 @@ static Image *ReadJNGImage(const ImageInfo *image_info,ExceptionInfo *exception)
   if (LocaleCompare(image_info->magick,"JNG") != 0)
     ThrowReaderException(CorruptImageError,"ImproperImageHeader");
 
-  /*
-    Verify JNG signature.
-  */
+  /* Verify JNG signature.  */
+
   count=(size_t) ReadBlob(image,8,(unsigned char *) magic_number);
+
   if (memcmp(magic_number,"\213JNG\r\n\032\n",8) != 0)
     ThrowReaderException(CorruptImageError,"ImproperImageHeader");
 
-  /*
-    Allocate a MngInfo structure.
-  */
+  /* Allocate a MngInfo structure.  */
+
   have_mng_structure=MagickFalse;
   mng_info=(MngInfo *) AcquireMagickMemory(sizeof(*mng_info));
 
   if (mng_info == (MngInfo *) NULL)
     ThrowReaderException(ResourceLimitError,"MemoryAllocationFailed");
 
-  /*
-    Initialize members of the MngInfo structure.
-  */
+  /* Initialize members of the MngInfo structure.  */
+
   (void) ResetMagickMemory(mng_info,0,sizeof(MngInfo));
   have_mng_structure=MagickTrue;
 
@@ -3998,6 +4049,7 @@ static Image *ReadJNGImage(const ImageInfo *image_info,ExceptionInfo *exception)
       return((Image *) NULL);
     }
   (void) CloseBlob(image);
+
   if (image->columns == 0 || image->rows == 0)
     {
       if (logging != MagickFalse)
@@ -4115,9 +4167,8 @@ static Image *ReadMNGImage(const ImageInfo *image_info,ExceptionInfo *exception)
   default_fb.left=0;
   default_fb.right=0;
 
-  /*
-    Open image file.
-  */
+  /* Open image file.  */
+
   assert(image_info != (const ImageInfo *) NULL);
   assert(image_info->signature == MagickSignature);
   (void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",image_info->filename);
@@ -4134,17 +4185,16 @@ static Image *ReadMNGImage(const ImageInfo *image_info,ExceptionInfo *exception)
   first_mng_object=MagickFalse;
   skipping_loop=(-1);
   have_mng_structure=MagickFalse;
-  /*
-    Allocate a MngInfo structure.
-  */
+
+  /* Allocate a MngInfo structure.  */
+
   mng_info=(MngInfo *) AcquireMagickMemory(sizeof(MngInfo));
 
   if (mng_info == (MngInfo *) NULL)
     ThrowReaderException(ResourceLimitError,"MemoryAllocationFailed");
 
-  /*
-    Initialize members of the MngInfo structure.
-  */
+  /* Initialize members of the MngInfo structure.  */
+
   (void) ResetMagickMemory(mng_info,0,sizeof(MngInfo));
   mng_info->image=image;
   have_mng_structure=MagickTrue;
@@ -4154,15 +4204,12 @@ static Image *ReadMNGImage(const ImageInfo *image_info,ExceptionInfo *exception)
       char
         magic_number[MaxTextExtent];
 
-      /*
-        Verify MNG signature.
-      */
+      /* Verify MNG signature.  */
       count=(size_t) ReadBlob(image,8,(unsigned char *) magic_number);
       if (memcmp(magic_number,"\212MNG\r\n\032\n",8) != 0)
         ThrowReaderException(CorruptImageError,"ImproperImageHeader");
-      /*
-        Initialize some nonzero members of the MngInfo structure.
-      */
+
+      /* Initialize some nonzero members of the MngInfo structure.  */
       for (i=0; i < MNG_MAX_OBJECTS; i++)
       {
         mng_info->object_clip[i].right=(ssize_t) PNG_UINT_31_MAX;
@@ -4170,6 +4217,7 @@ static Image *ReadMNGImage(const ImageInfo *image_info,ExceptionInfo *exception)
       }
       mng_info->exists[0]=MagickTrue;
     }
+
   first_mng_object=MagickTrue;
   mng_type=0;
 #if defined(MNG_INSERT_LAYERS)
@@ -4227,10 +4275,13 @@ static Image *ReadMNGImage(const ImageInfo *image_info,ExceptionInfo *exception)
         if (length)
           {
             chunk=(unsigned char *) AcquireQuantumMemory(length,sizeof(*chunk));
+
             if (chunk == (unsigned char *) NULL)
               ThrowReaderException(ResourceLimitError,"MemoryAllocationFailed");
+
             for (i=0; i < (ssize_t) length; i++)
               chunk[i]=(unsigned char) ReadBlobByte(image);
+
             p=chunk;
           }
 
@@ -4260,6 +4311,7 @@ static Image *ReadMNGImage(const ImageInfo *image_info,ExceptionInfo *exception)
           }
         if (memcmp(type,mng_MEND,4) == 0)
           break;
+
         if (skip_to_iend)
           {
             if (memcmp(type,mng_IEND,4) == 0)
@@ -4324,9 +4376,7 @@ static Image *ReadMNGImage(const ImageInfo *image_info,ExceptionInfo *exception)
 #endif
             if (GetAuthenticPixelQueue(image) != (PixelPacket *) NULL)
               {
-                /*
-                  Allocate next image structure.
-                */
+                /* Allocate next image structure.  */
                 AcquireNextImage(image_info,image);
 
                 if (GetNextImageInList(image) == (Image *) NULL)
@@ -4519,11 +4569,11 @@ static Image *ReadMNGImage(const ImageInfo *image_info,ExceptionInfo *exception)
             chunk=(unsigned char *) RelinquishMagickMemory(chunk);
             continue;
           }
+
         if (memcmp(type,mng_PLTE,4) == 0)
           {
-            /*
-              Read global PLTE.
-            */
+            /* Read global PLTE.  */
+
             if (length && (length < 769))
               {
                 if (mng_info->global_plte == (png_colorp) NULL)
@@ -4556,6 +4606,7 @@ static Image *ReadMNGImage(const ImageInfo *image_info,ExceptionInfo *exception)
             chunk=(unsigned char *) RelinquishMagickMemory(chunk);
             continue;
           }
+
         if (memcmp(type,mng_tRNS,4) == 0)
           {
             /* read global tRNS */
@@ -4593,9 +4644,8 @@ static Image *ReadMNGImage(const ImageInfo *image_info,ExceptionInfo *exception)
 
         if (memcmp(type,mng_cHRM,4) == 0)
           {
-            /*
-              Read global cHRM
-            */
+            /* Read global cHRM */
+
             if (length == 32)
               {
                 mng_info->global_chrm.white_point.x=0.00001*mng_get_long(p);
@@ -4615,9 +4665,11 @@ static Image *ReadMNGImage(const ImageInfo *image_info,ExceptionInfo *exception)
               }
             else
               mng_info->have_global_chrm=MagickFalse;
+
             chunk=(unsigned char *) RelinquishMagickMemory(chunk);
             continue;
           }
+
         if (memcmp(type,mng_sRGB,4) == 0)
           {
             /*
@@ -4631,9 +4683,11 @@ static Image *ReadMNGImage(const ImageInfo *image_info,ExceptionInfo *exception)
               }
             else
               mng_info->have_global_srgb=MagickFalse;
+
             chunk=(unsigned char *) RelinquishMagickMemory(chunk);
             continue;
           }
+
         if (memcmp(type,mng_iCCP,4) == 0)
           {
             /* To do. */
@@ -4643,8 +4697,10 @@ static Image *ReadMNGImage(const ImageInfo *image_info,ExceptionInfo *exception)
             */
             if (length)
               chunk=(unsigned char *) RelinquishMagickMemory(chunk);
+
             continue;
           }
+
         if (memcmp(type,mng_FRAM,4) == 0)
           {
             if (mng_type == 3)
@@ -4658,6 +4714,7 @@ static Image *ReadMNGImage(const ImageInfo *image_info,ExceptionInfo *exception)
             frame_delay=default_frame_delay;
             frame_timeout=default_frame_timeout;
             fb=default_fb;
+
             if (length)
               if (p[0])
                 mng_info->framing_mode=p[0];
@@ -4668,13 +4725,15 @@ static Image *ReadMNGImage(const ImageInfo *image_info,ExceptionInfo *exception)
 
             if (length > 6)
               {
-                /*
-                  Note the delay and frame clipping boundaries.
-                */
+                /* Note the delay and frame clipping boundaries.  */
+
                 p++; /* framing mode */
+
                 while (*p && ((p-chunk) < (ssize_t) length))
                   p++;  /* frame name */
+
                 p++;  /* frame name terminator */
+
                 if ((p-chunk) < (ssize_t) (length-4))
                   {
                     int
@@ -4686,6 +4745,7 @@ static Image *ReadMNGImage(const ImageInfo *image_info,ExceptionInfo *exception)
                     change_timeout=(*p++);
                     change_clipping=(*p++);
                     p++; /* change_sync */
+
                     if (change_delay)
                       {
                         frame_delay=1UL*image->ticks_per_second*
@@ -4706,6 +4766,7 @@ static Image *ReadMNGImage(const ImageInfo *image_info,ExceptionInfo *exception)
                           (void) LogMagickEvent(CoderEvent,GetMagickModule(),
                             "    Framing_delay=%.20g",(double) frame_delay);
                       }
+
                     if (change_timeout)
                       {
                         frame_timeout=1UL*image->ticks_per_second*
@@ -4726,6 +4787,7 @@ static Image *ReadMNGImage(const ImageInfo *image_info,ExceptionInfo *exception)
                           (void) LogMagickEvent(CoderEvent,GetMagickModule(),
                             "    Framing_timeout=%.20g",(double) frame_timeout);
                       }
+
                     if (change_clipping)
                       {
                         fb=mng_read_box(previous_fb,(char) p[0],&p[1]);
@@ -4737,6 +4799,7 @@ static Image *ReadMNGImage(const ImageInfo *image_info,ExceptionInfo *exception)
                             "    Frame_clip: L=%.20g R=%.20g T=%.20g B=%.20g",
                             (double) fb.left,(double) fb.right,(double) fb.top,
                             (double) fb.bottom);
+
                         if (change_clipping == 2)
                           default_fb=fb;
                       }
@@ -4762,18 +4825,18 @@ static Image *ReadMNGImage(const ImageInfo *image_info,ExceptionInfo *exception)
             if (insert_layers && (mng_info->framing_mode == 4) &&
                 (subframe_width) && (subframe_height))
               {
-                /*
-                  Allocate next image structure.
-                */
+                /* Allocate next image structure.  */
                 if (GetAuthenticPixelQueue(image) != (PixelPacket *) NULL)
                   {
                     AcquireNextImage(image_info,image);
+
                     if (GetNextImageInList(image) == (Image *) NULL)
                       {
                         image=DestroyImageList(image);
                         MngInfoFreeStruct(mng_info,&have_mng_structure);
                         return((Image *) NULL);
                       }
+
                     image=SyncNextImageInList(image);
                   }
 
@@ -4821,6 +4884,7 @@ static Image *ReadMNGImage(const ImageInfo *image_info,ExceptionInfo *exception)
             */
             first_object=(p[0] << 8) | p[1];
             last_object=(p[2] << 8) | p[3];
+
             for (i=(int) first_object; i <= (int) last_object; i++)
             {
               if (mng_info->exists[i] && !mng_info->frozen[i])
@@ -4832,6 +4896,7 @@ static Image *ReadMNGImage(const ImageInfo *image_info,ExceptionInfo *exception)
                   mng_info->object_clip[i]=mng_read_box(box,(char) p[4],&p[5]);
                 }
             }
+
             chunk=(unsigned char *) RelinquishMagickMemory(chunk);
             continue;
           }
@@ -4855,9 +4920,8 @@ static Image *ReadMNGImage(const ImageInfo *image_info,ExceptionInfo *exception)
 
         if ((memcmp(type,mng_DISC,4) == 0) || (memcmp(type,mng_SEEK,4) == 0))
           {
-            /*
-              Read DISC or SEEK.
-            */
+            /* Read DISC or SEEK.  */
+
             if ((length == 0) || !memcmp(type,mng_SEEK,4))
               {
                 for (i=1; i < MNG_MAX_OBJECTS; i++)
@@ -4881,15 +4945,15 @@ static Image *ReadMNGImage(const ImageInfo *image_info,ExceptionInfo *exception)
 
             continue;
           }
+
         if (memcmp(type,mng_MOVE,4) == 0)
           {
             size_t
               first_object,
               last_object;
 
-            /*
-              read MOVE
-            */
+            /* read MOVE */
+
             first_object=(p[0] << 8) | p[1];
             last_object=(p[2] << 8) | p[3];
             for (i=(ssize_t) first_object; i <= (ssize_t) last_object; i++)
@@ -4909,6 +4973,7 @@ static Image *ReadMNGImage(const ImageInfo *image_info,ExceptionInfo *exception)
                   mng_info->y_off[i]=new_pair.b;
                 }
             }
+
             chunk=(unsigned char *) RelinquishMagickMemory(chunk);
             continue;
           }
@@ -4918,9 +4983,8 @@ static Image *ReadMNGImage(const ImageInfo *image_info,ExceptionInfo *exception)
             ssize_t loop_iters=1;
             loop_level=chunk[0];
             mng_info->loop_active[loop_level]=1;  /* mark loop active */
-            /*
-              Record starting point.
-            */
+
+            /* Record starting point.  */
             loop_iters=mng_get_long(&chunk[1]);
 
             if (logging != MagickFalse)
@@ -4941,9 +5005,11 @@ static Image *ReadMNGImage(const ImageInfo *image_info,ExceptionInfo *exception)
             chunk=(unsigned char *) RelinquishMagickMemory(chunk);
             continue;
           }
+
         if (memcmp(type,mng_ENDL,4) == 0)
           {
             loop_level=chunk[0];
+
             if (skipping_loop > 0)
               {
                 if (skipping_loop == loop_level)
@@ -4955,6 +5021,7 @@ static Image *ReadMNGImage(const ImageInfo *image_info,ExceptionInfo *exception)
                     mng_info->loop_active[loop_level]=0;
                   }
               }
+
             else
               {
                 if (mng_info->loop_active[loop_level] == 1)
@@ -4967,6 +5034,7 @@ static Image *ReadMNGImage(const ImageInfo *image_info,ExceptionInfo *exception)
                         "  ENDL: LOOP level %.20g has %.20g remaining iters ",
                         (double) loop_level,(double)
                         mng_info->loop_count[loop_level]);
+
                     if (mng_info->loop_count[loop_level] != 0)
                       {
                         offset=SeekBlob(image,mng_info->loop_jump[loop_level],
@@ -4976,6 +5044,7 @@ static Image *ReadMNGImage(const ImageInfo *image_info,ExceptionInfo *exception)
                           ThrowReaderException(CorruptImageError,
                             "ImproperImageHeader");
                       }
+
                     else
                       {
                         short
@@ -4993,17 +5062,21 @@ static Image *ReadMNGImage(const ImageInfo *image_info,ExceptionInfo *exception)
                       }
                   }
               }
+
             chunk=(unsigned char *) RelinquishMagickMemory(chunk);
             continue;
           }
+
         if (memcmp(type,mng_CLON,4) == 0)
           {
             if (mng_info->clon_warning == 0)
               (void) ThrowMagickException(&image->exception,GetMagickModule(),
                 CoderError,"CLON is not implemented yet","`%s'",
                 image->filename);
+
             mng_info->clon_warning++;
           }
+
         if (memcmp(type,mng_MAGN,4) == 0)
           {
             png_uint_16
@@ -5037,61 +5110,77 @@ static Image *ReadMNGImage(const ImageInfo *image_info,ExceptionInfo *exception)
                      GetMagickModule(),CoderError,
                      "MAGN is not implemented yet for nonzero objects",
                      "`%s'",image->filename);
+
                    mng_info->magn_warning++;
                 }
 #endif
             if (length > 4)
               magn_methx=p[4];
+
             else
               magn_methx=0;
 
             if (length > 6)
               magn_mx=(p[5] << 8) | p[6];
+
             else
               magn_mx=1;
+
             if (magn_mx == 0)
               magn_mx=1;
 
             if (length > 8)
               magn_my=(p[7] << 8) | p[8];
+
             else
               magn_my=magn_mx;
+
             if (magn_my == 0)
               magn_my=1;
 
             if (length > 10)
               magn_ml=(p[9] << 8) | p[10];
+
             else
               magn_ml=magn_mx;
+
             if (magn_ml == 0)
               magn_ml=1;
 
             if (length > 12)
               magn_mr=(p[11] << 8) | p[12];
+
             else
               magn_mr=magn_mx;
+
             if (magn_mr == 0)
               magn_mr=1;
 
             if (length > 14)
               magn_mt=(p[13] << 8) | p[14];
+
             else
               magn_mt=magn_my;
+
             if (magn_mt == 0)
               magn_mt=1;
 
             if (length > 16)
               magn_mb=(p[15] << 8) | p[16];
+
             else
               magn_mb=magn_my;
+
             if (magn_mb == 0)
               magn_mb=1;
 
             if (length > 17)
               magn_methy=p[17];
+
             else
               magn_methy=magn_methx;
 
+
             if (magn_methx > 5 || magn_methy > 5)
               if (mng_info->magn_warning == 0)
                 {
@@ -5099,6 +5188,7 @@ static Image *ReadMNGImage(const ImageInfo *image_info,ExceptionInfo *exception)
                      GetMagickModule(),CoderError,
                      "Unknown MAGN method in MNG datastream","`%s'",
                      image->filename);
+
                    mng_info->magn_warning++;
                 }
 #ifdef MNG_OBJECT_BUFFERS
@@ -5117,26 +5207,32 @@ static Image *ReadMNGImage(const ImageInfo *image_info,ExceptionInfo *exception)
                 mng_info->magn_methy=magn_methy;
               }
           }
+
         if (memcmp(type,mng_PAST,4) == 0)
           {
             if (mng_info->past_warning == 0)
               (void) ThrowMagickException(&image->exception,GetMagickModule(),
                 CoderError,"PAST is not implemented yet","`%s'",
                 image->filename);
+
             mng_info->past_warning++;
           }
+
         if (memcmp(type,mng_SHOW,4) == 0)
           {
             if (mng_info->show_warning == 0)
               (void) ThrowMagickException(&image->exception,GetMagickModule(),
                 CoderError,"SHOW is not implemented yet","`%s'",
                 image->filename);
+
             mng_info->show_warning++;
           }
+
         if (memcmp(type,mng_sBIT,4) == 0)
           {
             if (length < 4)
               mng_info->have_global_sbit=MagickFalse;
+
             else
               {
                 mng_info->global_sbit.gray=p[0];
@@ -5158,6 +5254,7 @@ static Image *ReadMNGImage(const ImageInfo *image_info,ExceptionInfo *exception)
                 mng_info->global_phys_unit_type=p[8];
                 mng_info->have_global_phys=MagickTrue;
               }
+
             else
               mng_info->have_global_phys=MagickFalse;
           }
@@ -5166,15 +5263,18 @@ static Image *ReadMNGImage(const ImageInfo *image_info,ExceptionInfo *exception)
             if (mng_info->phyg_warning == 0)
               (void) ThrowMagickException(&image->exception,GetMagickModule(),
                 CoderError,"pHYg is not implemented.","`%s'",image->filename);
+
             mng_info->phyg_warning++;
           }
         if (memcmp(type,mng_BASI,4) == 0)
           {
             skip_to_iend=MagickTrue;
+
             if (mng_info->basi_warning == 0)
               (void) ThrowMagickException(&image->exception,GetMagickModule(),
                 CoderError,"BASI is not implemented yet","`%s'",
                 image->filename);
+
             mng_info->basi_warning++;
 #ifdef MNG_BASI_SUPPORTED
             basi_width=(size_t) ((p[0] << 24) | (p[1] << 16) |
@@ -5187,18 +5287,25 @@ static Image *ReadMNGImage(const ImageInfo *image_info,ExceptionInfo *exception)
             basi_interlace_method=p[11];
             if (length > 11)
               basi_red=(p[12] << 8) & p[13];
+
             else
               basi_red=0;
+
             if (length > 13)
               basi_green=(p[14] << 8) & p[15];
+
             else
               basi_green=0;
+
             if (length > 15)
               basi_blue=(p[16] << 8) & p[17];
+
             else
               basi_blue=0;
+
             if (length > 17)
               basi_alpha=(p[18] << 8) & p[19];
+
             else
               {
                 if (basi_sample_depth == 16)
@@ -5206,14 +5313,18 @@ static Image *ReadMNGImage(const ImageInfo *image_info,ExceptionInfo *exception)
                 else
                   basi_alpha=255;
               }
+
             if (length > 19)
               basi_viewable=p[20];
+
             else
               basi_viewable=0;
+
 #endif
             chunk=(unsigned char *) RelinquishMagickMemory(chunk);
             continue;
           }
+
         if (memcmp(type,mng_IHDR,4)
 #if defined(JNG_SUPPORTED)
             && memcmp(type,mng_JHDR,4)
@@ -5223,19 +5334,23 @@ static Image *ReadMNGImage(const ImageInfo *image_info,ExceptionInfo *exception)
             /* Not an IHDR or JHDR chunk */
             if (length)
               chunk=(unsigned char *) RelinquishMagickMemory(chunk);
+
             continue;
           }
 /* Process IHDR */
         if (logging != MagickFalse)
           (void) LogMagickEvent(CoderEvent,GetMagickModule(),
             "  Processing %c%c%c%c chunk",type[0],type[1],type[2],type[3]);
+
         mng_info->exists[object_id]=MagickTrue;
         mng_info->viewable[object_id]=MagickTrue;
+
         if (mng_info->invisible[object_id])
           {
             if (logging != MagickFalse)
               (void) LogMagickEvent(CoderEvent,GetMagickModule(),
                 "  Skipping invisible object");
+
             skip_to_iend=MagickTrue;
             chunk=(unsigned char *) RelinquishMagickMemory(chunk);
             continue;
@@ -5243,6 +5358,7 @@ static Image *ReadMNGImage(const ImageInfo *image_info,ExceptionInfo *exception)
 #if defined(MNG_INSERT_LAYERS)
         if (length < 8)
           ThrowReaderException(CorruptImageError,"ImproperImageHeader");
+
         image_width=(size_t) mng_get_long(p);
         image_height=(size_t) mng_get_long(&p[4]);
 #endif
@@ -5267,26 +5383,30 @@ static Image *ReadMNGImage(const ImageInfo *image_info,ExceptionInfo *exception)
                       Allocate next image structure.
                     */
                     AcquireNextImage(image_info,image);
+
                     if (GetNextImageInList(image) == (Image *) NULL)
                       {
                         image=DestroyImageList(image);
                         MngInfoFreeStruct(mng_info,&have_mng_structure);
                         return((Image *) NULL);
                       }
+
                     image=SyncNextImageInList(image);
                   }
                 mng_info->image=image;
+
                 if (term_chunk_found)
                   {
                     image->start_loop=MagickTrue;
                     image->iterations=mng_iterations;
                     term_chunk_found=MagickFalse;
                   }
+
                 else
                     image->start_loop=MagickFalse;
-                /*
-                  Make a background rectangle.
-                */
+
+                /* Make a background rectangle.  */
+
                 image->delay=0;
                 image->columns=mng_info->mng_width;
                 image->rows=mng_info->mng_height;
@@ -5316,12 +5436,14 @@ static Image *ReadMNGImage(const ImageInfo *image_info,ExceptionInfo *exception)
                 Allocate next image structure.
               */
               AcquireNextImage(image_info,image);
+
               if (GetNextImageInList(image) == (Image *) NULL)
                 {
                   image=DestroyImageList(image);
                   MngInfoFreeStruct(mng_info,&have_mng_structure);
                   return((Image *) NULL);
                 }
+
               image=SyncNextImageInList(image);
             }
 
@@ -5336,6 +5458,7 @@ static Image *ReadMNGImage(const ImageInfo *image_info,ExceptionInfo *exception)
 
             else
                 image->start_loop=MagickFalse;
+
             image->delay=0;
             image->columns=subframe_width;
             image->rows=subframe_height;
@@ -5355,18 +5478,21 @@ static Image *ReadMNGImage(const ImageInfo *image_info,ExceptionInfo *exception)
           }
 #endif /* MNG_INSERT_LAYERS */
         first_mng_object=MagickFalse;
+
         if (GetAuthenticPixelQueue(image) != (PixelPacket *) NULL)
           {
             /*
               Allocate next image structure.
             */
             AcquireNextImage(image_info,image);
+
             if (GetNextImageInList(image) == (Image *) NULL)
               {
                 image=DestroyImageList(image);
                 MngInfoFreeStruct(mng_info,&have_mng_structure);
                 return((Image *) NULL);
               }
+
             image=SyncNextImageInList(image);
           }
         mng_info->image=image;
@@ -5399,14 +5525,18 @@ static Image *ReadMNGImage(const ImageInfo *image_info,ExceptionInfo *exception)
         image->page.x=mng_info->x_off[object_id];
         image->page.y=mng_info->y_off[object_id];
         image->iterations=mng_iterations;
+
         /*
           Seek back to the beginning of the IHDR or JHDR chunk's length field.
         */
+
         if (logging != MagickFalse)
           (void) LogMagickEvent(CoderEvent,GetMagickModule(),
             "  Seeking back to beginning of %c%c%c%c chunk",type[0],type[1],
             type[2],type[3]);
+
         offset=SeekBlob(image,-((ssize_t) length+12),SEEK_CUR);
+
         if (offset < 0)
           ThrowReaderException(CorruptImageError,"ImproperImageHeader");
       }
@@ -5418,6 +5548,7 @@ static Image *ReadMNGImage(const ImageInfo *image_info,ExceptionInfo *exception)
 
     if (memcmp(type,mng_IHDR,4) == 0)
       image=ReadOnePNGImage(mng_info,image_info,exception);
+
 #if defined(JNG_SUPPORTED)
     else
       image=ReadOneJNGImage(mng_info,image_info,exception);
@@ -5430,6 +5561,7 @@ static Image *ReadMNGImage(const ImageInfo *image_info,ExceptionInfo *exception)
             (void) DestroyImageList(previous);
             (void) CloseBlob(previous);
           }
+
         MngInfoFreeStruct(mng_info,&have_mng_structure);
         return((Image *) NULL);
       }
@@ -5462,39 +5594,57 @@ static Image *ReadMNGImage(const ImageInfo *image_info,ExceptionInfo *exception)
             if (mng_info->magn_methx == 1)
               {
                 magnified_width=mng_info->magn_ml;
+
                 if (image->columns > 1)
                    magnified_width += mng_info->magn_mr;
+
                 if (image->columns > 2)
-                   magnified_width += (png_uint_32) ((image->columns-2)*(mng_info->magn_mx));
+                   magnified_width += (png_uint_32)
+                      ((image->columns-2)*(mng_info->magn_mx));
               }
+
             else
               {
                 magnified_width=(png_uint_32) image->columns;
+
                 if (image->columns > 1)
                    magnified_width += mng_info->magn_ml-1;
+
                 if (image->columns > 2)
                    magnified_width += mng_info->magn_mr-1;
+
                 if (image->columns > 3)
-                   magnified_width += (png_uint_32) ((image->columns-3)*(mng_info->magn_mx-1));
+                   magnified_width += (png_uint_32)
+                      ((image->columns-3)*(mng_info->magn_mx-1));
               }
+
             if (mng_info->magn_methy == 1)
               {
                 magnified_height=mng_info->magn_mt;
+
                 if (image->rows > 1)
                    magnified_height += mng_info->magn_mb;
+
                 if (image->rows > 2)
-                   magnified_height += (png_uint_32) ((image->rows-2)*(mng_info->magn_my));
+                   magnified_height += (png_uint_32)
+                      ((image->rows-2)*(mng_info->magn_my));
               }
+
             else
               {
                 magnified_height=(png_uint_32) image->rows;
+
                 if (image->rows > 1)
                    magnified_height += mng_info->magn_mt-1;
+
                 if (image->rows > 2)
                    magnified_height += mng_info->magn_mb-1;
+
                 if (image->rows > 3)
-                   magnified_height += (png_uint_32) ((image->rows-3)*(mng_info->magn_my-1));
+                   magnified_height += (png_uint_32)
+                      ((image->rows-3)*(mng_info->magn_my-1));
               }
+
             if (magnified_height > image->rows ||
                 magnified_width > image->columns)
               {
@@ -5523,13 +5673,14 @@ static Image *ReadMNGImage(const ImageInfo *image_info,ExceptionInfo *exception)
                   magn_methx,
                   magn_methy;
 
-                /*
-                  Allocate next image structure.
-                */
+                /* Allocate next image structure.  */
+
                 if (logging != MagickFalse)
                   (void) LogMagickEvent(CoderEvent,GetMagickModule(),
                     "    Allocate magnified image");
+
                 AcquireNextImage(image_info,image);
+
                 if (GetNextImageInList(image) == (Image *) NULL)
                   {
                     image=DestroyImageList(image);
@@ -5557,6 +5708,7 @@ static Image *ReadMNGImage(const ImageInfo *image_info,ExceptionInfo *exception)
                      {
                        q=GetAuthenticPixels(image,0,y,image->columns,1,
                           exception);
+
                        for (x=(ssize_t) image->columns-1; x >= 0; x--)
                        {
                           q->red=ScaleQuantumToShort(q->red);
@@ -5565,6 +5717,7 @@ static Image *ReadMNGImage(const ImageInfo *image_info,ExceptionInfo *exception)
                           q->opacity=ScaleQuantumToShort(q->opacity);
                           q++;
                        }
+
                        if (SyncAuthenticPixels(image,exception) == MagickFalse)
                          break;
                      }
@@ -5575,16 +5728,21 @@ static Image *ReadMNGImage(const ImageInfo *image_info,ExceptionInfo *exception)
 
                 if (image->matte != MagickFalse)
                    (void) SetImageBackgroundColor(large_image);
+
                 else
                   {
                     large_image->background_color.opacity=OpaqueOpacity;
                     (void) SetImageBackgroundColor(large_image);
+
                     if (magn_methx == 4)
                       magn_methx=2;
+
                     if (magn_methx == 5)
                       magn_methx=3;
+
                     if (magn_methy == 4)
                       magn_methy=2;
+
                     if (magn_methy == 5)
                       magn_methy=3;
                   }
@@ -5599,6 +5757,7 @@ static Image *ReadMNGImage(const ImageInfo *image_info,ExceptionInfo *exception)
                 length=(size_t) image->columns;
                 next=(PixelPacket *) AcquireQuantumMemory(length,sizeof(*next));
                 prev=(PixelPacket *) AcquireQuantumMemory(length,sizeof(*prev));
+
                 if ((prev == (PixelPacket *) NULL) ||
                     (next == (PixelPacket *) NULL))
                   {
@@ -5607,29 +5766,38 @@ static Image *ReadMNGImage(const ImageInfo *image_info,ExceptionInfo *exception)
                      ThrowReaderException(ResourceLimitError,
                        "MemoryAllocationFailed");
                   }
+
                 n=GetAuthenticPixels(image,0,0,image->columns,1,exception);
                 (void) CopyMagickMemory(next,n,length);
+
                 for (y=0; y < (ssize_t) image->rows; y++)
                 {
                   if (y == 0)
                     m=(ssize_t) mng_info->magn_mt;
+
                   else if (magn_methy > 1 && y == (ssize_t) image->rows-2)
                     m=(ssize_t) mng_info->magn_mb;
+
                   else if (magn_methy <= 1 && y == (ssize_t) image->rows-1)
                     m=(ssize_t) mng_info->magn_mb;
+
                   else if (magn_methy > 1 && y == (ssize_t) image->rows-1)
                     m=1;
+
                   else
                     m=(ssize_t) mng_info->magn_my;
+
                   n=prev;
                   prev=next;
                   next=n;
+
                   if (y < (ssize_t) image->rows-1)
                     {
                       n=GetAuthenticPixels(image,0,y+1,image->columns,1,
                           exception);
                       (void) CopyMagickMemory(next,n,length);
                     }
+
                   for (i=0; i < m; i++, yy++)
                   {
                     register PixelPacket
@@ -5641,6 +5809,7 @@ static Image *ReadMNGImage(const ImageInfo *image_info,ExceptionInfo *exception)
                     q=GetAuthenticPixels(large_image,0,yy,large_image->columns,
                           1,exception);
                     q+=(large_image->columns-image->columns);
+
                     for (x=(ssize_t) image->columns-1; x >= 0; x--)
                     {
                       /* TO DO: get color as function of indexes[x] */
@@ -5654,10 +5823,12 @@ static Image *ReadMNGImage(const ImageInfo *image_info,ExceptionInfo *exception)
                         {
                           *q=(*pixels); /* replicate previous */
                         }
+
                       else if (magn_methy == 2 || magn_methy == 4)
                         {
                           if (i == 0)
                              *q=(*pixels);
+
                           else
                             {
                               /* Interpolate */
@@ -5670,12 +5841,14 @@ static Image *ReadMNGImage(const ImageInfo *image_info,ExceptionInfo *exception)
                               (*q).blue=(QM) (((ssize_t) (2*i*((*n).blue
                                  -(*pixels).blue)+m))/((ssize_t) (m*2))
                                  +(*pixels).blue);
+
                               if (image->matte != MagickFalse)
                                  (*q).opacity=(QM) (((ssize_t)
                                  (2*i*((*n).opacity
                                  -(*pixels).opacity)+m))
                                  /((ssize_t) (m*2))+(*pixels).opacity);
                             }
+
                           if (magn_methy == 4)
                             {
                               /* Replicate nearest */
@@ -5685,13 +5858,16 @@ static Image *ReadMNGImage(const ImageInfo *image_info,ExceptionInfo *exception)
                                  (*q).opacity=(*n).opacity+0;
                             }
                         }
+
                       else /* if (magn_methy == 3 || magn_methy == 5) */
                         {
                           /* Replicate nearest */
                           if (i <= ((m+1) << 1))
                              *q=(*pixels);
+
                           else
                              *q=(*n);
+
                           if (magn_methy == 5)
                             {
                               (*q).opacity=(QM) (((ssize_t) (2*i*((*n).opacity
@@ -5703,10 +5879,13 @@ static Image *ReadMNGImage(const ImageInfo *image_info,ExceptionInfo *exception)
                       q++;
                       pixels++;
                     } /* x */
+
                     if (SyncAuthenticPixels(large_image,exception) == 0)
                       break;
+
                   } /* i */
                 } /* y */
+
                 prev=(PixelPacket *) RelinquishMagickMemory(prev);
                 next=(PixelPacket *) RelinquishMagickMemory(next);
 
@@ -5735,19 +5914,25 @@ static Image *ReadMNGImage(const ImageInfo *image_info,ExceptionInfo *exception)
                   q=GetAuthenticPixels(image,0,y,image->columns,1,exception);
                   pixels=q+(image->columns-length);
                   n=pixels+1;
+
                   for (x=(ssize_t) (image->columns-length);
                     x < (ssize_t) image->columns; x++)
                   {
                     if (x == (ssize_t) (image->columns-length))
                       m=(ssize_t) mng_info->magn_ml;
+
                     else if (magn_methx > 1 && x == (ssize_t) image->columns-2)
                       m=(ssize_t) mng_info->magn_mr;
+
                     else if (magn_methx <= 1 && x == (ssize_t) image->columns-1)
                       m=(ssize_t) mng_info->magn_mr;
+
                     else if (magn_methx > 1 && x == (ssize_t) image->columns-1)
                       m=1;
+
                     else
                       m=(ssize_t) mng_info->magn_mx;
+
                     for (i=0; i < m; i++)
                     {
                       if (magn_methx <= 1)
@@ -5755,10 +5940,12 @@ static Image *ReadMNGImage(const ImageInfo *image_info,ExceptionInfo *exception)
                           /* replicate previous */
                           *q=(*pixels);
                         }
+
                       else if (magn_methx == 2 || magn_methx == 4)
                         {
                           if (i == 0)
                             *q=(*pixels);
+
                           else
                             {
                               /* Interpolate */
@@ -5776,6 +5963,7 @@ static Image *ReadMNGImage(const ImageInfo *image_info,ExceptionInfo *exception)
                                    -(*pixels).opacity)+m)/((ssize_t) (m*2))
                                    +(*pixels).opacity);
                             }
+
                           if (magn_methx == 4)
                             {
                               /* Replicate nearest */
@@ -5785,13 +5973,16 @@ static Image *ReadMNGImage(const ImageInfo *image_info,ExceptionInfo *exception)
                                  (*q).opacity=(*n).opacity+0;
                             }
                         }
+
                       else /* if (magn_methx == 3 || magn_methx == 5) */
                         {
                           /* Replicate nearest */
                           if (i <= ((m+1) << 1))
                              *q=(*pixels);
+
                           else
                              *q=(*n);
+
                           if (magn_methx == 5)
                             {
                               /* Interpolate */
@@ -5805,6 +5996,7 @@ static Image *ReadMNGImage(const ImageInfo *image_info,ExceptionInfo *exception)
                     n++;
                     p++;
                   }
+
                   if (SyncAuthenticPixels(image,exception) == MagickFalse)
                     break;
                 }
@@ -5817,6 +6009,7 @@ static Image *ReadMNGImage(const ImageInfo *image_info,ExceptionInfo *exception)
                    for (y=0; y < (ssize_t) image->rows; y++)
                    {
                      q=GetAuthenticPixels(image,0,y,image->columns,1,exception);
+
                      for (x=(ssize_t) image->columns-1; x >= 0; x--)
                      {
                         q->red=ScaleShortToQuantum(q->red);
@@ -5825,6 +6018,7 @@ static Image *ReadMNGImage(const ImageInfo *image_info,ExceptionInfo *exception)
                         q->opacity=ScaleShortToQuantum(q->opacity);
                         q++;
                      }
+
                      if (SyncAuthenticPixels(image,exception) == MagickFalse)
                        break;
                    }
@@ -5858,6 +6052,7 @@ static Image *ReadMNGImage(const ImageInfo *image_info,ExceptionInfo *exception)
             if (logging != MagickFalse)
               (void) LogMagickEvent(CoderEvent,GetMagickModule(),
                 "  Crop the PNG image");
+
             if ((crop_box.left < crop_box.right) &&
                 (crop_box.top < crop_box.bottom))
               {
@@ -5880,6 +6075,7 @@ static Image *ReadMNGImage(const ImageInfo *image_info,ExceptionInfo *exception)
                 image->page.x=0;
                 image->page.y=0;
                 im=CropImage(image,&crop_info,exception);
+
                 if (im != (Image *) NULL)
                   {
                     image->columns=im->columns;
@@ -5891,6 +6087,7 @@ static Image *ReadMNGImage(const ImageInfo *image_info,ExceptionInfo *exception)
                     image->page.y=crop_box.top;
                   }
               }
+
             else
               {
                 /*
@@ -5927,6 +6124,7 @@ static Image *ReadMNGImage(const ImageInfo *image_info,ExceptionInfo *exception)
 #endif
 
       GetImageException(image,exception);
+
       if (image_info->number_scenes != 0)
         {
           if (mng_info->scenes_found >
@@ -5939,10 +6137,13 @@ static Image *ReadMNGImage(const ImageInfo *image_info,ExceptionInfo *exception)
           "  Finished reading image datastream.");
 
   } while (LocaleCompare(image_info->magick,"MNG") == 0);
+
   (void) CloseBlob(image);
+
   if (logging != MagickFalse)
     (void) LogMagickEvent(CoderEvent,GetMagickModule(),
       "  Finished reading all image datastreams.");
+
 #if defined(MNG_INSERT_LAYERS)
   if (insert_layers && !mng_info->image_found && (mng_info->mng_width) &&
        (mng_info->mng_height))
@@ -5964,9 +6165,11 @@ static Image *ReadMNGImage(const ImageInfo *image_info,ExceptionInfo *exception)
             {
               image=DestroyImageList(image);
               MngInfoFreeStruct(mng_info,&have_mng_structure);
+
               if (logging != MagickFalse)
                 (void) LogMagickEvent(CoderEvent,GetMagickModule(),
                   "  Allocation failed, returning NULL.");
+
               return((Image *) NULL);
             }
           image=SyncNextImageInList(image);
@@ -5998,9 +6201,11 @@ static Image *ReadMNGImage(const ImageInfo *image_info,ExceptionInfo *exception)
       {
         if (logging != MagickFalse)
           (void) LogMagickEvent(CoderEvent,GetMagickModule(),"  No beginning");
+
         (void) ThrowMagickException(&image->exception,GetMagickModule(),
           CoderError,"Linked list is corrupted, beginning of list not found",
           "`%s'",image_info->filename);
+
         return((Image *) NULL);
       }
 
@@ -6010,11 +6215,13 @@ static Image *ReadMNGImage(const ImageInfo *image_info,ExceptionInfo *exception)
       {
         if (logging != MagickFalse)
           (void) LogMagickEvent(CoderEvent,GetMagickModule(),"  Corrupt list");
+
         (void) ThrowMagickException(&image->exception,GetMagickModule(),
           CoderError,"Linked list is corrupted; next_image is NULL","`%s'",
           image_info->filename);
       }
   }
+
   if (mng_info->ticks_per_second && mng_info->image_found > 1 &&
              GetNextImageInList(image) ==
      (Image *) NULL)
@@ -6022,19 +6229,24 @@ static Image *ReadMNGImage(const ImageInfo *image_info,ExceptionInfo *exception)
       if (logging != MagickFalse)
         (void) LogMagickEvent(CoderEvent,GetMagickModule(),
             "  First image null");
+
       (void) ThrowMagickException(&image->exception,GetMagickModule(),
         CoderError,"image->next for first image is NULL but shouldn't be.",
         "`%s'",image_info->filename);
     }
+
   if (mng_info->image_found == 0)
     {
       if (logging != MagickFalse)
         (void) LogMagickEvent(CoderEvent,GetMagickModule(),
           "  No visible images found.");
+
       (void) ThrowMagickException(&image->exception,GetMagickModule(),
         CoderError,"No visible images in file","`%s'",image_info->filename);
+
       if (image != (Image *) NULL)
         image=DestroyImageList(image);
+
       MngInfoFreeStruct(mng_info,&have_mng_structure);
       return((Image *) NULL);
     }
@@ -6053,6 +6265,7 @@ static Image *ReadMNGImage(const ImageInfo *image_info,ExceptionInfo *exception)
     {
       if (image->delay)
         final_image_delay=image->delay;
+
       image=GetNextImageInList(image);
     }
 
@@ -6073,10 +6286,13 @@ static Image *ReadMNGImage(const ImageInfo *image_info,ExceptionInfo *exception)
 
       scene=0;
       image=GetFirstImageInList(image);
+
       (void) LogMagickEvent(CoderEvent,GetMagickModule(),
         "  Before coalesce:");
+
       (void) LogMagickEvent(CoderEvent,GetMagickModule(),
         "    scene 0 delay=%.20g",(double) image->delay);
+
       while (GetNextImageInList(image) != (Image *) NULL)
       {
         image=GetNextImageInList(image);
@@ -6098,12 +6314,16 @@ static Image *ReadMNGImage(const ImageInfo *image_info,ExceptionInfo *exception)
 
       if (logging != MagickFalse)
         (void) LogMagickEvent(CoderEvent,GetMagickModule(),"  Coalesce Images");
+
       scene=image->scene;
       next_image=CoalesceImages(image,&image->exception);
+
       if (next_image == (Image *) NULL)
         ThrowReaderException(ResourceLimitError,"MemoryAllocationFailed");
+
       image=DestroyImageList(image);
       image=next_image;
+
       for (next=image; next != (Image *) NULL; next=next_image)
       {
          next->page.width=mng_info->mng_width;
@@ -6112,8 +6332,10 @@ static Image *ReadMNGImage(const ImageInfo *image_info,ExceptionInfo *exception)
          next->page.y=0;
          next->scene=scene++;
          next_image=GetNextImageInList(next);
+
          if (next_image == (Image *) NULL)
            break;
+
          if (next->delay == 0)
            {
              scene--;
@@ -6130,6 +6352,7 @@ static Image *ReadMNGImage(const ImageInfo *image_info,ExceptionInfo *exception)
 
   while (GetNextImageInList(image) != (Image *) NULL)
       image=GetNextImageInList(image);
+
   image->dispose=BackgroundDispose;
 
   if (logging != MagickFalse)
@@ -6139,24 +6362,31 @@ static Image *ReadMNGImage(const ImageInfo *image_info,ExceptionInfo *exception)
 
       scene=0;
       image=GetFirstImageInList(image);
+
       (void) LogMagickEvent(CoderEvent,GetMagickModule(),
         "  After coalesce:");
+
       (void) LogMagickEvent(CoderEvent,GetMagickModule(),
         "    scene 0 delay=%.20g dispose=%.20g",(double) image->delay,
         (double) image->dispose);
+
       while (GetNextImageInList(image) != (Image *) NULL)
       {
         image=GetNextImageInList(image);
+
         (void) LogMagickEvent(CoderEvent,GetMagickModule(),
           "    scene %.20g delay=%.20g dispose=%.20g",(double) scene++,
           (double) image->delay,(double) image->dispose);
       }
    }
+
   image=GetFirstImageInList(image);
   MngInfoFreeStruct(mng_info,&have_mng_structure);
   have_mng_structure=MagickFalse;
+
   if (logging != MagickFalse)
     (void) LogMagickEvent(CoderEvent,GetMagickModule(),"exit ReadMNGImage()");
+
   return(GetFirstImageInList(image));
 }
 #else /* PNG_LIBPNG_VER > 10011 */
@@ -6164,10 +6394,13 @@ static Image *ReadPNGImage(const ImageInfo *image_info,ExceptionInfo *exception)
 {
   printf("Your PNG library is too old: You have libpng-%s\n",
      PNG_LIBPNG_VER_STRING);
+
   (void) ThrowMagickException(exception,GetMagickModule(),CoderError,
     "PNG library is too old","`%s'",image_info->filename);
+
   return(Image *) NULL;
 }
+
 static Image *ReadMNGImage(const ImageInfo *image_info,ExceptionInfo *exception)
 {
   return(ReadPNGImage(image_info,exception));
@@ -6211,11 +6444,13 @@ ModuleExport size_t RegisterPNGImage(void)
     {
       "See http://www.libpng.org/ for details about the PNG format."
     },
+
     *JNGNote=
     {
       "See http://www.libpng.org/pub/mng/ for details about the JNG\n"
       "format."
     },
+
     *MNGNote=
     {
       "See http://www.libpng.org/pub/mng/ for details about the MNG\n"
@@ -6223,9 +6458,11 @@ ModuleExport size_t RegisterPNGImage(void)
     };
 
   *version='\0';
+
 #if defined(PNG_LIBPNG_VER_STRING)
   (void) ConcatenateMagickString(version,"libpng ",MaxTextExtent);
   (void) ConcatenateMagickString(version,PNG_LIBPNG_VER_STRING,MaxTextExtent);
+
   if (LocaleCompare(PNG_LIBPNG_VER_STRING,png_get_header_ver(NULL)) != 0)
     {
       (void) ConcatenateMagickString(version,",",MaxTextExtent);
@@ -6233,39 +6470,50 @@ ModuleExport size_t RegisterPNGImage(void)
             MaxTextExtent);
     }
 #endif
+
   entry=SetMagickInfo("MNG");
   entry->seekable_stream=MagickTrue;  /* To do: eliminate this. */
+
 #if defined(MAGICKCORE_PNG_DELEGATE)
   entry->decoder=(DecodeImageHandler *) ReadMNGImage;
   entry->encoder=(EncodeImageHandler *) WriteMNGImage;
 #endif
+
   entry->magick=(IsImageFormatHandler *) IsMNG;
   entry->description=ConstantString("Multiple-image Network Graphics");
+
   if (*version != '\0')
     entry->version=ConstantString(version);
+
   entry->module=ConstantString("PNG");
   entry->note=ConstantString(MNGNote);
   (void) RegisterMagickInfo(entry);
 
   entry=SetMagickInfo("PNG");
+
 #if defined(MAGICKCORE_PNG_DELEGATE)
   entry->decoder=(DecodeImageHandler *) ReadPNGImage;
   entry->encoder=(EncodeImageHandler *) WritePNGImage;
 #endif
+
   entry->magick=(IsImageFormatHandler *) IsPNG;
   entry->adjoin=MagickFalse;
   entry->description=ConstantString("Portable Network Graphics");
   entry->module=ConstantString("PNG");
+
   if (*version != '\0')
     entry->version=ConstantString(version);
+
   entry->note=ConstantString(PNGNote);
   (void) RegisterMagickInfo(entry);
 
   entry=SetMagickInfo("PNG8");
+
 #if defined(MAGICKCORE_PNG_DELEGATE)
   entry->decoder=(DecodeImageHandler *) ReadPNGImage;
   entry->encoder=(EncodeImageHandler *) WritePNGImage;
 #endif
+
   entry->magick=(IsImageFormatHandler *) IsPNG;
   entry->adjoin=MagickFalse;
   entry->description=ConstantString(
@@ -6275,21 +6523,26 @@ ModuleExport size_t RegisterPNGImage(void)
 
   entry=SetMagickInfo("PNG24");
   *version='\0';
+
 #if defined(ZLIB_VERSION)
   (void) ConcatenateMagickString(version,"zlib ",MaxTextExtent);
   (void) ConcatenateMagickString(version,ZLIB_VERSION,MaxTextExtent);
+
   if (LocaleCompare(ZLIB_VERSION,zlib_version) != 0)
     {
       (void) ConcatenateMagickString(version,",",MaxTextExtent);
       (void) ConcatenateMagickString(version,zlib_version,MaxTextExtent);
     }
 #endif
+
   if (*version != '\0')
     entry->version=ConstantString(version);
+
 #if defined(MAGICKCORE_PNG_DELEGATE)
   entry->decoder=(DecodeImageHandler *) ReadPNGImage;
   entry->encoder=(EncodeImageHandler *) WritePNGImage;
 #endif
+
   entry->magick=(IsImageFormatHandler *) IsPNG;
   entry->adjoin=MagickFalse;
   entry->description=ConstantString("opaque 24-bit RGB");
@@ -6297,10 +6550,12 @@ ModuleExport size_t RegisterPNGImage(void)
   (void) RegisterMagickInfo(entry);
 
   entry=SetMagickInfo("PNG32");
+
 #if defined(MAGICKCORE_PNG_DELEGATE)
   entry->decoder=(DecodeImageHandler *) ReadPNGImage;
   entry->encoder=(EncodeImageHandler *) WritePNGImage;
 #endif
+
   entry->magick=(IsImageFormatHandler *) IsPNG;
   entry->adjoin=MagickFalse;
   entry->description=ConstantString("opaque or transparent 32-bit RGBA");
@@ -6308,21 +6563,25 @@ ModuleExport size_t RegisterPNGImage(void)
   (void) RegisterMagickInfo(entry);
 
   entry=SetMagickInfo("JNG");
+
 #if defined(JNG_SUPPORTED)
 #if defined(MAGICKCORE_PNG_DELEGATE)
   entry->decoder=(DecodeImageHandler *) ReadJNGImage;
   entry->encoder=(EncodeImageHandler *) WriteJNGImage;
 #endif
 #endif
+
   entry->magick=(IsImageFormatHandler *) IsJNG;
   entry->adjoin=MagickFalse;
   entry->description=ConstantString("JPEG Network Graphics");
   entry->module=ConstantString("PNG");
   entry->note=ConstantString(JNGNote);
   (void) RegisterMagickInfo(entry);
+
 #if defined(PNG_SETJMP_NOT_THREAD_SAFE)
   png_semaphore=AllocateSemaphoreInfo();
 #endif
+
   return(MagickImageCoderSignature);
 }
 \f
@@ -6353,6 +6612,7 @@ ModuleExport void UnregisterPNGImage(void)
   (void) UnregisterMagickInfo("PNG24");
   (void) UnregisterMagickInfo("PNG32");
   (void) UnregisterMagickInfo("JNG");
+
 #if defined(PNG_SETJMP_NOT_THREAD_SAFE)
   if (png_semaphore != (SemaphoreInfo *) NULL)
     DestroySemaphoreInfo(&png_semaphore);
@@ -6491,6 +6751,7 @@ png_write_raw_profile(const ImageInfo *image_info,png_struct *ping,
    (void) FormatMagickString(dp,allocated_length-
      (png_size_t) (dp-text[0].text),"%8lu ",(unsigned long) length);
    dp+=8;
+
    for (i=0; i < (ssize_t) length; i++)
    {
      if (i%36 == 0)
@@ -6498,14 +6759,17 @@ png_write_raw_profile(const ImageInfo *image_info,png_struct *ping,
      *(dp++)=(char) hex[((*sp >> 4) & 0x0f)];
      *(dp++)=(char) hex[((*sp++ ) & 0x0f)];
    }
+
    *dp++='\n';
    *dp='\0';
    text[0].text_length=(png_size_t) (dp-text[0].text);
    text[0].compression=image_info->compression == NoCompression ||
      (image_info->compression == UndefinedCompression &&
      text[0].text_length < 128) ? -1 : 0;
+
    if (text[0].text_length <= allocated_length)
      png_set_text(ping,ping_info,text,1);
+
    png_free(ping,text[0].text);
    png_free(ping,text[0].key);
    png_free(ping,text);
@@ -6526,33 +6790,39 @@ static MagickBooleanType png_write_chunk_from_profile(Image *image,
   png_uint_32 length;
 
   ResetImageProfileIterator(image);
-  for (name=GetNextImageProfile(image); name != (const char *) NULL; ){
+
+  for (name=GetNextImageProfile(image); name != (const char *) NULL; )
+  {
     profile=GetImageProfile(image,name);
+
     if (profile != (const StringInfo *) NULL)
       {
         StringInfo
           *png_profile;
 
-        if (LocaleNCompare(name,string,11) == 0) {
-          if (logging != MagickFalse)
-             (void) LogMagickEvent(CoderEvent,GetMagickModule(),
-             "  Found %s profile",name);
-
-       png_profile=CloneStringInfo(profile);
-       data=GetStringInfoDatum(png_profile),
-       length=(png_uint_32) GetStringInfoLength(png_profile);
-       data[4]=data[3];
-       data[3]=data[2];
-       data[2]=data[1];
-       data[1]=data[0];
-       (void) WriteBlobMSBULong(image,length-5);  /* data length */
-       (void) WriteBlob(image,length-1,data+1);
-       (void) WriteBlobMSBULong(image,crc32(0,data+1,(uInt) length-1));
-       png_profile=DestroyStringInfo(png_profile);
-        }
+        if (LocaleNCompare(name,string,11) == 0)
+          {
+            if (logging != MagickFalse)
+               (void) LogMagickEvent(CoderEvent,GetMagickModule(),
+                   "  Found %s profile",name);
+
+            png_profile=CloneStringInfo(profile);
+            data=GetStringInfoDatum(png_profile),
+            length=(png_uint_32) GetStringInfoLength(png_profile);
+            data[4]=data[3];
+            data[3]=data[2];
+            data[2]=data[1];
+            data[1]=data[0];
+            (void) WriteBlobMSBULong(image,length-5);  /* data length */
+            (void) WriteBlob(image,length-1,data+1);
+            (void) WriteBlobMSBULong(image,crc32(0,data+1,(uInt) length-1));
+            png_profile=DestroyStringInfo(png_profile);
+          }
       }
+
       name=GetNextImageProfile(image);
    }
+
    return(MagickTrue);
 }