]> granicus.if.org Git - imagemagick/commitdiff
Cleaner implementation
authorCristy <urban-warrior@imagemagick.org>
Sun, 20 Oct 2019 15:10:41 +0000 (11:10 -0400)
committerCristy <urban-warrior@imagemagick.org>
Sun, 20 Oct 2019 15:10:41 +0000 (11:10 -0400)
coders/art.c
coders/bgr.c
coders/cmyk.c
coders/gray.c
coders/pgx.c
coders/raw.c
coders/rgb.c
coders/vicar.c
coders/ycbcr.c

index 834d3828be5c0bed586c515e22d3a1bf3b706f40..b14e801fb5fb88353f747b93aa79945c72b8f9c5 100644 (file)
@@ -97,9 +97,6 @@ static MagickBooleanType
 */
 static Image *ReadARTImage(const ImageInfo *image_info,ExceptionInfo *exception)
 {
-  const unsigned char
-    *pixels;
-
   Image
     *image;
 
@@ -116,6 +113,9 @@ static Image *ReadARTImage(const ImageInfo *image_info,ExceptionInfo *exception)
     count,
     y;
 
+  unsigned char
+    *pixels;
+
   /*
     Open image file.
   */
@@ -157,22 +157,25 @@ static Image *ReadARTImage(const ImageInfo *image_info,ExceptionInfo *exception)
   if (quantum_info == (QuantumInfo *) NULL)
     ThrowReaderException(ResourceLimitError,"MemoryAllocationFailed");
   length=GetQuantumExtent(image,quantum_info,GrayQuantum);
+  pixels=GetQuantumPixels(quantum_info);
   for (y=0; y < (ssize_t) image->rows; y++)
   {
+    const void
+      *stream;
+
     register Quantum
       *magick_restrict q;
 
     q=QueueAuthenticPixels(image,0,y,image->columns,1,exception);
     if (q == (Quantum *) NULL)
       break;
-    pixels=(const unsigned char *) ReadBlobStream(image,length,
-      GetQuantumPixels(quantum_info),&count);
+    stream=ReadBlobStream(image,length,pixels,&count);
     if (count != (ssize_t) length)
       break;
     (void) ImportQuantumPixels(image,(CacheView *) NULL,quantum_info,
-      GrayQuantum,pixels,exception);
-    pixels=(const unsigned char *) ReadBlobStream(image,(size_t) (-(ssize_t)
-      length) & 0x01,GetQuantumPixels(quantum_info),&count);
+      GrayQuantum,stream,exception);
+    stream=ReadBlobStream(image,(size_t) (-(ssize_t) length) & 0x01,pixels,
+      &count);
     if (SyncAuthenticPixels(image,exception) == MagickFalse)
       break;
     if (SetImageProgress(image,LoadImageTag,y,image->rows) == MagickFalse)
index 215f66d9d860d9f5899a3fb1867d9d0693759d30..2bb9a8b480a7d3ecf3cede4f32f0f6d9deaf6df8 100644 (file)
@@ -97,11 +97,10 @@ static MagickBooleanType
 %    o exception: return any errors or warnings in this structure.
 %
 */
-static Image *ReadBGRImage(const ImageInfo *image_info,
-  ExceptionInfo *exception)
+static Image *ReadBGRImage(const ImageInfo *image_info,ExceptionInfo *exception)
 {
-  const unsigned char
-    *pixels;
+  const void
+    *stream;
 
   Image
     *canvas_image,
@@ -129,6 +128,9 @@ static Image *ReadBGRImage(const ImageInfo *image_info,
     count,
     y;
 
+  unsigned char
+    *pixels;
+
   /*
     Open image file.
   */
@@ -182,7 +184,7 @@ static Image *ReadBGRImage(const ImageInfo *image_info,
       image->alpha_trait=BlendPixelTrait;
       canvas_image->alpha_trait=BlendPixelTrait;
     }
-  pixels=(const unsigned char *) NULL;
+  pixels=GetQuantumPixels(quantum_info);
   if (image_info->number_scenes != 0)
     while (image->scene < image_info->scene)
     {
@@ -193,8 +195,7 @@ static Image *ReadBGRImage(const ImageInfo *image_info,
       length=GetQuantumExtent(canvas_image,quantum_info,quantum_type);
       for (y=0; y < (ssize_t) image->rows; y++)
       {
-        pixels=(const unsigned char *) ReadBlobStream(image,length,
-          GetQuantumPixels(quantum_info),&count);
+        stream=ReadBlobStream(image,length,pixels,&count);
         if (count != (ssize_t) length)
           break;
       }
@@ -203,6 +204,7 @@ static Image *ReadBGRImage(const ImageInfo *image_info,
   length=0;
   scene=0;
   status=MagickTrue;
+  stream=NULL;
   do
   {
     /*
@@ -225,8 +227,7 @@ static Image *ReadBGRImage(const ImageInfo *image_info,
         if (scene == 0)
           {
             length=GetQuantumExtent(canvas_image,quantum_info,quantum_type);
-            pixels=(const unsigned char *) ReadBlobStream(image,length,
-              GetQuantumPixels(quantum_info),&count);
+            stream=ReadBlobStream(image,length,pixels,&count);
           }
         for (y=0; y < (ssize_t) image->extract_info.height; y++)
         {
@@ -251,10 +252,10 @@ static Image *ReadBGRImage(const ImageInfo *image_info,
           if (q == (Quantum *) NULL)
             break;
           length=ImportQuantumPixels(canvas_image,(CacheView *) NULL,
-            quantum_info,quantum_type,pixels,exception);
+            quantum_info,quantum_type,stream,exception);
           if (SyncAuthenticPixels(canvas_image,exception) == MagickFalse)
             break;
-          if (((y-image->extract_info.y) >= 0) && 
+          if (((y-image->extract_info.y) >= 0) &&
               ((y-image->extract_info.y) < (ssize_t) image->rows))
             {
               p=GetVirtualPixels(canvas_image,canvas_image->extract_info.x,0,
@@ -285,8 +286,7 @@ static Image *ReadBGRImage(const ImageInfo *image_info,
               if (status == MagickFalse)
                 break;
             }
-          pixels=(const unsigned char *) ReadBlobStream(image,length,
-            GetQuantumPixels(quantum_info),&count);
+          stream=ReadBlobStream(image,length,pixels,&count);
         }
         break;
       }
@@ -307,8 +307,7 @@ static Image *ReadBGRImage(const ImageInfo *image_info,
         if (scene == 0)
           {
             length=GetQuantumExtent(canvas_image,quantum_info,RedQuantum);
-            pixels=(const unsigned char *) ReadBlobStream(image,length,
-              GetQuantumPixels(quantum_info),&count);
+            stream=ReadBlobStream(image,length,pixels,&count);
           }
         for (y=0; y < (ssize_t) image->extract_info.height; y++)
         {
@@ -336,10 +335,10 @@ static Image *ReadBGRImage(const ImageInfo *image_info,
             if (q == (Quantum *) NULL)
               break;
             length=ImportQuantumPixels(canvas_image,(CacheView *) NULL,
-              quantum_info,quantum_type,pixels,exception);
+              quantum_info,quantum_type,stream,exception);
             if (SyncAuthenticPixels(canvas_image,exception) == MagickFalse)
               break;
-            if (((y-image->extract_info.y) >= 0) && 
+            if (((y-image->extract_info.y) >= 0) &&
                 ((y-image->extract_info.y) < (ssize_t) image->rows))
               {
                 p=GetVirtualPixels(canvas_image,canvas_image->extract_info.x,0,
@@ -387,8 +386,7 @@ static Image *ReadBGRImage(const ImageInfo *image_info,
                 if (SyncAuthenticPixels(image,exception) == MagickFalse)
                   break;
               }
-            pixels=(const unsigned char *) ReadBlobStream(image,length,
-              GetQuantumPixels(quantum_info),&count);
+            stream=ReadBlobStream(image,length,pixels,&count);
           }
           if (image->previous == (Image *) NULL)
             {
@@ -408,8 +406,7 @@ static Image *ReadBGRImage(const ImageInfo *image_info,
         if (scene == 0)
           {
             length=GetQuantumExtent(canvas_image,quantum_info,RedQuantum);
-            pixels=(const unsigned char *) ReadBlobStream(image,length,
-              GetQuantumPixels(quantum_info),&count);
+            stream=ReadBlobStream(image,length,pixels,&count);
           }
         for (y=0; y < (ssize_t) image->extract_info.height; y++)
         {
@@ -434,10 +431,10 @@ static Image *ReadBGRImage(const ImageInfo *image_info,
           if (q == (Quantum *) NULL)
             break;
           length=ImportQuantumPixels(canvas_image,(CacheView *) NULL,
-            quantum_info,RedQuantum,pixels,exception);
+            quantum_info,RedQuantum,stream,exception);
           if (SyncAuthenticPixels(canvas_image,exception) == MagickFalse)
             break;
-          if (((y-image->extract_info.y) >= 0) && 
+          if (((y-image->extract_info.y) >= 0) &&
               ((y-image->extract_info.y) < (ssize_t) image->rows))
             {
               p=GetVirtualPixels(canvas_image,canvas_image->extract_info.x,0,
@@ -456,8 +453,7 @@ static Image *ReadBGRImage(const ImageInfo *image_info,
               if (SyncAuthenticPixels(image,exception) == MagickFalse)
                 break;
             }
-          pixels=(const unsigned char *) ReadBlobStream(image,length,
-            GetQuantumPixels(quantum_info),&count);
+          stream=ReadBlobStream(image,length,pixels,&count);
         }
         if (image->previous == (Image *) NULL)
           {
@@ -488,10 +484,10 @@ static Image *ReadBGRImage(const ImageInfo *image_info,
           if (q == (Quantum *) NULL)
             break;
           length=ImportQuantumPixels(canvas_image,(CacheView *) NULL,
-            quantum_info,GreenQuantum,pixels,exception);
+            quantum_info,GreenQuantum,stream,exception);
           if (SyncAuthenticPixels(canvas_image,exception) == MagickFalse)
             break;
-          if (((y-image->extract_info.y) >= 0) && 
+          if (((y-image->extract_info.y) >= 0) &&
               ((y-image->extract_info.y) < (ssize_t) image->rows))
             {
               p=GetVirtualPixels(canvas_image,canvas_image->extract_info.x,0,
@@ -510,8 +506,7 @@ static Image *ReadBGRImage(const ImageInfo *image_info,
               if (SyncAuthenticPixels(image,exception) == MagickFalse)
                 break;
            }
-          pixels=(const unsigned char *) ReadBlobStream(image,length,
-            GetQuantumPixels(quantum_info),&count);
+          stream=ReadBlobStream(image,length,pixels,&count);
         }
         if (image->previous == (Image *) NULL)
           {
@@ -542,10 +537,10 @@ static Image *ReadBGRImage(const ImageInfo *image_info,
           if (q == (Quantum *) NULL)
             break;
           length=ImportQuantumPixels(canvas_image,(CacheView *) NULL,
-            quantum_info,BlueQuantum,pixels,exception);
+            quantum_info,BlueQuantum,stream,exception);
           if (SyncAuthenticPixels(canvas_image,exception) == MagickFalse)
             break;
-          if (((y-image->extract_info.y) >= 0) && 
+          if (((y-image->extract_info.y) >= 0) &&
               ((y-image->extract_info.y) < (ssize_t) image->rows))
             {
               p=GetVirtualPixels(canvas_image,canvas_image->extract_info.x,0,
@@ -564,8 +559,7 @@ static Image *ReadBGRImage(const ImageInfo *image_info,
               if (SyncAuthenticPixels(image,exception) == MagickFalse)
                 break;
             }
-          pixels=(const unsigned char *) ReadBlobStream(image,length,
-            GetQuantumPixels(quantum_info),&count);
+          stream=ReadBlobStream(image,length,pixels,&count);
         }
         if (image->previous == (Image *) NULL)
           {
@@ -604,10 +598,10 @@ static Image *ReadBGRImage(const ImageInfo *image_info,
               if (q == (Quantum *) NULL)
                 break;
               length=ImportQuantumPixels(canvas_image,(CacheView *) NULL,
-                quantum_info,AlphaQuantum,pixels,exception);
+                quantum_info,AlphaQuantum,stream,exception);
               if (SyncAuthenticPixels(canvas_image,exception) == MagickFalse)
                 break;
-              if (((y-image->extract_info.y) >= 0) && 
+              if (((y-image->extract_info.y) >= 0) &&
                   ((y-image->extract_info.y) < (ssize_t) image->rows))
                 {
                   p=GetVirtualPixels(canvas_image,
@@ -627,8 +621,7 @@ static Image *ReadBGRImage(const ImageInfo *image_info,
                   if (SyncAuthenticPixels(image,exception) == MagickFalse)
                     break;
                 }
-              pixels=(const unsigned char *) ReadBlobStream(image,length,
-                GetQuantumPixels(quantum_info),&count);
+              stream=ReadBlobStream(image,length,pixels,&count);
             }
             if (image->previous == (Image *) NULL)
               {
@@ -657,8 +650,8 @@ static Image *ReadBGRImage(const ImageInfo *image_info,
         if (DiscardBlobBytes(image,(MagickSizeType) image->offset) == MagickFalse)
           {
             status=MagickFalse;
-            ThrowFileException(exception,CorruptImageError,"UnexpectedEndOfFile",
-              image->filename);
+            ThrowFileException(exception,CorruptImageError,
+              "UnexpectedEndOfFile",image->filename);
             break;
           }
         length=GetQuantumExtent(canvas_image,quantum_info,BlueQuantum);
@@ -666,16 +659,14 @@ static Image *ReadBGRImage(const ImageInfo *image_info,
         {
           for (y=0; y < (ssize_t) image->extract_info.height; y++)
           {
-            pixels=(const unsigned char *) ReadBlobStream(image,length,
-              GetQuantumPixels(quantum_info),&count);
+            stream=ReadBlobStream(image,length,pixels,&count);
             if (count != (ssize_t) length)
               break;
           }
           if (count != (ssize_t) length)
             break;
         }
-        pixels=(const unsigned char *) ReadBlobStream(image,length,
-          GetQuantumPixels(quantum_info),&count);
+        stream=ReadBlobStream(image,length,pixels,&count);
         for (y=0; y < (ssize_t) image->extract_info.height; y++)
         {
           register const Quantum
@@ -699,10 +690,10 @@ static Image *ReadBGRImage(const ImageInfo *image_info,
           if (q == (Quantum *) NULL)
             break;
           length=ImportQuantumPixels(canvas_image,(CacheView *) NULL,
-            quantum_info,BlueQuantum,pixels,exception);
+            quantum_info,BlueQuantum,stream,exception);
           if (SyncAuthenticPixels(canvas_image,exception) == MagickFalse)
             break;
-          if (((y-image->extract_info.y) >= 0) && 
+          if (((y-image->extract_info.y) >= 0) &&
               ((y-image->extract_info.y) < (ssize_t) image->rows))
             {
               p=GetVirtualPixels(canvas_image,canvas_image->extract_info.x,0,
@@ -721,8 +712,7 @@ static Image *ReadBGRImage(const ImageInfo *image_info,
               if (SyncAuthenticPixels(image,exception) == MagickFalse)
                 break;
             }
-          pixels=(const unsigned char *) ReadBlobStream(image,length,
-            GetQuantumPixels(quantum_info),&count);
+          stream=ReadBlobStream(image,length,pixels,&count);
         }
         if (image->previous == (Image *) NULL)
           {
@@ -740,16 +730,14 @@ static Image *ReadBGRImage(const ImageInfo *image_info,
         {
           for (y=0; y < (ssize_t) image->extract_info.height; y++)
           {
-            pixels=(const unsigned char *) ReadBlobStream(image,length,
-              GetQuantumPixels(quantum_info),&count);
+            stream=ReadBlobStream(image,length,pixels,&count);
             if (count != (ssize_t) length)
               break;
           }
           if (count != (ssize_t) length)
             break;
         }
-        pixels=(const unsigned char *) ReadBlobStream(image,length,
-          GetQuantumPixels(quantum_info),&count);
+        stream=ReadBlobStream(image,length,pixels,&count);
         for (y=0; y < (ssize_t) image->extract_info.height; y++)
         {
           register const Quantum
@@ -773,10 +761,10 @@ static Image *ReadBGRImage(const ImageInfo *image_info,
           if (q == (Quantum *) NULL)
             break;
           length=ImportQuantumPixels(canvas_image,(CacheView *) NULL,
-            quantum_info,GreenQuantum,pixels,exception);
+            quantum_info,GreenQuantum,stream,exception);
           if (SyncAuthenticPixels(canvas_image,exception) == MagickFalse)
             break;
-          if (((y-image->extract_info.y) >= 0) && 
+          if (((y-image->extract_info.y) >= 0) &&
               ((y-image->extract_info.y) < (ssize_t) image->rows))
             {
               p=GetVirtualPixels(canvas_image,canvas_image->extract_info.x,0,
@@ -795,8 +783,7 @@ static Image *ReadBGRImage(const ImageInfo *image_info,
               if (SyncAuthenticPixels(image,exception) == MagickFalse)
                 break;
            }
-          pixels=(const unsigned char *) ReadBlobStream(image,length,
-            GetQuantumPixels(quantum_info),&count);
+          stream=ReadBlobStream(image,length,pixels,&count);
         }
         if (image->previous == (Image *) NULL)
           {
@@ -814,16 +801,14 @@ static Image *ReadBGRImage(const ImageInfo *image_info,
         {
           for (y=0; y < (ssize_t) image->extract_info.height; y++)
           {
-            pixels=(const unsigned char *) ReadBlobStream(image,length,
-              GetQuantumPixels(quantum_info),&count);
+            stream=ReadBlobStream(image,length,pixels,&count);
             if (count != (ssize_t) length)
               break;
           }
           if (count != (ssize_t) length)
             break;
         }
-        pixels=(const unsigned char *) ReadBlobStream(image,length,
-          GetQuantumPixels(quantum_info),&count);
+        stream=ReadBlobStream(image,length,pixels,&count);
         for (y=0; y < (ssize_t) image->extract_info.height; y++)
         {
           register const Quantum
@@ -847,10 +832,10 @@ static Image *ReadBGRImage(const ImageInfo *image_info,
           if (q == (Quantum *) NULL)
             break;
           length=ImportQuantumPixels(canvas_image,(CacheView *) NULL,
-            quantum_info,RedQuantum,pixels,exception);
+            quantum_info,RedQuantum,stream,exception);
           if (SyncAuthenticPixels(canvas_image,exception) == MagickFalse)
             break;
-          if (((y-image->extract_info.y) >= 0) && 
+          if (((y-image->extract_info.y) >= 0) &&
               ((y-image->extract_info.y) < (ssize_t) image->rows))
             {
               p=GetVirtualPixels(canvas_image,canvas_image->extract_info.x,0,
@@ -869,8 +854,7 @@ static Image *ReadBGRImage(const ImageInfo *image_info,
               if (SyncAuthenticPixels(image,exception) == MagickFalse)
                 break;
            }
-          pixels=(const unsigned char *) ReadBlobStream(image,length,
-            GetQuantumPixels(quantum_info),&count);
+          stream=ReadBlobStream(image,length,pixels,&count);
         }
         if (image->previous == (Image *) NULL)
           {
@@ -890,16 +874,14 @@ static Image *ReadBGRImage(const ImageInfo *image_info,
             {
               for (y=0; y < (ssize_t) image->extract_info.height; y++)
               {
-                pixels=(const unsigned char *) ReadBlobStream(image,length,
-                  GetQuantumPixels(quantum_info),&count);
+                stream=ReadBlobStream(image,length,pixels,&count);
                 if (count != (ssize_t) length)
                   break;
               }
               if (count != (ssize_t) length)
                 break;
             }
-            pixels=(const unsigned char *) ReadBlobStream(image,length,
-              GetQuantumPixels(quantum_info),&count);
+            stream=ReadBlobStream(image,length,pixels,&count);
             for (y=0; y < (ssize_t) image->extract_info.height; y++)
             {
               register const Quantum
@@ -923,10 +905,10 @@ static Image *ReadBGRImage(const ImageInfo *image_info,
               if (q == (Quantum *) NULL)
                 break;
               length=ImportQuantumPixels(canvas_image,(CacheView *) NULL,
-                quantum_info,BlueQuantum,pixels,exception);
+                quantum_info,BlueQuantum,stream,exception);
               if (SyncAuthenticPixels(canvas_image,exception) == MagickFalse)
                 break;
-              if (((y-image->extract_info.y) >= 0) && 
+              if (((y-image->extract_info.y) >= 0) &&
                   ((y-image->extract_info.y) < (ssize_t) image->rows))
                 {
                   p=GetVirtualPixels(canvas_image,canvas_image->extract_info.x,
@@ -945,8 +927,7 @@ static Image *ReadBGRImage(const ImageInfo *image_info,
                   if (SyncAuthenticPixels(image,exception) == MagickFalse)
                     break;
                }
-              pixels=(const unsigned char *) ReadBlobStream(image,length,
-                GetQuantumPixels(quantum_info),&count);
+              stream=ReadBlobStream(image,length,pixels,&count);
             }
             if (image->previous == (Image *) NULL)
               {
index 8be16c3d38d3f2e113f304d1ec962c49a86e3404..e9e8af3012fb502d271c553dbad18bfbba3fad15 100644 (file)
@@ -99,8 +99,8 @@ static MagickBooleanType
 static Image *ReadCMYKImage(const ImageInfo *image_info,
   ExceptionInfo *exception)
 {
-  const unsigned char
-    *pixels;
+  const void
+    *stream;
 
   Image
     *canvas_image,
@@ -128,6 +128,9 @@ static Image *ReadCMYKImage(const ImageInfo *image_info,
     count,
     y;
 
+  unsigned char
+    *pixels;
+
   /*
     Open image file.
   */
@@ -178,7 +181,7 @@ static Image *ReadCMYKImage(const ImageInfo *image_info,
       quantum_type=CMYKAQuantum;
       image->alpha_trait=BlendPixelTrait;
     }
-  pixels=(const unsigned char *) NULL;
+  pixels=GetQuantumPixels(quantum_info);
   if (image_info->number_scenes != 0)
     while (image->scene < image_info->scene)
     {
@@ -189,8 +192,7 @@ static Image *ReadCMYKImage(const ImageInfo *image_info,
       length=GetQuantumExtent(canvas_image,quantum_info,quantum_type);
       for (y=0; y < (ssize_t) image->rows; y++)
       {
-        pixels=(const unsigned char *) ReadBlobStream(image,length,
-          GetQuantumPixels(quantum_info),&count);
+        stream=ReadBlobStream(image,length,pixels,&count);
         if (count != (ssize_t) length)
           break;
       }
@@ -199,6 +201,7 @@ static Image *ReadCMYKImage(const ImageInfo *image_info,
   length=0;
   scene=0;
   status=MagickTrue;
+  stream=NULL;
   do
   {
     /*
@@ -223,8 +226,7 @@ static Image *ReadCMYKImage(const ImageInfo *image_info,
         if (scene == 0)
           {
             length=GetQuantumExtent(canvas_image,quantum_info,quantum_type);
-            pixels=(const unsigned char *) ReadBlobStream(image,length,
-              GetQuantumPixels(quantum_info),&count);
+            stream=ReadBlobStream(image,length,pixels,&count);
           }
         for (y=0; y < (ssize_t) image->extract_info.height; y++)
         {
@@ -249,7 +251,7 @@ static Image *ReadCMYKImage(const ImageInfo *image_info,
           if (q == (Quantum *) NULL)
             break;
           length=ImportQuantumPixels(canvas_image,(CacheView *) NULL,
-            quantum_info,quantum_type,pixels,exception);
+            quantum_info,quantum_type,stream,exception);
           if (SyncAuthenticPixels(canvas_image,exception) == MagickFalse)
             break;
           if (((y-image->extract_info.y) >= 0) && 
@@ -283,8 +285,7 @@ static Image *ReadCMYKImage(const ImageInfo *image_info,
               if (status == MagickFalse)
                 break;
             }
-          pixels=(const unsigned char *) ReadBlobStream(image,length,
-            GetQuantumPixels(quantum_info),&count);
+          stream=ReadBlobStream(image,length,pixels,&count);
         }
         break;
       }
@@ -306,8 +307,7 @@ static Image *ReadCMYKImage(const ImageInfo *image_info,
         if (scene == 0)
           {
             length=GetQuantumExtent(canvas_image,quantum_info,CyanQuantum);
-            pixels=(const unsigned char *) ReadBlobStream(image,length,
-              GetQuantumPixels(quantum_info),&count);
+            stream=ReadBlobStream(image,length,pixels,&count);
           }
         for (y=0; y < (ssize_t) image->extract_info.height; y++)
         {
@@ -335,7 +335,7 @@ static Image *ReadCMYKImage(const ImageInfo *image_info,
             if (q == (Quantum *) NULL)
               break;
             length=ImportQuantumPixels(canvas_image,(CacheView *) NULL,
-              quantum_info,quantum_type,pixels,exception);
+              quantum_info,quantum_type,stream,exception);
             if (SyncAuthenticPixels(canvas_image,exception) == MagickFalse)
               break;
             if (((y-image->extract_info.y) >= 0) && 
@@ -385,8 +385,7 @@ static Image *ReadCMYKImage(const ImageInfo *image_info,
                 if (SyncAuthenticPixels(image,exception) == MagickFalse)
                   break;
               }
-            pixels=(const unsigned char *) ReadBlobStream(image,length,
-              GetQuantumPixels(quantum_info),&count);
+            stream=ReadBlobStream(image,length,pixels,&count);
           }
           if (image->previous == (Image *) NULL)
             {
@@ -406,8 +405,7 @@ static Image *ReadCMYKImage(const ImageInfo *image_info,
         if (scene == 0)
           {
             length=GetQuantumExtent(canvas_image,quantum_info,CyanQuantum);
-            pixels=(const unsigned char *) ReadBlobStream(image,length,
-              GetQuantumPixels(quantum_info),&count);
+            stream=ReadBlobStream(image,length,pixels,&count);
           }
         for (y=0; y < (ssize_t) image->extract_info.height; y++)
         {
@@ -432,7 +430,7 @@ static Image *ReadCMYKImage(const ImageInfo *image_info,
           if (q == (Quantum *) NULL)
             break;
           length=ImportQuantumPixels(canvas_image,(CacheView *) NULL,
-            quantum_info,CyanQuantum,pixels,exception);
+            quantum_info,CyanQuantum,stream,exception);
           if (SyncAuthenticPixels(canvas_image,exception) == MagickFalse)
             break;
           if (((y-image->extract_info.y) >= 0) && 
@@ -453,8 +451,7 @@ static Image *ReadCMYKImage(const ImageInfo *image_info,
               if (SyncAuthenticPixels(image,exception) == MagickFalse)
                 break;
             }
-          pixels=(const unsigned char *) ReadBlobStream(image,length,
-            GetQuantumPixels(quantum_info),&count);
+          stream=ReadBlobStream(image,length,pixels,&count);
         }
         if (image->previous == (Image *) NULL)
           {
@@ -485,7 +482,7 @@ static Image *ReadCMYKImage(const ImageInfo *image_info,
           if (q == (Quantum *) NULL)
             break;
           length=ImportQuantumPixels(canvas_image,(CacheView *) NULL,
-            quantum_info,MagentaQuantum,pixels,exception);
+            quantum_info,MagentaQuantum,stream,exception);
           if (SyncAuthenticPixels(canvas_image,exception) == MagickFalse)
             break;
           if (((y-image->extract_info.y) >= 0) && 
@@ -506,8 +503,7 @@ static Image *ReadCMYKImage(const ImageInfo *image_info,
               if (SyncAuthenticPixels(image,exception) == MagickFalse)
                 break;
            }
-          pixels=(const unsigned char *) ReadBlobStream(image,length,
-            GetQuantumPixels(quantum_info),&count);
+          stream=ReadBlobStream(image,length,pixels,&count);
         }
         if (image->previous == (Image *) NULL)
           {
@@ -538,7 +534,7 @@ static Image *ReadCMYKImage(const ImageInfo *image_info,
           if (q == (Quantum *) NULL)
             break;
           length=ImportQuantumPixels(canvas_image,(CacheView *) NULL,
-            quantum_info,YellowQuantum,pixels,exception);
+            quantum_info,YellowQuantum,stream,exception);
           if (SyncAuthenticPixels(canvas_image,exception) == MagickFalse)
             break;
           if (((y-image->extract_info.y) >= 0) && 
@@ -559,8 +555,7 @@ static Image *ReadCMYKImage(const ImageInfo *image_info,
               if (SyncAuthenticPixels(image,exception) == MagickFalse)
                 break;
             }
-          pixels=(const unsigned char *) ReadBlobStream(image,length,
-            GetQuantumPixels(quantum_info),&count);
+          stream=ReadBlobStream(image,length,pixels,&count);
         }
         if (image->previous == (Image *) NULL)
           {
@@ -591,7 +586,7 @@ static Image *ReadCMYKImage(const ImageInfo *image_info,
           if (q == (Quantum *) NULL)
             break;
           length=ImportQuantumPixels(canvas_image,(CacheView *) NULL,
-            quantum_info,BlackQuantum,pixels,exception);
+            quantum_info,BlackQuantum,stream,exception);
           if (SyncAuthenticPixels(canvas_image,exception) == MagickFalse)
             break;
           if (((y-image->extract_info.y) >= 0) && 
@@ -612,8 +607,7 @@ static Image *ReadCMYKImage(const ImageInfo *image_info,
               if (SyncAuthenticPixels(image,exception) == MagickFalse)
                 break;
             }
-          pixels=(const unsigned char *) ReadBlobStream(image,length,
-            GetQuantumPixels(quantum_info),&count);
+          stream=ReadBlobStream(image,length,pixels,&count);
         }
         if (image->previous == (Image *) NULL)
           {
@@ -646,7 +640,7 @@ static Image *ReadCMYKImage(const ImageInfo *image_info,
               if (q == (Quantum *) NULL)
                 break;
               length=ImportQuantumPixels(canvas_image,(CacheView *) NULL,
-                quantum_info,AlphaQuantum,pixels,exception);
+                quantum_info,AlphaQuantum,stream,exception);
               if (SyncAuthenticPixels(canvas_image,exception) == MagickFalse)
                 break;
               if (((y-image->extract_info.y) >= 0) && 
@@ -668,8 +662,7 @@ static Image *ReadCMYKImage(const ImageInfo *image_info,
                   if (SyncAuthenticPixels(image,exception) == MagickFalse)
                     break;
                 }
-              pixels=(const unsigned char *) ReadBlobStream(image,length,
-                GetQuantumPixels(quantum_info),&count);
+              stream=ReadBlobStream(image,length,pixels,&count);
             }
             if (image->previous == (Image *) NULL)
               {
@@ -707,16 +700,14 @@ static Image *ReadCMYKImage(const ImageInfo *image_info,
         {
           for (y=0; y < (ssize_t) image->extract_info.height; y++)
           {
-            pixels=(const unsigned char *) ReadBlobStream(image,length,
-              GetQuantumPixels(quantum_info),&count);
+            stream=ReadBlobStream(image,length,pixels,&count);
             if (count != (ssize_t) length)
               break;
           }
           if (count != (ssize_t) length)
             break;
         }
-        pixels=(const unsigned char *) ReadBlobStream(image,length,
-          GetQuantumPixels(quantum_info),&count);
+        stream=ReadBlobStream(image,length,pixels,&count);
         for (y=0; y < (ssize_t) image->extract_info.height; y++)
         {
           register const Quantum
@@ -740,7 +731,7 @@ static Image *ReadCMYKImage(const ImageInfo *image_info,
           if (q == (Quantum *) NULL)
             break;
           length=ImportQuantumPixels(canvas_image,(CacheView *) NULL,
-            quantum_info,CyanQuantum,pixels,exception);
+            quantum_info,CyanQuantum,stream,exception);
           if (SyncAuthenticPixels(canvas_image,exception) == MagickFalse)
             break;
           if (((y-image->extract_info.y) >= 0) && 
@@ -761,8 +752,7 @@ static Image *ReadCMYKImage(const ImageInfo *image_info,
               if (SyncAuthenticPixels(image,exception) == MagickFalse)
                 break;
             }
-          pixels=(const unsigned char *) ReadBlobStream(image,length,
-            GetQuantumPixels(quantum_info),&count);
+          stream=ReadBlobStream(image,length,pixels,&count);
         }
         if (image->previous == (Image *) NULL)
           {
@@ -780,16 +770,14 @@ static Image *ReadCMYKImage(const ImageInfo *image_info,
         {
           for (y=0; y < (ssize_t) image->extract_info.height; y++)
           {
-            pixels=(const unsigned char *) ReadBlobStream(image,length,
-              GetQuantumPixels(quantum_info),&count);
+            stream=ReadBlobStream(image,length,pixels,&count);
             if (count != (ssize_t) length)
               break;
           }
           if (count != (ssize_t) length)
             break;
         }
-        pixels=(const unsigned char *) ReadBlobStream(image,length,
-          GetQuantumPixels(quantum_info),&count);
+        stream=ReadBlobStream(image,length,pixels,&count);
         for (y=0; y < (ssize_t) image->extract_info.height; y++)
         {
           register const Quantum
@@ -813,7 +801,7 @@ static Image *ReadCMYKImage(const ImageInfo *image_info,
           if (q == (Quantum *) NULL)
             break;
           length=ImportQuantumPixels(canvas_image,(CacheView *) NULL,
-            quantum_info,MagentaQuantum,pixels,exception);
+            quantum_info,MagentaQuantum,stream,exception);
           if (SyncAuthenticPixels(canvas_image,exception) == MagickFalse)
             break;
           if (((y-image->extract_info.y) >= 0) && 
@@ -834,8 +822,7 @@ static Image *ReadCMYKImage(const ImageInfo *image_info,
               if (SyncAuthenticPixels(image,exception) == MagickFalse)
                 break;
            }
-          pixels=(const unsigned char *) ReadBlobStream(image,length,
-            GetQuantumPixels(quantum_info),&count);
+          stream=ReadBlobStream(image,length,pixels,&count);
         }
         if (image->previous == (Image *) NULL)
           {
@@ -853,16 +840,14 @@ static Image *ReadCMYKImage(const ImageInfo *image_info,
         {
           for (y=0; y < (ssize_t) image->extract_info.height; y++)
           {
-            pixels=(const unsigned char *) ReadBlobStream(image,length,
-              GetQuantumPixels(quantum_info),&count);
+            stream=ReadBlobStream(image,length,pixels,&count);
             if (count != (ssize_t) length)
               break;
           }
           if (count != (ssize_t) length)
             break;
         }
-        pixels=(const unsigned char *) ReadBlobStream(image,length,
-          GetQuantumPixels(quantum_info),&count);
+        stream=ReadBlobStream(image,length,pixels,&count);
         for (y=0; y < (ssize_t) image->extract_info.height; y++)
         {
           register const Quantum
@@ -886,7 +871,7 @@ static Image *ReadCMYKImage(const ImageInfo *image_info,
           if (q == (Quantum *) NULL)
             break;
           length=ImportQuantumPixels(canvas_image,(CacheView *) NULL,
-            quantum_info,YellowQuantum,pixels,exception);
+            quantum_info,YellowQuantum,stream,exception);
           if (SyncAuthenticPixels(canvas_image,exception) == MagickFalse)
             break;
           if (((y-image->extract_info.y) >= 0) && 
@@ -908,8 +893,7 @@ static Image *ReadCMYKImage(const ImageInfo *image_info,
               if (SyncAuthenticPixels(image,exception) == MagickFalse)
                 break;
            }
-          pixels=(const unsigned char *) ReadBlobStream(image,length,
-            GetQuantumPixels(quantum_info),&count);
+          stream=ReadBlobStream(image,length,pixels,&count);
         }
         if (image->previous == (Image *) NULL)
           {
@@ -927,16 +911,14 @@ static Image *ReadCMYKImage(const ImageInfo *image_info,
         {
           for (y=0; y < (ssize_t) image->extract_info.height; y++)
           {
-            pixels=(const unsigned char *) ReadBlobStream(image,length,
-              GetQuantumPixels(quantum_info),&count);
+            stream=ReadBlobStream(image,length,pixels,&count);
             if (count != (ssize_t) length)
               break;
           }
           if (count != (ssize_t) length)
             break;
         }
-        pixels=(const unsigned char *) ReadBlobStream(image,length,
-          GetQuantumPixels(quantum_info),&count);
+        stream=ReadBlobStream(image,length,pixels,&count);
         for (y=0; y < (ssize_t) image->extract_info.height; y++)
         {
           register const Quantum
@@ -960,7 +942,7 @@ static Image *ReadCMYKImage(const ImageInfo *image_info,
           if (q == (Quantum *) NULL)
             break;
           length=ImportQuantumPixels(canvas_image,(CacheView *) NULL,
-            quantum_info,BlackQuantum,pixels,exception);
+            quantum_info,BlackQuantum,stream,exception);
           if (SyncAuthenticPixels(canvas_image,exception) == MagickFalse)
             break;
           if (((y-image->extract_info.y) >= 0) && 
@@ -982,8 +964,7 @@ static Image *ReadCMYKImage(const ImageInfo *image_info,
               if (SyncAuthenticPixels(image,exception) == MagickFalse)
                 break;
            }
-          pixels=(const unsigned char *) ReadBlobStream(image,length,
-            GetQuantumPixels(quantum_info),&count);
+          stream=ReadBlobStream(image,length,pixels,&count);
         }
         if (image->previous == (Image *) NULL)
           {
@@ -1003,16 +984,14 @@ static Image *ReadCMYKImage(const ImageInfo *image_info,
             {
               for (y=0; y < (ssize_t) image->extract_info.height; y++)
               {
-                pixels=(const unsigned char *) ReadBlobStream(image,length,
-                  GetQuantumPixels(quantum_info),&count);
+                stream=ReadBlobStream(image,length,pixels,&count);
                 if (count != (ssize_t) length)
                   break;
               }
               if (count != (ssize_t) length)
                 break;
             }
-            pixels=(const unsigned char *) ReadBlobStream(image,length,
-              GetQuantumPixels(quantum_info),&count);
+            stream=ReadBlobStream(image,length,pixels,&count);
             for (y=0; y < (ssize_t) image->extract_info.height; y++)
             {
               register const Quantum
@@ -1036,7 +1015,7 @@ static Image *ReadCMYKImage(const ImageInfo *image_info,
               if (q == (Quantum *) NULL)
                 break;
               length=ImportQuantumPixels(canvas_image,(CacheView *) NULL,
-                quantum_info,YellowQuantum,pixels,exception);
+                quantum_info,YellowQuantum,stream,exception);
               if (SyncAuthenticPixels(canvas_image,exception) == MagickFalse)
                 break;
               if (((y-image->extract_info.y) >= 0) && 
@@ -1058,8 +1037,7 @@ static Image *ReadCMYKImage(const ImageInfo *image_info,
                   if (SyncAuthenticPixels(image,exception) == MagickFalse)
                     break;
                }
-              pixels=(const unsigned char *) ReadBlobStream(image,length,
-                GetQuantumPixels(quantum_info),&count);
+              stream=ReadBlobStream(image,length,pixels,&count);
             }
             if (image->previous == (Image *) NULL)
               {
index b531ef773f928f92653f0832763b7196fe5ef090..37e8e6cef88919e9dc3d68c1564a049a697b0e46 100644 (file)
@@ -100,8 +100,8 @@ static MagickBooleanType
 static Image *ReadGRAYImage(const ImageInfo *image_info,
   ExceptionInfo *exception)
 {
-  const unsigned char
-    *pixels;
+  const void
+    *stream;
 
   Image
     *canvas_image,
@@ -129,6 +129,9 @@ static Image *ReadGRAYImage(const ImageInfo *image_info,
     count,
     y;
 
+  unsigned char
+    *pixels;
+
   /*
     Open image file.
   */
@@ -177,7 +180,7 @@ static Image *ReadGRAYImage(const ImageInfo *image_info,
       image->alpha_trait=BlendPixelTrait;
       canvas_image->alpha_trait=BlendPixelTrait;
     }
-  pixels=(const unsigned char *) NULL;
+  pixels=GetQuantumPixels(quantum_info);
   if (image_info->number_scenes != 0)
     while (image->scene < image_info->scene)
     {
@@ -188,8 +191,7 @@ static Image *ReadGRAYImage(const ImageInfo *image_info,
       length=GetQuantumExtent(canvas_image,quantum_info,quantum_type);
       for (y=0; y < (ssize_t) image->rows; y++)
       {
-        pixels=(const unsigned char *) ReadBlobStream(image,length,
-          GetQuantumPixels(quantum_info),&count);
+        stream=ReadBlobStream(image,length,pixels,&count);
         if (count != (ssize_t) length)
           break;
       }
@@ -198,6 +200,7 @@ static Image *ReadGRAYImage(const ImageInfo *image_info,
   length=0;
   scene=0;
   status=MagickTrue;
+  stream=NULL;
   do
   {
     /*
@@ -220,8 +223,7 @@ static Image *ReadGRAYImage(const ImageInfo *image_info,
         if (scene == 0)
           {
             length=GetQuantumExtent(canvas_image,quantum_info,quantum_type);
-            pixels=(const unsigned char *) ReadBlobStream(image,length,
-              GetQuantumPixels(quantum_info),&count);
+            stream=ReadBlobStream(image,length,pixels,&count);
           }
         for (y=0; y < (ssize_t) image->extract_info.height; y++)
         {
@@ -246,7 +248,7 @@ static Image *ReadGRAYImage(const ImageInfo *image_info,
           if (q == (Quantum *) NULL)
             break;
           length=ImportQuantumPixels(canvas_image,(CacheView *) NULL,
-            quantum_info,quantum_type,pixels,exception);
+            quantum_info,quantum_type,stream,exception);
           if (SyncAuthenticPixels(canvas_image,exception) == MagickFalse)
             break;
           if (((y-image->extract_info.y) >= 0) && 
@@ -279,8 +281,7 @@ static Image *ReadGRAYImage(const ImageInfo *image_info,
               if (status == MagickFalse)
                 break;
             }
-          pixels=(const unsigned char *) ReadBlobStream(image,length,
-            GetQuantumPixels(quantum_info),&count);
+          stream=ReadBlobStream(image,length,pixels,&count);
         }
         break;
       }
@@ -299,8 +300,7 @@ static Image *ReadGRAYImage(const ImageInfo *image_info,
         if (scene == 0)
           {
             length=GetQuantumExtent(canvas_image,quantum_info,RedQuantum);
-            pixels=(const unsigned char *) ReadBlobStream(image,length,
-              GetQuantumPixels(quantum_info),&count);
+            stream=ReadBlobStream(image,length,pixels,&count);
           }
         for (y=0; y < (ssize_t) image->extract_info.height; y++)
         {
@@ -328,7 +328,7 @@ static Image *ReadGRAYImage(const ImageInfo *image_info,
             if (q == (Quantum *) NULL)
               break;
             length=ImportQuantumPixels(canvas_image,(CacheView *) NULL,
-              quantum_info,quantum_type,pixels,exception);
+              quantum_info,quantum_type,stream,exception);
             if (SyncAuthenticPixels(canvas_image,exception) == MagickFalse)
               break;
             if (((y-image->extract_info.y) >= 0) && 
@@ -363,8 +363,7 @@ static Image *ReadGRAYImage(const ImageInfo *image_info,
                 if (SyncAuthenticPixels(image,exception) == MagickFalse)
                   break;
               }
-            pixels=(const unsigned char *) ReadBlobStream(image,length,
-              GetQuantumPixels(quantum_info),&count);
+            stream=ReadBlobStream(image,length,pixels,&count);
           }
           if (image->previous == (Image *) NULL)
             {
@@ -384,8 +383,7 @@ static Image *ReadGRAYImage(const ImageInfo *image_info,
         if (scene == 0)
           {
             length=GetQuantumExtent(canvas_image,quantum_info,RedQuantum);
-            pixels=(const unsigned char *) ReadBlobStream(image,length,
-              GetQuantumPixels(quantum_info),&count);
+            stream=ReadBlobStream(image,length,pixels,&count);
           }
         for (y=0; y < (ssize_t) image->extract_info.height; y++)
         {
@@ -410,7 +408,7 @@ static Image *ReadGRAYImage(const ImageInfo *image_info,
           if (q == (Quantum *) NULL)
             break;
           length=ImportQuantumPixels(canvas_image,(CacheView *) NULL,
-            quantum_info,RedQuantum,pixels,exception);
+            quantum_info,RedQuantum,stream,exception);
           if (SyncAuthenticPixels(canvas_image,exception) == MagickFalse)
             break;
           if (((y-image->extract_info.y) >= 0) && 
@@ -431,8 +429,7 @@ static Image *ReadGRAYImage(const ImageInfo *image_info,
               if (SyncAuthenticPixels(image,exception) == MagickFalse)
                 break;
             }
-          pixels=(const unsigned char *) ReadBlobStream(image,length,
-            GetQuantumPixels(quantum_info),&count);
+          stream=ReadBlobStream(image,length,pixels,&count);
         }
         if (image->previous == (Image *) NULL)
           {
@@ -465,7 +462,7 @@ static Image *ReadGRAYImage(const ImageInfo *image_info,
               if (q == (Quantum *) NULL)
                 break;
               length=ImportQuantumPixels(canvas_image,(CacheView *) NULL,
-                quantum_info,AlphaQuantum,pixels,exception);
+                quantum_info,AlphaQuantum,stream,exception);
               if (SyncAuthenticPixels(canvas_image,exception) == MagickFalse)
                 break;
               if (((y-image->extract_info.y) >= 0) && 
@@ -487,8 +484,7 @@ static Image *ReadGRAYImage(const ImageInfo *image_info,
                   if (SyncAuthenticPixels(image,exception) == MagickFalse)
                     break;
                 }
-              pixels=(const unsigned char *) ReadBlobStream(image,length,
-                GetQuantumPixels(quantum_info),&count);
+              stream=ReadBlobStream(image,length,pixels,&count);
             }
             if (image->previous == (Image *) NULL)
               {
@@ -517,8 +513,8 @@ static Image *ReadGRAYImage(const ImageInfo *image_info,
         if (DiscardBlobBytes(image,(MagickSizeType) image->offset) == MagickFalse)
           {
             status=MagickFalse;
-            ThrowFileException(exception,CorruptImageError,"UnexpectedEndOfFile",
-              image->filename);
+            ThrowFileException(exception,CorruptImageError,
+              "UnexpectedEndOfFile",image->filename);
             break;
           }
         length=GetQuantumExtent(canvas_image,quantum_info,RedQuantum);
@@ -526,16 +522,14 @@ static Image *ReadGRAYImage(const ImageInfo *image_info,
         {
           for (y=0; y < (ssize_t) image->extract_info.height; y++)
           {
-            pixels=(const unsigned char *) ReadBlobStream(image,length,
-              GetQuantumPixels(quantum_info),&count);
+            stream=ReadBlobStream(image,length,pixels,&count);
             if (count != (ssize_t) length)
               break;
           }
           if (count != (ssize_t) length)
             break;
         }
-        pixels=(const unsigned char *) ReadBlobStream(image,length,
-          GetQuantumPixels(quantum_info),&count);
+        stream=ReadBlobStream(image,length,pixels,&count);
         for (y=0; y < (ssize_t) image->extract_info.height; y++)
         {
           register const Quantum
@@ -559,7 +553,7 @@ static Image *ReadGRAYImage(const ImageInfo *image_info,
           if (q == (Quantum *) NULL)
             break;
           length=ImportQuantumPixels(canvas_image,(CacheView *) NULL,
-            quantum_info,RedQuantum,pixels,exception);
+            quantum_info,RedQuantum,stream,exception);
           if (SyncAuthenticPixels(canvas_image,exception) == MagickFalse)
             break;
           if (((y-image->extract_info.y) >= 0) && 
@@ -580,8 +574,7 @@ static Image *ReadGRAYImage(const ImageInfo *image_info,
               if (SyncAuthenticPixels(image,exception) == MagickFalse)
                 break;
             }
-          pixels=(const unsigned char *) ReadBlobStream(image,length,
-            GetQuantumPixels(quantum_info),&count);
+          stream=ReadBlobStream(image,length,pixels,&count);
         }
         if (image->previous == (Image *) NULL)
           {
@@ -602,16 +595,14 @@ static Image *ReadGRAYImage(const ImageInfo *image_info,
             {
               for (y=0; y < (ssize_t) image->extract_info.height; y++)
               {
-                pixels=(const unsigned char *) ReadBlobStream(image,length,
-                  GetQuantumPixels(quantum_info),&count);
+                stream=ReadBlobStream(image,length,pixels,&count);
                 if (count != (ssize_t) length)
                   break;
               }
               if (count != (ssize_t) length)
                 break;
             }
-            pixels=(const unsigned char *) ReadBlobStream(image,length,
-              GetQuantumPixels(quantum_info),&count);
+            stream=ReadBlobStream(image,length,pixels,&count);
             for (y=0; y < (ssize_t) image->extract_info.height; y++)
             {
               register const Quantum
@@ -635,7 +626,7 @@ static Image *ReadGRAYImage(const ImageInfo *image_info,
               if (q == (Quantum *) NULL)
                 break;
               length=ImportQuantumPixels(canvas_image,(CacheView *) NULL,
-                quantum_info,BlueQuantum,pixels,exception);
+                quantum_info,BlueQuantum,stream,exception);
               if (SyncAuthenticPixels(canvas_image,exception) == MagickFalse)
                 break;
               if (((y-image->extract_info.y) >= 0) && 
@@ -656,8 +647,7 @@ static Image *ReadGRAYImage(const ImageInfo *image_info,
                   if (SyncAuthenticPixels(image,exception) == MagickFalse)
                     break;
                }
-              pixels=(const unsigned char *) ReadBlobStream(image,length,
-                GetQuantumPixels(quantum_info),&count);
+              stream=ReadBlobStream(image,length,pixels,&count);
             }
             if (image->previous == (Image *) NULL)
               {
index 1dead57c3410809a083e82073f262ed6b70e52a0..772bf88a86de34a3e0691d04a7c07c1723b5ad12 100644 (file)
@@ -137,9 +137,6 @@ static Image *ReadPGXImage(const ImageInfo *image_info,ExceptionInfo *exception)
     sans[MagickPathExtent],
     sign[MagickPathExtent];
 
-  const unsigned char
-    *pixels;
-
   Image
     *image;
 
@@ -161,6 +158,9 @@ static Image *ReadPGXImage(const ImageInfo *image_info,ExceptionInfo *exception)
     count,
     y;
 
+  unsigned char
+    *pixels;
+
   /*
     Open image file.
   */
@@ -207,20 +207,23 @@ static Image *ReadPGXImage(const ImageInfo *image_info,ExceptionInfo *exception)
   if (quantum_info == (QuantumInfo *) NULL)
     ThrowReaderException(ResourceLimitError,"MemoryAllocationFailed");
   length=GetQuantumExtent(image,quantum_info,GrayQuantum);
+  pixels=GetQuantumPixels(quantum_info);
   for (y=0; y < (ssize_t) image->rows; y++)
   {
+    const void
+      *stream;
+
     register Quantum
       *magick_restrict q;
 
     q=QueueAuthenticPixels(image,0,y,image->columns,1,exception);
     if (q == (Quantum *) NULL)
       break;
-    pixels=(const unsigned char *) ReadBlobStream(image,length,
-      GetQuantumPixels(quantum_info),&count);
+    stream=ReadBlobStream(image,length,pixels,&count);
     if (count != (ssize_t) length)
       break;
     (void) ImportQuantumPixels(image,(CacheView *) NULL,quantum_info,
-      GrayQuantum,pixels,exception);
+      GrayQuantum,stream,exception);
     if (SyncAuthenticPixels(image,exception) == MagickFalse)
       break;
     if (SetImageProgress(image,LoadImageTag,(MagickOffsetType) y,image->rows) == MagickFalse)
index 519dea65bc9f04d789dc98278315810cb0b580a1..6410eaa6ff61cfd3b5d3c373624b3c88a28dafc5 100644 (file)
@@ -96,8 +96,8 @@ static MagickBooleanType
 */
 static Image *ReadRAWImage(const ImageInfo *image_info,ExceptionInfo *exception)
 {
-  const unsigned char
-    *pixels;
+  const void
+    *stream;
 
   Image
     *canvas_image,
@@ -122,6 +122,9 @@ static Image *ReadRAWImage(const ImageInfo *image_info,ExceptionInfo *exception)
     count,
     y;
 
+  unsigned char
+    *pixels;
+
   /*
     Open image file.
   */
@@ -163,7 +166,7 @@ static Image *ReadRAWImage(const ImageInfo *image_info,ExceptionInfo *exception)
       canvas_image=DestroyImage(canvas_image);
       ThrowReaderException(ResourceLimitError,"MemoryAllocationFailed");
     }
-  pixels=(const unsigned char *) NULL;
+  pixels=GetQuantumPixels(quantum_info);
   if (image_info->number_scenes != 0)
     while (image->scene < image_info->scene)
     {
@@ -174,8 +177,7 @@ static Image *ReadRAWImage(const ImageInfo *image_info,ExceptionInfo *exception)
       length=GetQuantumExtent(canvas_image,quantum_info,quantum_type);
       for (y=0; y < (ssize_t) image->rows; y++)
       {
-        pixels=(const unsigned char *) ReadBlobStream(image,length,
-          GetQuantumPixels(quantum_info),&count);
+        stream=ReadBlobStream(image,length,pixels,&count);
         if (count != (ssize_t) length)
           break;
       }
@@ -184,6 +186,7 @@ static Image *ReadRAWImage(const ImageInfo *image_info,ExceptionInfo *exception)
   count=0;
   length=0;
   status=MagickTrue;
+  stream=NULL;
   do
   {
     /*
@@ -198,8 +201,7 @@ static Image *ReadRAWImage(const ImageInfo *image_info,ExceptionInfo *exception)
     if (scene == 0)
       {
         length=GetQuantumExtent(canvas_image,quantum_info,quantum_type);
-        pixels=(const unsigned char *) ReadBlobStream(image,length,
-          GetQuantumPixels(quantum_info),&count);
+        stream=ReadBlobStream(image,length,pixels,&count);
         if (count != (ssize_t) length)
           break;
       }
@@ -225,7 +227,7 @@ static Image *ReadRAWImage(const ImageInfo *image_info,ExceptionInfo *exception)
       if (q == (Quantum *) NULL)
         break;
       length=ImportQuantumPixels(canvas_image,(CacheView *) NULL,quantum_info,
-        quantum_type,pixels,exception);
+        quantum_type,stream,exception);
       if (SyncAuthenticPixels(canvas_image,exception) == MagickFalse)
         break;
       if (((y-image->extract_info.y) >= 0) && 
@@ -255,8 +257,7 @@ static Image *ReadRAWImage(const ImageInfo *image_info,ExceptionInfo *exception)
           if (status == MagickFalse)
             break;
         }
-      pixels=(const unsigned char *) ReadBlobStream(image,length,
-        GetQuantumPixels(quantum_info),&count);
+      stream=ReadBlobStream(image,length,pixels,&count);
       if (count != (ssize_t) length)
         break;
     }
index 0bff43650e854faa5868e6545e5c87bacb3afaf0..0642bb35973fe7731e24770172381049b0219d0a 100644 (file)
@@ -99,8 +99,8 @@ static MagickBooleanType
 */
 static Image *ReadRGBImage(const ImageInfo *image_info,ExceptionInfo *exception)
 {
-  const unsigned char
-    *pixels;
+  const void
+    *stream;
 
   Image
     *canvas_image,
@@ -128,6 +128,9 @@ static Image *ReadRGBImage(const ImageInfo *image_info,ExceptionInfo *exception)
     count,
     y;
 
+  unsigned char
+    *pixels;
+
   /*
     Open image file.
   */
@@ -181,7 +184,7 @@ static Image *ReadRGBImage(const ImageInfo *image_info,ExceptionInfo *exception)
       image->alpha_trait=BlendPixelTrait;
       canvas_image->alpha_trait=BlendPixelTrait;
     }
-  pixels=(const unsigned char *) NULL;
+  pixels=GetQuantumPixels(quantum_info);
   if (image_info->number_scenes != 0)
     while (image->scene < image_info->scene)
     {
@@ -192,8 +195,7 @@ static Image *ReadRGBImage(const ImageInfo *image_info,ExceptionInfo *exception)
       length=GetQuantumExtent(canvas_image,quantum_info,quantum_type);
       for (y=0; y < (ssize_t) image->rows; y++)
       {
-        pixels=(const unsigned char *) ReadBlobStream(image,length,
-          GetQuantumPixels(quantum_info),&count);
+        stream=ReadBlobStream(image,length,pixels,&count);
         if (count != (ssize_t) length)
           break;
       }
@@ -202,6 +204,7 @@ static Image *ReadRGBImage(const ImageInfo *image_info,ExceptionInfo *exception)
   length=0;
   scene=0;
   status=MagickTrue;
+  stream=NULL;
   do
   {
     /*
@@ -224,8 +227,7 @@ static Image *ReadRGBImage(const ImageInfo *image_info,ExceptionInfo *exception)
         if (scene == 0)
           {
             length=GetQuantumExtent(canvas_image,quantum_info,quantum_type);
-            pixels=(const unsigned char *) ReadBlobStream(image,length,
-              GetQuantumPixels(quantum_info),&count);
+            stream=ReadBlobStream(image,length,pixels,&count);
           }
         for (y=0; y < (ssize_t) image->extract_info.height; y++)
         {
@@ -250,7 +252,7 @@ static Image *ReadRGBImage(const ImageInfo *image_info,ExceptionInfo *exception)
           if (q == (Quantum *) NULL)
             break;
           length=ImportQuantumPixels(canvas_image,(CacheView *) NULL,
-            quantum_info,quantum_type,pixels,exception);
+            quantum_info,quantum_type,stream,exception);
           if (SyncAuthenticPixels(canvas_image,exception) == MagickFalse)
             break;
           if (((y-image->extract_info.y) >= 0) &&
@@ -283,8 +285,7 @@ static Image *ReadRGBImage(const ImageInfo *image_info,ExceptionInfo *exception)
               if (status == MagickFalse)
                 break;
             }
-          pixels=(const unsigned char *) ReadBlobStream(image,length,
-            GetQuantumPixels(quantum_info),&count);
+          stream=ReadBlobStream(image,length,pixels,&count);
         }
         break;
       }
@@ -307,8 +308,7 @@ static Image *ReadRGBImage(const ImageInfo *image_info,ExceptionInfo *exception)
         if (scene == 0)
           {
             length=GetQuantumExtent(canvas_image,quantum_info,RedQuantum);
-            pixels=(const unsigned char *) ReadBlobStream(image,length,
-              GetQuantumPixels(quantum_info),&count);
+            stream=ReadBlobStream(image,length,pixels,&count);
           }
         for (y=0; y < (ssize_t) image->extract_info.height; y++)
         {
@@ -336,7 +336,7 @@ static Image *ReadRGBImage(const ImageInfo *image_info,ExceptionInfo *exception)
             if (q == (Quantum *) NULL)
               break;
             length=ImportQuantumPixels(canvas_image,(CacheView *) NULL,
-              quantum_info,quantum_type,pixels,exception);
+              quantum_info,quantum_type,stream,exception);
             if (SyncAuthenticPixels(canvas_image,exception) == MagickFalse)
               break;
             if (((y-image->extract_info.y) >= 0) &&
@@ -386,8 +386,7 @@ static Image *ReadRGBImage(const ImageInfo *image_info,ExceptionInfo *exception)
                 if (SyncAuthenticPixels(image,exception) == MagickFalse)
                   break;
               }
-            pixels=(const unsigned char *) ReadBlobStream(image,length,
-              GetQuantumPixels(quantum_info),&count);
+            stream=ReadBlobStream(image,length,pixels,&count);
           }
           if (image->previous == (Image *) NULL)
             {
@@ -407,8 +406,7 @@ static Image *ReadRGBImage(const ImageInfo *image_info,ExceptionInfo *exception)
         if (scene == 0)
           {
             length=GetQuantumExtent(canvas_image,quantum_info,RedQuantum);
-            pixels=(const unsigned char *) ReadBlobStream(image,length,
-              GetQuantumPixels(quantum_info),&count);
+            stream=ReadBlobStream(image,length,pixels,&count);
           }
         for (y=0; y < (ssize_t) image->extract_info.height; y++)
         {
@@ -433,7 +431,7 @@ static Image *ReadRGBImage(const ImageInfo *image_info,ExceptionInfo *exception)
           if (q == (Quantum *) NULL)
             break;
           length=ImportQuantumPixels(canvas_image,(CacheView *) NULL,
-            quantum_info,RedQuantum,pixels,exception);
+            quantum_info,RedQuantum,stream,exception);
           if (SyncAuthenticPixels(canvas_image,exception) == MagickFalse)
             break;
           if (((y-image->extract_info.y) >= 0) &&
@@ -454,8 +452,7 @@ static Image *ReadRGBImage(const ImageInfo *image_info,ExceptionInfo *exception)
               if (SyncAuthenticPixels(image,exception) == MagickFalse)
                 break;
             }
-          pixels=(const unsigned char *) ReadBlobStream(image,length,
-            GetQuantumPixels(quantum_info),&count);
+          stream=ReadBlobStream(image,length,pixels,&count);
         }
         if (image->previous == (Image *) NULL)
           {
@@ -486,7 +483,7 @@ static Image *ReadRGBImage(const ImageInfo *image_info,ExceptionInfo *exception)
           if (q == (Quantum *) NULL)
             break;
           length=ImportQuantumPixels(canvas_image,(CacheView *) NULL,
-            quantum_info,GreenQuantum,pixels,exception);
+            quantum_info,GreenQuantum,stream,exception);
           if (SyncAuthenticPixels(canvas_image,exception) == MagickFalse)
             break;
           if (((y-image->extract_info.y) >= 0) &&
@@ -507,8 +504,7 @@ static Image *ReadRGBImage(const ImageInfo *image_info,ExceptionInfo *exception)
               if (SyncAuthenticPixels(image,exception) == MagickFalse)
                 break;
            }
-          pixels=(const unsigned char *) ReadBlobStream(image,length,
-            GetQuantumPixels(quantum_info),&count);
+          stream=ReadBlobStream(image,length,pixels,&count);
         }
         if (image->previous == (Image *) NULL)
           {
@@ -539,7 +535,7 @@ static Image *ReadRGBImage(const ImageInfo *image_info,ExceptionInfo *exception)
           if (q == (Quantum *) NULL)
             break;
           length=ImportQuantumPixels(canvas_image,(CacheView *) NULL,
-            quantum_info,BlueQuantum,pixels,exception);
+            quantum_info,BlueQuantum,stream,exception);
           if (SyncAuthenticPixels(canvas_image,exception) == MagickFalse)
             break;
           if (((y-image->extract_info.y) >= 0) &&
@@ -560,8 +556,7 @@ static Image *ReadRGBImage(const ImageInfo *image_info,ExceptionInfo *exception)
               if (SyncAuthenticPixels(image,exception) == MagickFalse)
                 break;
             }
-          pixels=(const unsigned char *) ReadBlobStream(image,length,
-            GetQuantumPixels(quantum_info),&count);
+          stream=ReadBlobStream(image,length,pixels,&count);
         }
         if (image->previous == (Image *) NULL)
           {
@@ -594,7 +589,7 @@ static Image *ReadRGBImage(const ImageInfo *image_info,ExceptionInfo *exception)
               if (q == (Quantum *) NULL)
                 break;
               length=ImportQuantumPixels(canvas_image,(CacheView *) NULL,
-                quantum_info,AlphaQuantum,pixels,exception);
+                quantum_info,AlphaQuantum,stream,exception);
               if (SyncAuthenticPixels(canvas_image,exception) == MagickFalse)
                 break;
               if (((y-image->extract_info.y) >= 0) &&
@@ -616,8 +611,7 @@ static Image *ReadRGBImage(const ImageInfo *image_info,ExceptionInfo *exception)
                   if (SyncAuthenticPixels(image,exception) == MagickFalse)
                     break;
                 }
-              pixels=(const unsigned char *) ReadBlobStream(image,length,
-                GetQuantumPixels(quantum_info),&count);
+              stream=ReadBlobStream(image,length,pixels,&count);
             }
             if (image->previous == (Image *) NULL)
               {
@@ -646,8 +640,8 @@ static Image *ReadRGBImage(const ImageInfo *image_info,ExceptionInfo *exception)
         if (DiscardBlobBytes(image,(MagickSizeType) image->offset) == MagickFalse)
           {
             status=MagickFalse;
-            ThrowFileException(exception,CorruptImageError,"UnexpectedEndOfFile",
-              image->filename);
+            ThrowFileException(exception,CorruptImageError,
+              "UnexpectedEndOfFile",image->filename);
             break;
           }
         length=GetQuantumExtent(canvas_image,quantum_info,RedQuantum);
@@ -655,16 +649,14 @@ static Image *ReadRGBImage(const ImageInfo *image_info,ExceptionInfo *exception)
         {
           for (y=0; y < (ssize_t) image->extract_info.height; y++)
           {
-            pixels=(const unsigned char *) ReadBlobStream(image,length,
-              GetQuantumPixels(quantum_info),&count);
+            stream=ReadBlobStream(image,length,pixels,&count);
             if (count != (ssize_t) length)
               break;
           }
           if (count != (ssize_t) length)
             break;
         }
-        pixels=(const unsigned char *) ReadBlobStream(image,length,
-          GetQuantumPixels(quantum_info),&count);
+        stream=ReadBlobStream(image,length,pixels,&count);
         for (y=0; y < (ssize_t) image->extract_info.height; y++)
         {
           register const Quantum
@@ -688,7 +680,7 @@ static Image *ReadRGBImage(const ImageInfo *image_info,ExceptionInfo *exception)
           if (q == (Quantum *) NULL)
             break;
           length=ImportQuantumPixels(canvas_image,(CacheView *) NULL,
-            quantum_info,RedQuantum,pixels,exception);
+            quantum_info,RedQuantum,stream,exception);
           if (SyncAuthenticPixels(canvas_image,exception) == MagickFalse)
             break;
           if (((y-image->extract_info.y) >= 0) &&
@@ -709,8 +701,7 @@ static Image *ReadRGBImage(const ImageInfo *image_info,ExceptionInfo *exception)
               if (SyncAuthenticPixels(image,exception) == MagickFalse)
                 break;
             }
-          pixels=(const unsigned char *) ReadBlobStream(image,length,
-            GetQuantumPixels(quantum_info),&count);
+          stream=ReadBlobStream(image,length,pixels,&count);
         }
         if (image->previous == (Image *) NULL)
           {
@@ -728,16 +719,14 @@ static Image *ReadRGBImage(const ImageInfo *image_info,ExceptionInfo *exception)
         {
           for (y=0; y < (ssize_t) image->extract_info.height; y++)
           {
-            pixels=(const unsigned char *) ReadBlobStream(image,length,
-              GetQuantumPixels(quantum_info),&count);
+            stream=ReadBlobStream(image,length,pixels,&count);
             if (count != (ssize_t) length)
               break;
           }
           if (count != (ssize_t) length)
             break;
         }
-        pixels=(const unsigned char *) ReadBlobStream(image,length,
-          GetQuantumPixels(quantum_info),&count);
+        stream=ReadBlobStream(image,length,pixels,&count);
         for (y=0; y < (ssize_t) image->extract_info.height; y++)
         {
           register const Quantum
@@ -761,7 +750,7 @@ static Image *ReadRGBImage(const ImageInfo *image_info,ExceptionInfo *exception)
           if (q == (Quantum *) NULL)
             break;
           length=ImportQuantumPixels(canvas_image,(CacheView *) NULL,
-            quantum_info,GreenQuantum,pixels,exception);
+            quantum_info,GreenQuantum,stream,exception);
           if (SyncAuthenticPixels(canvas_image,exception) == MagickFalse)
             break;
           if (((y-image->extract_info.y) >= 0) &&
@@ -782,8 +771,7 @@ static Image *ReadRGBImage(const ImageInfo *image_info,ExceptionInfo *exception)
               if (SyncAuthenticPixels(image,exception) == MagickFalse)
                 break;
            }
-          pixels=(const unsigned char *) ReadBlobStream(image,length,
-            GetQuantumPixels(quantum_info),&count);
+          stream=ReadBlobStream(image,length,pixels,&count);
         }
         if (image->previous == (Image *) NULL)
           {
@@ -801,16 +789,14 @@ static Image *ReadRGBImage(const ImageInfo *image_info,ExceptionInfo *exception)
         {
           for (y=0; y < (ssize_t) image->extract_info.height; y++)
           {
-            pixels=(const unsigned char *) ReadBlobStream(image,length,
-              GetQuantumPixels(quantum_info),&count);
+            stream=ReadBlobStream(image,length,pixels,&count);
             if (count != (ssize_t) length)
               break;
           }
           if (count != (ssize_t) length)
             break;
         }
-        pixels=(const unsigned char *) ReadBlobStream(image,length,
-          GetQuantumPixels(quantum_info),&count);
+        stream=ReadBlobStream(image,length,pixels,&count);
         for (y=0; y < (ssize_t) image->extract_info.height; y++)
         {
           register const Quantum
@@ -834,7 +820,7 @@ static Image *ReadRGBImage(const ImageInfo *image_info,ExceptionInfo *exception)
           if (q == (Quantum *) NULL)
             break;
           length=ImportQuantumPixels(canvas_image,(CacheView *) NULL,
-            quantum_info,BlueQuantum,pixels,exception);
+            quantum_info,BlueQuantum,stream,exception);
           if (SyncAuthenticPixels(canvas_image,exception) == MagickFalse)
             break;
           if (((y-image->extract_info.y) >= 0) &&
@@ -855,8 +841,7 @@ static Image *ReadRGBImage(const ImageInfo *image_info,ExceptionInfo *exception)
               if (SyncAuthenticPixels(image,exception) == MagickFalse)
                 break;
            }
-          pixels=(const unsigned char *) ReadBlobStream(image,length,
-            GetQuantumPixels(quantum_info),&count);
+          stream=ReadBlobStream(image,length,pixels,&count);
         }
         if (image->previous == (Image *) NULL)
           {
@@ -876,16 +861,14 @@ static Image *ReadRGBImage(const ImageInfo *image_info,ExceptionInfo *exception)
             {
               for (y=0; y < (ssize_t) image->extract_info.height; y++)
               {
-                pixels=(const unsigned char *) ReadBlobStream(image,length,
-                  GetQuantumPixels(quantum_info),&count);
+                stream=ReadBlobStream(image,length,pixels,&count);
                 if (count != (ssize_t) length)
                   break;
               }
               if (count != (ssize_t) length)
                 break;
             }
-            pixels=(const unsigned char *) ReadBlobStream(image,length,
-              GetQuantumPixels(quantum_info),&count);
+            stream=ReadBlobStream(image,length,pixels,&count);
             for (y=0; y < (ssize_t) image->extract_info.height; y++)
             {
               register const Quantum
@@ -909,7 +892,7 @@ static Image *ReadRGBImage(const ImageInfo *image_info,ExceptionInfo *exception)
               if (q == (Quantum *) NULL)
                 break;
               length=ImportQuantumPixels(canvas_image,(CacheView *) NULL,
-                quantum_info,BlueQuantum,pixels,exception);
+                quantum_info,BlueQuantum,stream,exception);
               if (SyncAuthenticPixels(canvas_image,exception) == MagickFalse)
                 break;
               if (((y-image->extract_info.y) >= 0) &&
@@ -930,8 +913,7 @@ static Image *ReadRGBImage(const ImageInfo *image_info,ExceptionInfo *exception)
                   if (SyncAuthenticPixels(image,exception) == MagickFalse)
                     break;
                }
-              pixels=(const unsigned char *) ReadBlobStream(image,length,
-                GetQuantumPixels(quantum_info),&count);
+              stream=ReadBlobStream(image,length,pixels,&count);
             }
             if (image->previous == (Image *) NULL)
               {
@@ -1016,8 +998,8 @@ static Image *ReadRGBImage(const ImageInfo *image_info,ExceptionInfo *exception)
 static Image *ReadRGB565Image(const ImageInfo *image_info,
   ExceptionInfo *exception)
 {
-  const unsigned char
-    *pixels;
+  const void
+    *stream;
 
   Image
     *canvas_image,
@@ -1042,6 +1024,9 @@ static Image *ReadRGB565Image(const ImageInfo *image_info,
     count,
     y;
 
+  unsigned char
+    *pixels;
+
   /*
     Open image file.
   */
@@ -1084,7 +1069,7 @@ static Image *ReadRGB565Image(const ImageInfo *image_info,
       ThrowReaderException(ResourceLimitError,"MemoryAllocationFailed");
     }
   quantum_type=GrayQuantum;
-  pixels=(const unsigned char *) NULL;
+  pixels=GetQuantumPixels(quantum_info);
   if (image_info->number_scenes != 0)
     while (image->scene < image_info->scene)
     {
@@ -1095,8 +1080,7 @@ static Image *ReadRGB565Image(const ImageInfo *image_info,
       length=GetQuantumExtent(canvas_image,quantum_info,quantum_type);
       for (y=0; y < (ssize_t) image->rows; y++)
       {
-        pixels=(const unsigned char *) ReadBlobStream(image,length,
-          GetQuantumPixels(quantum_info),&count);
+        stream=ReadBlobStream(image,length,pixels,&count);
         if (count != (ssize_t) length)
           break;
       }
@@ -1105,6 +1089,7 @@ static Image *ReadRGB565Image(const ImageInfo *image_info,
   length=0;
   scene=0;
   status=MagickTrue;
+  stream=NULL;
   do
   {
     /*
@@ -1122,8 +1107,7 @@ static Image *ReadRGB565Image(const ImageInfo *image_info,
     if (scene == 0)
       {
         length=GetQuantumExtent(canvas_image,quantum_info,quantum_type);
-        pixels=(const unsigned char *) ReadBlobStream(image,length,
-          GetQuantumPixels(quantum_info),&count);
+        stream=ReadBlobStream(image,length,pixels,&count);
       }
     for (y=0; y < (ssize_t) image->extract_info.height; y++)
     {
@@ -1147,7 +1131,7 @@ static Image *ReadRGB565Image(const ImageInfo *image_info,
       if (q == (Quantum *) NULL)
         break;
       length=ImportQuantumPixels(canvas_image,(CacheView *) NULL,
-        quantum_info,quantum_type,pixels,exception);
+        quantum_info,quantum_type,stream,exception);
       if (SyncAuthenticPixels(canvas_image,exception) == MagickFalse)
         break;
       if (((y-image->extract_info.y) >= 0) &&
@@ -1182,8 +1166,7 @@ static Image *ReadRGB565Image(const ImageInfo *image_info,
           if (status == MagickFalse)
             break;
         }
-      pixels=(const unsigned char *) ReadBlobStream(image,length,
-        GetQuantumPixels(quantum_info),&count);
+      stream=ReadBlobStream(image,length,pixels,&count);
     }
     if (status == MagickFalse)
       break;
index 7bc1665316946859a55dd2f5a73a63c1fd74ce7f..a38ae436fd1ad1ee579fe285dbc59d35d6185f7f 100644 (file)
@@ -149,9 +149,6 @@ static Image *ReadVICARImage(const ImageInfo *image_info,
     keyword[MagickPathExtent],
     value[MagickPathExtent];
 
-  const unsigned char
-    *pixels;
-
   Image
     *image;
 
@@ -178,6 +175,9 @@ static Image *ReadVICARImage(const ImageInfo *image_info,
     count,
     y;
 
+  unsigned char
+    *pixels;
+
   /*
     Open image file.
   */
@@ -300,17 +300,20 @@ static Image *ReadVICARImage(const ImageInfo *image_info,
   if (quantum_info == (QuantumInfo *) NULL)
     ThrowReaderException(ResourceLimitError,"MemoryAllocationFailed");
   length=GetQuantumExtent(image,quantum_info,quantum_type);
+  pixels=GetQuantumPixels(quantum_info);
   for (y=0; y < (ssize_t) image->rows; y++)
   {
+    const void
+      *stream;
+
     q=QueueAuthenticPixels(image,0,y,image->columns,1,exception);
     if (q == (Quantum *) NULL)
       break;
-    pixels=(const unsigned char *) ReadBlobStream(image,length,
-      GetQuantumPixels(quantum_info),&count);
+    stream=ReadBlobStream(image,length,pixels,&count);
     if (count != (ssize_t) length)
       break;
     (void) ImportQuantumPixels(image,(CacheView *) NULL,quantum_info,
-      quantum_type,pixels,exception);
+      quantum_type,stream,exception);
     if (SyncAuthenticPixels(image,exception) == MagickFalse)
       break;
     status=SetImageProgress(image,LoadImageTag,(MagickOffsetType) y,
index 212c2fb8e4eae9dfaed135d16b2b67cb3b927cff..6d15c8cd7665117f43931ed06ddced5ea3e107f0 100644 (file)
@@ -99,8 +99,8 @@ static MagickBooleanType
 static Image *ReadYCBCRImage(const ImageInfo *image_info,
   ExceptionInfo *exception)
 {
-  const unsigned char
-    *pixels;
+  const void
+    *stream;
 
   Image
     *canvas_image,
@@ -128,6 +128,9 @@ static Image *ReadYCBCRImage(const ImageInfo *image_info,
     count,
     y;
 
+  unsigned char
+    *pixels;
+
   /*
     Open image file.
   */
@@ -178,7 +181,7 @@ static Image *ReadYCBCRImage(const ImageInfo *image_info,
       quantum_type=RGBAQuantum;
       image->alpha_trait=BlendPixelTrait;
     }
-  pixels=(const unsigned char *) NULL;
+  pixels=GetQuantumPixels(quantum_info);
   if (image_info->number_scenes != 0)
     while (image->scene < image_info->scene)
     {
@@ -189,8 +192,7 @@ static Image *ReadYCBCRImage(const ImageInfo *image_info,
       length=GetQuantumExtent(canvas_image,quantum_info,quantum_type);
       for (y=0; y < (ssize_t) image->rows; y++)
       {
-        pixels=(const unsigned char *) ReadBlobStream(image,length,
-          GetQuantumPixels(quantum_info),&count);
+        stream=ReadBlobStream(image,length,pixels,&count);
         if (count != (ssize_t) length)
           break;
       }
@@ -199,6 +201,7 @@ static Image *ReadYCBCRImage(const ImageInfo *image_info,
   length=0;
   scene=0;
   status=MagickTrue;
+  stream=NULL;
   do
   {
     /*
@@ -223,8 +226,7 @@ static Image *ReadYCBCRImage(const ImageInfo *image_info,
         if (scene == 0)
           {
             length=GetQuantumExtent(canvas_image,quantum_info,quantum_type);
-            pixels=(const unsigned char *) ReadBlobStream(image,length,
-              GetQuantumPixels(quantum_info),&count);
+            stream=ReadBlobStream(image,length,pixels,&count);
           }
         for (y=0; y < (ssize_t) image->extract_info.height; y++)
         {
@@ -249,7 +251,7 @@ static Image *ReadYCBCRImage(const ImageInfo *image_info,
           if (q == (Quantum *) NULL)
             break;
           length=ImportQuantumPixels(canvas_image,(CacheView *) NULL,
-            quantum_info,quantum_type,pixels,exception);
+            quantum_info,quantum_type,stream,exception);
           if (SyncAuthenticPixels(canvas_image,exception) == MagickFalse)
             break;
           if (((y-image->extract_info.y) >= 0) && 
@@ -282,8 +284,7 @@ static Image *ReadYCBCRImage(const ImageInfo *image_info,
               if (status == MagickFalse)
                 break;
             }
-          pixels=(const unsigned char *) ReadBlobStream(image,length,
-            GetQuantumPixels(quantum_info),&count);
+          stream=ReadBlobStream(image,length,pixels,&count);
         }
         break;
       }
@@ -304,8 +305,7 @@ static Image *ReadYCBCRImage(const ImageInfo *image_info,
         if (scene == 0)
           {
             length=GetQuantumExtent(canvas_image,quantum_info,RedQuantum);
-            pixels=(const unsigned char *) ReadBlobStream(image,length,
-              GetQuantumPixels(quantum_info),&count);
+            stream=ReadBlobStream(image,length,pixels,&count);
           }
         for (y=0; y < (ssize_t) image->extract_info.height; y++)
         {
@@ -333,7 +333,7 @@ static Image *ReadYCBCRImage(const ImageInfo *image_info,
             if (q == (Quantum *) NULL)
               break;
             length=ImportQuantumPixels(canvas_image,(CacheView *) NULL,
-              quantum_info,quantum_type,pixels,exception);
+              quantum_info,quantum_type,stream,exception);
             if (SyncAuthenticPixels(canvas_image,exception) == MagickFalse)
               break;
             if (((y-image->extract_info.y) >= 0) && 
@@ -379,8 +379,7 @@ static Image *ReadYCBCRImage(const ImageInfo *image_info,
                 if (SyncAuthenticPixels(image,exception) == MagickFalse)
                   break;
               }
-            pixels=(const unsigned char *) ReadBlobStream(image,length,
-              GetQuantumPixels(quantum_info),&count);
+            stream=ReadBlobStream(image,length,pixels,&count);
           }
           if (image->previous == (Image *) NULL)
             {
@@ -400,8 +399,7 @@ static Image *ReadYCBCRImage(const ImageInfo *image_info,
         if (scene == 0)
           {
             length=GetQuantumExtent(canvas_image,quantum_info,RedQuantum);
-            pixels=(const unsigned char *) ReadBlobStream(image,length,
-              GetQuantumPixels(quantum_info),&count);
+            stream=ReadBlobStream(image,length,pixels,&count);
           }
         for (y=0; y < (ssize_t) image->extract_info.height; y++)
         {
@@ -426,7 +424,7 @@ static Image *ReadYCBCRImage(const ImageInfo *image_info,
           if (q == (Quantum *) NULL)
             break;
           length=ImportQuantumPixels(canvas_image,(CacheView *) NULL,
-            quantum_info,RedQuantum,pixels,exception);
+            quantum_info,RedQuantum,stream,exception);
           if (SyncAuthenticPixels(canvas_image,exception) == MagickFalse)
             break;
           if (((y-image->extract_info.y) >= 0) && 
@@ -448,8 +446,7 @@ static Image *ReadYCBCRImage(const ImageInfo *image_info,
               if (SyncAuthenticPixels(image,exception) == MagickFalse)
                 break;
             }
-          pixels=(const unsigned char *) ReadBlobStream(image,length,
-            GetQuantumPixels(quantum_info),&count);
+          stream=ReadBlobStream(image,length,pixels,&count);
         }
         if (image->previous == (Image *) NULL)
           {
@@ -480,7 +477,7 @@ static Image *ReadYCBCRImage(const ImageInfo *image_info,
           if (q == (Quantum *) NULL)
             break;
           length=ImportQuantumPixels(canvas_image,(CacheView *) NULL,
-            quantum_info,GreenQuantum,pixels,exception);
+            quantum_info,GreenQuantum,stream,exception);
           if (SyncAuthenticPixels(canvas_image,exception) == MagickFalse)
             break;
           if (((y-image->extract_info.y) >= 0) && 
@@ -501,9 +498,8 @@ static Image *ReadYCBCRImage(const ImageInfo *image_info,
               }
               if (SyncAuthenticPixels(image,exception) == MagickFalse)
                 break;
-           }
-          pixels=(const unsigned char *) ReadBlobStream(image,length,
-            GetQuantumPixels(quantum_info),&count);
+            }
+          stream=ReadBlobStream(image,length,pixels,&count);
         }
         if (image->previous == (Image *) NULL)
           {
@@ -534,7 +530,7 @@ static Image *ReadYCBCRImage(const ImageInfo *image_info,
           if (q == (Quantum *) NULL)
             break;
           length=ImportQuantumPixels(canvas_image,(CacheView *) NULL,
-            quantum_info,BlueQuantum,pixels,exception);
+            quantum_info,BlueQuantum,stream,exception);
           if (SyncAuthenticPixels(canvas_image,exception) == MagickFalse)
             break;
           if (((y-image->extract_info.y) >= 0) && 
@@ -556,8 +552,7 @@ static Image *ReadYCBCRImage(const ImageInfo *image_info,
               if (SyncAuthenticPixels(image,exception) == MagickFalse)
                 break;
             }
-          pixels=(const unsigned char *) ReadBlobStream(image,length,
-            GetQuantumPixels(quantum_info),&count);
+          stream=ReadBlobStream(image,length,pixels,&count);
         }
         if (image->previous == (Image *) NULL)
           {
@@ -590,7 +585,7 @@ static Image *ReadYCBCRImage(const ImageInfo *image_info,
               if (q == (Quantum *) NULL)
                 break;
               length=ImportQuantumPixels(canvas_image,(CacheView *) NULL,
-                quantum_info,AlphaQuantum,pixels,exception);
+                quantum_info,AlphaQuantum,stream,exception);
               if (SyncAuthenticPixels(canvas_image,exception) == MagickFalse)
                 break;
               if (((y-image->extract_info.y) >= 0) && 
@@ -613,8 +608,7 @@ static Image *ReadYCBCRImage(const ImageInfo *image_info,
                   if (SyncAuthenticPixels(image,exception) == MagickFalse)
                     break;
                 }
-              pixels=(const unsigned char *) ReadBlobStream(image,length,
-                GetQuantumPixels(quantum_info),&count);
+              stream=ReadBlobStream(image,length,pixels,&count);
             }
             if (image->previous == (Image *) NULL)
               {
@@ -643,8 +637,8 @@ static Image *ReadYCBCRImage(const ImageInfo *image_info,
         if (DiscardBlobBytes(image,(MagickSizeType) image->offset) == MagickFalse)
           {
             status=MagickFalse;
-            ThrowFileException(exception,CorruptImageError,"UnexpectedEndOfFile",
-              image->filename);
+            ThrowFileException(exception,CorruptImageError,
+              "UnexpectedEndOfFile",image->filename);
             break;
           }
         length=GetQuantumExtent(canvas_image,quantum_info,RedQuantum);
@@ -652,16 +646,14 @@ static Image *ReadYCBCRImage(const ImageInfo *image_info,
         {
           for (y=0; y < (ssize_t) image->extract_info.height; y++)
           {
-            pixels=(const unsigned char *) ReadBlobStream(image,length,
-              GetQuantumPixels(quantum_info),&count);
+            stream=ReadBlobStream(image,length,pixels,&count);
             if (count != (ssize_t) length)
               break;
           }
           if (count != (ssize_t) length)
             break;
         }
-        pixels=(const unsigned char *) ReadBlobStream(image,length,
-          GetQuantumPixels(quantum_info),&count);
+        stream=ReadBlobStream(image,length,pixels,&count);
         for (y=0; y < (ssize_t) image->extract_info.height; y++)
         {
           register const Quantum
@@ -685,7 +677,7 @@ static Image *ReadYCBCRImage(const ImageInfo *image_info,
           if (q == (Quantum *) NULL)
             break;
           length=ImportQuantumPixels(canvas_image,(CacheView *) NULL,
-            quantum_info,RedQuantum,pixels,exception);
+            quantum_info,RedQuantum,stream,exception);
           if (SyncAuthenticPixels(canvas_image,exception) == MagickFalse)
             break;
           if (((y-image->extract_info.y) >= 0) && 
@@ -707,8 +699,7 @@ static Image *ReadYCBCRImage(const ImageInfo *image_info,
               if (SyncAuthenticPixels(image,exception) == MagickFalse)
                 break;
             }
-          pixels=(const unsigned char *) ReadBlobStream(image,length,
-            GetQuantumPixels(quantum_info),&count);
+          stream=ReadBlobStream(image,length,pixels,&count);
         }
         if (image->previous == (Image *) NULL)
           {
@@ -726,16 +717,14 @@ static Image *ReadYCBCRImage(const ImageInfo *image_info,
         {
           for (y=0; y < (ssize_t) image->extract_info.height; y++)
           {
-            pixels=(const unsigned char *) ReadBlobStream(image,length,
-              GetQuantumPixels(quantum_info),&count);
+            stream=ReadBlobStream(image,length,pixels,&count);
             if (count != (ssize_t) length)
               break;
           }
           if (count != (ssize_t) length)
             break;
         }
-        pixels=(const unsigned char *) ReadBlobStream(image,length,
-          GetQuantumPixels(quantum_info),&count);
+        stream=ReadBlobStream(image,length,pixels,&count);
         for (y=0; y < (ssize_t) image->extract_info.height; y++)
         {
           register const Quantum
@@ -759,7 +748,7 @@ static Image *ReadYCBCRImage(const ImageInfo *image_info,
           if (q == (Quantum *) NULL)
             break;
           length=ImportQuantumPixels(canvas_image,(CacheView *) NULL,
-            quantum_info,GreenQuantum,pixels,exception);
+            quantum_info,GreenQuantum,stream,exception);
           if (SyncAuthenticPixels(canvas_image,exception) == MagickFalse)
             break;
           if (((y-image->extract_info.y) >= 0) && 
@@ -781,8 +770,7 @@ static Image *ReadYCBCRImage(const ImageInfo *image_info,
               if (SyncAuthenticPixels(image,exception) == MagickFalse)
                 break;
            }
-          pixels=(const unsigned char *) ReadBlobStream(image,length,
-            GetQuantumPixels(quantum_info),&count);
+          stream=ReadBlobStream(image,length,pixels,&count);
         }
         if (image->previous == (Image *) NULL)
           {
@@ -800,16 +788,14 @@ static Image *ReadYCBCRImage(const ImageInfo *image_info,
         {
           for (y=0; y < (ssize_t) image->extract_info.height; y++)
           {
-            pixels=(const unsigned char *) ReadBlobStream(image,length,
-              GetQuantumPixels(quantum_info),&count);
+            stream=ReadBlobStream(image,length,pixels,&count);
             if (count != (ssize_t) length)
               break;
           }
           if (count != (ssize_t) length)
             break;
         }
-        pixels=(const unsigned char *) ReadBlobStream(image,length,
-          GetQuantumPixels(quantum_info),&count);
+        stream=ReadBlobStream(image,length,pixels,&count);
         for (y=0; y < (ssize_t) image->extract_info.height; y++)
         {
           register const Quantum
@@ -833,7 +819,7 @@ static Image *ReadYCBCRImage(const ImageInfo *image_info,
           if (q == (Quantum *) NULL)
             break;
           length=ImportQuantumPixels(canvas_image,(CacheView *) NULL,
-            quantum_info,BlueQuantum,pixels,exception);
+            quantum_info,BlueQuantum,stream,exception);
           if (SyncAuthenticPixels(canvas_image,exception) == MagickFalse)
             break;
           if (((y-image->extract_info.y) >= 0) && 
@@ -855,8 +841,7 @@ static Image *ReadYCBCRImage(const ImageInfo *image_info,
               if (SyncAuthenticPixels(image,exception) == MagickFalse)
                 break;
            }
-          pixels=(const unsigned char *) ReadBlobStream(image,length,
-            GetQuantumPixels(quantum_info),&count);
+          stream=ReadBlobStream(image,length,pixels,&count);
         }
         if (image->previous == (Image *) NULL)
           {
@@ -876,16 +861,14 @@ static Image *ReadYCBCRImage(const ImageInfo *image_info,
             {
               for (y=0; y < (ssize_t) image->extract_info.height; y++)
               {
-                pixels=(const unsigned char *) ReadBlobStream(image,length,
-                  GetQuantumPixels(quantum_info),&count);
+                stream=ReadBlobStream(image,length,pixels,&count);
                 if (count != (ssize_t) length)
                   break;
               }
               if (count != (ssize_t) length)
                 break;
             }
-            pixels=(const unsigned char *) ReadBlobStream(image,length,
-              GetQuantumPixels(quantum_info),&count);
+            stream=ReadBlobStream(image,length,pixels,&count);
             for (y=0; y < (ssize_t) image->extract_info.height; y++)
             {
               register const Quantum
@@ -909,7 +892,7 @@ static Image *ReadYCBCRImage(const ImageInfo *image_info,
               if (q == (Quantum *) NULL)
                 break;
               length=ImportQuantumPixels(canvas_image,(CacheView *) NULL,
-                quantum_info,BlueQuantum,pixels,exception);
+                quantum_info,BlueQuantum,stream,exception);
               if (SyncAuthenticPixels(canvas_image,exception) == MagickFalse)
                 break;
               if (((y-image->extract_info.y) >= 0) && 
@@ -932,8 +915,7 @@ static Image *ReadYCBCRImage(const ImageInfo *image_info,
                   if (SyncAuthenticPixels(image,exception) == MagickFalse)
                     break;
                }
-              pixels=(const unsigned char *) ReadBlobStream(image,length,
-                GetQuantumPixels(quantum_info),&count);
+              stream=ReadBlobStream(image,length,pixels,&count);
             }
             if (image->previous == (Image *) NULL)
               {