diff options
Diffstat (limited to 'coders/gray.c')
-rw-r--r-- | coders/gray.c | 70 |
1 files changed, 40 insertions, 30 deletions
diff --git a/coders/gray.c b/coders/gray.c index c4643f353..b531ef773 100644 --- a/coders/gray.c +++ b/coders/gray.c @@ -17,7 +17,7 @@ % July 1992 % % % % % -% Copyright 1999-2020 ImageMagick Studio LLC, a non-profit organization % +% Copyright 1999-2019 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 % @@ -100,8 +100,8 @@ static MagickBooleanType static Image *ReadGRAYImage(const ImageInfo *image_info, ExceptionInfo *exception) { - const void - *stream; + const unsigned char + *pixels; Image *canvas_image, @@ -129,9 +129,6 @@ static Image *ReadGRAYImage(const ImageInfo *image_info, count, y; - unsigned char - *pixels; - /* Open image file. */ @@ -180,7 +177,7 @@ static Image *ReadGRAYImage(const ImageInfo *image_info, image->alpha_trait=BlendPixelTrait; canvas_image->alpha_trait=BlendPixelTrait; } - pixels=GetQuantumPixels(quantum_info); + pixels=(const unsigned char *) NULL; if (image_info->number_scenes != 0) while (image->scene < image_info->scene) { @@ -191,7 +188,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++) { - stream=ReadBlobStream(image,length,pixels,&count); + pixels=(const unsigned char *) ReadBlobStream(image,length, + GetQuantumPixels(quantum_info),&count); if (count != (ssize_t) length) break; } @@ -200,7 +198,6 @@ static Image *ReadGRAYImage(const ImageInfo *image_info, length=0; scene=0; status=MagickTrue; - stream=NULL; do { /* @@ -223,7 +220,8 @@ static Image *ReadGRAYImage(const ImageInfo *image_info, if (scene == 0) { length=GetQuantumExtent(canvas_image,quantum_info,quantum_type); - stream=ReadBlobStream(image,length,pixels,&count); + pixels=(const unsigned char *) ReadBlobStream(image,length, + GetQuantumPixels(quantum_info),&count); } for (y=0; y < (ssize_t) image->extract_info.height; y++) { @@ -248,7 +246,7 @@ static Image *ReadGRAYImage(const ImageInfo *image_info, if (q == (Quantum *) NULL) break; length=ImportQuantumPixels(canvas_image,(CacheView *) NULL, - quantum_info,quantum_type,(unsigned char *) stream,exception); + quantum_info,quantum_type,pixels,exception); if (SyncAuthenticPixels(canvas_image,exception) == MagickFalse) break; if (((y-image->extract_info.y) >= 0) && @@ -281,7 +279,8 @@ static Image *ReadGRAYImage(const ImageInfo *image_info, if (status == MagickFalse) break; } - stream=ReadBlobStream(image,length,pixels,&count); + pixels=(const unsigned char *) ReadBlobStream(image,length, + GetQuantumPixels(quantum_info),&count); } break; } @@ -300,7 +299,8 @@ static Image *ReadGRAYImage(const ImageInfo *image_info, if (scene == 0) { length=GetQuantumExtent(canvas_image,quantum_info,RedQuantum); - stream=ReadBlobStream(image,length,pixels,&count); + pixels=(const unsigned char *) ReadBlobStream(image,length, + GetQuantumPixels(quantum_info),&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,(unsigned char *) stream,exception); + quantum_info,quantum_type,pixels,exception); if (SyncAuthenticPixels(canvas_image,exception) == MagickFalse) break; if (((y-image->extract_info.y) >= 0) && @@ -363,7 +363,8 @@ static Image *ReadGRAYImage(const ImageInfo *image_info, if (SyncAuthenticPixels(image,exception) == MagickFalse) break; } - stream=ReadBlobStream(image,length,pixels,&count); + pixels=(const unsigned char *) ReadBlobStream(image,length, + GetQuantumPixels(quantum_info),&count); } if (image->previous == (Image *) NULL) { @@ -383,7 +384,8 @@ static Image *ReadGRAYImage(const ImageInfo *image_info, if (scene == 0) { length=GetQuantumExtent(canvas_image,quantum_info,RedQuantum); - stream=ReadBlobStream(image,length,pixels,&count); + pixels=(const unsigned char *) ReadBlobStream(image,length, + GetQuantumPixels(quantum_info),&count); } for (y=0; y < (ssize_t) image->extract_info.height; y++) { @@ -408,7 +410,7 @@ static Image *ReadGRAYImage(const ImageInfo *image_info, if (q == (Quantum *) NULL) break; length=ImportQuantumPixels(canvas_image,(CacheView *) NULL, - quantum_info,RedQuantum,(unsigned char *) stream,exception); + quantum_info,RedQuantum,pixels,exception); if (SyncAuthenticPixels(canvas_image,exception) == MagickFalse) break; if (((y-image->extract_info.y) >= 0) && @@ -429,7 +431,8 @@ static Image *ReadGRAYImage(const ImageInfo *image_info, if (SyncAuthenticPixels(image,exception) == MagickFalse) break; } - stream=ReadBlobStream(image,length,pixels,&count); + pixels=(const unsigned char *) ReadBlobStream(image,length, + GetQuantumPixels(quantum_info),&count); } if (image->previous == (Image *) NULL) { @@ -462,7 +465,7 @@ static Image *ReadGRAYImage(const ImageInfo *image_info, if (q == (Quantum *) NULL) break; length=ImportQuantumPixels(canvas_image,(CacheView *) NULL, - quantum_info,AlphaQuantum,(unsigned char *) stream,exception); + quantum_info,AlphaQuantum,pixels,exception); if (SyncAuthenticPixels(canvas_image,exception) == MagickFalse) break; if (((y-image->extract_info.y) >= 0) && @@ -484,7 +487,8 @@ static Image *ReadGRAYImage(const ImageInfo *image_info, if (SyncAuthenticPixels(image,exception) == MagickFalse) break; } - stream=ReadBlobStream(image,length,pixels,&count); + pixels=(const unsigned char *) ReadBlobStream(image,length, + GetQuantumPixels(quantum_info),&count); } if (image->previous == (Image *) NULL) { @@ -513,8 +517,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); @@ -522,14 +526,16 @@ static Image *ReadGRAYImage(const ImageInfo *image_info, { for (y=0; y < (ssize_t) image->extract_info.height; y++) { - stream=ReadBlobStream(image,length,pixels,&count); + pixels=(const unsigned char *) ReadBlobStream(image,length, + GetQuantumPixels(quantum_info),&count); if (count != (ssize_t) length) break; } if (count != (ssize_t) length) break; } - stream=ReadBlobStream(image,length,pixels,&count); + pixels=(const unsigned char *) ReadBlobStream(image,length, + GetQuantumPixels(quantum_info),&count); for (y=0; y < (ssize_t) image->extract_info.height; y++) { register const Quantum @@ -553,7 +559,7 @@ static Image *ReadGRAYImage(const ImageInfo *image_info, if (q == (Quantum *) NULL) break; length=ImportQuantumPixels(canvas_image,(CacheView *) NULL, - quantum_info,RedQuantum,(unsigned char *) stream,exception); + quantum_info,RedQuantum,pixels,exception); if (SyncAuthenticPixels(canvas_image,exception) == MagickFalse) break; if (((y-image->extract_info.y) >= 0) && @@ -574,7 +580,8 @@ static Image *ReadGRAYImage(const ImageInfo *image_info, if (SyncAuthenticPixels(image,exception) == MagickFalse) break; } - stream=ReadBlobStream(image,length,pixels,&count); + pixels=(const unsigned char *) ReadBlobStream(image,length, + GetQuantumPixels(quantum_info),&count); } if (image->previous == (Image *) NULL) { @@ -595,14 +602,16 @@ static Image *ReadGRAYImage(const ImageInfo *image_info, { for (y=0; y < (ssize_t) image->extract_info.height; y++) { - stream=ReadBlobStream(image,length,pixels,&count); + pixels=(const unsigned char *) ReadBlobStream(image,length, + GetQuantumPixels(quantum_info),&count); if (count != (ssize_t) length) break; } if (count != (ssize_t) length) break; } - stream=ReadBlobStream(image,length,pixels,&count); + pixels=(const unsigned char *) ReadBlobStream(image,length, + GetQuantumPixels(quantum_info),&count); for (y=0; y < (ssize_t) image->extract_info.height; y++) { register const Quantum @@ -626,7 +635,7 @@ static Image *ReadGRAYImage(const ImageInfo *image_info, if (q == (Quantum *) NULL) break; length=ImportQuantumPixels(canvas_image,(CacheView *) NULL, - quantum_info,BlueQuantum,(unsigned char *) stream,exception); + quantum_info,BlueQuantum,pixels,exception); if (SyncAuthenticPixels(canvas_image,exception) == MagickFalse) break; if (((y-image->extract_info.y) >= 0) && @@ -647,7 +656,8 @@ static Image *ReadGRAYImage(const ImageInfo *image_info, if (SyncAuthenticPixels(image,exception) == MagickFalse) break; } - stream=ReadBlobStream(image,length,pixels,&count); + pixels=(const unsigned char *) ReadBlobStream(image,length, + GetQuantumPixels(quantum_info),&count); } if (image->previous == (Image *) NULL) { |