% %
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%
-% GetVirtualMetacontentFromStream() returns the associated pixel
-% channels corresponding with the last call to QueueAuthenticPixelsStream() or
+% GetVirtualMetacontentFromStream() returns the associated pixel channels
+% corresponding with the last call to QueueAuthenticPixelsStream() or
% GetVirtualPixelStream().
%
% The format of the GetVirtualMetacontentFromStream() method is:
% o image: the image.
%
*/
-static const void *GetVirtualMetacontentFromStream(
- const Image *image)
+static const void *GetVirtualMetacontentFromStream(const Image *image)
{
CacheInfo
*cache_info;
if (cache_info->pixels == (Quantum *) NULL)
{
(void) ThrowMagickException(exception,GetMagickModule(),
- ResourceLimitError,"MemoryAllocationFailed","`%s'",
+ ResourceLimitError,"MemoryAllocationFailed","'%s'",
cache_info->filename);
return(MagickFalse);
}
(columns == 0) || (rows == 0))
{
(void) ThrowMagickException(exception,GetMagickModule(),StreamError,
- "ImageDoesNotContainTheStreamGeometry","`%s'",image->filename);
+ "ImageDoesNotContainTheStreamGeometry","'%s'",image->filename);
return((Quantum *) NULL);
}
cache_info=(CacheInfo *) image->cache;
CacheInfo
*cache_info;
+ MagickBooleanType
+ status;
+
MagickSizeType
number_pixels;
(columns == 0) || (rows == 0))
{
(void) ThrowMagickException(exception,GetMagickModule(),StreamError,
- "ImageDoesNotContainTheStreamGeometry","`%s'",image->filename);
+ "ImageDoesNotContainTheStreamGeometry","'%s'",image->filename);
return((Quantum *) NULL);
}
stream_handler=GetBlobStreamHandler(image);
if (stream_handler == (StreamHandler) NULL)
{
(void) ThrowMagickException(exception,GetMagickModule(),StreamError,
- "NoStreamHandlerIsDefined","`%s'",image->filename);
+ "NoStreamHandlerIsDefined","'%s'",image->filename);
return((Quantum *) NULL);
}
cache_info=(CacheInfo *) image->cache;
cache_info->rows=rows;
number_pixels=(MagickSizeType) columns*rows;
length=(size_t) number_pixels*cache_info->number_channels*sizeof(Quantum);
+ if (length == 0)
+ length=number_pixels*sizeof(Quantum);
if (cache_info->metacontent_extent != 0)
length+=number_pixels*cache_info->metacontent_extent;
if (cache_info->pixels == (Quantum *) NULL)
{
- cache_info->pixels=(Quantum *) AcquireAlignedMemory(1,length);
- cache_info->length=(MagickSizeType) length;
+ cache_info->length=length;
+ status=AcquireStreamPixels(cache_info,exception);
+ if (status == MagickFalse)
+ {
+ cache_info->length=0;
+ return((Quantum *) NULL);
+ }
}
else
- if (cache_info->length < (MagickSizeType) length)
+ if (cache_info->length < length)
{
- (void) RelinquishAlignedMemory(cache_info->pixels);
- cache_info->pixels=(Quantum *) AcquireAlignedMemory(1,length);
- cache_info->length=(MagickSizeType) length;
+ RelinquishStreamPixels(cache_info);
+ cache_info->length=length;
+ status=AcquireStreamPixels(cache_info,exception);
+ if (status == MagickFalse)
+ {
+ cache_info->length=0;
+ return((Quantum *) NULL);
+ }
}
- if (cache_info->pixels == (void *) NULL)
- return((Quantum *) NULL);
cache_info->metacontent=(void *) NULL;
if (cache_info->metacontent_extent != 0)
cache_info->metacontent=(void *) (cache_info->pixels+number_pixels*
Prepare stream for writing.
*/
(void) RelinquishAlignedMemory(stream_info->pixels);
- stream_info->pixels=(unsigned char *) AcquireAlignedMemory(length,
- sizeof(*stream_info->pixels));
+ stream_info->pixels=(unsigned char *) AcquireAlignedMemory(1,length);
if (stream_info->pixels == (unsigned char *) NULL)
return(0);
(void) ResetMagickMemory(stream_info->pixels,0,length);
if (quantum_map == (QuantumType *) NULL)
{
(void) ThrowMagickException(exception,GetMagickModule(),
- ResourceLimitError,"MemoryAllocationFailed","`%s'",image->filename);
+ ResourceLimitError,"MemoryAllocationFailed","'%s'",image->filename);
return(MagickFalse);
}
for (i=0; i < (ssize_t) length; i++)
break;
quantum_map=(QuantumType *) RelinquishMagickMemory(quantum_map);
(void) ThrowMagickException(exception,GetMagickModule(),ImageError,
- "ColorSeparatedImageRequired","`%s'",stream_info->map);
+ "ColorSeparatedImageRequired","'%s'",stream_info->map);
return(MagickFalse);
}
case 'g':
break;
quantum_map=(QuantumType *) RelinquishMagickMemory(quantum_map);
(void) ThrowMagickException(exception,GetMagickModule(),ImageError,
- "ColorSeparatedImageRequired","`%s'",stream_info->map);
+ "ColorSeparatedImageRequired","'%s'",stream_info->map);
return(MagickFalse);
}
case 'M':
break;
quantum_map=(QuantumType *) RelinquishMagickMemory(quantum_map);
(void) ThrowMagickException(exception,GetMagickModule(),ImageError,
- "ColorSeparatedImageRequired","`%s'",stream_info->map);
+ "ColorSeparatedImageRequired","'%s'",stream_info->map);
return(MagickFalse);
}
case 'o':
break;
quantum_map=(QuantumType *) RelinquishMagickMemory(quantum_map);
(void) ThrowMagickException(exception,GetMagickModule(),ImageError,
- "ColorSeparatedImageRequired","`%s'",stream_info->map);
+ "ColorSeparatedImageRequired","'%s'",stream_info->map);
return(MagickFalse);
}
default:
{
quantum_map=(QuantumType *) RelinquishMagickMemory(quantum_map);
(void) ThrowMagickException(exception,GetMagickModule(),OptionError,
- "UnrecognizedPixelMap","`%s'",stream_info->map);
+ "UnrecognizedPixelMap","'%s'",stream_info->map);
return(MagickFalse);
}
}
{
quantum_map=(QuantumType *) RelinquishMagickMemory(quantum_map);
(void) ThrowMagickException(exception,GetMagickModule(),OptionError,
- "UnrecognizedPixelMap","`%s'",stream_info->map);
+ "UnrecognizedPixelMap","'%s'",stream_info->map);
break;
}
}
if (stream_handler == (StreamHandler) NULL)
{
(void) ThrowMagickException(exception,GetMagickModule(),StreamError,
- "NoStreamHandlerIsDefined","`%s'",image->filename);
+ "NoStreamHandlerIsDefined","'%s'",image->filename);
return(MagickFalse);
}
length=stream_handler(image,cache_info->pixels,(size_t) cache_info->columns);