CacheInfo *magick_restrict clone_info,CacheInfo *magick_restrict cache_info,
ExceptionInfo *exception)
{
-#define MaxCacheThreads GetMagickResourceLimit(ThreadResource)
+#define MaxCacheThreads ((size_t) GetMagickResourceLimit(ThreadResource))
#define cache_number_threads(source,destination,chunk,multithreaded) \
num_threads((multithreaded) == 0 ? 1 : \
(((source)->type != MemoryCache) && \
if ((status != MagickFalse) && (length == (MagickSizeType) ((size_t) length)))
{
status=AcquireMagickResource(MemoryResource,cache_info->length);
- if (((cache_info->type == UndefinedCache) && (status != MagickFalse)) ||
- (cache_info->type == MemoryCache))
+ if ((cache_info->type == UndefinedCache) && (status != MagickFalse))
{
status=MagickTrue;
if (cache_anonymous_memory <= 0)
}
}
}
- /*
- Create pixel cache on disk.
- */
- status=AcquireMagickResource(DiskResource,cache_info->length);
- if ((status == MagickFalse) || (cache_info->type == DistributedCache))
+ if (cache_info->type == DistributedCache)
{
DistributeCacheInfo
*server_info;
- if (cache_info->type == DistributedCache)
- RelinquishMagickResource(DiskResource,cache_info->length);
+ /*
+ Distribute the pixel cache to a remote server.
+ */
server_info=AcquireDistributeCacheInfo(exception);
if (server_info != (DistributeCacheInfo *) NULL)
{
"CacheResourcesExhausted","`%s'",image->filename);
return(MagickFalse);
}
+ /*
+ Create pixel cache on disk.
+ */
+ status=AcquireMagickResource(DiskResource,cache_info->length);
+ if (status == MagickFalse)
+ {
+ cache_info->type=UndefinedCache;
+ (void) ThrowMagickException(exception,GetMagickModule(),CacheError,
+ "CacheResourcesExhausted","`%s'",image->filename);
+ return(MagickFalse);
+ }
if ((source_info.storage_class != UndefinedClass) && (mode != ReadMode) &&
(cache_info->mode != PersistMode))
{
/*
Clone persistent pixel cache.
*/
+ status=AcquireMagickResource(DiskResource,cache_info->length);
+ if (status == MagickFalse)
+ {
+ (void) ThrowMagickException(exception,GetMagickModule(),CacheError,
+ "CacheResourcesExhausted","`%s'",image->filename);
+ return(MagickFalse);
+ }
clone_info=(CacheInfo *) ClonePixelCache(cache_info);
clone_info->type=DiskCache;
(void) CopyMagickString(clone_info->cache_filename,filename,MagickPathExtent);
status=MagickTrue;
else
resource_info.memory-=(MagickOffsetType) size;
- assert(resource_info.memory >= 0);
if (logging != MagickFalse)
{
(void) FormatMagickSize(size,MagickTrue,"B",MagickFormatExtent,
status=MagickTrue;
else
resource_info.map-=(MagickOffsetType) size;
- assert(resource_info.map >= 0);
if (logging != MagickFalse)
{
(void) FormatMagickSize(size,MagickTrue,"B",MagickFormatExtent,
status=MagickTrue;
else
resource_info.disk-=(MagickOffsetType) size;
- assert(resource_info.disk >= 0);
if (logging != MagickFalse)
{
(void) FormatMagickSize(size,MagickTrue,"B",MagickFormatExtent,
status=MagickTrue;
else
resource_info.file-=(MagickOffsetType) size;
- assert(resource_info.file >= 0);
if (logging != MagickFalse)
{
(void) FormatMagickSize(size,MagickFalse,(const char *) NULL,
status=MagickTrue;
else
resource_info.time-=(MagickOffsetType) size;
- assert(resource_info.time >= 0);
if (logging != MagickFalse)
{
(void) FormatMagickSize(size,MagickFalse,(const char *) NULL,
case MemoryResource:
{
resource_info.memory-=size;
+ assert(resource_info.memory >= 0);
if (logging != MagickFalse)
{
(void) FormatMagickSize(size,MagickFalse,"B",MagickFormatExtent,
case MapResource:
{
resource_info.map-=size;
+ assert(resource_info.map >= 0);
if (logging != MagickFalse)
{
(void) FormatMagickSize(size,MagickFalse,"B",MagickFormatExtent,
case DiskResource:
{
resource_info.disk-=size;
+ assert(resource_info.disk >= 0);
if (logging != MagickFalse)
{
(void) FormatMagickSize(size,MagickFalse,"B",MagickFormatExtent,
case FileResource:
{
resource_info.file-=size;
+ assert(resource_info.file >= 0);
if (logging != MagickFalse)
{
(void) FormatMagickSize(size,MagickFalse,(const char *) NULL,
case TimeResource:
{
resource_info.time-=size;
+ assert(resource_info.time >= 0);
if (logging != MagickFalse)
{
(void) FormatMagickSize(size,MagickFalse,(const char *) NULL,