Removed unnecessary calls to DiscardBlobBytes.
diff --git a/coders/psd.c b/coders/psd.c
index fe7c58e..3c133ca 100644
--- a/coders/psd.c
+++ b/coders/psd.c
@@ -1256,26 +1256,14 @@
count=ReadBlob(image,4,(unsigned char *) type);
status=MagickFalse;
if ((count == 0) || (LocaleNCompare(type,"8BIM",4) != 0))
- {
- if (size >= (quantum+8))
- status=DiscardBlobBytes(image,(MagickSizeType) (size-quantum-8));
- if (status == MagickFalse)
- ThrowBinaryException(CorruptImageError,"UnexpectedEndOfFile",
- image->filename);
- }
+ return(MagickTrue);
else
{
count=ReadBlob(image,4,(unsigned char *) type);
if ((count != 0) && (LocaleNCompare(type,"Lr16",4) == 0))
size=GetPSDSize(psd_info,image);
else
- {
- if (size >= (quantum+12))
- status=DiscardBlobBytes(image,(MagickSizeType) (size-quantum-12));
- if (status == MagickFalse)
- ThrowBinaryException(CorruptImageError,"UnexpectedEndOfFile",
- image->filename);
- }
+ return(MagickTrue);
}
}
status=MagickTrue;
@@ -1297,6 +1285,9 @@
image->alpha_trait=BlendPixelTrait;
}
+ /*
+ We only need to know if the image has an alpha channel
+ */
if (skip_layers != MagickFalse)
return(MagickTrue);
@@ -1694,7 +1685,7 @@
if ((count == 0) || (LocaleNCompare(psd_info.signature,"8BPS",4) != 0) ||
((psd_info.version != 1) && (psd_info.version != 2)))
ThrowReaderException(CorruptImageError,"ImproperImageHeader");
- count=ReadBlob(image,6,psd_info.reserved);
+ (void) ReadBlob(image,6,psd_info.reserved);
psd_info.channels=ReadBlobMSBShort(image);
if (psd_info.channels > MaxPSDChannels)
ThrowReaderException(CorruptImageError,"MaximumChannelsExceeded");
@@ -1770,7 +1761,7 @@
sizeof(*data));
if (data == (unsigned char *) NULL)
ThrowReaderException(ResourceLimitError,"MemoryAllocationFailed");
- count=ReadBlob(image,(size_t) length,data);
+ (void) ReadBlob(image,(size_t) length,data);
data=(unsigned char *) RelinquishMagickMemory(data);
}
else
@@ -2844,8 +2835,9 @@
/*
Write composite image.
*/
- status=WriteImageChannels(&psd_info,image_info,image,image,MagickFalse,
- exception);
+ if (status != MagickFalse)
+ status=WriteImageChannels(&psd_info,image_info,image,image,MagickFalse,
+ exception);
(void) CloseBlob(image);
return(status);
}