format[MaxTextExtent],
message[MaxTextExtent];
- (void) FormatMagickSize(length,MagickFalse,format);
+ (void) FormatMagickSize(length,MagickFalse,"B",format);
(void) FormatLocaleString(message,MaxTextExtent,
"extend %s (%s[%d], disk, %s)",cache_info->filename,
cache_info->cache_filename,cache_info->file,format);
}
if (image->debug != MagickFalse)
{
- (void) FormatMagickSize(cache_info->length,MagickTrue,format);
+ (void) FormatMagickSize(cache_info->length,MagickTrue,"B",
+ format);
type=CommandOptionToMnemonic(MagickCacheOptions,(ssize_t)
cache_info->type);
(void) FormatLocaleString(message,MaxTextExtent,
}
if (image->debug != MagickFalse)
{
- (void) FormatMagickSize(cache_info->length,MagickFalse,
+ (void) FormatMagickSize(cache_info->length,MagickFalse,"B",
format);
type=CommandOptionToMnemonic(MagickCacheOptions,(ssize_t)
cache_info->type);
}
if (image->debug != MagickFalse)
{
- (void) FormatMagickSize(cache_info->length,MagickTrue,format);
+ (void) FormatMagickSize(cache_info->length,MagickTrue,"B",
+ format);
type=CommandOptionToMnemonic(MagickCacheOptions,(ssize_t)
cache_info->type);
(void) FormatLocaleString(message,MaxTextExtent,
}
if (image->debug != MagickFalse)
{
- (void) FormatMagickSize(cache_info->length,MagickFalse,format);
+ (void) FormatMagickSize(cache_info->length,MagickFalse,"B",format);
type=CommandOptionToMnemonic(MagickCacheOptions,(ssize_t)
cache_info->type);
(void) FormatLocaleString(message,MaxTextExtent,
{
if (image->total_colors != 0)
{
- (void) FormatMagickSize(image->total_colors,MagickFalse,format);
+ (void) FormatMagickSize(image->total_colors,MagickFalse,"B",
+ format);
(void) FormatLocaleFile(file,"%s ",format);
}
}
image->error.normalized_maximum_error);
if (GetBlobSize(image) != 0)
{
- (void) FormatMagickSize(GetBlobSize(image),MagickFalse,format);
+ (void) FormatMagickSize(GetBlobSize(image),MagickFalse,"B",
+ format);
(void) FormatLocaleFile(file,"%s ",format);
}
(void) FormatLocaleFile(file,"%0.3fu %lu:%02lu.%03lu",user_time,
}
(void) FormatLocaleFile(file," Tainted: %s\n",CommandOptionToMnemonic(
MagickBooleanOptions,(ssize_t) image->taint));
- (void) FormatMagickSize(GetBlobSize(image),MagickFalse,format);
+ (void) FormatMagickSize(GetBlobSize(image),MagickFalse,"B",format);
(void) FormatLocaleFile(file," Filesize: %s\n",format);
(void) FormatMagickSize((MagickSizeType) image->columns*image->rows,
- MagickFalse,format);
+ MagickFalse,"B",format);
if (strlen(format) > 1)
format[strlen(format)-1]='\0';
(void) FormatLocaleFile(file," Number pixels: %s\n",format);
(void) FormatMagickSize((MagickSizeType) ((double) image->columns*image->rows/
- elapsed_time+0.5),MagickFalse,format);
+ elapsed_time+0.5),MagickFalse,"B",format);
(void) FormatLocaleFile(file," Pixels per second: %s\n",format);
(void) FormatLocaleFile(file," User time: %0.3fu\n",user_time);
(void) FormatLocaleFile(file," Elapsed time: %lu:%02lu.%03lu\n",
case 'b': /* image size read in - in bytes */
{
WarnNoImageReturn("\"%%%c\"",letter);
- (void) FormatLocaleString(value,MaxTextExtent,"%.20g",(double)
- ((MagickOffsetType) image->extent));
- if (image->extent != (MagickSizeType) ((size_t) image->extent))
- (void) FormatMagickSize(image->extent,MagickFalse,value);
- ConcatenateMagickString(value,"B",MaxTextExtent);
+ (void) FormatMagickSize(image->extent,MagickFalse,"B",value);
break;
}
case 'c': /* image comment property - empty string by default */
}
if (LocaleCompare("size",property) == 0)
{
- char
- format[MaxTextExtent];
-
WarnNoImageReturn("\"%%[%s]\"",property);
- (void) FormatMagickSize(GetBlobSize(image),MagickFalse,format);
- (void) FormatLocaleString(value,MaxTextExtent,"%sB",format);
+ (void) FormatMagickSize(GetBlobSize(image),MagickFalse,"B",value);
break;
}
if (LocaleCompare("skewness",property) == 0)
}
(void) FormatLocaleString(value,MaxTextExtent,"%.20g",(double)
attributes.st_mtime);
- (void) FormatMagickSize(GetBlobSize(image),MagickFalse,value);
+ (void) FormatMagickSize(GetBlobSize(image),MagickFalse,"B",value);
(void) ConcatenateMagickString(value,"B",MaxTextExtent);
(void) SetImageProperty(thumbnail_image,"Thumb::Size",value,exception);
(void) FormatLocaleString(value,MaxTextExtent,"image/%s",image->magick);
limit;
status=MagickFalse;
- (void) FormatMagickSize(size,MagickFalse,resource_request);
+ (void) FormatMagickSize(size,MagickFalse,"B",resource_request);
if (resource_semaphore == (SemaphoreInfo *) NULL)
ActivateSemaphoreInfo(&resource_semaphore);
LockSemaphoreInfo(resource_semaphore);
status=(resource_info.area_limit == MagickResourceInfinity) ||
(size < limit) ? MagickTrue : MagickFalse;
(void) FormatMagickSize((MagickSizeType) resource_info.area,MagickFalse,
- resource_current);
+ "B",resource_current);
(void) FormatMagickSize(resource_info.area_limit,MagickFalse,
- resource_limit);
+ "B",resource_limit);
break;
}
case MemoryResource:
((MagickSizeType) resource_info.memory < limit) ? MagickTrue :
MagickFalse;
(void) FormatMagickSize((MagickSizeType) resource_info.memory,MagickTrue,
- resource_current);
+ "B",resource_current);
(void) FormatMagickSize(resource_info.memory_limit,MagickTrue,
- resource_limit);
+ "B",resource_limit);
break;
}
case MapResource:
status=(resource_info.map_limit == MagickResourceInfinity) ||
((MagickSizeType) resource_info.map < limit) ? MagickTrue : MagickFalse;
(void) FormatMagickSize((MagickSizeType) resource_info.map,MagickTrue,
- resource_current);
+ "B",resource_current);
(void) FormatMagickSize(resource_info.map_limit,MagickTrue,
- resource_limit);
+ "B",resource_limit);
break;
}
case DiskResource:
((MagickSizeType) resource_info.disk < limit) ? MagickTrue :
MagickFalse;
(void) FormatMagickSize((MagickSizeType) resource_info.disk,MagickTrue,
- resource_current);
+ "B",resource_current);
(void) FormatMagickSize(resource_info.disk_limit,MagickTrue,
- resource_limit);
+ "B",resource_limit);
break;
}
case FileResource:
((MagickSizeType) resource_info.file < limit) ?
MagickTrue : MagickFalse;
(void) FormatMagickSize((MagickSizeType) resource_info.file,MagickFalse,
- resource_current);
+ "B",resource_current);
(void) FormatMagickSize((MagickSizeType) resource_info.file_limit,
- MagickFalse,resource_limit);
+ MagickFalse,"B",resource_limit);
break;
}
case HeightResource:
status=(resource_info.area_limit == MagickResourceInfinity) ||
(size < limit) ? MagickTrue : MagickFalse;
(void) FormatMagickSize((MagickSizeType) resource_info.height,MagickFalse,
- resource_current);
+ "P",resource_current);
(void) FormatMagickSize(resource_info.height_limit,MagickFalse,
- resource_limit);
+ "P",resource_limit);
break;
}
case ThreadResource:
((MagickSizeType) resource_info.thread < limit) ?
MagickTrue : MagickFalse;
(void) FormatMagickSize((MagickSizeType) resource_info.thread,MagickFalse,
- resource_current);
+ "B",resource_current);
(void) FormatMagickSize((MagickSizeType) resource_info.thread_limit,
- MagickFalse,resource_limit);
+ MagickFalse,"B",resource_limit);
break;
}
case ThrottleResource:
((MagickSizeType) resource_info.throttle < limit) ?
MagickTrue : MagickFalse;
(void) FormatMagickSize((MagickSizeType) resource_info.throttle,
- MagickFalse,resource_current);
+ MagickFalse,"B",resource_current);
(void) FormatMagickSize((MagickSizeType) resource_info.throttle_limit,
- MagickFalse,resource_limit);
+ MagickFalse,"B",resource_limit);
break;
}
case TimeResource:
((MagickSizeType) resource_info.time < limit) ?
MagickTrue : MagickFalse;
(void) FormatMagickSize((MagickSizeType) resource_info.time,MagickFalse,
- resource_current);
+ "B",resource_current);
(void) FormatMagickSize((MagickSizeType) resource_info.time_limit,
- MagickFalse,resource_limit);
+ MagickFalse,"B",resource_limit);
break;
}
case WidthResource:
status=(resource_info.area_limit == MagickResourceInfinity) ||
(size < limit) ? MagickTrue : MagickFalse;
(void) FormatMagickSize((MagickSizeType) resource_info.width,MagickFalse,
- resource_current);
+ "P",resource_current);
(void) FormatMagickSize(resource_info.width_limit,MagickFalse,
- resource_limit);
+ "P",resource_limit);
break;
}
default:
if (resource_semaphore == (SemaphoreInfo *) NULL)
ActivateSemaphoreInfo(&resource_semaphore);
LockSemaphoreInfo(resource_semaphore);
- (void) FormatMagickSize(resource_info.width_limit,MagickFalse,width_limit);
- (void) FormatMagickSize(resource_info.height_limit,MagickFalse,height_limit);
- (void) FormatMagickSize(resource_info.area_limit,MagickFalse,area_limit);
- (void) FormatMagickSize(resource_info.memory_limit,MagickTrue,memory_limit);
- (void) FormatMagickSize(resource_info.map_limit,MagickTrue,map_limit);
+ (void) FormatMagickSize(resource_info.width_limit,MagickFalse,"P",
+ width_limit);
+ (void) FormatMagickSize(resource_info.height_limit,MagickFalse,"P",
+ height_limit);
+ (void) FormatMagickSize(resource_info.area_limit,MagickFalse,"B",area_limit);
+ (void) FormatMagickSize(resource_info.memory_limit,MagickTrue,"B",
+ memory_limit);
+ (void) FormatMagickSize(resource_info.map_limit,MagickTrue,"B",map_limit);
(void) CopyMagickString(disk_limit,"unlimited",MaxTextExtent);
if (resource_info.disk_limit != MagickResourceInfinity)
- (void) FormatMagickSize(resource_info.disk_limit,MagickTrue,disk_limit);
+ (void) FormatMagickSize(resource_info.disk_limit,MagickTrue,"B",disk_limit);
(void) CopyMagickString(time_limit,"unlimited",MaxTextExtent);
if (resource_info.time_limit != MagickResourceInfinity)
(void) FormatLocaleString(time_limit,MaxTextExtent,"%.20g",(double)
resource_limit[MaxTextExtent],
resource_request[MaxTextExtent];
- (void) FormatMagickSize(size,MagickFalse,resource_request);
+ (void) FormatMagickSize(size,MagickFalse,"B",resource_request);
if (resource_semaphore == (SemaphoreInfo *) NULL)
ActivateSemaphoreInfo(&resource_semaphore);
LockSemaphoreInfo(resource_semaphore);
{
resource_info.width=(MagickOffsetType) size;
(void) FormatMagickSize((MagickSizeType) resource_info.width,MagickFalse,
- resource_current);
+ "P",resource_current);
(void) FormatMagickSize(resource_info.width_limit,MagickFalse,
- resource_limit);
+ "P",resource_limit);
break;
}
case HeightResource:
{
resource_info.width=(MagickOffsetType) size;
(void) FormatMagickSize((MagickSizeType) resource_info.width,MagickFalse,
- resource_current);
+ "P",resource_current);
(void) FormatMagickSize(resource_info.width_limit,MagickFalse,
- resource_limit);
+ "P",resource_limit);
break;
}
case AreaResource:
{
resource_info.area=(MagickOffsetType) size;
(void) FormatMagickSize((MagickSizeType) resource_info.area,MagickFalse,
- resource_current);
+ "B",resource_current);
(void) FormatMagickSize(resource_info.area_limit,MagickFalse,
- resource_limit);
+ "B",resource_limit);
break;
}
case MemoryResource:
{
resource_info.memory-=size;
(void) FormatMagickSize((MagickSizeType) resource_info.memory,
- MagickTrue,resource_current);
+ MagickTrue,"B",resource_current);
(void) FormatMagickSize(resource_info.memory_limit,MagickTrue,
- resource_limit);
+ "B",resource_limit);
break;
}
case MapResource:
{
resource_info.map-=size;
(void) FormatMagickSize((MagickSizeType) resource_info.map,MagickTrue,
- resource_current);
+ "B",resource_current);
(void) FormatMagickSize(resource_info.map_limit,MagickTrue,
- resource_limit);
+ "B",resource_limit);
break;
}
case DiskResource:
{
resource_info.disk-=size;
(void) FormatMagickSize((MagickSizeType) resource_info.disk,MagickTrue,
- resource_current);
+ "B",resource_current);
(void) FormatMagickSize(resource_info.disk_limit,MagickTrue,
- resource_limit);
+ "B",resource_limit);
break;
}
case FileResource:
{
resource_info.file-=size;
(void) FormatMagickSize((MagickSizeType) resource_info.file,MagickFalse,
- resource_current);
+ "B",resource_current);
(void) FormatMagickSize((MagickSizeType) resource_info.file_limit,
- MagickFalse,resource_limit);
+ MagickFalse,"B",resource_limit);
break;
}
case ThreadResource:
{
(void) FormatMagickSize((MagickSizeType) resource_info.thread,MagickFalse,
- resource_current);
+ "B",resource_current);
(void) FormatMagickSize((MagickSizeType) resource_info.thread_limit,
- MagickFalse,resource_limit);
+ MagickFalse,"B",resource_limit);
break;
}
case ThrottleResource:
{
(void) FormatMagickSize((MagickSizeType) resource_info.throttle,
- MagickFalse,resource_current);
+ MagickFalse,"B",resource_current);
(void) FormatMagickSize((MagickSizeType) resource_info.throttle_limit,
- MagickFalse,resource_limit);
+ MagickFalse,"B",resource_limit);
break;
}
case TimeResource:
{
resource_info.time-=size;
(void) FormatMagickSize((MagickSizeType) resource_info.time,MagickFalse,
- resource_current);
+ "B",resource_current);
(void) FormatMagickSize((MagickSizeType) resource_info.time_limit,
- MagickFalse,resource_limit);
+ MagickFalse,"B",resource_limit);
break;
}
default:
%
% The format of the FormatMagickSize method is:
%
-% ssize_t FormatMagickSize(const MagickSizeType size,char *format)
+% ssize_t FormatMagickSize(const MagickSizeType size,const char *suffix,
+^ char *format)
%
% A description of each parameter follows:
%
%
% o bi: use power of two rather than power of ten.
%
+% o suffix: append suffix, typically B or P.
+%
% o format: human readable format.
%
*/
MagickExport ssize_t FormatMagickSize(const MagickSizeType size,
- const MagickBooleanType bi,char *format)
+ const MagickBooleanType bi,const char *suffix,char *format)
{
const char
**units;
count=0;
for (j=2; j < 12; j++)
{
- count=FormatLocaleString(format,MaxTextExtent,"%.*g%sB",(int) (i+j),length,
- units[i]);
+ if (suffix == (const char *) NULL)
+ count=FormatLocaleString(format,MaxTextExtent,"%.*g%s",(int) (i+j),
+ length,units[i]);
+ else
+ count=FormatLocaleString(format,MaxTextExtent,"%.*g%s%s",(int) (i+j),
+ length,units[i],suffix);
if (strchr(format,'+') == (char *) NULL)
break;
}
}
}
}
- if (*q == 'B')
+ if ((*q == 'B') || (*q == 'P'))
q++;
}
if (sentinal != (char **) NULL)
GetStringInfoLength(const StringInfo *);
extern MagickExport ssize_t
- FormatMagickSize(const MagickSizeType,const MagickBooleanType,char *),
+ FormatMagickSize(const MagickSizeType,const MagickBooleanType,const char *,
+ char *),
FormatMagickTime(const time_t,const size_t,char *);
extern MagickExport StringInfo
}
(void) FormatLocaleFile(file," Tainted: %s\n",CommandOptionToMnemonic(
MagickBooleanOptions,(ssize_t) image->taint));
- (void) FormatMagickSize(GetBlobSize(image),MagickFalse,format);
+ (void) FormatMagickSize(GetBlobSize(image),MagickFalse,"B",format);
(void) FormatLocaleFile(file," Filesize: %s\n",format);
(void) FormatMagickSize((MagickSizeType) image->columns*image->rows,
- MagickFalse,format);
+ MagickFalse,"B",format);
if (strlen(format) > 1)
format[strlen(format)-1]='\0';
(void) FormatLocaleFile(file," Number pixels: %s\n",format);
(void) FormatMagickSize((MagickSizeType) ((double) image->columns*image->rows/
- elapsed_time+0.5),MagickFalse,format);
+ elapsed_time+0.5),MagickFalse,"B",format);
(void) FormatLocaleFile(file," Pixels per second: %s\n",format);
(void) FormatLocaleFile(file," User time: %0.3fu\n",user_time);
(void) FormatLocaleFile(file," Elapsed time: %lu:%02lu.%03lu\n",
<!-- <policy domain="resource" name="temporary-path" value="/tmp"/> -->
<!-- <policy domain="resource" name="memory" value="2GiB"/> -->
<!-- <policy domain="resource" name="map" value="4GiB"/> -->
- <!-- <policy domain="resource" name="width" value="1GB"/> -->
- <!-- <policy domain="resource" name="height" value="1GB"/> -->
+ <!-- <policy domain="resource" name="width" value="100MP"/> -->
+ <!-- <policy domain="resource" name="height" value="100MP"/> -->
<!-- <policy domain="resource" name="area" value="1GB"/> -->
<!-- <policy domain="resource" name="disk" value="16EB"/> -->
<!-- <policy domain="resource" name="file" value="768"/> -->