% March 2000 %
% %
% %
-% Copyright 1999-2009 ImageMagick Studio LLC, a non-profit organization %
+% Copyright 1999-2012 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 %
/*
Include declarations.
*/
-#include "magick/studio.h"
-#include "magick/artifact.h"
-#include "magick/blob.h"
-#include "magick/blob-private.h"
-#include "magick/cache.h"
-#include "magick/color.h"
-#include "magick/color-private.h"
-#include "magick/constitute.h"
-#include "magick/exception.h"
-#include "magick/exception-private.h"
-#include "magick/geometry.h"
-#include "magick/hashmap.h"
-#include "magick/image.h"
-#include "magick/image-private.h"
-#include "magick/list.h"
-#include "magick/magick.h"
-#include "magick/memory_.h"
-#include "magick/monitor.h"
-#include "magick/monitor-private.h"
-#include "magick/option.h"
-#include "magick/profile.h"
-#include "magick/property.h"
-#include "magick/quantum-private.h"
-#include "magick/static.h"
-#include "magick/statistic.h"
-#include "magick/string_.h"
-#include "magick/module.h"
-#include "magick/utility.h"
+#include "MagickCore/studio.h"
+#include "MagickCore/artifact.h"
+#include "MagickCore/attribute.h"
+#include "MagickCore/blob.h"
+#include "MagickCore/blob-private.h"
+#include "MagickCore/cache.h"
+#include "MagickCore/color.h"
+#include "MagickCore/color-private.h"
+#include "MagickCore/colormap.h"
+#include "MagickCore/constitute.h"
+#include "MagickCore/exception.h"
+#include "MagickCore/exception-private.h"
+#include "MagickCore/geometry.h"
+#include "MagickCore/hashmap.h"
+#include "MagickCore/image.h"
+#include "MagickCore/image-private.h"
+#include "MagickCore/list.h"
+#include "MagickCore/magick.h"
+#include "MagickCore/memory_.h"
+#include "MagickCore/module.h"
+#include "MagickCore/monitor.h"
+#include "MagickCore/monitor-private.h"
+#include "MagickCore/option.h"
+#include "MagickCore/profile.h"
+#include "MagickCore/property.h"
+#include "MagickCore/quantum-private.h"
+#include "MagickCore/static.h"
+#include "MagickCore/statistic.h"
+#include "MagickCore/string_.h"
+#include "MagickCore/string-private.h"
+#include "MagickCore/utility.h"
\f
/*
Forward declarations.
*/
static MagickBooleanType
- WriteMPCImage(const ImageInfo *,Image *);
+ WriteMPCImage(const ImageInfo *,Image *,ExceptionInfo *);
\f
/*
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
MagickStatusType
flags;
- register long
+ register ssize_t
i;
size_t
- length;
+ depth,
+ length,
+ quantum_depth;
ssize_t
count;
StringInfo
*profile;
- unsigned long
- depth,
- quantum_depth;
-
/*
Open image file.
*/
image_info->filename);
assert(exception != (ExceptionInfo *) NULL);
assert(exception->signature == MagickSignature);
- image=AcquireImage(image_info);
+ image=AcquireImage(image_info,exception);
status=OpenBlob(image_info,image,ReadBinaryBlobMode,exception);
if (status == MagickFalse)
{
for (p=comment; comment != (char *) NULL; p++)
{
c=ReadBlobByte(image);
- if ((c == EOF) || (c == (int) '}'))
- break;
+ if (c == (int) '\\')
+ c=ReadBlobByte(image);
+ else
+ if ((c == EOF) || (c == (int) '}'))
+ break;
if ((size_t) (p-comment+1) >= length)
{
*p='\0';
if (comment == (char *) NULL)
ThrowReaderException(ResourceLimitError,"MemoryAllocationFailed");
*p='\0';
- (void) SetImageProperty(image,"comment",comment);
+ (void) SetImageProperty(image,"comment",comment,exception);
comment=DestroyString(comment);
c=ReadBlobByte(image);
}
p=keyword;
do
{
- if (isspace((int) ((unsigned char) c)) != 0)
- break;
if (c == (int) '=')
break;
if ((size_t) (p-keyword) < (MaxTextExtent-1))
"MemoryAllocationFailed");
*p++=(char) c;
c=ReadBlobByte(image);
+ if (c == '\\')
+ {
+ c=ReadBlobByte(image);
+ if (c == (int) '}')
+ {
+ *p++=(char) c;
+ c=ReadBlobByte(image);
+ }
+ }
if (*options != '{')
if (isspace((int) ((unsigned char) c)) != 0)
break;
{
if (LocaleCompare(keyword,"background-color") == 0)
{
- (void) QueryColorDatabase(options,&image->background_color,
- exception);
+ (void) QueryColorCompliance(options,AllCompliance,
+ &image->background_color,exception);
break;
}
if (LocaleCompare(keyword,"blue-primary") == 0)
}
if (LocaleCompare(keyword,"border-color") == 0)
{
- (void) QueryColorDatabase(options,&image->border_color,
- exception);
+ (void) QueryColorCompliance(options,AllCompliance,
+ &image->border_color,exception);
break;
}
- (void) SetImageProperty(image,keyword,options);
+ (void) SetImageProperty(image,keyword,options,exception);
break;
}
case 'c':
{
if (LocaleCompare(keyword,"class") == 0)
{
- long
+ ssize_t
storage_class;
- storage_class=ParseMagickOption(MagickClassOptions,
+ storage_class=ParseCommandOption(MagickClassOptions,
MagickFalse,options);
if (storage_class < 0)
break;
}
if (LocaleCompare(keyword,"colors") == 0)
{
- image->colors=(unsigned long) atol(options);
+ image->colors=StringToUnsignedLong(options);
break;
}
if (LocaleCompare(keyword,"colorspace") == 0)
{
- long
+ ssize_t
colorspace;
- colorspace=ParseMagickOption(MagickColorspaceOptions,
+ colorspace=ParseCommandOption(MagickColorspaceOptions,
MagickFalse,options);
if (colorspace < 0)
break;
}
if (LocaleCompare(keyword,"compression") == 0)
{
- long
+ ssize_t
compression;
- compression=ParseMagickOption(MagickCompressOptions,
+ compression=ParseCommandOption(MagickCompressOptions,
MagickFalse,options);
if (compression < 0)
break;
}
if (LocaleCompare(keyword,"columns") == 0)
{
- image->columns=(unsigned long) atol(options);
+ image->columns=StringToUnsignedLong(options);
break;
}
- (void) SetImageProperty(image,keyword,options);
+ (void) SetImageProperty(image,keyword,options,exception);
break;
}
case 'd':
{
if (LocaleCompare(keyword,"delay") == 0)
{
- image->delay=(unsigned long) atol(options);
+ image->delay=StringToUnsignedLong(options);
break;
}
if (LocaleCompare(keyword,"depth") == 0)
{
- image->depth=(unsigned long) atol(options);
+ image->depth=StringToUnsignedLong(options);
break;
}
if (LocaleCompare(keyword,"dispose") == 0)
{
- long
+ ssize_t
dispose;
- dispose=ParseMagickOption(MagickDisposeOptions,MagickFalse,
+ dispose=ParseCommandOption(MagickDisposeOptions,MagickFalse,
options);
if (dispose < 0)
break;
image->dispose=(DisposeType) dispose;
break;
}
- (void) SetImageProperty(image,keyword,options);
+ (void) SetImageProperty(image,keyword,options,exception);
break;
}
case 'e':
{
if (LocaleCompare(keyword,"endian") == 0)
{
- long
+ ssize_t
endian;
- endian=ParseMagickOption(MagickEndianOptions,MagickFalse,
+ endian=ParseCommandOption(MagickEndianOptions,MagickFalse,
options);
if (endian < 0)
break;
}
if (LocaleCompare(keyword,"error") == 0)
{
- image->error.mean_error_per_pixel=atof(options);
+ image->error.mean_error_per_pixel=StringToDouble(options,
+ (char **) NULL);
break;
}
- (void) SetImageProperty(image,keyword,options);
+ (void) SetImageProperty(image,keyword,options,exception);
break;
}
case 'g':
{
if (LocaleCompare(keyword,"gamma") == 0)
{
- image->gamma=atof(options);
+ image->gamma=StringToDouble(options,(char **) NULL);
break;
}
if (LocaleCompare(keyword,"green-primary") == 0)
image->chromaticity.green_primary.x;
break;
}
- (void) SetImageProperty(image,keyword,options);
+ (void) SetImageProperty(image,keyword,options,exception);
break;
}
case 'i':
}
if (LocaleCompare(keyword,"iterations") == 0)
{
- image->iterations=(unsigned long) atol(options);
+ image->iterations=StringToUnsignedLong(options);
break;
}
- (void) SetImageProperty(image,keyword,options);
+ (void) SetImageProperty(image,keyword,options,exception);
break;
}
case 'm':
{
if (LocaleCompare(keyword,"matte") == 0)
{
- long
+ ssize_t
matte;
- matte=ParseMagickOption(MagickBooleanOptions,MagickFalse,
+ matte=ParseCommandOption(MagickBooleanOptions,MagickFalse,
options);
if (matte < 0)
break;
}
if (LocaleCompare(keyword,"matte-color") == 0)
{
- (void) QueryColorDatabase(options,&image->matte_color,
- exception);
+ (void) QueryColorCompliance(options,AllCompliance,
+ &image->matte_color,exception);
break;
}
if (LocaleCompare(keyword,"maximum-error") == 0)
{
- image->error.normalized_maximum_error=atof(options);
+ image->error.normalized_maximum_error=StringToDouble(
+ options,(char **) NULL);
break;
}
if (LocaleCompare(keyword,"mean-error") == 0)
{
- image->error.normalized_mean_error=atof(options);
+ image->error.normalized_mean_error=StringToDouble(options,
+ (char **) NULL);
break;
}
if (LocaleCompare(keyword,"montage") == 0)
(void) CloneString(&image->montage,options);
break;
}
- (void) SetImageProperty(image,keyword,options);
+ (void) SetImageProperty(image,keyword,options,exception);
break;
}
case 'o':
{
if (LocaleCompare(keyword,"opaque") == 0)
{
- long
+ ssize_t
matte;
- matte=ParseMagickOption(MagickBooleanOptions,MagickFalse,
+ matte=ParseCommandOption(MagickBooleanOptions,MagickFalse,
options);
if (matte < 0)
break;
}
if (LocaleCompare(keyword,"orientation") == 0)
{
- long
+ ssize_t
orientation;
- orientation=ParseMagickOption(MagickOrientationOptions,
+ orientation=ParseCommandOption(MagickOrientationOptions,
MagickFalse,options);
if (orientation < 0)
break;
image->orientation=(OrientationType) orientation;
break;
}
- (void) SetImageProperty(image,keyword,options);
+ (void) SetImageProperty(image,keyword,options,exception);
break;
}
case 'p':
profiles=NewLinkedList(0);
(void) AppendValueToLinkedList(profiles,
AcquireString(keyword+8));
- profile=AcquireStringInfo((size_t) atol(options));
- (void) SetImageProfile(image,keyword+8,profile);
+ profile=BlobToStringInfo((const void *) NULL,(size_t)
+ StringToLong(options));
+ if (profile == (StringInfo *) NULL)
+ ThrowReaderException(ResourceLimitError,
+ "MemoryAllocationFailed");
+ (void) SetImageProfile(image,keyword+8,profile,exception);
profile=DestroyStringInfo(profile);
break;
}
- (void) SetImageProperty(image,keyword,options);
+ (void) SetImageProperty(image,keyword,options,exception);
break;
}
case 'q':
{
if (LocaleCompare(keyword,"quality") == 0)
{
- image->quality=(unsigned long) atol(options);
+ image->quality=StringToUnsignedLong(options);
break;
}
if (LocaleCompare(keyword,"quantum-depth") == 0)
{
- quantum_depth=(unsigned long) atol(options);
+ quantum_depth=StringToUnsignedLong(options);
break;
}
- (void) SetImageProperty(image,keyword,options);
+ (void) SetImageProperty(image,keyword,options,exception);
break;
}
case 'r':
}
if (LocaleCompare(keyword,"rendering-intent") == 0)
{
- long
+ ssize_t
rendering_intent;
- rendering_intent=ParseMagickOption(MagickIntentOptions,
+ rendering_intent=ParseCommandOption(MagickIntentOptions,
MagickFalse,options);
if (rendering_intent < 0)
break;
if (LocaleCompare(keyword,"resolution") == 0)
{
flags=ParseGeometry(options,&geometry_info);
- image->x_resolution=geometry_info.rho;
- image->y_resolution=geometry_info.sigma;
+ image->resolution.x=geometry_info.rho;
+ image->resolution.y=geometry_info.sigma;
if ((flags & SigmaValue) == 0)
- image->y_resolution=image->x_resolution;
+ image->resolution.y=image->resolution.x;
break;
}
if (LocaleCompare(keyword,"rows") == 0)
{
- image->rows=(unsigned long) atol(options);
+ image->rows=StringToUnsignedLong(options);
break;
}
- (void) SetImageProperty(image,keyword,options);
+ (void) SetImageProperty(image,keyword,options,exception);
break;
}
case 's':
{
if (LocaleCompare(keyword,"scene") == 0)
{
- image->scene=(unsigned long) atol(options);
+ image->scene=StringToUnsignedLong(options);
break;
}
- (void) SetImageProperty(image,keyword,options);
+ (void) SetImageProperty(image,keyword,options,exception);
break;
}
case 't':
{
if (LocaleCompare(keyword,"ticks-per-second") == 0)
{
- image->ticks_per_second=(long) atol(options);
+ image->ticks_per_second=(ssize_t) StringToLong(options);
break;
}
if (LocaleCompare(keyword,"tile-offset") == 0)
}
if (LocaleCompare(keyword,"type") == 0)
{
- long
+ ssize_t
type;
- type=ParseMagickOption(MagickTypeOptions,MagickFalse,
+ type=ParseCommandOption(MagickTypeOptions,MagickFalse,
options);
if (type < 0)
break;
image->type=(ImageType) type;
break;
}
- (void) SetImageProperty(image,keyword,options);
+ (void) SetImageProperty(image,keyword,options,exception);
break;
}
case 'u':
{
if (LocaleCompare(keyword,"units") == 0)
{
- long
+ ssize_t
units;
- units=ParseMagickOption(MagickResolutionOptions,MagickFalse,
- options);
+ units=ParseCommandOption(MagickResolutionOptions,
+ MagickFalse,options);
if (units < 0)
break;
image->units=(ResolutionType) units;
break;
}
- (void) SetImageProperty(image,keyword,options);
+ (void) SetImageProperty(image,keyword,options,exception);
break;
}
case 'w':
image->chromaticity.white_point.x;
break;
}
- (void) SetImageProperty(image,keyword,options);
+ (void) SetImageProperty(image,keyword,options,exception);
break;
}
default:
{
- (void) SetImageProperty(image,keyword,options);
+ (void) SetImageProperty(image,keyword,options,exception);
break;
}
}
/*
Create image colormap.
*/
- if (AcquireImageColormap(image,image->colors) == MagickFalse)
+ if (AcquireImageColormap(image,image->colors,exception) == MagickFalse)
ThrowReaderException(ResourceLimitError,"MemoryAllocationFailed");
if (image->colors != 0)
{
unsigned char
pixel;
- for (i=0; i < (long) image->colors; i++)
+ for (i=0; i < (ssize_t) image->colors; i++)
{
p=PushCharPixel(p,&pixel);
image->colormap[i].red=ScaleCharToQuantum(pixel);
unsigned short
pixel;
- for (i=0; i < (long) image->colors; i++)
+ for (i=0; i < (ssize_t) image->colors; i++)
{
p=PushShortPixel(MSBEndian,p,&pixel);
image->colormap[i].red=ScaleShortToQuantum(pixel);
}
case 32:
{
- unsigned long
+ unsigned int
pixel;
- for (i=0; i < (long) image->colors; i++)
+ for (i=0; i < (ssize_t) image->colors; i++)
{
p=PushLongPixel(MSBEndian,p,&pixel);
image->colormap[i].red=ScaleLongToQuantum(pixel);
/*
Allocate next image structure.
*/
- AcquireNextImage(image_info,image);
+ AcquireNextImage(image_info,image,exception);
if (GetNextImageInList(image) == (Image *) NULL)
{
image=DestroyImageList(image);
%
% The format of the RegisterMPCImage method is:
%
-% unsigned long RegisterMPCImage(void)
+% size_t RegisterMPCImage(void)
%
*/
-ModuleExport unsigned long RegisterMPCImage(void)
+ModuleExport size_t RegisterMPCImage(void)
{
MagickInfo
*entry;
%
% The format of the WriteMPCImage method is:
%
-% MagickBooleanType WriteMPCImage(const ImageInfo *image_info,Image *image)
+% MagickBooleanType WriteMPCImage(const ImageInfo *image_info,
+% Image *image,ExceptionInfo *exception)
%
% A description of each parameter follows:
%
%
% o image: the image.
%
+% o exception: return any errors or warnings in this structure.
+%
*/
-static MagickBooleanType WriteMPCImage(const ImageInfo *image_info,Image *image)
+static MagickBooleanType WriteMPCImage(const ImageInfo *image_info,Image *image,
+ ExceptionInfo *exception)
{
char
buffer[MaxTextExtent],
offset,
scene;
- register long
+ register ssize_t
i;
- unsigned long
- depth;
+ size_t
+ depth,
+ one;
/*
Open persistent cache.
assert(image->signature == MagickSignature);
if (image->debug != MagickFalse)
(void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",image->filename);
- status=OpenBlob(image_info,image,WriteBinaryBlobMode,&image->exception);
+ assert(exception != (ExceptionInfo *) NULL);
+ assert(exception->signature == MagickSignature);
+ status=OpenBlob(image_info,image,WriteBinaryBlobMode,exception);
if (status == MagickFalse)
return(status);
(void) CopyMagickString(cache_filename,image->filename,MaxTextExtent);
AppendImageFormat("cache",cache_filename);
scene=0;
offset=0;
+ one=1;
do
{
/*
*/
depth=GetImageQuantumDepth(image,MagickTrue);
if ((image->storage_class == PseudoClass) &&
- (image->colors > (1UL << depth)))
+ (image->colors > (one << depth)))
image->storage_class=DirectClass;
(void) WriteBlobString(image,"id=MagickCache\n");
- (void) FormatMagickString(buffer,MaxTextExtent,"quantum-depth=%d\n",
+ (void) FormatLocaleString(buffer,MaxTextExtent,"quantum-depth=%d\n",
MAGICKCORE_QUANTUM_DEPTH);
(void) WriteBlobString(image,buffer);
- (void) FormatMagickString(buffer,MaxTextExtent,
- "class=%s colors=%lu matte=%s\n",MagickOptionToMnemonic(
- MagickClassOptions,image->storage_class),image->colors,
- MagickOptionToMnemonic(MagickBooleanOptions,(long) image->matte));
+ (void) FormatLocaleString(buffer,MaxTextExtent,
+ "class=%s colors=%.20g matte=%s\n",CommandOptionToMnemonic(
+ MagickClassOptions,image->storage_class),(double) image->colors,
+ CommandOptionToMnemonic(MagickBooleanOptions,(ssize_t) image->matte));
(void) WriteBlobString(image,buffer);
- (void) FormatMagickString(buffer,MaxTextExtent,
- "columns=%lu rows=%lu depth=%lu\n",image->columns,image->rows,
- image->depth);
+ (void) FormatLocaleString(buffer,MaxTextExtent,
+ "columns=%.20g rows=%.20g depth=%.20g\n",(double) image->columns,
+ (double) image->rows,(double) image->depth);
(void) WriteBlobString(image,buffer);
if (image->type != UndefinedType)
{
- (void) FormatMagickString(buffer,MaxTextExtent,"type=%s\n",
- MagickOptionToMnemonic(MagickTypeOptions,image->type));
+ (void) FormatLocaleString(buffer,MaxTextExtent,"type=%s\n",
+ CommandOptionToMnemonic(MagickTypeOptions,image->type));
(void) WriteBlobString(image,buffer);
}
if (image->colorspace != UndefinedColorspace)
{
- (void) FormatMagickString(buffer,MaxTextExtent,"colorspace=%s\n",
- MagickOptionToMnemonic(MagickColorspaceOptions,image->colorspace));
+ (void) FormatLocaleString(buffer,MaxTextExtent,"colorspace=%s\n",
+ CommandOptionToMnemonic(MagickColorspaceOptions,image->colorspace));
(void) WriteBlobString(image,buffer);
}
if (image->endian != UndefinedEndian)
{
- (void) FormatMagickString(buffer,MaxTextExtent,"endian=%s\n",
- MagickOptionToMnemonic(MagickEndianOptions,image->endian));
+ (void) FormatLocaleString(buffer,MaxTextExtent,"endian=%s\n",
+ CommandOptionToMnemonic(MagickEndianOptions,image->endian));
(void) WriteBlobString(image,buffer);
}
if (image->compression != UndefinedCompression)
{
- (void) FormatMagickString(buffer,MaxTextExtent,
- "compression=%s quality=%lu\n",MagickOptionToMnemonic(
- MagickCompressOptions,image->compression),image->quality);
+ (void) FormatLocaleString(buffer,MaxTextExtent,
+ "compression=%s quality=%.20g\n",CommandOptionToMnemonic(
+ MagickCompressOptions,image->compression),(double) image->quality);
(void) WriteBlobString(image,buffer);
}
if (image->units != UndefinedResolution)
{
- (void) FormatMagickString(buffer,MaxTextExtent,"units=%s\n",
- MagickOptionToMnemonic(MagickResolutionOptions,image->units));
+ (void) FormatLocaleString(buffer,MaxTextExtent,"units=%s\n",
+ CommandOptionToMnemonic(MagickResolutionOptions,image->units));
(void) WriteBlobString(image,buffer);
}
- if ((image->x_resolution != 0) || (image->y_resolution != 0))
+ if ((image->resolution.x != 0) || (image->resolution.y != 0))
{
- (void) FormatMagickString(buffer,MaxTextExtent,"resolution=%gx%g\n",
- image->x_resolution,image->y_resolution);
+ (void) FormatLocaleString(buffer,MaxTextExtent,
+ "resolution=%gx%g\n",image->resolution.x,image->resolution.y);
(void) WriteBlobString(image,buffer);
}
if ((image->page.width != 0) || (image->page.height != 0))
{
- (void) FormatMagickString(buffer,MaxTextExtent,"page=%lux%lu%+ld%+ld\n",
- image->page.width,image->page.height,image->page.x,image->page.y);
+ (void) FormatLocaleString(buffer,MaxTextExtent,
+ "page=%.20gx%.20g%+.20g%+.20g\n",(double) image->page.width,(double)
+ image->page.height,(double) image->page.x,(double) image->page.y);
(void) WriteBlobString(image,buffer);
}
else
if ((image->page.x != 0) || (image->page.y != 0))
{
- (void) FormatMagickString(buffer,MaxTextExtent,"page=%+ld%+ld\n",
- image->page.x,image->page.y);
+ (void) FormatLocaleString(buffer,MaxTextExtent,"page=%+ld%+ld\n",
+ (long) image->page.x,(long) image->page.y);
(void) WriteBlobString(image,buffer);
}
if ((image->page.x != 0) || (image->page.y != 0))
{
- (void) FormatMagickString(buffer,MaxTextExtent,"tile-offset=%+ld%+ld\n",
- image->tile_offset.x,image->tile_offset.y);
+ (void) FormatLocaleString(buffer,MaxTextExtent,"tile-offset=%+ld%+ld\n",
+ (long) image->tile_offset.x,(long) image->tile_offset.y);
(void) WriteBlobString(image,buffer);
}
if ((GetNextImageInList(image) != (Image *) NULL) ||
(GetPreviousImageInList(image) != (Image *) NULL))
{
if (image->scene == 0)
- (void) FormatMagickString(buffer,MaxTextExtent,
- "iterations=%lu delay=%lu ticks-per-second=%lu\n",
- image->iterations,image->delay,image->ticks_per_second);
- else
- (void) FormatMagickString(buffer,MaxTextExtent,
- "scene=%lu iterations=%lu delay=%lu ticks-per-second=%lu\n",
- image->scene,image->iterations,image->delay,
+ (void) FormatLocaleString(buffer,MaxTextExtent,
+ "iterations=%.20g delay=%.20g ticks-per-second=%.20g\n",(double)
+ image->iterations,(double) image->delay,(double)
image->ticks_per_second);
+ else
+ (void) FormatLocaleString(buffer,MaxTextExtent,"scene=%.20g "
+ "iterations=%.20g delay=%.20g ticks-per-second=%.20g\n",
+ (double) image->scene,(double) image->iterations,(double)
+ image->delay,(double) image->ticks_per_second);
(void) WriteBlobString(image,buffer);
}
else
{
if (image->scene != 0)
{
- (void) FormatMagickString(buffer,MaxTextExtent,"scene=%lu\n",
- image->scene);
+ (void) FormatLocaleString(buffer,MaxTextExtent,"scene=%.20g\n",
+ (double) image->scene);
(void) WriteBlobString(image,buffer);
}
if (image->iterations != 0)
{
- (void) FormatMagickString(buffer,MaxTextExtent,"iterations=%lu\n",
- image->iterations);
+ (void) FormatLocaleString(buffer,MaxTextExtent,"iterations=%.20g\n",
+ (double) image->iterations);
(void) WriteBlobString(image,buffer);
}
if (image->delay != 0)
{
- (void) FormatMagickString(buffer,MaxTextExtent,"delay=%lu\n",
- image->delay);
+ (void) FormatLocaleString(buffer,MaxTextExtent,"delay=%.20g\n",
+ (double) image->delay);
(void) WriteBlobString(image,buffer);
}
if (image->ticks_per_second != UndefinedTicksPerSecond)
{
- (void) FormatMagickString(buffer,MaxTextExtent,
- "ticks-per-second=%lu\n",image->ticks_per_second);
+ (void) FormatLocaleString(buffer,MaxTextExtent,
+ "ticks-per-second=%.20g\n",(double) image->ticks_per_second);
(void) WriteBlobString(image,buffer);
}
}
if (image->gravity != UndefinedGravity)
{
- (void) FormatMagickString(buffer,MaxTextExtent,"gravity=%s\n",
- MagickOptionToMnemonic(MagickGravityOptions,image->gravity));
+ (void) FormatLocaleString(buffer,MaxTextExtent,"gravity=%s\n",
+ CommandOptionToMnemonic(MagickGravityOptions,image->gravity));
(void) WriteBlobString(image,buffer);
}
if (image->dispose != UndefinedDispose)
{
- (void) FormatMagickString(buffer,MaxTextExtent,"dispose=%s\n",
- MagickOptionToMnemonic(MagickDisposeOptions,image->dispose));
+ (void) FormatLocaleString(buffer,MaxTextExtent,"dispose=%s\n",
+ CommandOptionToMnemonic(MagickDisposeOptions,image->dispose));
(void) WriteBlobString(image,buffer);
}
if (image->rendering_intent != UndefinedIntent)
{
- (void) FormatMagickString(buffer,MaxTextExtent,
- "rendering-intent=%s\n",
- MagickOptionToMnemonic(MagickIntentOptions,image->rendering_intent));
+ (void) FormatLocaleString(buffer,MaxTextExtent,
+ "rendering-intent=%s\n",CommandOptionToMnemonic(MagickIntentOptions,
+ image->rendering_intent));
(void) WriteBlobString(image,buffer);
}
if (image->gamma != 0.0)
{
- (void) FormatMagickString(buffer,MaxTextExtent,"gamma=%g\n",
+ (void) FormatLocaleString(buffer,MaxTextExtent,"gamma=%g\n",
image->gamma);
(void) WriteBlobString(image,buffer);
}
/*
Note chomaticity points.
*/
- (void) FormatMagickString(buffer,MaxTextExtent,
- "red-primary=%g,%g green-primary=%g,%g blue-primary=%g,%g\n",
+ (void) FormatLocaleString(buffer,MaxTextExtent,"red-primary="
+ "%g,%g green-primary=%g,%g blue-primary=%g,%g\n",
image->chromaticity.red_primary.x,image->chromaticity.red_primary.y,
image->chromaticity.green_primary.x,
image->chromaticity.green_primary.y,
image->chromaticity.blue_primary.x,
image->chromaticity.blue_primary.y);
(void) WriteBlobString(image,buffer);
- (void) FormatMagickString(buffer,MaxTextExtent,"white-point=%g,%g\n",
- image->chromaticity.white_point.x,image->chromaticity.white_point.y);
+ (void) FormatLocaleString(buffer,MaxTextExtent,
+ "white-point=%g,%g\n",image->chromaticity.white_point.x,
+ image->chromaticity.white_point.y);
(void) WriteBlobString(image,buffer);
}
if (image->orientation != UndefinedOrientation)
{
- (void) FormatMagickString(buffer,MaxTextExtent,
- "orientation=%s\n",MagickOptionToMnemonic(MagickOrientationOptions,
+ (void) FormatLocaleString(buffer,MaxTextExtent,
+ "orientation=%s\n",CommandOptionToMnemonic(MagickOrientationOptions,
image->orientation));
(void) WriteBlobString(image,buffer);
}
profile=GetImageProfile(image,name);
if (profile != (StringInfo *) NULL)
{
- (void) FormatMagickString(buffer,MaxTextExtent,"profile:%s=%lu\n",
- name,(unsigned long) GetStringInfoLength(profile));
+ (void) FormatLocaleString(buffer,MaxTextExtent,
+ "profile:%s=%.20g\n",name,(double)
+ GetStringInfoLength(profile));
(void) WriteBlobString(image,buffer);
}
name=GetNextImageProfile(image);
}
if (image->montage != (char *) NULL)
{
- (void) FormatMagickString(buffer,MaxTextExtent,"montage=%s\n",
+ (void) FormatLocaleString(buffer,MaxTextExtent,"montage=%s\n",
image->montage);
(void) WriteBlobString(image,buffer);
}
property=GetNextImageProperty(image);
while (property != (const char *) NULL)
{
- (void) FormatMagickString(buffer,MaxTextExtent,"%s=",property);
+ (void) FormatLocaleString(buffer,MaxTextExtent,"%s=",property);
(void) WriteBlobString(image,buffer);
- value=GetImageProperty(image,property);
+ value=GetImageProperty(image,property,exception);
if (value != (const char *) NULL)
{
- for (i=0; i < (long) strlen(value); i++)
+ for (i=0; i < (ssize_t) strlen(value); i++)
if (isspace((int) ((unsigned char) value[i])) != 0)
break;
- if (i <= (long) strlen(value))
- (void) WriteBlobByte(image,'{');
- (void) WriteBlob(image,strlen(value),(unsigned char *) value);
- if (i <= (long) strlen(value))
- (void) WriteBlobByte(image,'}');
+ if (i == (ssize_t) strlen(value))
+ (void) WriteBlob(image,strlen(value),(const unsigned char *) value);
+ else
+ {
+ (void) WriteBlobByte(image,'{');
+ for (i=0; i < (ssize_t) strlen(value); i++)
+ {
+ if (value[i] == (int) '}')
+ (void) WriteBlobByte(image,'\\');
+ (void) WriteBlobByte(image,value[i]);
+ }
+ (void) WriteBlobByte(image,'}');
+ }
}
(void) WriteBlobByte(image,'\n');
property=GetNextImageProperty(image);
Write colormap to file.
*/
q=colormap;
- for (i=0; i < (long) image->colors; i++)
+ for (i=0; i < (ssize_t) image->colors; i++)
{
switch (depth)
{
ThrowWriterException(CorruptImageError,"ImageDepthNotSupported");
case 32:
{
- unsigned long
+ unsigned int
pixel;
pixel=ScaleQuantumToLong(image->colormap[i].red);
Initialize persistent pixel cache.
*/
status=PersistPixelCache(image,cache_filename,MagickFalse,&offset,
- &image->exception);
+ exception);
if (status == MagickFalse)
ThrowWriterException(CacheError,"UnableToPersistPixelCache");
if (GetNextImageInList(image) == (Image *) NULL)