(no commit message)
authorcristy <urban-warrior@git.imagemagick.org>
Sat, 24 Jan 2015 20:42:32 +0000 (20:42 +0000)
committercristy <urban-warrior@git.imagemagick.org>
Sat, 24 Jan 2015 20:42:32 +0000 (20:42 +0000)
16 files changed:
MagickCore/blob.c
MagickCore/blob.h
MagickCore/quantum.c
MagickCore/quantum.h
coders/art.c
coders/bgr.c
coders/cin.c
coders/cmyk.c
coders/dpx.c
coders/fpx.c
coders/gray.c
coders/pnm.c
coders/raw.c
coders/rgb.c
coders/vicar.c
coders/ycbcr.c

index dac06385dcd03c76803b1d63d3ddc8d0559934fd..f697e9ea9787c549676c3bae25e40ab260e19e54 100644 (file)
@@ -775,32 +775,6 @@ MagickPrivate void DisassociateBlob(Image *image)
 %    o length:  the number of bytes to skip.
 %
 */
-
-static inline const unsigned char *ReadBlobStream(Image *image,
-  const size_t length,unsigned char *data,ssize_t *count)
-{
-  assert(count != (ssize_t *) NULL);
-  assert(image->blob != (BlobInfo *) NULL);
-  if (image->blob->type != BlobStream)
-    {
-      *count=ReadBlob(image,length,data);
-      return(data);
-    }
-  if (image->blob->offset >= (MagickOffsetType) image->blob->length)
-    {
-      *count=0;
-      image->blob->eof=MagickTrue;
-      return(data);
-    }
-  data=image->blob->data+image->blob->offset;
-  *count=(ssize_t) MagickMin((MagickOffsetType) length,image->blob->length-
-    image->blob->offset);
-  image->blob->offset+=(*count);
-  if (*count != (ssize_t) length)
-    image->blob->eof=MagickTrue;
-  return(data);
-}
-
 MagickExport MagickBooleanType DiscardBlobBytes(Image *image,
   const MagickSizeType length)
 {
@@ -3505,6 +3479,70 @@ MagickExport unsigned short ReadBlobMSBShort(Image *image)
 %                                                                             %
 %                                                                             %
 %                                                                             %
++  R e a d B l o b S t r e a m                                                %
+%                                                                             %
+%                                                                             %
+%                                                                             %
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%
+%  ReadBlobStream() reads data from the blob or image file and returns it.  It
+%  returns a pointer to the data buffer you supply or to the image memory
+%  buffer if its supported (zero-copy). If length is zero, ReadBlobStream()
+%  returns a count of zero and has no other results. If length is greater than
+%  SSIZE_MAX, the result is unspecified.
+%
+%  The format of the ReadBlobStream method is:
+%
+%      const void *ReadBlobStream(Image *image,const size_t length,void *data,
+%        ssize_t *count)
+%
+%  A description of each parameter follows:
+%
+%    o image: the image.
+%
+%    o length:  Specifies an integer representing the number of bytes to read
+%      from the file.
+%
+%    o count: returns the number of bytes read.
+%
+%    o data:  Specifies an area to place the information requested from the
+%      file.
+%
+*/
+MagickExport const void *ReadBlobStream(Image *image,const size_t length,
+  void *data,ssize_t *count)
+{
+  assert(image != (Image *) NULL);
+  assert(image->signature == MagickSignature);
+  assert(image->blob != (BlobInfo *) NULL);
+  assert(image->blob->type != UndefinedStream);
+  assert(count != (ssize_t *) NULL);
+  if (image->blob->type != BlobStream)
+    {
+      assert(data != NULL);
+      *count=ReadBlob(image,length,data);
+      return(data);
+    }
+  if (image->blob->offset >= (MagickOffsetType) image->blob->length)
+    {
+      *count=0;
+      image->blob->eof=MagickTrue;
+      return(data);
+    }
+  data=image->blob->data+image->blob->offset;
+  *count=(ssize_t) MagickMin((MagickOffsetType) length,image->blob->length-
+    image->blob->offset);
+  image->blob->offset+=(*count);
+  if (*count != (ssize_t) length)
+    image->blob->eof=MagickTrue;
+  return(data);
+}
+\f
+/*
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%                                                                             %
+%                                                                             %
+%                                                                             %
 +   R e a d B l o b S t r i n g                                               %
 %                                                                             %
 %                                                                             %
@@ -4629,45 +4667,3 @@ MagickExport ssize_t WriteBlobString(Image *image,const char *string)
   assert(string != (const char *) NULL);
   return(WriteBlobStream(image,strlen(string),(const unsigned char *) string));
 }
-\f
-/*
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-%                                                                             %
-%                                                                             %
-%                                                                             %
-+  Z e r o C o p y R e a d B l o b                                            %
-%                                                                             %
-%                                                                             %
-%                                                                             %
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-%
-%  ZeroCopyReadBlob() reads data from the blob or image file and returns it.  It
-%  returns a pointer to the data buffer you supply or to the image memory
-%  buffer if its supported (zero-copy). If length is zero, ZeroCopyReadBlob()
-%  returns a count of zero and has no other results. If length is greater than
-%  SSIZE_MAX, the result is unspecified.
-%
-%  The format of the ZeroReadBlobCopy method is:
-%
-%      void *ZeroCopyReadBlob(Image *image,const size_t length,ssize_t *count,
-%        void *data)
-%
-%  A description of each parameter follows:
-%
-%    o image: the image.
-%
-%    o length:  Specifies an integer representing the number of bytes to read
-%      from the file.
-%
-%    o length: returns the number of bytes read.
-%
-%    o data:  Specifies an area to place the information requested from the
-%      file.
-%
-*/
-MagickExport void *ZeroCopyReadBlob(Image *image,const size_t length,void *data,
-  ssize_t *count)
-{
-  *count=ReadBlob(image,length,data);
-  return(data);
-}
index f2eb2ec8617ccf608dde4eed2bdfd34a7ee2a690..0968f9f1760179dc57cd8581c82d6acf69190c3f 100644 (file)
@@ -55,6 +55,9 @@ extern MagickExport BlobInfo
 extern MagickExport char
   *ReadBlobString(Image *,char *);
 
+extern MagickExport const void
+  *ReadBlobStream(Image *,const size_t,void *,ssize_t *);
+
 extern MagickExport double
   ReadBlobDouble(Image *);
 
@@ -127,8 +130,7 @@ extern MagickExport void
   *ImagesToBlob(const ImageInfo *,Image *,size_t *,ExceptionInfo *),
   *MapBlob(int,const MapMode,const MagickOffsetType,const size_t),
   MSBOrderLong(unsigned char *,const size_t),
-  MSBOrderShort(unsigned char *,const size_t),
-  *ZeroCopyReadBlob(Image *,const size_t,void *,ssize_t *);
+  MSBOrderShort(unsigned char *,const size_t);
 
 #if defined(__cplusplus) || defined(c_plusplus)
 }
