]> granicus.if.org Git - imagemagick/blobdiff - coders/ycbcr.c
(no commit message)
[imagemagick] / coders / ycbcr.c
index 2686541ed0db47bfdb5b6f8e7bc6a348548eabd3..2fe5acddc270a60990d839a828f08deb57f3dd90 100644 (file)
@@ -17,7 +17,7 @@
 %                                 July 1992                                   %
 %                                                                             %
 %                                                                             %
-%  Copyright 1999-2010 ImageMagick Studio LLC, a non-profit organization      %
+%  Copyright 1999-2011 ImageMagick Studio LLC, a non-profit organization      %
 %  dedicated to making software imaging solutions freely available.           %
 %                                                                             %
 %  You may not use this file except in compliance with the License.  You may  %
@@ -158,13 +158,9 @@ static Image *ReadYCBCRImage(const ImageInfo *image_info,
           image=DestroyImageList(image);
           return((Image *) NULL);
         }
-      for (i=0; i < image->offset; i++)
-        if (ReadBlobByte(image) == EOF)
-          {
-            ThrowFileException(exception,CorruptImageError,
-              "UnexpectedEndOfFile",image->filename);
-            break;
-          }
+      if (DiscardBlobBytes(image,image->offset) == MagickFalse)
+        ThrowFileException(exception,CorruptImageError,"UnexpectedEndOfFile",
+          image->filename);
     }
   /*
     Create virtual canvas to support cropping (i.e. image.rgb[100x100+10+20]).
@@ -263,7 +259,8 @@ static Image *ReadYCBCRImage(const ImageInfo *image_info,
             }
           if (image->previous == (Image *) NULL)
             {
-              status=SetImageProgress(image,LoadImageTag,y,image->rows);
+              status=SetImageProgress(image,LoadImageTag,(MagickOffsetType) y,
+                image->rows);
               if (status == MagickFalse)
                 break;
             }
@@ -323,11 +320,28 @@ static Image *ReadYCBCRImage(const ImageInfo *image_info,
                 {
                   switch (quantum_type)
                   {
-                    case RedQuantum: SetRedPixelComponent(q,GetRedPixelComponent(p)); break;
-                    case GreenQuantum: SetGreenPixelComponent(q,GetGreenPixelComponent(p)); break;
-                    case BlueQuantum: SetBluePixelComponent(q,GetBluePixelComponent(p)); break;
-                    case OpacityQuantum: SetOpacityPixelComponent(q,GetOpacityPixelComponent(p)); break;
-                    default: break;
+                    case RedQuantum:
+                    {
+                      SetRedPixelComponent(q,GetRedPixelComponent(p));
+                      break;
+                    }
+                    case GreenQuantum:
+                    {
+                      SetGreenPixelComponent(q,GetGreenPixelComponent(p));
+                      break;
+                    }
+                    case BlueQuantum:
+                    {
+                      SetBluePixelComponent(q,GetBluePixelComponent(p));
+                      break;
+                    }
+                    case OpacityQuantum:
+                    {
+                      SetOpacityPixelComponent(q,GetOpacityPixelComponent(p));
+                      break;
+                    }
+                    default:
+                      break;
                   }
                   p++;
                   q++;
@@ -339,7 +353,8 @@ static Image *ReadYCBCRImage(const ImageInfo *image_info,
           }
           if (image->previous == (Image *) NULL)
             {
-              status=SetImageProgress(image,LoadImageTag,y,image->rows);
+              status=SetImageProgress(image,LoadImageTag,(MagickOffsetType) y,
+                image->rows);
               if (status == MagickFalse)
                 break;
             }
@@ -553,13 +568,9 @@ static Image *ReadYCBCRImage(const ImageInfo *image_info,
             image=DestroyImageList(image);
             return((Image *) NULL);
           }
-        for (i=0; i < image->offset; i++)
-          if (ReadBlobByte(image) == EOF)
-            {
-              ThrowFileException(exception,CorruptImageError,
-                "UnexpectedEndOfFile",image->filename);
-              break;
-            }
+        if (DiscardBlobBytes(image,image->offset) == MagickFalse)
+          ThrowFileException(exception,CorruptImageError,"UnexpectedEndOfFile",
+            image->filename);
         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++)
@@ -1032,7 +1043,8 @@ static MagickBooleanType WriteYCBCRImage(const ImageInfo *image_info,
             break;
           if (image->previous == (Image *) NULL)
             {
-              status=SetImageProgress(image,SaveImageTag,y,image->rows);
+              status=SetImageProgress(image,SaveImageTag,(MagickOffsetType) y,
+                image->rows);
               if (status == MagickFalse)
                 break;
             }
@@ -1074,7 +1086,8 @@ static MagickBooleanType WriteYCBCRImage(const ImageInfo *image_info,
             }
           if (image->previous == (Image *) NULL)
             {
-              status=SetImageProgress(image,SaveImageTag,y,image->rows);
+              status=SetImageProgress(image,SaveImageTag,(MagickOffsetType) y,
+                image->rows);
               if (status == MagickFalse)
                 break;
             }