index b7bee3907402892583aa7b7b88a51e77ffcc364b..9b8916db7522a62d2b77f6575d9e5bed3a1b9415 100644 (file)
@@ -470,15 +470,14 @@ MagickExport void GetQuantumInfo(const ImageInfo *image_info,
 %
 %  The format of the GetQuantumPixels method is:
 %
-%      unsigned char *QuantumPixels GetQuantumPixels(
-%        const QuantumInfo *quantum_info)
+%      void *QuantumPixels GetQuantumPixels(const QuantumInfo *quantum_info)
 %
 %  A description of each parameter follows:
 %
 %    o image: the image.
 %
 */
-MagickExport unsigned char *GetQuantumPixels(const QuantumInfo *quantum_info)
+MagickExport void *GetQuantumPixels(const QuantumInfo *quantum_info)
 {
   const int
     id = GetOpenMPThreadId();
index 85a8184913363181f9facf20bc621b11dd93f45d..ffefd603f1a80601f8aa1fe737aaafe368ca777b 100644 (file)
@@ -175,11 +175,9 @@ extern MagickExport size_t
   ImportQuantumPixels(const Image *,CacheView *,QuantumInfo *,const QuantumType,
     const unsigned char *,ExceptionInfo *);
 
-extern MagickExport unsigned char
-  *GetQuantumPixels(const QuantumInfo *);
-
 extern MagickExport void
   GetQuantumInfo(const ImageInfo *,QuantumInfo *),
+  *GetQuantumPixels(const QuantumInfo *),
   SetQuantumAlphaType(QuantumInfo *,const QuantumAlphaType),
   SetQuantumImageType(Image *,const QuantumType),
   SetQuantumMinIsWhite(QuantumInfo *,const MagickBooleanType),
index bc9d7c1b7e53318b86ff16252f95919e598f91f5..1936adb691ab0e807b7904d01c1462e0a765cec2 100644 (file)
@@ -97,6 +97,9 @@ static MagickBooleanType
 */
 static Image *ReadARTImage(const ImageInfo *image_info,ExceptionInfo *exception)
 {
+  const void
+    *pixels;
+
   Image
     *image;
 
@@ -113,9 +116,6 @@ static Image *ReadARTImage(const ImageInfo *image_info,ExceptionInfo *exception)
     count,
     y;
 
-  unsigned char
-    *pixels;
-
   /*
     Open image file.
   */
@@ -156,7 +156,6 @@ static Image *ReadARTImage(const ImageInfo *image_info,ExceptionInfo *exception)
   quantum_info=AcquireQuantumInfo(image_info,image);
   if (quantum_info == (QuantumInfo *) NULL)
     ThrowReaderException(ResourceLimitError,"MemoryAllocationFailed");
-  pixels=GetQuantumPixels(quantum_info);
   length=GetQuantumExtent(image,quantum_info,GrayQuantum);
   for (y=0; y < (ssize_t) image->rows; y++)
   {
@@ -166,12 +165,14 @@ static Image *ReadARTImage(const ImageInfo *image_info,ExceptionInfo *exception)
     q=QueueAuthenticPixels(image,0,y,image->columns,1,exception);
     if (q == (Quantum *) NULL)
       break;
-    count=ReadBlob(image,length,pixels);
+    pixels=ReadBlobStream(image,length,GetQuantumPixels(quantum_info),
+      &count);
     if (count != (ssize_t) length)
       ThrowReaderException(CorruptImageError,"UnableToReadImageData");
     (void) ImportQuantumPixels(image,(CacheView *) NULL,quantum_info,
       GrayQuantum,pixels,exception);
-    count=ReadBlob(image,(size_t) (-(ssize_t) length) & 0x01,pixels);
+    pixels=ReadBlobStream(image,(size_t) (-(ssize_t) length) & 0x01,
+      GetQuantumPixels(quantum_info),&count);
     if (SyncAuthenticPixels(image,exception) == MagickFalse)
       break;
     if (SetImageProgress(image,LoadImageTag,y,image->rows) == MagickFalse)
index 188ba166c9219581bcb0b74c372cdad761d24330..cec2a4c5adb16eefa8cb8313eed8196c15aca1ec 100644 (file)
@@ -100,6 +100,9 @@ static MagickBooleanType
 static Image *ReadBGRImage(const ImageInfo *image_info,
   ExceptionInfo *exception)
 {
+  const void
+    *pixels;
+
   Image
     *canvas_image,
     *image;
@@ -126,9 +129,6 @@ static Image *ReadBGRImage(const ImageInfo *image_info,
     count,
     y;
 
-  unsigned char
-    *pixels;
-
   /*
     Open image file.
   */
@@ -164,13 +164,13 @@ static Image *ReadBGRImage(const ImageInfo *image_info,
   quantum_info=AcquireQuantumInfo(image_info,canvas_image);
   if (quantum_info == (QuantumInfo *) NULL)
     ThrowReaderException(ResourceLimitError,"MemoryAllocationFailed");
-  pixels=GetQuantumPixels(quantum_info);
   quantum_type=BGRQuantum;
   if (LocaleCompare(image_info->magick,"BGRA") == 0)
     {
       quantum_type=BGRAQuantum;
       image->alpha_trait=BlendPixelTrait;
     }
+  pixels=NULL;
   if (image_info->number_scenes != 0)
     while (image->scene < image_info->scene)
     {
@@ -181,7 +181,8 @@ static Image *ReadBGRImage(const ImageInfo *image_info,
       length=GetQuantumExtent(canvas_image,quantum_info,quantum_type);
       for (y=0; y < (ssize_t) image->rows; y++)
       {
-        count=ReadBlob(image,length,pixels);
+        pixels=ReadBlobStream(image,length,GetQuantumPixels(quantum_info),
+          &count);
         if (count != (ssize_t) length)
           break;
       }
@@ -211,7 +212,8 @@ static Image *ReadBGRImage(const ImageInfo *image_info,
         if (scene == 0)
           {
             length=GetQuantumExtent(canvas_image,quantum_info,quantum_type);
-            count=ReadBlob(image,length,pixels);
+            pixels=ReadBlobStream(image,length,GetQuantumPixels(quantum_info),
+              &count);
           }
         for (y=0; y < (ssize_t) image->extract_info.height; y++)
         {
@@ -269,7 +271,8 @@ static Image *ReadBGRImage(const ImageInfo *image_info,
               if (status == MagickFalse)
                 break;
             }
-          count=ReadBlob(image,length,pixels);
+          pixels=ReadBlobStream(image,length,GetQuantumPixels(quantum_info),
+            &count);
         }
         break;
       }
@@ -290,7 +293,8 @@ static Image *ReadBGRImage(const ImageInfo *image_info,
         if (scene == 0)
           {
             length=GetQuantumExtent(canvas_image,quantum_info,RedQuantum);
-            count=ReadBlob(image,length,pixels);
+            pixels=ReadBlobStream(image,length,GetQuantumPixels(quantum_info),
+              &count);
           }
         for (y=0; y < (ssize_t) image->extract_info.height; y++)
         {
@@ -368,7 +372,8 @@ static Image *ReadBGRImage(const ImageInfo *image_info,
                 if (SyncAuthenticPixels(image,exception) == MagickFalse)
                   break;
               }
-            count=ReadBlob(image,length,pixels);
+            pixels=ReadBlobStream(image,length,GetQuantumPixels(quantum_info),
+              &count);
           }
           if (image->previous == (Image *) NULL)
             {
@@ -388,7 +393,8 @@ static Image *ReadBGRImage(const ImageInfo *image_info,
         if (scene == 0)
           {
             length=GetQuantumExtent(canvas_image,quantum_info,RedQuantum);
-            count=ReadBlob(image,length,pixels);
+            pixels=ReadBlobStream(image,length,GetQuantumPixels(quantum_info),
+              &count);
           }
         for (y=0; y < (ssize_t) image->extract_info.height; y++)
         {
@@ -434,7 +440,8 @@ static Image *ReadBGRImage(const ImageInfo *image_info,
               if (SyncAuthenticPixels(image,exception) == MagickFalse)
                 break;
             }
-          count=ReadBlob(image,length,pixels);
+          pixels=ReadBlobStream(image,length,GetQuantumPixels(quantum_info),
+            &count);
         }
         if (image->previous == (Image *) NULL)
           {
@@ -486,7 +493,8 @@ static Image *ReadBGRImage(const ImageInfo *image_info,
               if (SyncAuthenticPixels(image,exception) == MagickFalse)
                 break;
            }
-          count=ReadBlob(image,length,pixels);
+          pixels=ReadBlobStream(image,length,GetQuantumPixels(quantum_info),
+            &count);
         }
         if (image->previous == (Image *) NULL)
           {
@@ -538,7 +546,8 @@ static Image *ReadBGRImage(const ImageInfo *image_info,
               if (SyncAuthenticPixels(image,exception) == MagickFalse)
                 break;
             }
-          count=ReadBlob(image,length,pixels);
+          pixels=ReadBlobStream(image,length,GetQuantumPixels(quantum_info),
+            &count);
         }
         if (image->previous == (Image *) NULL)
           {
@@ -599,7 +608,8 @@ static Image *ReadBGRImage(const ImageInfo *image_info,
                   if (SyncAuthenticPixels(image,exception) == MagickFalse)
                     break;
                 }
-              count=ReadBlob(image,length,pixels);
+              pixels=ReadBlobStream(image,length,GetQuantumPixels(quantum_info),
+                &count);
             }
             if (image->previous == (Image *) NULL)
               {
@@ -635,13 +645,18 @@ static Image *ReadBGRImage(const ImageInfo *image_info,
         length=GetQuantumExtent(canvas_image,quantum_info,BlueQuantum);
         for (i=0; i < (ssize_t) scene; i++)
           for (y=0; y < (ssize_t) image->extract_info.height; y++)
-            if (ReadBlob(image,length,pixels) != (ssize_t) length)
+          {
+            pixels=ReadBlobStream(image,length,GetQuantumPixels(quantum_info),
+              &count);
+            if (count != (ssize_t) length)
               {
                 ThrowFileException(exception,CorruptImageError,
                   "UnexpectedEndOfFile",image->filename);
                 break;
               }
-        count=ReadBlob(image,length,pixels);
+          }
+        pixels=ReadBlobStream(image,length,GetQuantumPixels(quantum_info),
+          &count);
         for (y=0; y < (ssize_t) image->extract_info.height; y++)
         {
           register const Quantum
@@ -686,7 +701,8 @@ static Image *ReadBGRImage(const ImageInfo *image_info,
               if (SyncAuthenticPixels(image,exception) == MagickFalse)
                 break;
             }
-          count=ReadBlob(image,length,pixels);
+          pixels=ReadBlobStream(image,length,GetQuantumPixels(quantum_info),
+            &count);
         }
         if (image->previous == (Image *) NULL)
           {
@@ -706,13 +722,18 @@ static Image *ReadBGRImage(const ImageInfo *image_info,
         length=GetQuantumExtent(canvas_image,quantum_info,GreenQuantum);
         for (i=0; i < (ssize_t) scene; i++)
           for (y=0; y < (ssize_t) image->extract_info.height; y++)
-            if (ReadBlob(image,length,pixels) != (ssize_t) length)
+          {
+            pixels=ReadBlobStream(image,length,GetQuantumPixels(quantum_info),
+              &count);
+            if (count != (ssize_t) length)
               {
                 ThrowFileException(exception,CorruptImageError,
                   "UnexpectedEndOfFile",image->filename);
                 break;
               }
-        count=ReadBlob(image,length,pixels);
+          }
+        pixels=ReadBlobStream(image,length,GetQuantumPixels(quantum_info),
+          &count);
         for (y=0; y < (ssize_t) image->extract_info.height; y++)
         {
           register const Quantum
@@ -757,7 +778,8 @@ static Image *ReadBGRImage(const ImageInfo *image_info,
               if (SyncAuthenticPixels(image,exception) == MagickFalse)
                 break;
            }
-          count=ReadBlob(image,length,pixels);
+          pixels=ReadBlobStream(image,length,GetQuantumPixels(quantum_info),
+            &count);
         }
         if (image->previous == (Image *) NULL)
           {
@@ -777,13 +799,18 @@ static Image *ReadBGRImage(const ImageInfo *image_info,
         length=GetQuantumExtent(canvas_image,quantum_info,RedQuantum);
         for (i=0; i < (ssize_t) scene; i++)
           for (y=0; y < (ssize_t) image->extract_info.height; y++)
-            if (ReadBlob(image,length,pixels) != (ssize_t) length)
+          {
+            pixels=ReadBlobStream(image,length,GetQuantumPixels(quantum_info),
+              &count);
+            if (count != (ssize_t) length)
               {
                 ThrowFileException(exception,CorruptImageError,
                   "UnexpectedEndOfFile",image->filename);
                 break;
               }
-        count=ReadBlob(image,length,pixels);
+          }
+        pixels=ReadBlobStream(image,length,GetQuantumPixels(quantum_info),
+          &count);
         for (y=0; y < (ssize_t) image->extract_info.height; y++)
         {
           register const Quantum
@@ -828,7 +855,8 @@ static Image *ReadBGRImage(const ImageInfo *image_info,
               if (SyncAuthenticPixels(image,exception) == MagickFalse)
                 break;
            }
-          count=ReadBlob(image,length,pixels);
+          pixels=ReadBlobStream(image,length,GetQuantumPixels(quantum_info),
+            &count);
         }
         if (image->previous == (Image *) NULL)
           {
@@ -850,13 +878,18 @@ static Image *ReadBGRImage(const ImageInfo *image_info,
             length=GetQuantumExtent(canvas_image,quantum_info,AlphaQuantum);
             for (i=0; i < (ssize_t) scene; i++)
               for (y=0; y < (ssize_t) image->extract_info.height; y++)
-                if (ReadBlob(image,length,pixels) != (ssize_t) length)
+              {
+                pixels=ReadBlobStream(image,length,
+                  GetQuantumPixels(quantum_info),&count);
+                if (count != (ssize_t) length)
                   {
                     ThrowFileException(exception,CorruptImageError,
                       "UnexpectedEndOfFile",image->filename);
                     break;
                   }
-            count=ReadBlob(image,length,pixels);
+              }
+            pixels=ReadBlobStream(image,length,GetQuantumPixels(quantum_info),
+              &count);
             for (y=0; y < (ssize_t) image->extract_info.height; y++)
             {
               register const Quantum
@@ -901,7 +934,8 @@ static Image *ReadBGRImage(const ImageInfo *image_info,
                   if (SyncAuthenticPixels(image,exception) == MagickFalse)
                     break;
                }
-              count=ReadBlob(image,length,pixels);
+              pixels=ReadBlobStream(image,length,GetQuantumPixels(quantum_info),
+                &count);
             }
             if (image->previous == (Image *) NULL)
               {
index e64afacf431fc0ecf4dfe060a8e7b00c59f7ca41..a09529e87bb54091ede00ed395876bd1365d1225 100644 (file)
@@ -387,6 +387,9 @@ static Image *ReadCINImage(const ImageInfo *image_info,ExceptionInfo *exception)
   CINInfo
     cin;
 
+  const void
+    *pixels;
+
   Image
     *image;
 
@@ -416,8 +419,7 @@ static Image *ReadCINImage(const ImageInfo *image_info,ExceptionInfo *exception)
     y;
 
   unsigned char
-    magick[4],
-    *pixels;
+    magick[4];
 
   /*
     Open image file.
@@ -743,7 +745,6 @@ static Image *ReadCINImage(const ImageInfo *image_info,ExceptionInfo *exception)
   quantum_info->quantum=32;
   quantum_info->pack=MagickFalse;
   quantum_type=RGBQuantum;
-  pixels=GetQuantumPixels(quantum_info);
   length=GetQuantumExtent(image,quantum_info,quantum_type);
   length=GetBytesPerRow(image->columns,3,image->depth,MagickTrue);
   if (cin.image.number_channels == 1)
@@ -756,7 +757,8 @@ static Image *ReadCINImage(const ImageInfo *image_info,ExceptionInfo *exception)
     q=QueueAuthenticPixels(image,0,y,image->columns,1,exception);
     if (q == (Quantum *) NULL)
       break;
-    count=ReadBlob(image,length,pixels);
+    pixels=ReadBlobStream(image,length,GetQuantumPixels(quantum_info),
+      &count);
     if ((size_t) count != length)
       break;
     (void) ImportQuantumPixels(image,(CacheView *) NULL,quantum_info,
index fd33679e06111084ebff330d94a7b6cfcb00e867..5e6f8b8e305e4aadff6b79b8d4d2d79215a54754 100644 (file)
@@ -99,6 +99,9 @@ static MagickBooleanType
 static Image *ReadCMYKImage(const ImageInfo *image_info,
   ExceptionInfo *exception)
 {
+  const void
+    *pixels;
+
   Image
     *canvas_image,
     *image;
@@ -125,9 +128,6 @@ static Image *ReadCMYKImage(const ImageInfo *image_info,
     count,
     y;
 
-  unsigned char
-    *pixels;
-
   /*
     Open image file.
   */
@@ -164,7 +164,6 @@ static Image *ReadCMYKImage(const ImageInfo *image_info,
   quantum_info=AcquireQuantumInfo(image_info,canvas_image);
   if (quantum_info == (QuantumInfo *) NULL)
     ThrowReaderException(ResourceLimitError,"MemoryAllocationFailed");
-  pixels=GetQuantumPixels(quantum_info);
   quantum_type=CMYKQuantum;
   if (LocaleCompare(image_info->magick,"CMYKA") == 0)
     {
@@ -181,7 +180,8 @@ static Image *ReadCMYKImage(const ImageInfo *image_info,
       length=GetQuantumExtent(canvas_image,quantum_info,quantum_type);
       for (y=0; y < (ssize_t) image->rows; y++)
       {
-        count=ReadBlob(image,length,pixels);
+        pixels=ReadBlobStream(image,length,GetQuantumPixels(quantum_info),
+          &count);
         if (count != (ssize_t) length)
           break;
       }
@@ -212,7 +212,8 @@ static Image *ReadCMYKImage(const ImageInfo *image_info,
         if (scene == 0)
           {
             length=GetQuantumExtent(canvas_image,quantum_info,quantum_type);
-            count=ReadBlob(image,length,pixels);
+            pixels=ReadBlobStream(image,length,GetQuantumPixels(quantum_info),
+              &count);
           }
         for (y=0; y < (ssize_t) image->extract_info.height; y++)
         {
@@ -271,7 +272,8 @@ static Image *ReadCMYKImage(const ImageInfo *image_info,
               if (status == MagickFalse)
                 break;
             }
-          count=ReadBlob(image,length,pixels);
+          pixels=ReadBlobStream(image,length,GetQuantumPixels(quantum_info),
+            &count);
         }
         break;
       }
@@ -293,7 +295,8 @@ static Image *ReadCMYKImage(const ImageInfo *image_info,
         if (scene == 0)
           {
             length=GetQuantumExtent(canvas_image,quantum_info,CyanQuantum);
-            count=ReadBlob(image,length,pixels);
+            pixels=ReadBlobStream(image,length,GetQuantumPixels(quantum_info),
+              &count);
           }
         for (y=0; y < (ssize_t) image->extract_info.height; y++)
         {
@@ -371,7 +374,8 @@ static Image *ReadCMYKImage(const ImageInfo *image_info,
                 if (SyncAuthenticPixels(image,exception) == MagickFalse)
                   break;
               }
-            count=ReadBlob(image,length,pixels);
+            pixels=ReadBlobStream(image,length,GetQuantumPixels(quantum_info),
+              &count);
           }
           if (image->previous == (Image *) NULL)
             {
@@ -391,7 +395,8 @@ static Image *ReadCMYKImage(const ImageInfo *image_info,
         if (scene == 0)
           {
             length=GetQuantumExtent(canvas_image,quantum_info,CyanQuantum);
-            count=ReadBlob(image,length,pixels);
+            pixels=ReadBlobStream(image,length,GetQuantumPixels(quantum_info),
+              &count);
           }
         for (y=0; y < (ssize_t) image->extract_info.height; y++)
         {
@@ -437,7 +442,8 @@ static Image *ReadCMYKImage(const ImageInfo *image_info,
               if (SyncAuthenticPixels(image,exception) == MagickFalse)
                 break;
             }
-          count=ReadBlob(image,length,pixels);
+          pixels=ReadBlobStream(image,length,GetQuantumPixels(quantum_info),
+            &count);
         }
         if (image->previous == (Image *) NULL)
           {
@@ -489,7 +495,8 @@ static Image *ReadCMYKImage(const ImageInfo *image_info,
               if (SyncAuthenticPixels(image,exception) == MagickFalse)
                 break;
            }
-          count=ReadBlob(image,length,pixels);
+          pixels=ReadBlobStream(image,length,GetQuantumPixels(quantum_info),
+            &count);
         }
         if (image->previous == (Image *) NULL)
           {
@@ -541,7 +548,8 @@ static Image *ReadCMYKImage(const ImageInfo *image_info,
               if (SyncAuthenticPixels(image,exception) == MagickFalse)
                 break;
             }
-          count=ReadBlob(image,length,pixels);
+          pixels=ReadBlobStream(image,length,GetQuantumPixels(quantum_info),
+            &count);
         }
         if (image->previous == (Image *) NULL)
           {
@@ -593,7 +601,8 @@ static Image *ReadCMYKImage(const ImageInfo *image_info,
               if (SyncAuthenticPixels(image,exception) == MagickFalse)
                 break;
             }
-          count=ReadBlob(image,length,pixels);
+          pixels=ReadBlobStream(image,length,GetQuantumPixels(quantum_info),
+            &count);
         }
         if (image->previous == (Image *) NULL)
           {
@@ -648,7 +657,8 @@ static Image *ReadCMYKImage(const ImageInfo *image_info,
                   if (SyncAuthenticPixels(image,exception) == MagickFalse)
                     break;
                 }
-              count=ReadBlob(image,length,pixels);
+              pixels=ReadBlobStream(image,length,GetQuantumPixels(quantum_info),
+                &count);
             }
             if (image->previous == (Image *) NULL)
               {
@@ -684,13 +694,18 @@ static Image *ReadCMYKImage(const ImageInfo *image_info,
         length=GetQuantumExtent(canvas_image,quantum_info,CyanQuantum);
         for (i=0; i < (ssize_t) scene; i++)
           for (y=0; y < (ssize_t) image->extract_info.height; y++)
-            if (ReadBlob(image,length,pixels) != (ssize_t) length)
+          {
+            pixels=ReadBlobStream(image,length,GetQuantumPixels(quantum_info),
+              &count);
+            if (count != (ssize_t) length)
               {
                 ThrowFileException(exception,CorruptImageError,
                   "UnexpectedEndOfFile",image->filename);
                 break;
               }
-        count=ReadBlob(image,length,pixels);
+          }
+        pixels=ReadBlobStream(image,length,GetQuantumPixels(quantum_info),
+          &count);
         for (y=0; y < (ssize_t) image->extract_info.height; y++)
         {
           register const Quantum
@@ -735,7 +750,8 @@ static Image *ReadCMYKImage(const ImageInfo *image_info,
               if (SyncAuthenticPixels(image,exception) == MagickFalse)
                 break;
             }
-          count=ReadBlob(image,length,pixels);
+          pixels=ReadBlobStream(image,length,GetQuantumPixels(quantum_info),
+            &count);
         }
         if (image->previous == (Image *) NULL)
           {
@@ -755,13 +771,18 @@ static Image *ReadCMYKImage(const ImageInfo *image_info,
         length=GetQuantumExtent(canvas_image,quantum_info,MagentaQuantum);
         for (i=0; i < (ssize_t) scene; i++)
           for (y=0; y < (ssize_t) image->extract_info.height; y++)
-            if (ReadBlob(image,length,pixels) != (ssize_t) length)
+          {
+            pixels=ReadBlobStream(image,length,GetQuantumPixels(quantum_info),
+              &count);
+            if (count != (ssize_t) length)
               {
                 ThrowFileException(exception,CorruptImageError,
                   "UnexpectedEndOfFile",image->filename);
                 break;
               }
-        count=ReadBlob(image,length,pixels);
+          }
+        pixels=ReadBlobStream(image,length,GetQuantumPixels(quantum_info),
+          &count);
         for (y=0; y < (ssize_t) image->extract_info.height; y++)
         {
           register const Quantum
@@ -794,8 +815,7 @@ static Image *ReadCMYKImage(const ImageInfo *image_info,
                 canvas_image->columns,1,exception);
               q=GetAuthenticPixels(image,0,y-image->extract_info.y,
                 image->columns,1,exception);
-              if ((p == (const Quantum *) NULL) ||
-                  (q == (Quantum *) NULL))
+              if ((p == (const Quantum *) NULL) || (q == (Quantum *) NULL))
                 break;
               for (x=0; x < (ssize_t) image->columns; x++)
               {
@@ -806,7 +826,8 @@ static Image *ReadCMYKImage(const ImageInfo *image_info,
               if (SyncAuthenticPixels(image,exception) == MagickFalse)
                 break;
            }
-          count=ReadBlob(image,length,pixels);
+          pixels=ReadBlobStream(image,length,GetQuantumPixels(quantum_info),
+            &count);
         }
         if (image->previous == (Image *) NULL)
           {
@@ -826,13 +847,18 @@ static Image *ReadCMYKImage(const ImageInfo *image_info,
         length=GetQuantumExtent(canvas_image,quantum_info,YellowQuantum);
         for (i=0; i < (ssize_t) scene; i++)
           for (y=0; y < (ssize_t) image->extract_info.height; y++)
-            if (ReadBlob(image,length,pixels) != (ssize_t) length)
+          {
+            pixels=ReadBlobStream(image,length,GetQuantumPixels(quantum_info),
+              &count);
+            if (count != (ssize_t) length)
               {
                 ThrowFileException(exception,CorruptImageError,
                   "UnexpectedEndOfFile",image->filename);
                 break;
               }
-        count=ReadBlob(image,length,pixels);
+          }
+        pixels=ReadBlobStream(image,length,GetQuantumPixels(quantum_info),
+          &count);
         for (y=0; y < (ssize_t) image->extract_info.height; y++)
         {
           register const Quantum
@@ -877,7 +903,8 @@ static Image *ReadCMYKImage(const ImageInfo *image_info,
               if (SyncAuthenticPixels(image,exception) == MagickFalse)
                 break;
            }
-          count=ReadBlob(image,length,pixels);
+          pixels=ReadBlobStream(image,length,GetQuantumPixels(quantum_info),
+            &count);
         }
         if (image->previous == (Image *) NULL)
           {
@@ -897,13 +924,18 @@ static Image *ReadCMYKImage(const ImageInfo *image_info,
         length=GetQuantumExtent(canvas_image,quantum_info,BlackQuantum);
         for (i=0; i < (ssize_t) scene; i++)
           for (y=0; y < (ssize_t) image->extract_info.height; y++)
-            if (ReadBlob(image,length,pixels) != (ssize_t) length)
+          {
+            pixels=ReadBlobStream(image,length,GetQuantumPixels(quantum_info),
+              &count);
+            if (count != (ssize_t) length)
               {
                 ThrowFileException(exception,CorruptImageError,
                   "UnexpectedEndOfFile",image->filename);
                 break;
               }
-        count=ReadBlob(image,length,pixels);
+          }
+        pixels=ReadBlobStream(image,length,GetQuantumPixels(quantum_info),
+          &count);
         for (y=0; y < (ssize_t) image->extract_info.height; y++)
         {
           register const Quantum
@@ -948,7 +980,8 @@ static Image *ReadCMYKImage(const ImageInfo *image_info,
               if (SyncAuthenticPixels(image,exception) == MagickFalse)
                 break;
            }
-          count=ReadBlob(image,length,pixels);
+          pixels=ReadBlobStream(image,length,GetQuantumPixels(quantum_info),
+            &count);
         }
         if (image->previous == (Image *) NULL)
           {
@@ -970,13 +1003,18 @@ static Image *ReadCMYKImage(const ImageInfo *image_info,
             length=GetQuantumExtent(canvas_image,quantum_info,AlphaQuantum);
             for (i=0; i < (ssize_t) scene; i++)
               for (y=0; y < (ssize_t) image->extract_info.height; y++)
-                if (ReadBlob(image,length,pixels) != (ssize_t) length)
+              {
+                pixels=ReadBlobStream(image,length,
+                  GetQuantumPixels(quantum_info),&count);
+                if (count != (ssize_t) length)
                   {
                     ThrowFileException(exception,CorruptImageError,
                       "UnexpectedEndOfFile",image->filename);
                     break;
                   }
-            count=ReadBlob(image,length,pixels);
+              }
+            pixels=ReadBlobStream(image,length,GetQuantumPixels(quantum_info),
+              &count);
             for (y=0; y < (ssize_t) image->extract_info.height; y++)
             {
               register const Quantum
@@ -1021,7 +1059,8 @@ static Image *ReadCMYKImage(const ImageInfo *image_info,
                   if (SyncAuthenticPixels(image,exception) == MagickFalse)
                     break;
                }
-              count=ReadBlob(image,length,pixels);
+              pixels=ReadBlobStream(image,length,GetQuantumPixels(quantum_info),
+                &count);
             }
             if (image->previous == (Image *) NULL)
               {
index afa2d60ecdd0c53235e089acd302d32c7671ccbf..281bf913e43b77aa7f1783921692a7831db87dfb 100644 (file)
@@ -1217,6 +1217,9 @@ static Image *ReadDPXImage(const ImageInfo *image_info,ExceptionInfo *exception)
       MagickTrue : MagickFalse);
     for (y=0; y < (ssize_t) image->rows; y++)
     {
+      const void
+        *pixels;
+
       MagickBooleanType
         sync;
 
@@ -1230,29 +1233,24 @@ static Image *ReadDPXImage(const ImageInfo *image_info,ExceptionInfo *exception)
         count,
         offset;
 
-      unsigned char
-        *pixels;
-
       if (status == MagickFalse)
         continue;
-      pixels=GetQuantumPixels(quantum_info);
-      {
-        count=ReadBlob(image,extent,pixels);
-        if ((image->progress_monitor != (MagickProgressMonitor) NULL) &&
-            (image->previous == (Image *) NULL))
-          {
-            MagickBooleanType
-              proceed;
-
-            proceed=SetImageProgress(image,LoadImageTag,(MagickOffsetType) row,
-              image->rows);
-            if (proceed == MagickFalse)
-              status=MagickFalse;
-          }
-        offset=row++;
-      }
+      pixels=ReadBlobStream(image,length,GetQuantumPixels(quantum_info),
+        &count);
       if (count != (ssize_t) extent)
         status=MagickFalse;
+      if ((image->progress_monitor != (MagickProgressMonitor) NULL) &&
+          (image->previous == (Image *) NULL))
+        {
+          MagickBooleanType
+            proceed;
+
+          proceed=SetImageProgress(image,LoadImageTag,(MagickOffsetType) row,
+            image->rows);
+          if (proceed == MagickFalse)
+            status=MagickFalse;
+        }
+      offset=row++;
       q=QueueAuthenticPixels(image,0,offset,image->columns,1,exception);
       if (q == (Quantum *) NULL)
         {
index 7b153183c9e09c8194ba55b313b00da9a0a53cc4..5ea43c38786754a43905c4a210e308ecb9716625 100644 (file)
@@ -946,13 +946,13 @@ static MagickBooleanType WriteFPXImage(const ImageInfo *image_info,Image *image,
       image->columns*fpx_info.components[i].columnStride;
     fpx_info.components[i].theData=pixels+i;
   }
-  fpx_info.components[0].myColorType.myColor=fpx_info.numberOfComponents != 1
-    NIFRGB_R : MONOCHROME;
+  fpx_info.components[0].myColorType.myColor=fpx_info.numberOfComponents != 1 ?
+    NIFRGB_R : MONOCHROME;
   fpx_info.components[1].myColorType.myColor=NIFRGB_G;
   fpx_info.components[2].myColorType.myColor=NIFRGB_B;
   fpx_info.components[3].myColorType.myColor=ALPHA;
   /*
-    Write image pixelss.
+    Write image pixels.
   */
   quantum_type=RGBQuantum;
   if (image->alpha_trait != UndefinedPixelTrait)
index 703cf6d10b985bedac5cb6f82b6d03d71f9e3c85..7de0c016e91e69230d3d897b4834a3de727a8036 100644 (file)
@@ -100,6 +100,9 @@ static MagickBooleanType
 static Image *ReadGRAYImage(const ImageInfo *image_info,
   ExceptionInfo *exception)
 {
+  const void
+    *pixels;
+
   Image
     *canvas_image,
     *image;
@@ -123,9 +126,6 @@ static Image *ReadGRAYImage(const ImageInfo *image_info,
     count,
     y;
 
-  unsigned char
-    *pixels;
-
   /*
     Open image file.
   */
@@ -160,7 +160,6 @@ static Image *ReadGRAYImage(const ImageInfo *image_info,
   quantum_info=AcquireQuantumInfo(image_info,canvas_image);
   if (quantum_info == (QuantumInfo *) NULL)
     ThrowReaderException(ResourceLimitError,"MemoryAllocationFailed");
-  pixels=GetQuantumPixels(quantum_info);
   if (image_info->number_scenes != 0)
     while (image->scene < image_info->scene)
     {
@@ -171,7 +170,8 @@ static Image *ReadGRAYImage(const ImageInfo *image_info,
       length=GetQuantumExtent(canvas_image,quantum_info,quantum_type);
       for (y=0; y < (ssize_t) image->rows; y++)
       {
-        count=ReadBlob(image,length,pixels);
+        pixels=ReadBlobStream(image,length,GetQuantumPixels(quantum_info),
+          &count);
         if (count != (ssize_t) length)
           break;
       }
@@ -194,7 +194,8 @@ static Image *ReadGRAYImage(const ImageInfo *image_info,
     if (scene == 0)
       {
         length=GetQuantumExtent(canvas_image,quantum_info,quantum_type);
-        count=ReadBlob(image,length,pixels);
+        pixels=ReadBlobStream(image,length,GetQuantumPixels(quantum_info),
+          &count);
       }
     for (y=0; y < (ssize_t) image->extract_info.height; y++)
     {
@@ -246,7 +247,8 @@ static Image *ReadGRAYImage(const ImageInfo *image_info,
           if (status == MagickFalse)
             break;
         }
-      count=ReadBlob(image,length,pixels);
+      pixels=ReadBlobStream(image,length,GetQuantumPixels(quantum_info),
+        &count);
     }
     SetQuantumImageType(image,quantum_type);
     /*
index 0ed69f143ccf3b019fbb0dceaf45892def1a82d3..4a32249adc3d09f7a571fdd8ea8fd71f9642ad96 100644 (file)
@@ -564,6 +564,9 @@ static Image *ReadPNMImage(const ImageInfo *image_info,ExceptionInfo *exception)
         extent=GetQuantumExtent(image,quantum_info,quantum_type);
         for (y=0; y < (ssize_t) image->rows; y++)
         {
+          const void
+            *pixels;
+
           MagickBooleanType
             sync;
 
@@ -577,29 +580,24 @@ static Image *ReadPNMImage(const ImageInfo *image_info,ExceptionInfo *exception)
           size_t
             length;
 
-          unsigned char
-            *pixels;
-
           if (status == MagickFalse)
             continue;
-          pixels=GetQuantumPixels(quantum_info);
-          {
-            count=ReadBlob(image,extent,pixels);
-            if ((image->progress_monitor != (MagickProgressMonitor) NULL) &&
-                (image->previous == (Image *) NULL))
-              {
-                MagickBooleanType
-                  proceed;
-
-                proceed=SetImageProgress(image,LoadImageTag,(MagickOffsetType)
-                  row,image->rows);
-                if (proceed == MagickFalse)
-                  status=MagickFalse;
-              }
-            offset=row++;
-          }
+          pixels=ReadBlobStream(image,extent,GetQuantumPixels(quantum_info),
+            &count);
           if (count != (ssize_t) extent)
             status=MagickFalse;
+          if ((image->progress_monitor != (MagickProgressMonitor) NULL) &&
+              (image->previous == (Image *) NULL))
+            {
+              MagickBooleanType
+                proceed;
+
+              proceed=SetImageProgress(image,LoadImageTag,(MagickOffsetType)
+                row,image->rows);
+              if (proceed == MagickFalse)
+                status=MagickFalse;
+            }
+          offset=row++;
           q=QueueAuthenticPixels(image,0,offset,image->columns,1,exception);
           if (q == (Quantum *) NULL)
             {
@@ -639,6 +637,9 @@ static Image *ReadPNMImage(const ImageInfo *image_info,ExceptionInfo *exception)
           ThrowReaderException(ResourceLimitError,"MemoryAllocationFailed");
         for (y=0; y < (ssize_t) image->rows; y++)
         {
+          const void
+            *pixels;
+
           MagickBooleanType
             sync;
 
@@ -655,29 +656,24 @@ static Image *ReadPNMImage(const ImageInfo *image_info,ExceptionInfo *exception)
             count,
             offset;
 
-          unsigned char
-            *pixels;
-
           if (status == MagickFalse)
             continue;
-          pixels=GetQuantumPixels(quantum_info);
-          {
-            count=ReadBlob(image,extent,pixels);
-            if ((image->progress_monitor != (MagickProgressMonitor) NULL) &&
-                (image->previous == (Image *) NULL))
-              {
-                MagickBooleanType
-                  proceed;
-
-                proceed=SetImageProgress(image,LoadImageTag,(MagickOffsetType)
-                  row,image->rows);
-                if (proceed == MagickFalse)
-                  status=MagickFalse;
-              }
-            offset=row++;
-          }
+          pixels=ReadBlobStream(image,extent,GetQuantumPixels(quantum_info),
+            &count);
           if (count != (ssize_t) extent)
             status=MagickFalse;
+          if ((image->progress_monitor != (MagickProgressMonitor) NULL) &&
+              (image->previous == (Image *) NULL))
+            {
+              MagickBooleanType
+                proceed;
+
+              proceed=SetImageProgress(image,LoadImageTag,(MagickOffsetType)
+                row,image->rows);
+              if (proceed == MagickFalse)
+                status=MagickFalse;
+            }
+          offset=row++;
           q=QueueAuthenticPixels(image,0,offset,image->columns,1,exception);
           if (q == (Quantum *) NULL)
             {
@@ -758,6 +754,9 @@ static Image *ReadPNMImage(const ImageInfo *image_info,ExceptionInfo *exception)
         (void) SetQuantumEndian(image,quantum_info,MSBEndian);
         for (y=0; y < (ssize_t) image->rows; y++)
         {
+          const void
+            *pixels;
+
           MagickBooleanType
             sync;
 
@@ -774,29 +773,24 @@ static Image *ReadPNMImage(const ImageInfo *image_info,ExceptionInfo *exception)
             count,
             offset;
 
-          unsigned char
-            *pixels;
-
           if (status == MagickFalse)
             continue;
-          pixels=GetQuantumPixels(quantum_info);
-          {
-            count=ReadBlob(image,extent,pixels);
-            if ((image->progress_monitor != (MagickProgressMonitor) NULL) &&
-                (image->previous == (Image *) NULL))
-              {
-                MagickBooleanType
-                  proceed;
-
-                proceed=SetImageProgress(image,LoadImageTag,(MagickOffsetType)
-                  row,image->rows);
-                if (proceed == MagickFalse)
-                  status=MagickFalse;
-              }
-            offset=row++;
-          }
+          pixels=ReadBlobStream(image,extent,GetQuantumPixels(quantum_info),
+            &count);
           if (count != (ssize_t) extent)
             status=MagickFalse;
+          if ((image->progress_monitor != (MagickProgressMonitor) NULL) &&
+              (image->previous == (Image *) NULL))
+            {
+              MagickBooleanType
+                proceed;
+
+              proceed=SetImageProgress(image,LoadImageTag,(MagickOffsetType)
+                row,image->rows);
+              if (proceed == MagickFalse)
+                status=MagickFalse;
+            }
+          offset=row++;
           q=QueueAuthenticPixels(image,0,offset,image->columns,1,exception);
           if (q == (Quantum *) NULL)
             {
@@ -960,6 +954,9 @@ static Image *ReadPNMImage(const ImageInfo *image_info,ExceptionInfo *exception)
           ThrowReaderException(ResourceLimitError,"MemoryAllocationFailed");
         for (y=0; y < (ssize_t) image->rows; y++)
         {
+          const void
+            *pixels;
+
           MagickBooleanType
             sync;
 
@@ -976,29 +973,24 @@ static Image *ReadPNMImage(const ImageInfo *image_info,ExceptionInfo *exception)
             count,
             offset;
 
-          unsigned char
-            *pixels;
-
           if (status == MagickFalse)
             continue;
-          pixels=GetQuantumPixels(quantum_info);
-          {
-            count=ReadBlob(image,extent,pixels);
-            if ((image->progress_monitor != (MagickProgressMonitor) NULL) &&
-                (image->previous == (Image *) NULL))
-              {
-                MagickBooleanType
-                  proceed;
-
-                proceed=SetImageProgress(image,LoadImageTag,(MagickOffsetType)
-                  row,image->rows);
-                if (proceed == MagickFalse)
-                  status=MagickFalse;
-              }
-            offset=row++;
-          }
+          pixels=ReadBlobStream(image,extent,GetQuantumPixels(quantum_info),
+            &count);
           if (count != (ssize_t) extent)
             status=MagickFalse;
+          if ((image->progress_monitor != (MagickProgressMonitor) NULL) &&
+              (image->previous == (Image *) NULL))
+            {
+              MagickBooleanType
+                proceed;
+
+              proceed=SetImageProgress(image,LoadImageTag,(MagickOffsetType)
+                row,image->rows);
+              if (proceed == MagickFalse)
+                status=MagickFalse;
+            }
+          offset=row++;
           q=QueueAuthenticPixels(image,0,offset,image->columns,1,exception);
           if (q == (Quantum *) NULL)
             {
@@ -1034,7 +1026,8 @@ static Image *ReadPNMImage(const ImageInfo *image_info,ExceptionInfo *exception)
                       for (x=0; x < (ssize_t) image->columns; x++)
                       {
                         p=PushCharPixel(p,&pixel);
-                        SetPixelGray(image,ScaleAnyToQuantum(pixel,max_value),q);
+                        SetPixelGray(image,ScaleAnyToQuantum(pixel,max_value),
+                          q);
                         SetPixelAlpha(image,OpaqueAlpha,q);
                         if (image->alpha_trait != UndefinedPixelTrait)
                           {
@@ -1079,7 +1072,8 @@ static Image *ReadPNMImage(const ImageInfo *image_info,ExceptionInfo *exception)
                     if (image->alpha_trait != UndefinedPixelTrait)
                       {
                         p=PushLongPixel(MSBEndian,p,&pixel);
-                        SetPixelAlpha(image,ScaleAnyToQuantum(pixel,max_value),q);
+                        SetPixelAlpha(image,ScaleAnyToQuantum(pixel,max_value),
+                          q);
                       }
                     q+=GetPixelChannels(image);
                   }
@@ -1101,11 +1095,14 @@ static Image *ReadPNMImage(const ImageInfo *image_info,ExceptionInfo *exception)
                         p=PushCharPixel(p,&pixel);
                         SetPixelRed(image,ScaleAnyToQuantum(pixel,max_value),q);
                         p=PushCharPixel(p,&pixel);
-                        SetPixelGreen(image,ScaleAnyToQuantum(pixel,max_value),q);
+                        SetPixelGreen(image,ScaleAnyToQuantum(pixel,max_value),
+                          q);
                         p=PushCharPixel(p,&pixel);
-                        SetPixelBlue(image,ScaleAnyToQuantum(pixel,max_value),q);
+                        SetPixelBlue(image,ScaleAnyToQuantum(pixel,max_value),
+                          q);
                         p=PushCharPixel(p,&pixel);
-                        SetPixelBlack(image,ScaleAnyToQuantum(pixel,max_value),q);
+                        SetPixelBlack(image,ScaleAnyToQuantum(pixel,max_value),
+                          q);
                         SetPixelAlpha(image,OpaqueAlpha,q);
                         if (image->alpha_trait != UndefinedPixelTrait)
                           {
@@ -1127,11 +1124,14 @@ static Image *ReadPNMImage(const ImageInfo *image_info,ExceptionInfo *exception)
                         p=PushShortPixel(MSBEndian,p,&pixel);
                         SetPixelRed(image,ScaleAnyToQuantum(pixel,max_value),q);
                         p=PushShortPixel(MSBEndian,p,&pixel);
-                        SetPixelGreen(image,ScaleAnyToQuantum(pixel,max_value),q);
+                        SetPixelGreen(image,ScaleAnyToQuantum(pixel,max_value),
+                          q);
                         p=PushShortPixel(MSBEndian,p,&pixel);
-                        SetPixelBlue(image,ScaleAnyToQuantum(pixel,max_value),q);
+                        SetPixelBlue(image,ScaleAnyToQuantum(pixel,max_value),
+                          q);
                         p=PushShortPixel(MSBEndian,p,&pixel);
-                        SetPixelBlack(image,ScaleAnyToQuantum(pixel,max_value),q);
+                        SetPixelBlack(image,ScaleAnyToQuantum(pixel,max_value),
+                          q);
                         SetPixelAlpha(image,OpaqueAlpha,q);
                         if (image->alpha_trait != UndefinedPixelTrait)
                           {
@@ -1156,7 +1156,8 @@ static Image *ReadPNMImage(const ImageInfo *image_info,ExceptionInfo *exception)
                     if (image->alpha_trait != UndefinedPixelTrait)
                       {
                         p=PushLongPixel(MSBEndian,p,&pixel);
-                        SetPixelAlpha(image,ScaleAnyToQuantum(pixel,max_value),q);
+                        SetPixelAlpha(image,ScaleAnyToQuantum(pixel,max_value),
+                          q);
                       }
                     q+=GetPixelChannels(image);
                   }
@@ -1177,14 +1178,17 @@ static Image *ReadPNMImage(const ImageInfo *image_info,ExceptionInfo *exception)
                         p=PushCharPixel(p,&pixel);
                         SetPixelRed(image,ScaleAnyToQuantum(pixel,max_value),q);
                         p=PushCharPixel(p,&pixel);
-                        SetPixelGreen(image,ScaleAnyToQuantum(pixel,max_value),q);
+                        SetPixelGreen(image,ScaleAnyToQuantum(pixel,max_value),
+                          q);
                         p=PushCharPixel(p,&pixel);
-                        SetPixelBlue(image,ScaleAnyToQuantum(pixel,max_value),q);
+                        SetPixelBlue(image,ScaleAnyToQuantum(pixel,max_value),
+                          q);
                         SetPixelAlpha(image,OpaqueAlpha,q);
                         if (image->alpha_trait != UndefinedPixelTrait)
                           {
                             p=PushCharPixel(p,&pixel);
-                            SetPixelAlpha(image,ScaleAnyToQuantum(pixel,max_value),q);
+                            SetPixelAlpha(image,ScaleAnyToQuantum(pixel,
+                              max_value),q);
                           }
                         q+=GetPixelChannels(image);
                       }
@@ -1200,9 +1204,11 @@ static Image *ReadPNMImage(const ImageInfo *image_info,ExceptionInfo *exception)
                         p=PushShortPixel(MSBEndian,p,&pixel);
                         SetPixelRed(image,ScaleAnyToQuantum(pixel,max_value),q);
                         p=PushShortPixel(MSBEndian,p,&pixel);
-                        SetPixelGreen(image,ScaleAnyToQuantum(pixel,max_value),q);
+                        SetPixelGreen(image,ScaleAnyToQuantum(pixel,max_value),
+                          q);
                         p=PushShortPixel(MSBEndian,p,&pixel);
-                        SetPixelBlue(image,ScaleAnyToQuantum(pixel,max_value),q);
+                        SetPixelBlue(image,ScaleAnyToQuantum(pixel,max_value),
+                          q);
                         SetPixelAlpha(image,OpaqueAlpha,q);
                         if (image->alpha_trait != UndefinedPixelTrait)
                           {
@@ -1226,7 +1232,8 @@ static Image *ReadPNMImage(const ImageInfo *image_info,ExceptionInfo *exception)
                     if (image->alpha_trait != UndefinedPixelTrait)
                       {
                         p=PushLongPixel(MSBEndian,p,&pixel);
-                        SetPixelAlpha(image,ScaleAnyToQuantum(pixel,max_value),q);
+                        SetPixelAlpha(image,ScaleAnyToQuantum(pixel,max_value),
+                          q);
                       }
                     q+=GetPixelChannels(image);
                   }
@@ -1269,6 +1276,9 @@ static Image *ReadPNMImage(const ImageInfo *image_info,ExceptionInfo *exception)
         extent=GetQuantumExtent(image,quantum_info,quantum_type);
         for (y=0; y < (ssize_t) image->rows; y++)
         {
+          const void
+            *pixels;
+
           MagickBooleanType
             sync;
 
@@ -1282,29 +1292,24 @@ static Image *ReadPNMImage(const ImageInfo *image_info,ExceptionInfo *exception)
           size_t
             length;
 
-          unsigned char
-            *pixels;
-
           if (status == MagickFalse)
             continue;
-          pixels=GetQuantumPixels(quantum_info);
-          {
-            count=ReadBlob(image,extent,pixels);
-            if ((image->progress_monitor != (MagickProgressMonitor) NULL) &&
-                (image->previous == (Image *) NULL))
-              {
-                MagickBooleanType
-                  proceed;
-
-                proceed=SetImageProgress(image,LoadImageTag,(MagickOffsetType)
-                  row,image->rows);
-                if (proceed == MagickFalse)
-                  status=MagickFalse;
-              }
-            offset=row++;
-          }
+          pixels=ReadBlobStream(image,extent,GetQuantumPixels(quantum_info),
+            &count);
           if ((size_t) count != extent)
             status=MagickFalse;
+          if ((image->progress_monitor != (MagickProgressMonitor) NULL) &&
+              (image->previous == (Image *) NULL))
+            {
+              MagickBooleanType
+                proceed;
+
+              proceed=SetImageProgress(image,LoadImageTag,(MagickOffsetType)
+                row,image->rows);
+              if (proceed == MagickFalse)
+                status=MagickFalse;
+            }
+          offset=row++;
           q=QueueAuthenticPixels(image,0,(ssize_t) (image->rows-offset-1),
             image->columns,1,exception);
           if (q == (Quantum *) NULL)
index 2b35ba51cfba6f97279d6cc2b72a8b2fdc7d98ec..407f2bed39af2c7d849a3e477144c32afcca52be 100644 (file)
@@ -96,6 +96,9 @@ static MagickBooleanType
 */
 static Image *ReadRAWImage(const ImageInfo *image_info,ExceptionInfo *exception)
 {
+  const void
+    *pixels;
+
   Image
     *canvas_image,
     *image;
@@ -119,9 +122,6 @@ static Image *ReadRAWImage(const ImageInfo *image_info,ExceptionInfo *exception)
     count,
     y;
 
-  unsigned char
-    *pixels;
-
   /*
     Open image file.
   */
@@ -155,7 +155,6 @@ static Image *ReadRAWImage(const ImageInfo *image_info,ExceptionInfo *exception)
   quantum_info=AcquireQuantumInfo(image_info,canvas_image);
   if (quantum_info == (QuantumInfo *) NULL)
     ThrowReaderException(ResourceLimitError,"MemoryAllocationFailed");
-  pixels=GetQuantumPixels(quantum_info);
   if (image_info->number_scenes != 0)
     while (image->scene < image_info->scene)
     {
@@ -166,7 +165,8 @@ 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++)
       {
-        count=ReadBlob(image,length,pixels);
+        pixels=ReadBlobStream(image,length,GetQuantumPixels(quantum_info),
+          &count);
         if (count != (ssize_t) length)
           break;
       }
@@ -188,7 +188,8 @@ static Image *ReadRAWImage(const ImageInfo *image_info,ExceptionInfo *exception)
     if (scene == 0)
       {
         length=GetQuantumExtent(canvas_image,quantum_info,quantum_type);
-        count=ReadBlob(image,length,pixels);
+        pixels=ReadBlobStream(image,length,GetQuantumPixels(quantum_info),
+          &count);
       }
     for (y=0; y < (ssize_t) image->extract_info.height; y++)
     {
@@ -241,7 +242,8 @@ static Image *ReadRAWImage(const ImageInfo *image_info,ExceptionInfo *exception)
           if (status == MagickFalse)
             break;
         }
-      count=ReadBlob(image,length,pixels);
+      pixels=ReadBlobStream(image,length,GetQuantumPixels(quantum_info),
+        &count);
     }
     SetQuantumImageType(image,quantum_type);
     /*
index 8bafb5235ecf04d54f0b0d8e7d3ff4cfbadb318d..f5fe1e1361ccf776144c42a8a0e1fbe5b3e8975c 100644 (file)
@@ -99,6 +99,9 @@ static MagickBooleanType
 */
 static Image *ReadRGBImage(const ImageInfo *image_info,ExceptionInfo *exception)
 {
+  const void
+    *pixels;
+
   Image
     *canvas_image,
     *image;
@@ -125,9 +128,6 @@ static Image *ReadRGBImage(const ImageInfo *image_info,ExceptionInfo *exception)
     count,
     y;
 
-  unsigned char
-    *pixels;
-
   /*
     Open image file.
   */
@@ -163,7 +163,6 @@ static Image *ReadRGBImage(const ImageInfo *image_info,ExceptionInfo *exception)
   quantum_info=AcquireQuantumInfo(image_info,canvas_image);
   if (quantum_info == (QuantumInfo *) NULL)
     ThrowReaderException(ResourceLimitError,"MemoryAllocationFailed");
-  pixels=GetQuantumPixels(quantum_info);
   quantum_type=RGBQuantum;
   if (LocaleCompare(image_info->magick,"RGBA") == 0)
     {
@@ -186,7 +185,8 @@ 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++)
       {
-        count=ReadBlob(image,length,pixels);
+        pixels=ReadBlobStream(image,length,GetQuantumPixels(quantum_info),
+          &count);
         if (count != (ssize_t) length)
           break;
       }
@@ -216,7 +216,8 @@ static Image *ReadRGBImage(const ImageInfo *image_info,ExceptionInfo *exception)
         if (scene == 0)
           {
             length=GetQuantumExtent(canvas_image,quantum_info,quantum_type);
-            count=ReadBlob(image,length,pixels);
+            pixels=ReadBlobStream(image,length,GetQuantumPixels(quantum_info),
+              &count);
           }
         for (y=0; y < (ssize_t) image->extract_info.height; y++)
         {
@@ -273,7 +274,8 @@ static Image *ReadRGBImage(const ImageInfo *image_info,ExceptionInfo *exception)
               if (status == MagickFalse)
                 break;
             }
-          count=ReadBlob(image,length,pixels);
+          pixels=ReadBlobStream(image,length,GetQuantumPixels(quantum_info),
+            &count);
         }
         break;
       }
@@ -296,7 +298,8 @@ static Image *ReadRGBImage(const ImageInfo *image_info,ExceptionInfo *exception)
         if (scene == 0)
           {
             length=GetQuantumExtent(canvas_image,quantum_info,RedQuantum);
-            count=ReadBlob(image,length,pixels);
+            pixels=ReadBlobStream(image,length,GetQuantumPixels(quantum_info),
+              &count);
           }
         for (y=0; y < (ssize_t) image->extract_info.height; y++)
         {
@@ -373,7 +376,8 @@ static Image *ReadRGBImage(const ImageInfo *image_info,ExceptionInfo *exception)
                 if (SyncAuthenticPixels(image,exception) == MagickFalse)
                   break;
               }
-            count=ReadBlob(image,length,pixels);
+            pixels=ReadBlobStream(image,length,GetQuantumPixels(quantum_info),
+              &count);
           }
           if (image->previous == (Image *) NULL)
             {
@@ -393,7 +397,8 @@ static Image *ReadRGBImage(const ImageInfo *image_info,ExceptionInfo *exception)
         if (scene == 0)
           {
             length=GetQuantumExtent(canvas_image,quantum_info,RedQuantum);
-            count=ReadBlob(image,length,pixels);
+            pixels=ReadBlobStream(image,length,GetQuantumPixels(quantum_info),
+              &count);
           }
         for (y=0; y < (ssize_t) image->extract_info.height; y++)
         {
@@ -438,7 +443,8 @@ static Image *ReadRGBImage(const ImageInfo *image_info,ExceptionInfo *exception)
               if (SyncAuthenticPixels(image,exception) == MagickFalse)
                 break;
             }
-          count=ReadBlob(image,length,pixels);
+          pixels=ReadBlobStream(image,length,GetQuantumPixels(quantum_info),
+            &count);
         }
         if (image->previous == (Image *) NULL)
           {
@@ -489,7 +495,8 @@ static Image *ReadRGBImage(const ImageInfo *image_info,ExceptionInfo *exception)
               if (SyncAuthenticPixels(image,exception) == MagickFalse)
                 break;
            }
-          count=ReadBlob(image,length,pixels);
+          pixels=ReadBlobStream(image,length,GetQuantumPixels(quantum_info),
+            &count);
         }
         if (image->previous == (Image *) NULL)
           {
@@ -540,7 +547,8 @@ static Image *ReadRGBImage(const ImageInfo *image_info,ExceptionInfo *exception)
               if (SyncAuthenticPixels(image,exception) == MagickFalse)
                 break;
             }
-          count=ReadBlob(image,length,pixels);
+          pixels=ReadBlobStream(image,length,GetQuantumPixels(quantum_info),
+            &count);
         }
         if (image->previous == (Image *) NULL)
           {
@@ -600,7 +608,8 @@ static Image *ReadRGBImage(const ImageInfo *image_info,ExceptionInfo *exception)
                   if (SyncAuthenticPixels(image,exception) == MagickFalse)
                     break;
                 }
-              count=ReadBlob(image,length,pixels);
+              pixels=ReadBlobStream(image,length,GetQuantumPixels(quantum_info),
+                &count);
             }
             if (image->previous == (Image *) NULL)
               {
@@ -636,13 +645,18 @@ static Image *ReadRGBImage(const ImageInfo *image_info,ExceptionInfo *exception)
         length=GetQuantumExtent(canvas_image,quantum_info,RedQuantum);
         for (i=0; i < (ssize_t) scene; i++)
           for (y=0; y < (ssize_t) image->extract_info.height; y++)
-            if (ReadBlob(image,length,pixels) != (ssize_t) length)
+          {
+            pixels=ReadBlobStream(image,length,GetQuantumPixels(quantum_info),
+              &count);
+            if (count != (ssize_t) length)
               {
                 ThrowFileException(exception,CorruptImageError,
                   "UnexpectedEndOfFile",image->filename);
                 break;
               }
-        count=ReadBlob(image,length,pixels);
+          }
+        pixels=ReadBlobStream(image,length,GetQuantumPixels(quantum_info),
+          &count);
         for (y=0; y < (ssize_t) image->extract_info.height; y++)
         {
           register const Quantum
@@ -686,7 +700,8 @@ static Image *ReadRGBImage(const ImageInfo *image_info,ExceptionInfo *exception)
               if (SyncAuthenticPixels(image,exception) == MagickFalse)
                 break;
             }
-          count=ReadBlob(image,length,pixels);
+          pixels=ReadBlobStream(image,length,GetQuantumPixels(quantum_info),
+            &count);
         }
         if (image->previous == (Image *) NULL)
           {
@@ -706,13 +721,18 @@ static Image *ReadRGBImage(const ImageInfo *image_info,ExceptionInfo *exception)
         length=GetQuantumExtent(canvas_image,quantum_info,GreenQuantum);
         for (i=0; i < (ssize_t) scene; i++)
           for (y=0; y < (ssize_t) image->extract_info.height; y++)
-            if (ReadBlob(image,length,pixels) != (ssize_t) length)
+          {
+            pixels=ReadBlobStream(image,length,GetQuantumPixels(quantum_info),
+              &count);
+            if (count != (ssize_t) length)
               {
                 ThrowFileException(exception,CorruptImageError,
                   "UnexpectedEndOfFile",image->filename);
                 break;
               }
-        count=ReadBlob(image,length,pixels);
+          }
+        pixels=ReadBlobStream(image,length,GetQuantumPixels(quantum_info),
+          &count);
         for (y=0; y < (ssize_t) image->extract_info.height; y++)
         {
           register const Quantum
@@ -756,7 +776,8 @@ static Image *ReadRGBImage(const ImageInfo *image_info,ExceptionInfo *exception)
               if (SyncAuthenticPixels(image,exception) == MagickFalse)
                 break;
            }
-          count=ReadBlob(image,length,pixels);
+          pixels=ReadBlobStream(image,length,GetQuantumPixels(quantum_info),
+            &count);
         }
         if (image->previous == (Image *) NULL)
           {
@@ -776,13 +797,18 @@ static Image *ReadRGBImage(const ImageInfo *image_info,ExceptionInfo *exception)
         length=GetQuantumExtent(canvas_image,quantum_info,BlueQuantum);
         for (i=0; i < (ssize_t) scene; i++)
           for (y=0; y < (ssize_t) image->extract_info.height; y++)
-            if (ReadBlob(image,length,pixels) != (ssize_t) length)
+          {     
+            pixels=ReadBlobStream(image,length,GetQuantumPixels(quantum_info),
+              &count);
+            if (count != (ssize_t) length)
               {
                 ThrowFileException(exception,CorruptImageError,
                   "UnexpectedEndOfFile",image->filename);
                 break;
               }
-        count=ReadBlob(image,length,pixels);
+          }     
+        pixels=ReadBlobStream(image,length,GetQuantumPixels(quantum_info),
+          &count);
         for (y=0; y < (ssize_t) image->extract_info.height; y++)
         {
           register const Quantum
@@ -826,7 +852,8 @@ static Image *ReadRGBImage(const ImageInfo *image_info,ExceptionInfo *exception)
               if (SyncAuthenticPixels(image,exception) == MagickFalse)
                 break;
            }
-          count=ReadBlob(image,length,pixels);
+          pixels=ReadBlobStream(image,length,GetQuantumPixels(quantum_info),
+            &count);
         }
         if (image->previous == (Image *) NULL)
           {
@@ -848,13 +875,18 @@ static Image *ReadRGBImage(const ImageInfo *image_info,ExceptionInfo *exception)
             length=GetQuantumExtent(canvas_image,quantum_info,AlphaQuantum);
             for (i=0; i < (ssize_t) scene; i++)
               for (y=0; y < (ssize_t) image->extract_info.height; y++)
-                if (ReadBlob(image,length,pixels) != (ssize_t) length)
+              {
+                pixels=ReadBlobStream(image,length,
+                  GetQuantumPixels(quantum_info),&count);
+                if (count != (ssize_t) length)
                   {
                     ThrowFileException(exception,CorruptImageError,
                       "UnexpectedEndOfFile",image->filename);
                     break;
                   }
-            count=ReadBlob(image,length,pixels);
+              }
+            pixels=ReadBlobStream(image,length,GetQuantumPixels(quantum_info),
+              &count);
             for (y=0; y < (ssize_t) image->extract_info.height; y++)
             {
               register const Quantum
@@ -898,7 +930,8 @@ static Image *ReadRGBImage(const ImageInfo *image_info,ExceptionInfo *exception)
                   if (SyncAuthenticPixels(image,exception) == MagickFalse)
                     break;
                }
-              count=ReadBlob(image,length,pixels);
+              pixels=ReadBlobStream(image,length,GetQuantumPixels(quantum_info),
+                &count);
             }
             if (image->previous == (Image *) NULL)
               {
index bfac89b3066c2fa4545c7f8ad8f4b9a324a97b39..345c6c5f523dbbb96e4e3ead18b9d1be9bcc10d3 100644 (file)
@@ -149,6 +149,9 @@ static Image *ReadVICARImage(const ImageInfo *image_info,
     keyword[MaxTextExtent],
     value[MaxTextExtent];
 
+  const void
+    *pixels;
+
   Image
     *image;
 
@@ -175,9 +178,6 @@ static Image *ReadVICARImage(const ImageInfo *image_info,
     count,
     y;
 
-  unsigned char
-    *pixels;
-
   /*
     Open image file.
   */
@@ -297,14 +297,16 @@ static Image *ReadVICARImage(const ImageInfo *image_info,
   quantum_info=AcquireQuantumInfo(image_info,image);
   if (quantum_info == (QuantumInfo *) NULL)
     ThrowReaderException(ResourceLimitError,"MemoryAllocationFailed");
-  pixels=GetQuantumPixels(quantum_info);
   length=GetQuantumExtent(image,quantum_info,quantum_type);
   for (y=0; y < (ssize_t) image->rows; y++)
   {
     q=QueueAuthenticPixels(image,0,y,image->columns,1,exception);
     if (q == (Quantum *) NULL)
       break;
-    count=ReadBlob(image,length,pixels);
+    pixels=ReadBlobStream(image,length,GetQuantumPixels(quantum_info),
+      &count);
+    if (count != (ssize_t) length)
+      break;
     (void) ImportQuantumPixels(image,(CacheView *) NULL,quantum_info,
       quantum_type,pixels,exception);
     if (SyncAuthenticPixels(image,exception) == MagickFalse)
index 5745da5a831b086108ac3c9a24847044563a8a9f..856f2499a83a2c0759c5a31d4f61076a989c1d50 100644 (file)
@@ -99,6 +99,9 @@ static MagickBooleanType
 static Image *ReadYCBCRImage(const ImageInfo *image_info,
   ExceptionInfo *exception)
 {
+  const void
+    *pixels;
+
   Image
     *canvas_image,
     *image;
@@ -132,9 +135,6 @@ static Image *ReadYCBCRImage(const ImageInfo *image_info,
     count,
     y;
 
-  unsigned char
-    *pixels;
-
   /*
     Open image file.
   */
@@ -174,7 +174,6 @@ static Image *ReadYCBCRImage(const ImageInfo *image_info,
   quantum_info=AcquireQuantumInfo(image_info,canvas_image);
   if (quantum_info == (QuantumInfo *) NULL)
     ThrowReaderException(ResourceLimitError,"MemoryAllocationFailed");
-  pixels=GetQuantumPixels(quantum_info);
   quantum_type=RGBQuantum;
   if (LocaleCompare(image_info->magick,"YCbCrA") == 0)
     {
@@ -191,7 +190,8 @@ static Image *ReadYCBCRImage(const ImageInfo *image_info,
       length=GetQuantumExtent(canvas_image,quantum_info,quantum_type);
       for (y=0; y < (ssize_t) image->rows; y++)
       {
-        count=ReadBlob(image,length,pixels);
+        pixels=ReadBlobStream(image,length,GetQuantumPixels(quantum_info),
+          &count);
         if (count != (ssize_t) length)
           break;
       }
@@ -222,7 +222,8 @@ static Image *ReadYCBCRImage(const ImageInfo *image_info,
         if (scene == 0)
           {
             length=GetQuantumExtent(canvas_image,quantum_info,quantum_type);
-            count=ReadBlob(image,length,pixels);
+            pixels=ReadBlobStream(image,length,GetQuantumPixels(quantum_info),
+              &count);
           }
         for (y=0; y < (ssize_t) image->extract_info.height; y++)
         {
@@ -270,7 +271,8 @@ static Image *ReadYCBCRImage(const ImageInfo *image_info,
               if (status == MagickFalse)
                 break;
             }
-          count=ReadBlob(image,length,pixels);
+          pixels=ReadBlobStream(image,length,GetQuantumPixels(quantum_info),
+            &count);
         }
         break;
       }
@@ -291,7 +293,8 @@ static Image *ReadYCBCRImage(const ImageInfo *image_info,
         if (scene == 0)
           {
             length=GetQuantumExtent(canvas_image,quantum_info,RedQuantum);
-            count=ReadBlob(image,length,pixels);
+            pixels=ReadBlobStream(image,length,GetQuantumPixels(quantum_info),
+              &count);
           }
         for (y=0; y < (ssize_t) image->extract_info.height; y++)
         {
@@ -355,7 +358,8 @@ static Image *ReadYCBCRImage(const ImageInfo *image_info,
                 if (SyncAuthenticPixels(image,exception) == MagickFalse)
                   break;
               }
-            count=ReadBlob(image,length,pixels);
+            pixels=ReadBlobStream(image,length,GetQuantumPixels(quantum_info),
+              &count);
           }
           if (image->previous == (Image *) NULL)
             {
@@ -375,7 +379,8 @@ static Image *ReadYCBCRImage(const ImageInfo *image_info,
         if (scene == 0)
           {
             length=GetQuantumExtent(canvas_image,quantum_info,RedQuantum);
-            count=ReadBlob(image,length,pixels);
+            pixels=ReadBlobStream(image,length,GetQuantumPixels(quantum_info),
+              &count);
           }
         for (y=0; y < (ssize_t) image->extract_info.height; y++)
         {
@@ -412,7 +417,8 @@ static Image *ReadYCBCRImage(const ImageInfo *image_info,
               if (SyncAuthenticPixels(image,exception) == MagickFalse)
                 break;
             }
-          count=ReadBlob(image,length,pixels);
+          pixels=ReadBlobStream(image,length,GetQuantumPixels(quantum_info),
+            &count);
         }
         if (image->previous == (Image *) NULL)
           {
@@ -455,7 +461,8 @@ static Image *ReadYCBCRImage(const ImageInfo *image_info,
               if (SyncAuthenticPixels(image,exception) == MagickFalse)
                 break;
            }
-          count=ReadBlob(image,length,pixels);
+          pixels=ReadBlobStream(image,length,GetQuantumPixels(quantum_info),
+            &count);
         }
         if (image->previous == (Image *) NULL)
           {
@@ -498,7 +505,8 @@ static Image *ReadYCBCRImage(const ImageInfo *image_info,
               if (SyncAuthenticPixels(image,exception) == MagickFalse)
                 break;
             }
-          count=ReadBlob(image,length,pixels);
+          pixels=ReadBlobStream(image,length,GetQuantumPixels(quantum_info),
+            &count);
         }
         if (image->previous == (Image *) NULL)
           {
@@ -544,7 +552,8 @@ static Image *ReadYCBCRImage(const ImageInfo *image_info,
                   if (SyncAuthenticPixels(image,exception) == MagickFalse)
                     break;
                 }
-              count=ReadBlob(image,length,pixels);
+              pixels=ReadBlobStream(image,length,GetQuantumPixels(quantum_info),
+                &count);
             }
             if (image->previous == (Image *) NULL)
               {
@@ -580,13 +589,18 @@ static Image *ReadYCBCRImage(const ImageInfo *image_info,
         length=GetQuantumExtent(canvas_image,quantum_info,RedQuantum);
         for (i=0; i < (ssize_t) scene; i++)
           for (y=0; y < (ssize_t) image->extract_info.height; y++)
-            if (ReadBlob(image,length,pixels) != (ssize_t) length)
+          {
+            pixels=ReadBlobStream(image,length,GetQuantumPixels(quantum_info),
+              &count);
+            if (count != (ssize_t) length)
               {
                 ThrowFileException(exception,CorruptImageError,
                   "UnexpectedEndOfFile",image->filename);
                 break;
               }
-        count=ReadBlob(image,length,pixels);
+          }
+        pixels=ReadBlobStream(image,length,GetQuantumPixels(quantum_info),
+          &count);
         for (y=0; y < (ssize_t) image->extract_info.height; y++)
         {
           if (count != (ssize_t) length)
@@ -622,7 +636,8 @@ static Image *ReadYCBCRImage(const ImageInfo *image_info,
               if (SyncAuthenticPixels(image,exception) == MagickFalse)
                 break;
             }
-          count=ReadBlob(image,length,pixels);
+          pixels=ReadBlobStream(image,length,GetQuantumPixels(quantum_info),
+            &count);
         }
         if (image->previous == (Image *) NULL)
           {
@@ -642,13 +657,18 @@ static Image *ReadYCBCRImage(const ImageInfo *image_info,
         length=GetQuantumExtent(canvas_image,quantum_info,GreenQuantum);
         for (i=0; i < (ssize_t) scene; i++)
           for (y=0; y < (ssize_t) image->extract_info.height; y++)
-            if (ReadBlob(image,length,pixels) != (ssize_t) length)
+          {
+            pixels=ReadBlobStream(image,length,GetQuantumPixels(quantum_info),
+              &count);
+            if (count != (ssize_t) length)
               {
                 ThrowFileException(exception,CorruptImageError,
                   "UnexpectedEndOfFile",image->filename);
                 break;
               }
-        count=ReadBlob(image,length,pixels);
+          }
+        pixels=ReadBlobStream(image,length,GetQuantumPixels(quantum_info),
+          &count);
         for (y=0; y < (ssize_t) image->extract_info.height; y++)
         {
           if (count != (ssize_t) length)
@@ -684,7 +704,8 @@ static Image *ReadYCBCRImage(const ImageInfo *image_info,
               if (SyncAuthenticPixels(image,exception) == MagickFalse)
                 break;
            }
-          count=ReadBlob(image,length,pixels);
+          pixels=ReadBlobStream(image,length,GetQuantumPixels(quantum_info),
+            &count);
         }
         if (image->previous == (Image *) NULL)
           {
@@ -704,13 +725,18 @@ static Image *ReadYCBCRImage(const ImageInfo *image_info,
         length=GetQuantumExtent(canvas_image,quantum_info,BlueQuantum);
         for (i=0; i < (ssize_t) scene; i++)
           for (y=0; y < (ssize_t) image->extract_info.height; y++)
-            if (ReadBlob(image,length,pixels) != (ssize_t) length)
+          {
+            pixels=ReadBlobStream(image,length,GetQuantumPixels(quantum_info),
+              &count);
+            if (count != (ssize_t) length)
               {
                 ThrowFileException(exception,CorruptImageError,
                   "UnexpectedEndOfFile",image->filename);
                 break;
               }
-        count=ReadBlob(image,length,pixels);
+          }
+        pixels=ReadBlobStream(image,length,GetQuantumPixels(quantum_info),
+          &count);
         for (y=0; y < (ssize_t) image->extract_info.height; y++)
         {
           if (count != (ssize_t) length)
@@ -746,7 +772,8 @@ static Image *ReadYCBCRImage(const ImageInfo *image_info,
               if (SyncAuthenticPixels(image,exception) == MagickFalse)
                 break;
            }
-          count=ReadBlob(image,length,pixels);
+          pixels=ReadBlobStream(image,length,GetQuantumPixels(quantum_info),
+            &count);
         }
         if (image->previous == (Image *) NULL)
           {
@@ -768,13 +795,18 @@ static Image *ReadYCBCRImage(const ImageInfo *image_info,
             length=GetQuantumExtent(canvas_image,quantum_info,AlphaQuantum);
             for (i=0; i < (ssize_t) scene; i++)
               for (y=0; y < (ssize_t) image->extract_info.height; y++)
-                if (ReadBlob(image,length,pixels) != (ssize_t) length)
+              {
+                pixels=ReadBlobStream(image,length,
+                  GetQuantumPixels(quantum_info),&count);
+                if (count != (ssize_t) length)
                   {
                     ThrowFileException(exception,CorruptImageError,
                       "UnexpectedEndOfFile",image->filename);
                     break;
                   }
-            count=ReadBlob(image,length,pixels);
+              }
+            pixels=ReadBlobStream(image,length,GetQuantumPixels(quantum_info),
+              &count);
             for (y=0; y < (ssize_t) image->extract_info.height; y++)
             {
               if (count != (ssize_t) length)
@@ -811,7 +843,8 @@ static Image *ReadYCBCRImage(const ImageInfo *image_info,
                   if (SyncAuthenticPixels(image,exception) == MagickFalse)
                     break;
                }
-              count=ReadBlob(image,length,pixels);
+              pixels=ReadBlobStream(image,length,GetQuantumPixels(quantum_info),
+                &count);
             }
             if (image->previous == (Image *) NULL)
               {