% March 2000 %
% %
% %
-% Copyright 1999-2015 ImageMagick Studio LLC, a non-profit organization %
+% Copyright 1999-2017 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 %
% obtain a copy of the License at %
% %
-% http://www.imagemagick.org/script/license.php %
+% https://www.imagemagick.org/script/license.php %
% %
% Unless required by applicable law or agreed to in writing, software %
% distributed under the License is distributed on an "AS IS" BASIS, %
#include "MagickCore/monitor.h"
#include "MagickCore/montage.h"
#include "MagickCore/option.h"
+#include "MagickCore/policy.h"
#include "MagickCore/profile.h"
#include "MagickCore/property.h"
#include "MagickCore/quantum.h"
#include "MagickCore/xml-tree.h"
#include "MagickCore/xml-tree-private.h"
#if defined(MAGICKCORE_LCMS_DELEGATE)
-#if defined(MAGICKCORE_HAVE_LCMS_LCMS2_H)
-#include <lcms/lcms2.h>
+#if defined(MAGICKCORE_HAVE_LCMS2_LCMS2_H)
+#include <lcms2/lcms2.h>
#elif defined(MAGICKCORE_HAVE_LCMS2_H)
#include "lcms2.h"
#elif defined(MAGICKCORE_HAVE_LCMS_LCMS_H)
const Image *clone_image)
{
assert(image != (Image *) NULL);
- assert(image->signature == MagickSignature);
+ assert(image->signature == MagickCoreSignature);
if (image->debug != MagickFalse)
(void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",image->filename);
assert(clone_image != (const Image *) NULL);
- assert(clone_image->signature == MagickSignature);
- if( IfMagickTrue(clone_image->debug) )
+ assert(clone_image->signature == MagickCoreSignature);
+ if (clone_image->debug != MagickFalse)
(void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",
clone_image->filename);
- (void) CopyMagickString(image->filename,clone_image->filename,MaxTextExtent);
+ (void) CopyMagickString(image->filename,clone_image->filename,
+ MagickPathExtent);
(void) CopyMagickString(image->magick_filename,clone_image->magick_filename,
- MaxTextExtent);
+ MagickPathExtent);
image->compression=clone_image->compression;
image->quality=clone_image->quality;
image->depth=clone_image->depth;
+ image->matte_color=clone_image->matte_color;
image->background_color=clone_image->background_color;
image->border_color=clone_image->border_color;
- image->matte_color=clone_image->matte_color;
image->transparent_color=clone_image->transparent_color;
image->gamma=clone_image->gamma;
image->chromaticity=clone_image->chromaticity;
%
% DefineImageProperty() associates an assignment string of the form
% "key=value" with an artifact or options. It is equivelent to
-% SetImageProperty()
+% SetImageProperty().
%
% The format of the DefineImageProperty method is:
%
const char *property,ExceptionInfo *exception)
{
char
- key[MaxTextExtent],
- value[MaxTextExtent];
+ key[MagickPathExtent],
+ value[MagickPathExtent];
register char
*p;
assert(image != (Image *) NULL);
assert(property != (const char *) NULL);
- (void) CopyMagickString(key,property,MaxTextExtent-1);
+ (void) CopyMagickString(key,property,MagickPathExtent-1);
for (p=key; *p != '\0'; p++)
if (*p == '=')
break;
*value='\0';
if (*p == '=')
- (void) CopyMagickString(value,p+1,MaxTextExtent);
+ (void) CopyMagickString(value,p+1,MagickPathExtent);
*p='\0';
return(SetImageProperty(image,key,value,exception));
}
const char *property)
{
assert(image != (Image *) NULL);
- assert(image->signature == MagickSignature);
+ assert(image->signature == MagickCoreSignature);
if (image->debug != MagickFalse)
- (void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",
- image->filename);
+ (void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",image->filename);
if (image->properties == (void *) NULL)
return(MagickFalse);
return(DeleteNodeFromSplayTree((SplayTreeInfo *) image->properties,property));
MagickExport void DestroyImageProperties(Image *image)
{
assert(image != (Image *) NULL);
- assert(image->signature == MagickSignature);
+ assert(image->signature == MagickCoreSignature);
if (image->debug != MagickFalse)
- (void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",
- image->filename);
+ (void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",image->filename);
if (image->properties != (void *) NULL)
image->properties=(void *) DestroySplayTree((SplayTreeInfo *)
image->properties);
const char *property,const char *format,...)
{
char
- value[MaxTextExtent];
+ value[MagickPathExtent];
ExceptionInfo
*exception;
operands;
va_start(operands,format);
- n=FormatLocaleStringList(value,MaxTextExtent,format,operands);
+ n=FormatLocaleStringList(value,MagickPathExtent,format,operands);
(void) n;
va_end(operands);
exception=AcquireExceptionInfo();
*/
static char
- *TracePSClippath(const unsigned char *,size_t,const size_t,
- const size_t),
+ *TracePSClippath(const unsigned char *,size_t),
*TraceSVGClippath(const unsigned char *,size_t,const size_t,
const size_t);
return(c);
}
-static inline size_t ReadPropertyMSBLong(const unsigned char **p,
+static inline signed int ReadPropertyMSBLong(const unsigned char **p,
size_t *length)
{
+ union
+ {
+ unsigned int
+ unsigned_value;
+
+ signed int
+ signed_value;
+ } quantum;
+
int
c;
unsigned char
buffer[4];
- size_t
+ unsigned int
value;
if (*length < 4)
- return(~0UL);
+ return(-1);
for (i=0; i < 4; i++)
{
c=(int) (*(*p)++);
(*length)--;
buffer[i]=(unsigned char) c;
}
- value=(size_t) (buffer[0] << 24);
- value|=buffer[1] << 16;
- value|=buffer[2] << 8;
- value|=buffer[3];
- return(value & 0xffffffff);
+ value=(unsigned int) buffer[0] << 24;
+ value|=(unsigned int) buffer[1] << 16;
+ value|=(unsigned int) buffer[2] << 8;
+ value|=(unsigned int) buffer[3];
+ quantum.unsigned_value=value & 0xffffffff;
+ return(quantum.signed_value);
}
-static inline unsigned short ReadPropertyMSBShort(const unsigned char **p,
+static inline signed short ReadPropertyMSBShort(const unsigned char **p,
size_t *length)
{
+ union
+ {
+ unsigned short
+ unsigned_value;
+
+ signed short
+ signed_value;
+ } quantum;
+
int
c;
(*length)--;
buffer[i]=(unsigned char) c;
}
- value=(unsigned short) (buffer[0] << 8);
- value|=buffer[1];
- return((unsigned short) (value & 0xffff));
+ value=(unsigned short) buffer[0] << 8;
+ value|=(unsigned short) buffer[1];
+ quantum.unsigned_value=value & 0xffff;
+ return(quantum.signed_value);
}
static MagickBooleanType Get8BIMProperty(const Image *image,const char *key,
{
char
*attribute,
- format[MaxTextExtent],
- name[MaxTextExtent],
+ format[MagickPathExtent],
+ name[MagickPathExtent],
*resource;
const StringInfo
register ssize_t
i;
+ size_t
+ length;
+
ssize_t
count,
id,
sub_number;
- size_t
- length;
-
/*
There are no newlines in path names, so it's safe as terminator.
*/
profile=GetImageProfile(image,"8bim");
if (profile == (StringInfo *) NULL)
return(MagickFalse);
- count=(ssize_t) sscanf(key,"8BIM:%ld,%ld:%[^\n]\n%[^\n]",&start,&stop,name,
- format);
+ count=(ssize_t) sscanf(key,"8BIM:%ld,%ld:%1024[^\n]\n%1024[^\n]",&start,&stop,
+ name,format);
if ((count != 2) && (count != 3) && (count != 4))
return(MagickFalse);
if (count < 4)
- (void) CopyMagickString(format,"SVG",MaxTextExtent);
+ (void) CopyMagickString(format,"SVG",MagickPathExtent);
if (count < 3)
*name='\0';
sub_number=1;
status=MagickFalse;
length=GetStringInfoLength(profile);
info=GetStringInfoDatum(profile);
- while ((length > 0) && IfMagickFalse(status))
+ while ((length > 0) && (status == MagickFalse))
{
if (ReadPropertyByte(&info,&length) != (unsigned char) '8')
continue;
continue;
if (ReadPropertyByte(&info,&length) != (unsigned char) 'M')
continue;
- id=(ssize_t) ((int) ReadPropertyMSBShort(&info,&length));
+ id=(ssize_t) ReadPropertyMSBShort(&info,&length);
if (id < (ssize_t) start)
continue;
if (id > (ssize_t) stop)
if ((count != 0) && ((size_t) count <= length))
{
resource=(char *) NULL;
- if (~((size_t) count) >= (MaxTextExtent-1))
- resource=(char *) AcquireQuantumMemory((size_t) count+MaxTextExtent,
- sizeof(*resource));
+ if (~((size_t) count) >= (MagickPathExtent-1))
+ resource=(char *) AcquireQuantumMemory((size_t) count+
+ MagickPathExtent,sizeof(*resource));
if (resource != (char *) NULL)
{
for (i=0; i < (ssize_t) count; i++)
}
if ((count & 0x01) == 0)
(void) ReadPropertyByte(&info,&length);
- count=(ssize_t) ((int) ReadPropertyMSBLong(&info,&length));
+ count=(ssize_t) ReadPropertyMSBLong(&info,&length);
+ if ((count < 0) || ((size_t) count > length))
+ {
+ length=0;
+ continue;
+ }
if ((*name != '\0') && (*name != '#'))
if ((resource == (char *) NULL) || (LocaleCompare(name,resource) != 0))
{
We have the resource of interest.
*/
attribute=(char *) NULL;
- if (~((size_t) count) >= (MaxTextExtent-1))
- attribute=(char *) AcquireQuantumMemory((size_t) count+MaxTextExtent,
+ if (~((size_t) count) >= (MagickPathExtent-1))
+ attribute=(char *) AcquireQuantumMemory((size_t) count+MagickPathExtent,
sizeof(*attribute));
if (attribute != (char *) NULL)
{
info+=count;
length-=MagickMin(count,(ssize_t) length);
if ((id <= 1999) || (id >= 2999))
- (void) SetImageProperty((Image *) image,key,(const char *)
- attribute,exception);
+ (void) SetImageProperty((Image *) image,key,(const char *) attribute,
+ exception);
else
{
char
path=TraceSVGClippath((unsigned char *) attribute,(size_t) count,
image->columns,image->rows);
else
- path=TracePSClippath((unsigned char *) attribute,(size_t) count,
- image->columns,image->rows);
+ path=TracePSClippath((unsigned char *) attribute,(size_t) count);
(void) SetImageProperty((Image *) image,key,(const char *) path,
exception);
path=DestroyString(path);
return(status);
}
-static inline unsigned short ReadPropertyShort(const EndianType endian,
+static inline signed int ReadPropertySignedLong(const EndianType endian,
+ const unsigned char *buffer)
+{
+ union
+ {
+ unsigned int
+ unsigned_value;
+
+ signed int
+ signed_value;
+ } quantum;
+
+ unsigned int
+ value;
+
+ if (endian == LSBEndian)
+ {
+ value=(unsigned int) buffer[3] << 24;
+ value|=(unsigned int) buffer[2] << 16;
+ value|=(unsigned int) buffer[1] << 8;
+ value|=(unsigned int) buffer[0];
+ quantum.unsigned_value=value & 0xffffffff;
+ return(quantum.signed_value);
+ }
+ value=(unsigned int) buffer[0] << 24;
+ value|=(unsigned int) buffer[1] << 16;
+ value|=(unsigned int) buffer[2] << 8;
+ value|=(unsigned int) buffer[3];
+ quantum.unsigned_value=value & 0xffffffff;
+ return(quantum.signed_value);
+}
+
+static inline unsigned int ReadPropertyUnsignedLong(const EndianType endian,
+ const unsigned char *buffer)
+{
+ unsigned int
+ value;
+
+ if (endian == LSBEndian)
+ {
+ value=(unsigned int) buffer[3] << 24;
+ value|=(unsigned int) buffer[2] << 16;
+ value|=(unsigned int) buffer[1] << 8;
+ value|=(unsigned int) buffer[0];
+ return(value & 0xffffffff);
+ }
+ value=(unsigned int) buffer[0] << 24;
+ value|=(unsigned int) buffer[1] << 16;
+ value|=(unsigned int) buffer[2] << 8;
+ value|=(unsigned int) buffer[3];
+ return(value & 0xffffffff);
+}
+
+static inline signed short ReadPropertySignedShort(const EndianType endian,
const unsigned char *buffer)
{
+ union
+ {
+ unsigned short
+ unsigned_value;
+
+ signed short
+ signed_value;
+ } quantum;
+
unsigned short
value;
if (endian == LSBEndian)
{
- value=(unsigned short) ((buffer[1] << 8) | buffer[0]);
- return((unsigned short) (value & 0xffff));
+ value=(unsigned short) buffer[1] << 8;
+ value|=(unsigned short) buffer[0];
+ quantum.unsigned_value=value & 0xffff;
+ return(quantum.signed_value);
}
- value=(unsigned short) ((((unsigned char *) buffer)[0] << 8) |
- ((unsigned char *) buffer)[1]);
- return((unsigned short) (value & 0xffff));
+ value=(unsigned short) buffer[0] << 8;
+ value|=(unsigned short) buffer[1];
+ quantum.unsigned_value=value & 0xffff;
+ return(quantum.signed_value);
}
-static inline size_t ReadPropertyLong(const EndianType endian,
+static inline unsigned short ReadPropertyUnsignedShort(const EndianType endian,
const unsigned char *buffer)
{
- size_t
+ unsigned short
value;
if (endian == LSBEndian)
{
- value=(size_t) ((buffer[3] << 24) | (buffer[2] << 16) |
- (buffer[1] << 8 ) | (buffer[0]));
- return((size_t) (value & 0xffffffff));
+ value=(unsigned short) buffer[1] << 8;
+ value|=(unsigned short) buffer[0];
+ return(value & 0xffff);
}
- value=(size_t) ((buffer[0] << 24) | (buffer[1] << 16) |
- (buffer[2] << 8) | buffer[3]);
- return((size_t) (value & 0xffffffff));
+ value=(unsigned short) buffer[0] << 8;
+ value|=(unsigned short) buffer[1];
+ return(value & 0xffff);
}
static MagickBooleanType GetEXIFProperty(const Image *image,
p1=p; \
for (component=0; component < components; component++) \
{ \
- length+=FormatLocaleString(buffer+length,MaxTextExtent-length, \
+ length+=FormatLocaleString(buffer+length,MagickPathExtent-length, \
format", ",arg); \
- if (length >= (MaxTextExtent-1)) \
- length=MaxTextExtent-1; \
+ if (length >= (MagickPathExtent-1)) \
+ length=MagickPathExtent-1; \
p1+=size; \
} \
if (length > 1) \
p1=p; \
for (component=0; component < components; component++) \
{ \
- length+=FormatLocaleString(buffer+length,MaxTextExtent-length, \
+ length+=FormatLocaleString(buffer+length,MagickPathExtent-length, \
format", ",(arg1),(arg2)); \
- if (length >= (MaxTextExtent-1)) \
- length=MaxTextExtent-1; \
+ if (length >= (MagickPathExtent-1)) \
+ length=MagickPathExtent-1; \
p1+=size; \
} \
if (length > 1) \
entry,
length,
number_entries,
- tag;
+ tag,
+ tag_value;
SplayTreeInfo
*exif_resources;
id,
level,
offset,
- tag_offset,
- tag_value;
+ tag_offset;
static int
tag_bytes[] = {0, 1, 1, 2, 4, 8, 1, 1, 2, 4, 8, 4, 8};
If EXIF data exists, then try to parse the request for a tag.
*/
profile=GetImageProfile(image,"exif");
- if (profile == (StringInfo *) NULL)
+ if (profile == (const StringInfo *) NULL)
return(MagickFalse);
if ((property == (const char *) NULL) || (*property == '\0'))
return(MagickFalse);
while (isspace((int) ((unsigned char) *property)) != 0)
property++;
+ if (strlen(property) <= 5)
+ return(MagickFalse);
all=0;
tag=(~0UL);
switch (*(property+5))
}
if (length < 16)
return(MagickFalse);
- id=(ssize_t) ((int) ReadPropertyShort(LSBEndian,exif));
+ id=(ssize_t) ReadPropertySignedShort(LSBEndian,exif);
endian=LSBEndian;
if (id == 0x4949)
endian=LSBEndian;
endian=MSBEndian;
else
return(MagickFalse);
- if (ReadPropertyShort(endian,exif+2) != 0x002a)
+ if (ReadPropertyUnsignedShort(endian,exif+2) != 0x002a)
return(MagickFalse);
/*
This the offset to the first IFD.
*/
- offset=(ssize_t) ((int) ReadPropertyLong(endian,exif+4));
+ offset=(ssize_t) ReadPropertySignedLong(endian,exif+4);
if ((offset < 0) || (size_t) offset >= length)
return(MagickFalse);
/*
entry=directory_stack[level].entry;
tag_offset=directory_stack[level].offset;
}
+ if ((directory < exif) || (directory > (exif+length-2)))
+ break;
/*
Determine how many entries there are in the current IFD.
*/
- number_entries=(size_t) ((int) ReadPropertyShort(endian,directory));
+ number_entries=(size_t) ReadPropertyUnsignedShort(endian,directory);
for ( ; entry < number_entries; entry++)
{
register unsigned char
components;
q=(unsigned char *) (directory+(12*entry)+2);
+ if (q > (exif+length-12))
+ break; /* corrupt EXIF */
if (GetValueFromSplayTree(exif_resources,q) == q)
break;
(void) AddValueToSplayTree(exif_resources,q,q);
- tag_value=(ssize_t) ((int) ReadPropertyShort(endian,q)+tag_offset);
- format=(size_t) ((int) ReadPropertyShort(endian,q+2));
+ tag_value=(size_t) ReadPropertyUnsignedShort(endian,q)+tag_offset;
+ format=(size_t) ReadPropertyUnsignedShort(endian,q+2);
if (format >= (sizeof(tag_bytes)/sizeof(*tag_bytes)))
break;
- components=(ssize_t) ((int) ReadPropertyLong(endian,q+4));
+ components=(ssize_t) ReadPropertySignedLong(endian,q+4);
+ if (components < 0)
+ break; /* corrupt EXIF */
number_bytes=(size_t) components*tag_bytes[format];
if (number_bytes < components)
break; /* prevent overflow */
/*
The directory entry contains an offset.
*/
- offset=(ssize_t) ((int) ReadPropertyLong(endian,q+8));
+ offset=(ssize_t) ReadPropertySignedLong(endian,q+8);
if ((offset < 0) || (size_t) offset >= length)
continue;
if ((ssize_t) (offset+number_bytes) < offset)
if ((all != 0) || (tag == (size_t) tag_value))
{
char
- buffer[MaxTextExtent],
+ buffer[MagickPathExtent],
*value;
value=(char *) NULL;
}
case EXIF_FMT_SSHORT:
{
- EXIFMultipleValues(2,"%hd",ReadPropertyShort(endian,p1));
+ EXIFMultipleValues(2,"%hd",ReadPropertySignedShort(endian,p1));
break;
}
case EXIF_FMT_USHORT:
{
- EXIFMultipleValues(2,"%hu",ReadPropertyShort(endian,p1));
+ EXIFMultipleValues(2,"%hu",ReadPropertyUnsignedShort(endian,p1));
break;
}
case EXIF_FMT_ULONG:
{
EXIFMultipleValues(4,"%.20g",(double)
- ((int) ReadPropertyLong(endian,p1)));
+ ReadPropertyUnsignedLong(endian,p1));
break;
}
case EXIF_FMT_SLONG:
{
EXIFMultipleValues(4,"%.20g",(double)
- ((int) ReadPropertyLong(endian,p1)));
+ ReadPropertySignedLong(endian,p1));
break;
}
case EXIF_FMT_URATIONAL:
{
EXIFMultipleFractions(8,"%.20g/%.20g",(double)
- ((int) ReadPropertyLong(endian,p1)),(double)
- ((int) ReadPropertyLong(endian,p1+4)));
+ ReadPropertyUnsignedLong(endian,p1),(double)
+ ReadPropertyUnsignedLong(endian,p1+4));
break;
}
case EXIF_FMT_SRATIONAL:
{
EXIFMultipleFractions(8,"%.20g/%.20g",(double)
- ((int) ReadPropertyLong(endian,p1)),(double)
- ((int) ReadPropertyLong(endian,p1+4)));
+ ReadPropertySignedLong(endian,p1),(double)
+ ReadPropertySignedLong(endian,p1+4));
break;
}
case EXIF_FMT_SINGLE:
{
if (EXIFTag[i].tag == 0)
break;
- if ((ssize_t) EXIFTag[i].tag == tag_value)
+ if (EXIFTag[i].tag == tag_value)
{
description=EXIFTag[i].description;
break;
}
}
- (void) FormatLocaleString(key,MaxTextExtent,"%s",
+ (void) FormatLocaleString(key,MagickPathExtent,"%s",
description);
if (level == 2)
(void) SubstituteString(&key,"exif:","exif:thumbnail:");
case 2:
{
if (tag_value < 0x10000)
- (void) FormatLocaleString(key,MaxTextExtent,"#%04lx",
+ (void) FormatLocaleString(key,MagickPathExtent,"#%04lx",
(unsigned long) tag_value);
else
if (tag_value < 0x20000)
- (void) FormatLocaleString(key,MaxTextExtent,"@%04lx",
+ (void) FormatLocaleString(key,MagickPathExtent,"@%04lx",
(unsigned long) (tag_value & 0xffff));
else
- (void) FormatLocaleString(key,MaxTextExtent,"unknown");
+ (void) FormatLocaleString(key,MagickPathExtent,"unknown");
break;
}
default:
ssize_t
offset;
- offset=(ssize_t) ((int) ReadPropertyLong(endian,p));
+ offset=(ssize_t) ReadPropertySignedLong(endian,p);
if (((size_t) offset < length) && (level < (MaxDirectoryStack-2)))
{
ssize_t
level++;
if ((directory+2+(12*number_entries)) > (exif+length))
break;
- offset=(ssize_t) ((int) ReadPropertyLong(endian,directory+2+(12*
- number_entries)));
+ offset=(ssize_t) ReadPropertySignedLong(endian,directory+2+(12*
+ number_entries));
if ((offset != 0) && ((size_t) offset < length) &&
(level < (MaxDirectoryStack-2)))
{
(void) SetImageProperty((Image *) image,"icc:name",name,exception);
#else
char
- info[MaxTextExtent];
+ info[MagickPathExtent];
- (void) cmsGetProfileInfoASCII(icc_profile,cmsInfoDescription,
- "en","US",info,MaxTextExtent);
+ (void) cmsGetProfileInfoASCII(icc_profile,cmsInfoDescription,"en","US",
+ info,MagickPathExtent);
(void) SetImageProperty((Image *) image,"icc:description",info,
exception);
- (void) cmsGetProfileInfoASCII(icc_profile,cmsInfoManufacturer,
- "en","US",info,MaxTextExtent);
+ (void) cmsGetProfileInfoASCII(icc_profile,cmsInfoManufacturer,"en","US",
+ info,MagickPathExtent);
(void) SetImageProperty((Image *) image,"icc:manufacturer",info,
exception);
- (void) cmsGetProfileInfoASCII(icc_profile,cmsInfoModel,"en",
- "US",info,MaxTextExtent);
+ (void) cmsGetProfileInfoASCII(icc_profile,cmsInfoModel,"en","US",info,
+ MagickPathExtent);
(void) SetImageProperty((Image *) image,"icc:model",info,exception);
- (void) cmsGetProfileInfoASCII(icc_profile,cmsInfoCopyright,
- "en","US",info,MaxTextExtent);
+ (void) cmsGetProfileInfoASCII(icc_profile,cmsInfoCopyright,"en","US",
+ info,MagickPathExtent);
(void) SetImageProperty((Image *) image,"icc:copyright",info,exception);
#endif
(void) cmsCloseProfile(icc_profile);
description=GetXMLTreeChild(rdf,"rdf:Description");
while (description != (XMLTreeInfo *) NULL)
{
+ char
+ *xmp_namespace;
+
node=GetXMLTreeChild(description,(const char *) NULL);
while (node != (XMLTreeInfo *) NULL)
{
content=GetXMLTreeContent(node);
if ((child == (XMLTreeInfo *) NULL) &&
(SkipXMPValue(content) == MagickFalse))
- (void) AddValueToSplayTree((SplayTreeInfo *) image->properties,
- ConstantString(GetXMLTreeTag(node)),ConstantString(content));
+ {
+ xmp_namespace=ConstantString(GetXMLTreeTag(node));
+ (void) SubstituteString(&xmp_namespace,"exif:","xmp:");
+ (void) AddValueToSplayTree((SplayTreeInfo *) image->properties,
+ xmp_namespace,ConstantString(content));
+ }
while (child != (XMLTreeInfo *) NULL)
{
content=GetXMLTreeContent(child);
if (SkipXMPValue(content) == MagickFalse)
- (void) AddValueToSplayTree((SplayTreeInfo *) image->properties,
- ConstantString(GetXMLTreeTag(child)),ConstantString(content));
+ {
+ xmp_namespace=ConstantString(GetXMLTreeTag(node));
+ (void) SubstituteString(&xmp_namespace,"exif:","xmp:");
+ (void) AddValueToSplayTree((SplayTreeInfo *) image->properties,
+ xmp_namespace,ConstantString(content));
+ }
child=GetXMLTreeSibling(child);
}
node=GetXMLTreeSibling(node);
return(status);
}
-static char *TracePSClippath(const unsigned char *blob,size_t length,
- const size_t magick_unused(columns),const size_t magick_unused(rows))
+static char *TracePSClippath(const unsigned char *blob,size_t length)
{
char
*path,
if (path == (char *) NULL)
return((char *) NULL);
message=AcquireString((char *) NULL);
- (void) FormatLocaleString(message,MaxTextExtent,"/ClipImage\n");
+ (void) FormatLocaleString(message,MagickPathExtent,"/ClipImage\n");
(void) ConcatenateString(&path,message);
- (void) FormatLocaleString(message,MaxTextExtent,"{\n");
+ (void) FormatLocaleString(message,MagickPathExtent,"{\n");
(void) ConcatenateString(&path,message);
- (void) FormatLocaleString(message,MaxTextExtent," /c {curveto} bind def\n");
+ (void) FormatLocaleString(message,MagickPathExtent,
+ " /c {curveto} bind def\n");
(void) ConcatenateString(&path,message);
- (void) FormatLocaleString(message,MaxTextExtent," /l {lineto} bind def\n");
+ (void) FormatLocaleString(message,MagickPathExtent,
+ " /l {lineto} bind def\n");
(void) ConcatenateString(&path,message);
- (void) FormatLocaleString(message,MaxTextExtent," /m {moveto} bind def\n");
+ (void) FormatLocaleString(message,MagickPathExtent,
+ " /m {moveto} bind def\n");
(void) ConcatenateString(&path,message);
- (void) FormatLocaleString(message,MaxTextExtent,
+ (void) FormatLocaleString(message,MagickPathExtent,
" /v {currentpoint 6 2 roll curveto} bind def\n");
(void) ConcatenateString(&path,message);
- (void) FormatLocaleString(message,MaxTextExtent,
+ (void) FormatLocaleString(message,MagickPathExtent,
" /y {2 copy curveto} bind def\n");
(void) ConcatenateString(&path,message);
- (void) FormatLocaleString(message,MaxTextExtent,
+ (void) FormatLocaleString(message,MagickPathExtent,
" /z {closepath} bind def\n");
(void) ConcatenateString(&path,message);
- (void) FormatLocaleString(message,MaxTextExtent," newpath\n");
+ (void) FormatLocaleString(message,MagickPathExtent," newpath\n");
(void) ConcatenateString(&path,message);
/*
- The clipping path format is defined in "Adobe Photoshop File
- Formats Specification" version 6.0 downloadable from adobe.com.
+ The clipping path format is defined in "Adobe Photoshop File Formats
+ Specification" version 6.0 downloadable from adobe.com.
*/
(void) ResetMagickMemory(point,0,sizeof(point));
(void) ResetMagickMemory(first,0,sizeof(first));
in_subpath=MagickFalse;
while (length > 0)
{
- selector=(ssize_t) ((int) ReadPropertyMSBShort(&blob,&length));
+ selector=(ssize_t) ReadPropertyMSBShort(&blob,&length);
switch (selector)
{
case 0:
/*
Expected subpath length record.
*/
- knot_count=(ssize_t) ((int) ReadPropertyMSBShort(&blob,&length));
+ knot_count=(ssize_t) ReadPropertyMSBShort(&blob,&length);
blob+=22;
length-=MagickMin(22,(ssize_t) length);
break;
xx,
yy;
- yy=(size_t) ((int) ReadPropertyMSBLong(&blob,&length));
- xx=(size_t) ((int) ReadPropertyMSBLong(&blob,&length));
+ yy=(size_t) ReadPropertyMSBLong(&blob,&length);
+ xx=(size_t) ReadPropertyMSBLong(&blob,&length);
x=(ssize_t) xx;
if (xx > 2147483647)
x=(ssize_t) xx-4294967295U-1;
point[i].x=(double) x/4096/4096;
point[i].y=1.0-(double) y/4096/4096;
}
- if( IfMagickFalse(in_subpath) )
+ if (in_subpath == MagickFalse)
{
- (void) FormatLocaleString(message,MaxTextExtent," %g %g m\n",
+ (void) FormatLocaleString(message,MagickPathExtent," %g %g m\n",
point[1].x,point[1].y);
for (i=0; i < 3; i++)
{
*/
if ((last[1].x == last[2].x) && (last[1].y == last[2].y) &&
(point[0].x == point[1].x) && (point[0].y == point[1].y))
- (void) FormatLocaleString(message,MaxTextExtent,
+ (void) FormatLocaleString(message,MagickPathExtent,
" %g %g l\n",point[1].x,point[1].y);
else
if ((last[1].x == last[2].x) && (last[1].y == last[2].y))
- (void) FormatLocaleString(message,MaxTextExtent,
+ (void) FormatLocaleString(message,MagickPathExtent,
" %g %g %g %g v\n",point[0].x,point[0].y,
point[1].x,point[1].y);
else
if ((point[0].x == point[1].x) && (point[0].y == point[1].y))
- (void) FormatLocaleString(message,MaxTextExtent,
+ (void) FormatLocaleString(message,MagickPathExtent,
" %g %g %g %g y\n",last[2].x,last[2].y,
point[1].x,point[1].y);
else
- (void) FormatLocaleString(message,MaxTextExtent,
+ (void) FormatLocaleString(message,MagickPathExtent,
" %g %g %g %g %g %g c\n",last[2].x,
last[2].y,point[0].x,point[0].y,point[1].x,point[1].y);
for (i=0; i < 3; i++)
*/
if ((last[1].x == last[2].x) && (last[1].y == last[2].y) &&
(first[0].x == first[1].x) && (first[0].y == first[1].y))
- (void) FormatLocaleString(message,MaxTextExtent,
+ (void) FormatLocaleString(message,MagickPathExtent,
" %g %g l z\n",first[1].x,first[1].y);
else
if ((last[1].x == last[2].x) && (last[1].y == last[2].y))
- (void) FormatLocaleString(message,MaxTextExtent,
+ (void) FormatLocaleString(message,MagickPathExtent,
" %g %g %g %g v z\n",first[0].x,first[0].y,
first[1].x,first[1].y);
else
if ((first[0].x == first[1].x) && (first[0].y == first[1].y))
- (void) FormatLocaleString(message,MaxTextExtent,
+ (void) FormatLocaleString(message,MagickPathExtent,
" %g %g %g %g y z\n",last[2].x,last[2].y,
first[1].x,first[1].y);
else
- (void) FormatLocaleString(message,MaxTextExtent,
+ (void) FormatLocaleString(message,MagickPathExtent,
" %g %g %g %g %g %g c z\n",last[2].x,
last[2].y,first[0].x,first[0].y,first[1].x,first[1].y);
(void) ConcatenateString(&path,message);
/*
Returns an empty PS path if the path has no knots.
*/
- (void) FormatLocaleString(message,MaxTextExtent," eoclip\n");
+ (void) FormatLocaleString(message,MagickPathExtent," eoclip\n");
(void) ConcatenateString(&path,message);
- (void) FormatLocaleString(message,MaxTextExtent,"} bind def");
+ (void) FormatLocaleString(message,MagickPathExtent,"} bind def");
(void) ConcatenateString(&path,message);
message=DestroyString(message);
return(path);
if (path == (char *) NULL)
return((char *) NULL);
message=AcquireString((char *) NULL);
- (void) FormatLocaleString(message,MaxTextExtent,
- ("<?xml version=\"1.0\" encoding=\"iso-8859-1\"?>\n"
+ (void) FormatLocaleString(message,MagickPathExtent,(
+ "<?xml version=\"1.0\" encoding=\"iso-8859-1\"?>\n"
"<svg xmlns=\"http://www.w3.org/2000/svg\""
" width=\"%.20g\" height=\"%.20g\">\n"
"<g>\n"
- "<path fill-rule=\"evenodd\" style=\"fill:#00000000;stroke:#00000000;"
- "stroke-width:0;stroke-antialiasing:false\" d=\"\n"),
- (double) columns,(double) rows);
+ "<path fill-rule=\"evenodd\" style=\"fill:#000000;stroke:#000000;"
+ "stroke-width:0;stroke-antialiasing:false\" d=\"\n"),(double) columns,
+ (double) rows);
(void) ConcatenateString(&path,message);
(void) ResetMagickMemory(point,0,sizeof(point));
(void) ResetMagickMemory(first,0,sizeof(first));
in_subpath=MagickFalse;
while (length != 0)
{
- selector=(ssize_t) ((int) ReadPropertyMSBShort(&blob,&length));
+ selector=(ssize_t) ReadPropertyMSBShort(&blob,&length);
switch (selector)
{
case 0:
/*
Expected subpath length record.
*/
- knot_count=(ssize_t) ((int) ReadPropertyMSBShort(&blob,&length));
+ knot_count=(ssize_t) ReadPropertyMSBShort(&blob,&length);
blob+=22;
length-=MagickMin(22,(ssize_t) length);
break;
xx,
yy;
- yy=(unsigned int) ((int) ReadPropertyMSBLong(&blob,&length));
- xx=(unsigned int) ((int) ReadPropertyMSBLong(&blob,&length));
+ yy=(unsigned int) ReadPropertyMSBLong(&blob,&length);
+ xx=(unsigned int) ReadPropertyMSBLong(&blob,&length);
x=(ssize_t) xx;
if (xx > 2147483647)
x=(ssize_t) xx-4294967295U-1;
}
if (in_subpath == MagickFalse)
{
- (void) FormatLocaleString(message,MaxTextExtent,"M %g %g\n",
+ (void) FormatLocaleString(message,MagickPathExtent,"M %g %g\n",
point[1].x,point[1].y);
for (i=0; i < 3; i++)
{
*/
if ((last[1].x == last[2].x) && (last[1].y == last[2].y) &&
(point[0].x == point[1].x) && (point[0].y == point[1].y))
- (void) FormatLocaleString(message,MaxTextExtent,
+ (void) FormatLocaleString(message,MagickPathExtent,
"L %g %g\n",point[1].x,point[1].y);
else
- (void) FormatLocaleString(message,MaxTextExtent,
+ (void) FormatLocaleString(message,MagickPathExtent,
"C %g %g %g %g %g %g\n",last[2].x,
last[2].y,point[0].x,point[0].y,point[1].x,point[1].y);
for (i=0; i < 3; i++)
*/
if ((last[1].x == last[2].x) && (last[1].y == last[2].y) &&
(first[0].x == first[1].x) && (first[0].y == first[1].y))
- (void) FormatLocaleString(message,MaxTextExtent,
+ (void) FormatLocaleString(message,MagickPathExtent,
"L %g %g Z\n",first[1].x,first[1].y);
else
- (void) FormatLocaleString(message,MaxTextExtent,
+ (void) FormatLocaleString(message,MagickPathExtent,
"C %g %g %g %g %g %g Z\n",last[2].x,
last[2].y,first[0].x,first[0].y,first[1].x,first[1].y);
(void) ConcatenateString(&path,message);
*p;
assert(image != (Image *) NULL);
- assert(image->signature == MagickSignature);
- if (IfMagickTrue(image->debug))
+ assert(image->signature == MagickCoreSignature);
+ if (image->debug != MagickFalse)
(void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",image->filename);
p=(const char *) NULL;
if (image->properties != (void *) NULL)
% o exception: return any errors or warnings in this structure.
%
*/
+static const char *GetMagickPropertyLetter(ImageInfo *image_info,
+ Image *image,const char letter,ExceptionInfo *exception)
+{
#define WarnNoImageReturn(format,arg) \
if (image == (Image *) NULL ) { \
(void) ThrowMagickException(exception,GetMagickModule(),OptionWarning, \
- "NoImageForProperty",format,arg); \
+ "NoImageForProperty",format,arg); \
return((const char *) NULL); \
}
#define WarnNoImageInfoReturn(format,arg) \
if (image_info == (ImageInfo *) NULL ) { \
(void) ThrowMagickException(exception,GetMagickModule(),OptionWarning, \
- "NoImageInfoForProperty",format,arg); \
+ "NoImageInfoForProperty",format,arg); \
return((const char *) NULL); \
}
-static const char *GetMagickPropertyLetter(ImageInfo *image_info,
- Image *image,const char letter,ExceptionInfo *exception)
-{
char
- value[MaxTextExtent]; /* formated string to store as a returned artifact */
+ value[MagickPathExtent]; /* formatted string to store as an artifact */
const char
*string; /* return a string already stored somewher */
- if (image != (Image *) NULL && IfMagickTrue(image->debug))
+ if ((image != (Image *) NULL) && (image->debug != MagickFalse))
(void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",image->filename);
- else if( image_info != (ImageInfo *) NULL && IfMagickTrue(image_info->debug))
+ else
+ if ((image_info != (ImageInfo *) NULL) &&
+ (image_info->debug != MagickFalse))
(void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s","no-images");
-
*value='\0'; /* formatted string */
string=(char *) NULL; /* constant string reference */
-
- /* Get properities that are directly defined by images */
+ /*
+ Get properities that are directly defined by images.
+ */
switch (letter)
{
case 'b': /* image size read in - in bytes */
{
WarnNoImageReturn("\"%%%c\"",letter);
- (void) FormatMagickSize(image->extent,MagickFalse,"B",value);
+ (void) FormatMagickSize(image->extent,MagickFalse,"B",MagickPathExtent,
+ value);
+ if (image->extent == 0)
+ (void) FormatMagickSize(GetBlobSize(image),MagickFalse,"B",
+ MagickPathExtent,value);
break;
}
case 'c': /* image comment property - empty string by default */
{
WarnNoImageReturn("\"%%%c\"",letter);
GetPathComponent(image->magick_filename,HeadPath,value);
- if (*value == '\0') string="";
+ if (*value == '\0')
+ string="";
break;
}
case 'e': /* Filename extension (suffix) of image file */
{
WarnNoImageReturn("\"%%%c\"",letter);
GetPathComponent(image->magick_filename,ExtensionPath,value);
- if (*value == '\0') string="";
+ if (*value == '\0')
+ string="";
break;
}
case 'f': /* Filename without directory component */
{
WarnNoImageReturn("\"%%%c\"",letter);
GetPathComponent(image->magick_filename,TailPath,value);
- if (*value == '\0') string="";
+ if (*value == '\0')
+ string="";
break;
}
case 'g': /* Image geometry, canvas and offset %Wx%H+%X+%Y */
{
WarnNoImageReturn("\"%%%c\"",letter);
- (void) FormatLocaleString(value,MaxTextExtent,"%.20gx%.20g%+.20g%+.20g",
- (double) image->page.width,(double) image->page.height,
- (double) image->page.x,(double) image->page.y);
+ (void) FormatLocaleString(value,MagickPathExtent,
+ "%.20gx%.20g%+.20g%+.20g",(double) image->page.width,(double)
+ image->page.height,(double) image->page.x,(double) image->page.y);
break;
}
case 'h': /* Image height (current) */
{
WarnNoImageReturn("\"%%%c\"",letter);
- (void) FormatLocaleString(value,MaxTextExtent,"%.20g",(double)
+ (void) FormatLocaleString(value,MagickPathExtent,"%.20g",(double)
(image->rows != 0 ? image->rows : image->magick_rows));
break;
}
FUTURE: ensure this does not generate the formatted comment!
*/
WarnNoImageReturn("\"%%%c\"",letter);
- (void) FormatLocaleString(value,MaxTextExtent,"%.20g",(double)
+ (void) FormatLocaleString(value,MagickPathExtent,"%.20g",(double)
GetNumberColors(image,(FILE *) NULL,exception));
break;
}
{
WarnNoImageReturn("\"%%%c\"",letter);
string=GetImageProperty(image,"label",exception);
- if ( string == (const char *) NULL)
+ if (string == (const char *) NULL)
string="";
break;
}
case 'n': /* Number of images in the list. */
{
if ( image != (Image *) NULL )
- (void) FormatLocaleString(value,MaxTextExtent,"%.20g",(double)
+ (void) FormatLocaleString(value,MagickPathExtent,"%.20g",(double)
GetImageListLength(image));
else
string="0"; /* no images or scenes */
case 'p': /* Image index in current image list */
{
WarnNoImageReturn("\"%%%c\"",letter);
- (void) FormatLocaleString(value,MaxTextExtent,"%.20g",(double)
+ (void) FormatLocaleString(value,MagickPathExtent,"%.20g",(double)
GetImageIndexInList(image));
break;
}
case 'q': /* Quantum depth of image in memory */
{
WarnNoImageReturn("\"%%%c\"",letter);
- (void) FormatLocaleString(value,MaxTextExtent,"%.20g",(double)
+ (void) FormatLocaleString(value,MagickPathExtent,"%.20g",(double)
MAGICKCORE_QUANTUM_DEPTH);
break;
}
WarnNoImageReturn("\"%%%c\"",letter);
colorspace=image->colorspace;
- if (IfMagickTrue(IsImageGray(image,exception)))
+ if (SetImageGray(image,exception) != MagickFalse)
colorspace=GRAYColorspace; /* FUTURE: this is IMv6 not IMv7 */
- (void) FormatLocaleString(value,MaxTextExtent,"%s %s %s",
- CommandOptionToMnemonic(MagickClassOptions,(ssize_t) image->storage_class),
- CommandOptionToMnemonic(MagickColorspaceOptions,(ssize_t) colorspace),
- image->alpha_trait != UndefinedPixelTrait ? "Alpha" : "");
+ (void) FormatLocaleString(value,MagickPathExtent,"%s %s %s",
+ CommandOptionToMnemonic(MagickClassOptions,(ssize_t)
+ image->storage_class),CommandOptionToMnemonic(MagickColorspaceOptions,
+ (ssize_t) colorspace),image->alpha_trait != UndefinedPixelTrait ?
+ "Alpha" : "");
break;
}
case 's': /* Image scene number */
{
#if 0 /* this seems non-sensical -- simplifing */
if (image_info->number_scenes != 0)
- (void) FormatLocaleString(value,MaxTextExtent,"%.20g",(double)
+ (void) FormatLocaleString(value,MagickPathExtent,"%.20g",(double)
image_info->scene);
else if (image != (Image *) NULL)
- (void) FormatLocaleString(value,MaxTextExtent,"%.20g",(double)
+ (void) FormatLocaleString(value,MagickPathExtent,"%.20g",(double)
image->scene);
else
string="0";
#else
WarnNoImageReturn("\"%%%c\"",letter);
- (void) FormatLocaleString(value,MaxTextExtent,"%.20g",(double)
+ (void) FormatLocaleString(value,MagickPathExtent,"%.20g",(double)
image->scene);
#endif
break;
{
WarnNoImageReturn("\"%%%c\"",letter);
GetPathComponent(image->magick_filename,BasePath,value);
- if (*value == '\0') string="";
+ if (*value == '\0')
+ string="";
break;
}
case 'u': /* Unique filename */
+ {
WarnNoImageInfoReturn("\"%%%c\"",letter);
string=image_info->unique;
break;
+ }
case 'w': /* Image width (current) */
{
WarnNoImageReturn("\"%%%c\"",letter);
- (void) FormatLocaleString(value,MaxTextExtent,"%.20g",(double)
+ (void) FormatLocaleString(value,MagickPathExtent,"%.20g",(double)
(image->columns != 0 ? image->columns : image->magick_columns));
break;
}
case 'x': /* Image horizontal resolution (with units) */
{
WarnNoImageReturn("\"%%%c\"",letter);
- (void) FormatLocaleString(value,MaxTextExtent,"%.20g",
+ (void) FormatLocaleString(value,MagickPathExtent,"%.20g",
fabs(image->resolution.x) > MagickEpsilon ? image->resolution.x : 72.0);
break;
}
case 'y': /* Image vertical resolution (with units) */
{
WarnNoImageReturn("\"%%%c\"",letter);
- (void) FormatLocaleString(value,MaxTextExtent,"%.20g",
+ (void) FormatLocaleString(value,MagickPathExtent,"%.20g",
fabs(image->resolution.y) > MagickEpsilon ? image->resolution.y : 72.0);
break;
}
case 'z': /* Image depth as read in */
{
WarnNoImageReturn("\"%%%c\"",letter);
- (void) FormatLocaleString(value,MaxTextExtent,"%.20g",
- (double) image->depth);
+ (void) FormatLocaleString(value,MagickPathExtent,"%.20g",(double)
+ image->depth);
break;
}
case 'A': /* Image alpha channel */
{
WarnNoImageReturn("\"%%%c\"",letter);
- string=CommandOptionToMnemonic(MagickBooleanOptions,
- (ssize_t) image->alpha_trait);
+ string=CommandOptionToMnemonic(MagickPixelTraitOptions,(ssize_t)
+ image->alpha_trait);
break;
}
case 'C': /* Image compression method. */
{
WarnNoImageReturn("\"%%%c\"",letter);
- string=CommandOptionToMnemonic(MagickCompressOptions,
- (ssize_t) image->compression);
+ string=CommandOptionToMnemonic(MagickCompressOptions,(ssize_t)
+ image->compression);
break;
}
case 'D': /* Image dispose method. */
{
WarnNoImageReturn("\"%%%c\"",letter);
- string=CommandOptionToMnemonic(MagickDisposeOptions,
- (ssize_t) image->dispose);
+ string=CommandOptionToMnemonic(MagickDisposeOptions,(ssize_t)
+ image->dispose);
break;
}
case 'G': /* Image size as geometry = "%wx%h" */
{
WarnNoImageReturn("\"%%%c\"",letter);
- (void) FormatLocaleString(value,MaxTextExtent,"%.20gx%.20g",
- (double)image->magick_columns,(double) image->magick_rows);
+ (void) FormatLocaleString(value,MagickPathExtent,"%.20gx%.20g",(double)
+ image->magick_columns,(double) image->magick_rows);
break;
}
case 'H': /* layer canvas height */
{
WarnNoImageReturn("\"%%%c\"",letter);
- (void) FormatLocaleString(value,MaxTextExtent,"%.20g",
- (double) image->page.height);
+ (void) FormatLocaleString(value,MagickPathExtent,"%.20g",(double)
+ image->page.height);
break;
}
case 'M': /* Magick filename - filename given incl. coder & read mods */
case 'O': /* layer canvas offset with sign = "+%X+%Y" */
{
WarnNoImageReturn("\"%%%c\"",letter);
- (void) FormatLocaleString(value,MaxTextExtent,"%+ld%+ld",(long)
+ (void) FormatLocaleString(value,MagickPathExtent,"%+ld%+ld",(long)
image->page.x,(long) image->page.y);
break;
}
case 'P': /* layer canvas page size = "%Wx%H" */
{
WarnNoImageReturn("\"%%%c\"",letter);
- (void) FormatLocaleString(value,MaxTextExtent,"%.20gx%.20g",
- (double) image->page.width,(double) image->page.height);
+ (void) FormatLocaleString(value,MagickPathExtent,"%.20gx%.20g",(double)
+ image->page.width,(double) image->page.height);
break;
}
case 'Q': /* image compression quality */
{
WarnNoImageReturn("\"%%%c\"",letter);
- (void) FormatLocaleString(value,MaxTextExtent,"%.20g",(double)
+ (void) FormatLocaleString(value,MagickPathExtent,"%.20g",(double)
(image->quality == 0 ? 92 : image->quality));
break;
}
if (image_info->number_scenes == 0)
string="2147483647";
else if ( image != (Image *) NULL )
- (void) FormatLocaleString(value,MaxTextExtent,"%.20g",(double)
+ (void) FormatLocaleString(value,MagickPathExtent,"%.20g",(double)
image_info->scene+image_info->number_scenes);
else
string="0";
#else
- (void) FormatLocaleString(value,MaxTextExtent,"%.20g",(double)
+ (void) FormatLocaleString(value,MagickPathExtent,"%.20g",(double)
(image_info->number_scenes == 0 ? 2147483647 :
image_info->number_scenes));
#endif
case 'T': /* image time delay for animations */
{
WarnNoImageReturn("\"%%%c\"",letter);
- (void) FormatLocaleString(value,MaxTextExtent,"%.20g",(double)
+ (void) FormatLocaleString(value,MagickPathExtent,"%.20g",(double)
image->delay);
break;
}
case 'U': /* Image resolution units. */
{
WarnNoImageReturn("\"%%%c\"",letter);
- string=CommandOptionToMnemonic(MagickResolutionOptions,
- (ssize_t) image->units);
+ string=CommandOptionToMnemonic(MagickResolutionOptions,(ssize_t)
+ image->units);
break;
}
case 'W': /* layer canvas width */
{
WarnNoImageReturn("\"%%%c\"",letter);
- (void) FormatLocaleString(value,MaxTextExtent,"%.20g",(double)
+ (void) FormatLocaleString(value,MagickPathExtent,"%.20g",(double)
image->page.width);
break;
}
case 'X': /* layer canvas X offset */
{
WarnNoImageReturn("\"%%%c\"",letter);
- (void) FormatLocaleString(value,MaxTextExtent,"%+.20g",(double)
+ (void) FormatLocaleString(value,MagickPathExtent,"%+.20g",(double)
image->page.x);
break;
}
case 'Y': /* layer canvas Y offset */
{
WarnNoImageReturn("\"%%%c\"",letter);
- (void) FormatLocaleString(value,MaxTextExtent,"%+.20g",(double)
+ (void) FormatLocaleString(value,MagickPathExtent,"%+.20g",(double)
image->page.y);
break;
}
- case 'Z': /* Zero filename ??? */
- WarnNoImageInfoReturn("\"%%%c\"",letter);
- string=image_info->zero;
- break;
case '%': /* percent escaped */
+ {
string="%";
break;
+ }
case '@': /* Trim bounding box, without actually Trimming! */
{
RectangleInfo
WarnNoImageReturn("\"%%%c\"",letter);
page=GetImageBoundingBox(image,exception);
- (void) FormatLocaleString(value,MaxTextExtent,"%.20gx%.20g%+.20g%+.20g",
- (double) page.width,(double) page.height,(double) page.x,(double)
- page.y);
+ (void) FormatLocaleString(value,MagickPathExtent,
+ "%.20gx%.20g%+.20g%+.20g",(double) page.width,(double) page.height,
+ (double) page.x,(double)page.y);
break;
}
case '#':
Image *image,const char *property,ExceptionInfo *exception)
{
char
- value[MaxTextExtent];
+ value[MagickPathExtent];
const char
*string;
assert(property[0] != '\0');
assert(image != (Image *) NULL || image_info != (ImageInfo *) NULL );
-
if (property[1] == '\0') /* single letter property request */
return(GetMagickPropertyLetter(image_info,image,*property,exception));
-
- if (image != (Image *) NULL && IfMagickTrue(image->debug))
+ if ((image != (Image *) NULL) && (image->debug != MagickFalse))
(void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",image->filename);
- else if( image_info != (ImageInfo *) NULL && IfMagickTrue(image_info->debug))
+ else
+ if ((image_info != (ImageInfo *) NULL) &&
+ (image_info->debug != MagickFalse))
(void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s","no-images");
-
*value='\0'; /* formated string */
string=(char *) NULL; /* constant string reference */
switch (*property)
{
case 'b':
{
- if ((LocaleCompare("base",property) == 0) ||
- (LocaleCompare("basename",property) == 0) )
+ if (LocaleCompare("basename",property) == 0)
{
WarnNoImageReturn("\"%%[%s]\"",property);
GetPathComponent(image->magick_filename,BasePath,value);
- if (*value == '\0') string="";
+ if (*value == '\0')
+ string="";
break;
}
if (LocaleCompare("bit-depth",property) == 0)
{
- (void) FormatLocaleString(value,MaxTextExtent,"%.20g",(double)
- GetImageDepth(image, exception));
+ (void) FormatLocaleString(value,MagickPathExtent,"%.20g",(double)
+ GetImageDepth(image,exception));
break;
}
break;
{
WarnNoImageReturn("\"%%[%s]\"",property);
/* FUTURE: return actual image channels */
- (void) FormatLocaleString(value,MaxTextExtent,"%s",
+ (void) FormatLocaleString(value,MagickPathExtent,"%s",
CommandOptionToMnemonic(MagickColorspaceOptions,(ssize_t)
image->colorspace));
LocaleLower(value);
if( image->alpha_trait != UndefinedPixelTrait )
- (void) ConcatenateMagickString(value,"a",MaxTextExtent);
+ (void) ConcatenateMagickString(value,"a",MagickPathExtent);
break;
}
if (LocaleCompare("colorspace",property) == 0)
image->colorspace);
break;
}
+ if (LocaleCompare("compose",property) == 0)
+ {
+ WarnNoImageReturn("\"%%[%s]\"",property);
+ string=CommandOptionToMnemonic(MagickComposeOptions,(ssize_t)
+ image->compose);
+ break;
+ }
if (LocaleCompare("copyright",property) == 0)
{
- (void) CopyMagickString(value,GetMagickCopyright(),MaxTextExtent);
+ (void) CopyMagickString(value,GetMagickCopyright(),MagickPathExtent);
break;
}
break;
if (LocaleCompare("depth",property) == 0)
{
WarnNoImageReturn("\"%%[%s]\"",property);
- (void) FormatLocaleString(value,MaxTextExtent,"%.20g",(double)
+ (void) FormatLocaleString(value,MagickPathExtent,"%.20g",(double)
image->depth);
break;
}
{
WarnNoImageReturn("\"%%[%s]\"",property);
GetPathComponent(image->magick_filename,HeadPath,value);
- if (*value == '\0') string="";
+ if (*value == '\0')
+ string="";
break;
}
break;
WarnNoImageReturn("\"%%[%s]\"",property);
(void) GetImageEntropy(image,&entropy,exception);
- (void) FormatLocaleString(value,MaxTextExtent,"%.*g",
+ (void) FormatLocaleString(value,MagickPathExtent,"%.*g",
GetMagickPrecision(),entropy);
break;
}
{
WarnNoImageReturn("\"%%[%s]\"",property);
GetPathComponent(image->magick_filename,ExtensionPath,value);
- if (*value == '\0') string="";
+ if (*value == '\0')
+ string="";
break;
}
break;
if (LocaleCompare("gamma",property) == 0)
{
WarnNoImageReturn("\"%%[%s]\"",property);
- (void) FormatLocaleString(value,MaxTextExtent,"%.*g",
+ (void) FormatLocaleString(value,MagickPathExtent,"%.*g",
GetMagickPrecision(),image->gamma);
break;
}
- if (LocaleCompare("group",property) == 0)
- {
- WarnNoImageInfoReturn("\"%%[%s]\"",property);
- (void) FormatLocaleString(value,MaxTextExtent,"0x%lx",(unsigned long)
- image_info->group);
- break;
- }
break;
}
case 'h':
if (LocaleCompare("height",property) == 0)
{
WarnNoImageReturn("\"%%[%s]\"",property);
- (void) FormatLocaleString(value,MaxTextExtent,"%.20g",
+ (void) FormatLocaleString(value,MagickPathExtent,"%.20g",
image->magick_rows != 0 ? (double) image->magick_rows : 256.0);
break;
}
WarnNoImageReturn("\"%%[%s]\"",property);
(void) GetImageKurtosis(image,&kurtosis,&skewness,exception);
- (void) FormatLocaleString(value,MaxTextExtent,"%.*g",
+ (void) FormatLocaleString(value,MagickPathExtent,"%.*g",
GetMagickPrecision(),kurtosis);
break;
}
string=image->magick;
break;
}
- if (LocaleCompare("max",property) == 0)
+ if ((LocaleCompare("maxima",property) == 0) ||
+ (LocaleCompare("max",property) == 0))
{
double
maximum,
WarnNoImageReturn("\"%%[%s]\"",property);
(void) GetImageRange(image,&minimum,&maximum,exception);
- (void) FormatLocaleString(value,MaxTextExtent,"%.*g",
+ (void) FormatLocaleString(value,MagickPathExtent,"%.*g",
GetMagickPrecision(),maximum);
break;
}
WarnNoImageReturn("\"%%[%s]\"",property);
(void) GetImageMean(image,&mean,&standard_deviation,exception);
- (void) FormatLocaleString(value,MaxTextExtent,"%.*g",
+ (void) FormatLocaleString(value,MagickPathExtent,"%.*g",
GetMagickPrecision(),mean);
break;
}
- if (LocaleCompare("min",property) == 0)
+ if ((LocaleCompare("minima",property) == 0) ||
+ (LocaleCompare("min",property) == 0))
{
double
maximum,
WarnNoImageReturn("\"%%[%s]\"",property);
(void) GetImageRange(image,&minimum,&maximum,exception);
- (void) FormatLocaleString(value,MaxTextExtent,"%.*g",
+ (void) FormatLocaleString(value,MagickPathExtent,"%.*g",
GetMagickPrecision(),minimum);
break;
}
if (LocaleCompare("opaque",property) == 0)
{
WarnNoImageReturn("\"%%[%s]\"",property);
- string=CommandOptionToMnemonic(MagickBooleanOptions,
- (ssize_t) IsImageOpaque(image,exception));
+ string=CommandOptionToMnemonic(MagickBooleanOptions,(ssize_t)
+ IsImageOpaque(image,exception));
break;
}
if (LocaleCompare("orientation",property) == 0)
if (LocaleCompare("output",property) == 0)
{
WarnNoImageInfoReturn("\"%%[%s]\"",property);
- (void) CopyMagickString(value,image_info->filename,MaxTextExtent);
+ (void) CopyMagickString(value,image_info->filename,MagickPathExtent);
break;
}
break;
profile=GetImageProfile(image,property+8);
if (profile == (StringInfo *) NULL)
break;
-
icc_profile=cmsOpenProfileFromMem(GetStringInfoDatum(profile),
(cmsUInt32Number) GetStringInfoLength(profile));
if (icc_profile != (cmsHPROFILE *) NULL)
string=cmsTakeProductName(icc_profile);
#else
(void) cmsGetProfileInfoASCII(icc_profile,cmsInfoDescription,
- "en","US",value,MaxTextExtent);
+ "en","US",value,MagickPathExtent);
#endif
(void) cmsCloseProfile(icc_profile);
}
name=GetNextImageProfile(image);
if (name != (char *) NULL)
{
- (void) CopyMagickString(value,name,MaxTextExtent);
+ (void) CopyMagickString(value,name,MagickPathExtent);
name=GetNextImageProfile(image);
while (name != (char *) NULL)
{
- ConcatenateMagickString(value,",",MaxTextExtent);
- ConcatenateMagickString(value,name,MaxTextExtent);
+ ConcatenateMagickString(value,",",MagickPathExtent);
+ ConcatenateMagickString(value,name,MagickPathExtent);
name=GetNextImageProfile(image);
}
}
if (LocaleCompare("resolution.x",property) == 0)
{
WarnNoImageReturn("\"%%[%s]\"",property);
- (void) FormatLocaleString(value,MaxTextExtent,"%g",
+ (void) FormatLocaleString(value,MagickPathExtent,"%g",
image->resolution.x);
break;
}
if (LocaleCompare("resolution.y",property) == 0)
{
WarnNoImageReturn("\"%%[%s]\"",property);
- (void) FormatLocaleString(value,MaxTextExtent,"%g",
+ (void) FormatLocaleString(value,MagickPathExtent,"%g",
image->resolution.y);
break;
}
{
WarnNoImageInfoReturn("\"%%[%s]\"",property);
if (image_info->number_scenes != 0)
- (void) FormatLocaleString(value,MaxTextExtent,"%.20g",(double)
+ (void) FormatLocaleString(value,MagickPathExtent,"%.20g",(double)
image_info->scene);
else {
WarnNoImageReturn("\"%%[%s]\"",property);
- (void) FormatLocaleString(value,MaxTextExtent,"%.20g",(double)
+ (void) FormatLocaleString(value,MagickPathExtent,"%.20g",(double)
image->scene);
}
break;
{
/* FUTURE: equivelent to %n? */
WarnNoImageReturn("\"%%[%s]\"",property);
- (void) FormatLocaleString(value,MaxTextExtent,"%.20g",(double)
+ (void) FormatLocaleString(value,MagickPathExtent,"%.20g",(double)
GetImageListLength(image));
break;
}
if (LocaleCompare("size",property) == 0)
{
WarnNoImageReturn("\"%%[%s]\"",property);
- (void) FormatMagickSize(GetBlobSize(image),MagickFalse,"B",value);
+ (void) FormatMagickSize(GetBlobSize(image),MagickFalse,"B",
+ MagickPathExtent,value);
break;
}
if (LocaleCompare("skewness",property) == 0)
WarnNoImageReturn("\"%%[%s]\"",property);
(void) GetImageKurtosis(image,&kurtosis,&skewness,exception);
- (void) FormatLocaleString(value,MaxTextExtent,"%.*g",
+ (void) FormatLocaleString(value,MagickPathExtent,"%.*g",
GetMagickPrecision(),skewness);
break;
}
- if ((LocaleCompare("standard-deviation",property) == 0) ||
- (LocaleCompare("standard_deviation",property) == 0))
+ if (LocaleCompare("standard-deviation",property) == 0)
{
double
mean,
WarnNoImageReturn("\"%%[%s]\"",property);
(void) GetImageMean(image,&mean,&standard_deviation,exception);
- (void) FormatLocaleString(value,MaxTextExtent,"%.*g",
+ (void) FormatLocaleString(value,MagickPathExtent,"%.*g",
GetMagickPrecision(),standard_deviation);
break;
}
{
WarnNoImageReturn("\"%%[%s]\"",property);
string=CommandOptionToMnemonic(MagickTypeOptions,(ssize_t)
- GetImageType(image,exception));
+ IdentifyImageType(image,exception));
break;
}
break;
image->units);
break;
}
- if (LocaleCompare("copyright",property) == 0)
break;
}
case 'v':
if (LocaleCompare("width",property) == 0)
{
WarnNoImageReturn("\"%%[%s]\"",property);
- (void) FormatLocaleString(value,MaxTextExtent,"%.20g",(double)
+ (void) FormatLocaleString(value,MagickPathExtent,"%.20g",(double)
(image->magick_columns != 0 ? image->magick_columns : 256));
break;
}
break;
}
- case 'x': /* FUTURE: Obsolete X resolution */
- {
- if ((LocaleCompare("xresolution",property) == 0) ||
- (LocaleCompare("x-resolution",property) == 0) )
- {
- WarnNoImageReturn("\"%%[%s]\"",property);
- (void) FormatLocaleString(value,MaxTextExtent,"%.20g",
- image->resolution.x);
- break;
- }
- break;
- }
- case 'y': /* FUTURE: Obsolete Y resolution */
+ }
+ if (string != (char *) NULL)
+ return(string);
+ if (*value != '\0')
{
- if ((LocaleCompare("yresolution",property) == 0) ||
- (LocaleCompare("y-resolution",property) == 0) )
+ /*
+ Create a cloned copy of result, that will get cleaned up, eventually.
+ */
+ if (image != (Image *) NULL)
{
- WarnNoImageReturn("\"%%[%s]\"",property);
- (void) FormatLocaleString(value,MaxTextExtent,"%.20g",
- image->resolution.y);
- break;
+ (void) SetImageArtifact(image,"get-property",value);
+ return(GetImageArtifact(image,"get-property"));
}
- break;
- }
- case 'z':
- {
- if (LocaleCompare("zero",property) == 0)
+ else
{
- WarnNoImageInfoReturn("\"%%[%s]\"",property);
- string=image_info->zero;
- break;
+ (void) SetImageOption(image_info,"get-property",value);
+ return(GetImageOption(image_info,"get-property"));
}
- break;
}
- }
- if (string != (char *) NULL)
- return(string);
- if (*value != '\0')
- {
- /* create a cloned copy of result, that will get cleaned up, eventually */
- if (image != (Image *) NULL)
- {
- (void) SetImageArtifact(image,"get-property",value);
- return(GetImageArtifact(image,"get-property"));
- }
- else
- {
- (void) SetImageOption(image_info,"get-property",value);
- return(GetImageOption(image_info,"get-property"));
- }
- }
return((char *) NULL);
}
#undef WarnNoImageReturn
% o image: the image.
%
*/
-MagickExport char *GetNextImageProperty(const Image *image)
+MagickExport const char *GetNextImageProperty(const Image *image)
{
assert(image != (Image *) NULL);
- assert(image->signature == MagickSignature);
+ assert(image->signature == MagickCoreSignature);
if (image->debug != MagickFalse)
(void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",
image->filename);
if (image->properties == (void *) NULL)
- return((char *) NULL);
- return((char *) GetNextKeyInSplayTree((SplayTreeInfo *) image->properties));
+ return((const char *) NULL);
+ return((const char *) GetNextKeyInSplayTree((SplayTreeInfo *) image->properties));
}
\f
/*
% o exception: return any errors or warnings in this structure.
%
*/
-
-/* common inline code to expand the interpreted text string */
-#define ExtendInterpretText(string_length) do { \
+MagickExport char *InterpretImageProperties(ImageInfo *image_info,Image *image,
+ const char *embed_text,ExceptionInfo *exception)
+{
+#define ExtendInterpretText(string_length) \
DisableMSCWarning(4127) \
- size_t length=(string_length); \
- if ((size_t) (q-interpret_text+length+1) >= extent) \
- { extent+=length; \
- interpret_text=(char *) ResizeQuantumMemory(interpret_text, \
- extent+MaxTextExtent,sizeof(*interpret_text)); \
- if (interpret_text == (char *) NULL) \
- return((char *) NULL); \
- q=interpret_text+strlen(interpret_text); \
- } } while (0) /* no trailing ; */ \
+{ \
+ size_t length=(string_length); \
+ if ((size_t) (q-interpret_text+length+1) >= extent) \
+ { \
+ extent+=length; \
+ interpret_text=(char *) ResizeQuantumMemory(interpret_text,extent+ \
+ MaxTextExtent,sizeof(*interpret_text)); \
+ if (interpret_text == (char *) NULL) \
+ return((char *) NULL); \
+ q=interpret_text+strlen(interpret_text); \
+ } \
+} \
RestoreMSCWarning
-/* same but append the given string */
-#define AppendString2Text(string) do { \
+#define AppendKeyValue2Text(key,value)\
DisableMSCWarning(4127) \
- size_t length=strlen((string)); \
- if ((size_t) (q-interpret_text+length+1) >= extent) \
- { extent+=length; \
- interpret_text=(char *) ResizeQuantumMemory(interpret_text, \
- extent+MaxTextExtent,sizeof(*interpret_text)); \
- if (interpret_text == (char *) NULL) \
- return((char *) NULL); \
- q=interpret_text+strlen(interpret_text); \
- } \
- (void) CopyMagickString(q,(string),extent); \
- q+=length; \
- } while (0) /* no trailing ; */ \
+{ \
+ size_t length=strlen(key)+strlen(value)+2; \
+ if ((size_t) (q-interpret_text+length+1) >= extent) \
+ { \
+ extent+=length; \
+ interpret_text=(char *) ResizeQuantumMemory(interpret_text,extent+ \
+ MaxTextExtent,sizeof(*interpret_text)); \
+ if (interpret_text == (char *) NULL) \
+ return((char *) NULL); \
+ q=interpret_text+strlen(interpret_text); \
+ } \
+ q+=FormatLocaleString(q,extent,"%s=%s\n",(key),(value)); \
+} \
RestoreMSCWarning
-/* same but append a 'key' and 'string' pair */
-#define AppendKeyValue2Text(key,string) do { \
+#define AppendString2Text(string) \
DisableMSCWarning(4127) \
- size_t length=strlen(key)+strlen(string)+2; \
- if ((size_t) (q-interpret_text+length+1) >= extent) \
- { extent+=length; \
- interpret_text=(char *) ResizeQuantumMemory(interpret_text, \
- extent+MaxTextExtent,sizeof(*interpret_text)); \
+{ \
+ size_t length=strlen((string)); \
+ if ((size_t) (q-interpret_text+length+1) >= extent) \
+ { \
+ extent+=length; \
+ interpret_text=(char *) ResizeQuantumMemory(interpret_text,extent+ \
+ MaxTextExtent,sizeof(*interpret_text)); \
if (interpret_text == (char *) NULL) \
return((char *) NULL); \
q=interpret_text+strlen(interpret_text); \
- } \
- q+=FormatLocaleString(q,extent,"%s=%s\n",(key),(string)); \
- } while (0) /* no trailing ; */ \
+ } \
+ (void) CopyMagickString(q,(string),extent); \
+ q+=length; \
+} \
RestoreMSCWarning
-MagickExport char *InterpretImageProperties(ImageInfo *image_info,
- Image *image,const char *embed_text,ExceptionInfo *exception)
-{
char
*interpret_text;
+ MagickBooleanType
+ number;
+
register char
- *q; /* current position in interpret_text */
+ *q; /* current position in interpret_text */
register const char
- *p; /* position in embed_text string being expanded */
+ *p; /* position in embed_text string being expanded */
size_t
- extent; /* allocated length of interpret_text */
-
- MagickBooleanType
- number;
+ extent; /* allocated length of interpret_text */
- assert(image == NULL || image->signature == MagickSignature);
- assert(image_info == NULL || image_info->signature == MagickSignature);
-
- if (image != (Image *) NULL && IfMagickTrue(image->debug))
+ assert(image == NULL || image->signature == MagickCoreSignature);
+ assert(image_info == NULL || image_info->signature == MagickCoreSignature);
+ if ((image != (Image *) NULL) && (image->debug != MagickFalse))
(void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",image->filename);
- else if( image_info != (ImageInfo *) NULL && IfMagickTrue(image_info->debug))
- (void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s","no-image");
-
+ else
+ if ((image_info != (ImageInfo *) NULL) && (image_info->debug != MagickFalse))
+ (void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s","no-image");
if (embed_text == (const char *) NULL)
- return((char *) NULL);
+ return(ConstantString(""));
p=embed_text;
-
+ while ((isspace((int) ((unsigned char) *p)) != 0) && (*p != '\0'))
+ p++;
if (*p == '\0')
return(ConstantString(""));
-
- /* handle a '@' replace string from file */
- if (*p == '@') {
- p++;
- if (*p != '-' && IfMagickFalse(IsPathAccessible(p)) ) {
- (void) ThrowMagickException(exception,GetMagickModule(),OptionError,
- "UnableToAccessPath","%s",p);
- return((char *) NULL);
- }
- return(FileToString(p,~0UL,exception));
- }
-
+ if ((*p == '@') && (IsPathAccessible(p+1) != MagickFalse))
+ {
+ /*
+ Handle a '@' replace string from file.
+ */
+ if (IsRightsAuthorized(PathPolicyDomain,ReadPolicyRights,p) == MagickFalse)
+ {
+ errno=EPERM;
+ (void) ThrowMagickException(exception,GetMagickModule(),PolicyError,
+ "NotAuthorized","`%s'",p);
+ return(ConstantString(""));
+ }
+ interpret_text=FileToString(p+1,~0UL,exception);
+ if (interpret_text != (char *) NULL)
+ return(interpret_text);
+ }
/*
Translate any embedded format characters.
*/
interpret_text=AcquireString(embed_text); /* new string with extra space */
- extent=MaxTextExtent; /* allocated space in string */
+ extent=MagickPathExtent; /* allocated space in string */
number=MagickFalse; /* is last char a number? */
- for (q=interpret_text; *p!='\0'; number=IsMagickTrue(isdigit(*p)),p++)
+ for (q=interpret_text; *p!='\0'; number=isdigit(*p) ? MagickTrue : MagickFalse,p++)
{
- *q='\0';
- ExtendInterpretText(MaxTextExtent);
/*
Look for the various escapes, (and handle other specials)
*/
- switch (*p) {
+ *q='\0';
+ ExtendInterpretText(MagickPathExtent);
+ switch (*p)
+ {
case '\\':
- switch (*(p+1)) {
+ {
+ switch (*(p+1))
+ {
case '\0':
continue;
- case 'r': /* convert to RETURN */
+ case 'r': /* convert to RETURN */
+ {
*q++='\r';
p++;
continue;
- case 'n': /* convert to NEWLINE */
+ }
+ case 'n': /* convert to NEWLINE */
+ {
*q++='\n';
p++;
continue;
- case '\n': /* EOL removal UNIX,MacOSX */
+ }
+ case '\n': /* EOL removal UNIX,MacOSX */
+ {
p++;
continue;
- case '\r': /* EOL removal DOS,Windows */
+ }
+ case '\r': /* EOL removal DOS,Windows */
+ {
p++;
if (*p == '\n') /* return-newline EOL */
p++;
continue;
+ }
default:
+ {
p++;
*q++=(*p);
+ }
}
continue;
+ }
case '&':
+ {
if (LocaleNCompare("<",p,4) == 0)
- *q++='<', p+=3;
- else if (LocaleNCompare(">",p,4) == 0)
- *q++='>', p+=3;
- else if (LocaleNCompare("&",p,5) == 0)
- *q++='&', p+=4;
+ {
+ *q++='<';
+ p+=3;
+ }
else
- *q++=(*p);
+ if (LocaleNCompare(">",p,4) == 0)
+ {
+ *q++='>';
+ p+=3;
+ }
+ else
+ if (LocaleNCompare("&",p,5) == 0)
+ {
+ *q++='&';
+ p+=4;
+ }
+ else
+ *q++=(*p);
continue;
+ }
case '%':
- break; /* continue to next set of handlers */
+ break; /* continue to next set of handlers */
default:
+ {
*q++=(*p); /* any thing else is 'as normal' */
continue;
+ }
}
p++; /* advance beyond the percent */
-
/*
- Doubled Percent - or percent at end of string
+ Doubled Percent - or percent at end of string.
*/
if ((*p == '\0') || (*p == '\'') || (*p == '"'))
p--;
- if (*p == '%') {
+ if (*p == '%')
+ {
*q++='%';
continue;
}
/*
- Single letter escapes %c
+ Single letter escapes %c.
*/
- if ( *p != '[' ) {
- const char
- *string;
+ if (*p != '[')
+ {
+ const char
+ *string;
- /* But only if not preceeded by a number! */
- if ( IfMagickTrue(number) ) {
- *q++='%'; /* do NOT substitute the percent */
- p--; /* back up one */
+ if (number != MagickFalse)
+ {
+ /*
+ But only if not preceeded by a number!
+ */
+ *q++='%'; /* do NOT substitute the percent */
+ p--; /* back up one */
+ continue;
+ }
+ string=GetMagickPropertyLetter(image_info,image,*p, exception);
+ if (string != (char *) NULL)
+ {
+ AppendString2Text(string);
+ if (image != (Image *) NULL)
+ (void) DeleteImageArtifact(image,"get-property");
+ if (image_info != (ImageInfo *) NULL)
+ (void) DeleteImageOption(image_info,"get-property");
+ continue;
+ }
+ (void) ThrowMagickException(exception,GetMagickModule(),OptionWarning,
+ "UnknownImageProperty","\"%%%c\"",*p);
continue;
}
- string=GetMagickPropertyLetter(image_info,image,*p, exception);
- if (string != (char *) NULL)
- {
- AppendString2Text(string);
- if (image != (Image *) NULL)
- (void)DeleteImageArtifact(image,"get-property");
- if (image_info != (ImageInfo *) NULL)
- (void)DeleteImageOption(image_info,"get-property");
- continue;
- }
- (void) ThrowMagickException(exception,GetMagickModule(),OptionWarning,
- "UnknownImageProperty","\"%%%c\"",*p);
- continue;
- }
-
- /*
- Braced Percent Escape %[...]
- */
{
char
- pattern[2*MaxTextExtent];
+ pattern[2*MagickPathExtent];
const char
*key,
ssize_t
depth;
- /* get the property name framed by the %[...] */
+ /*
+ Braced Percent Escape %[...].
+ */
p++; /* advance p to just inside the opening brace */
depth=1;
- if ( *p == ']' ) {
- (void) ThrowMagickException(exception,GetMagickModule(),OptionWarning,
- "UnknownImageProperty","\"%%[]\"");
- break;
- }
- for (len=0; len<(MaxTextExtent-1L) && (*p != '\0');)
- {
- /* skip escaped braces within braced pattern */
- if ( (*p == '\\') && (*(p+1) != '\0') ) {
- pattern[len++]=(*p++);
- pattern[len++]=(*p++);
- continue;
+ if (*p == ']')
+ {
+ (void) ThrowMagickException(exception,GetMagickModule(),OptionWarning,
+ "UnknownImageProperty","\"%%[]\"");
+ break;
}
+ for (len=0; len<(MagickPathExtent-1L) && (*p != '\0');)
+ {
+ if ((*p == '\\') && (*(p+1) != '\0'))
+ {
+ /*
+ Skip escaped braces within braced pattern.
+ */
+ pattern[len++]=(*p++);
+ pattern[len++]=(*p++);
+ continue;
+ }
if (*p == '[')
depth++;
if (*p == ']')
pattern[len++]=(*p++);
}
pattern[len]='\0';
- /* Check for unmatched final ']' for "%[...]" */
- if ( depth != 0 ) {
- if (len >= 64) { /* truncate string for error message */
- pattern[61] = '.';
- pattern[62] = '.';
- pattern[63] = '.';
- pattern[64] = '\0';
+ if (depth != 0)
+ {
+ /*
+ Check for unmatched final ']' for "%[...]".
+ */
+ if (len >= 64)
+ {
+ pattern[61] = '.'; /* truncate string for error message */
+ pattern[62] = '.';
+ pattern[63] = '.';
+ pattern[64] = '\0';
+ }
+ (void) ThrowMagickException(exception,GetMagickModule(),OptionError,
+ "UnbalancedBraces","\"%%[%s\"",pattern);
+ interpret_text=DestroyString(interpret_text);
+ return((char *) NULL);
}
- (void) ThrowMagickException(exception,GetMagickModule(),
- OptionError,"UnbalancedBraces","\"%%[%s\"",pattern);
- interpret_text=DestroyString(interpret_text);
- return((char *) NULL);
- }
-
/*
- Special Lookup Prefixes %[prefix:...]
+ Special Lookup Prefixes %[prefix:...].
*/
- /* fx - value calculator */
if (LocaleNCompare("fx:",pattern,3) == 0)
{
- FxInfo
- *fx_info;
-
double
value;
+ FxInfo
+ *fx_info;
+
MagickBooleanType
status;
- if (image == (Image *) NULL ) {
- (void) ThrowMagickException(exception,GetMagickModule(),
+ /*
+ FX - value calculator.
+ */
+ if (image == (Image *) NULL )
+ {
+ (void) ThrowMagickException(exception,GetMagickModule(),
OptionWarning,"NoImageForProperty","\"%%[%s]\"",pattern);
- continue; /* else no image to retrieve artifact */
- }
+ continue; /* else no image to retrieve artifact */
+ }
fx_info=AcquireFxInfo(image,pattern+3,exception);
status=FxEvaluateChannelExpression(fx_info,IntensityPixelChannel,0,0,
&value,exception);
fx_info=DestroyFxInfo(fx_info);
- if( IfMagickTrue(status) )
+ if (status != MagickFalse)
{
char
- result[MaxTextExtent];
+ result[MagickPathExtent];
- (void) FormatLocaleString(result,MaxTextExtent,"%.*g",
+ (void) FormatLocaleString(result,MagickPathExtent,"%.*g",
GetMagickPrecision(),(double) value);
AppendString2Text(result);
}
continue;
}
- /* pixel - color value calculator */
- if (LocaleNCompare("pixel:",pattern,6) == 0)
+ if (LocaleNCompare("hex:",pattern,4) == 0)
{
+ double
+ value;
+
FxInfo
*fx_info;
+ MagickStatusType
+ status;
+
+ PixelInfo
+ pixel;
+
+ /*
+ Pixel - color value calculator.
+ */
+ if (image == (Image *) NULL)
+ {
+ (void) ThrowMagickException(exception,GetMagickModule(),
+ OptionWarning,"NoImageForProperty","\"%%[%s]\"",pattern);
+ continue; /* else no image to retrieve artifact */
+ }
+ GetPixelInfo(image,&pixel);
+ fx_info=AcquireFxInfo(image,pattern+4,exception);
+ status=FxEvaluateChannelExpression(fx_info,RedPixelChannel,0,0,
+ &value,exception);
+ pixel.red=(double) QuantumRange*value;
+ status&=FxEvaluateChannelExpression(fx_info,GreenPixelChannel,0,0,
+ &value,exception);
+ pixel.green=(double) QuantumRange*value;
+ status&=FxEvaluateChannelExpression(fx_info,BluePixelChannel,0,0,
+ &value,exception);
+ pixel.blue=(double) QuantumRange*value;
+ if (image->colorspace == CMYKColorspace)
+ {
+ status&=FxEvaluateChannelExpression(fx_info,BlackPixelChannel,0,0,
+ &value,exception);
+ pixel.black=(double) QuantumRange*value;
+ }
+ status&=FxEvaluateChannelExpression(fx_info,AlphaPixelChannel,0,0,
+ &value,exception);
+ pixel.alpha=(double) QuantumRange*value;
+ fx_info=DestroyFxInfo(fx_info);
+ if (status != MagickFalse)
+ {
+ char
+ hex[MagickPathExtent],
+ name[MagickPathExtent];
+
+ (void) QueryColorname(image,&pixel,SVGCompliance,name,exception);
+ GetColorTuple(&pixel,MagickTrue,hex);
+ AppendString2Text(hex+1);
+ }
+ continue;
+ }
+ if (LocaleNCompare("pixel:",pattern,6) == 0)
+ {
double
value;
+ FxInfo
+ *fx_info;
+
MagickStatusType
status;
PixelInfo
pixel;
- if (image == (Image *) NULL ) {
- (void) ThrowMagickException(exception,GetMagickModule(),
+ /*
+ Pixel - color value calculator.
+ */
+ if (image == (Image *) NULL)
+ {
+ (void) ThrowMagickException(exception,GetMagickModule(),
OptionWarning,"NoImageForProperty","\"%%[%s]\"",pattern);
- continue; /* else no image to retrieve artifact */
- }
+ continue; /* else no image to retrieve artifact */
+ }
GetPixelInfo(image,&pixel);
fx_info=AcquireFxInfo(image,pattern+6,exception);
status=FxEvaluateChannelExpression(fx_info,RedPixelChannel,0,0,
&value,exception);
pixel.alpha=(double) QuantumRange*value;
fx_info=DestroyFxInfo(fx_info);
- if( IfMagickTrue(status) )
+ if (status != MagickFalse)
{
char
- name[MaxTextExtent];
+ name[MagickPathExtent];
- (void) QueryColorname(image,&pixel,SVGCompliance,name,
- exception);
+ (void) QueryColorname(image,&pixel,SVGCompliance,name,exception);
AppendString2Text(name);
}
continue;
}
- /* option - direct global option lookup (with globbing) */
if (LocaleNCompare("option:",pattern,7) == 0)
- {
- if (image_info == (ImageInfo *) NULL ) {
- (void) ThrowMagickException(exception,GetMagickModule(),
- OptionWarning,"NoImageForProperty","\"%%[%s]\"",pattern);
- continue; /* else no image to retrieve artifact */
- }
- if( IfMagickTrue(IsGlob(pattern+7)) )
{
- ResetImageOptionIterator(image_info);
- while ((key=GetNextImageOption(image_info)) != (const char *) NULL)
- if( IfMagickTrue(GlobExpression(key,pattern+7,MagickTrue)) )
- {
- string=GetImageOption(image_info,key);
- if (string != (const char *) NULL)
- AppendKeyValue2Text(key,string);
- /* else - assertion failure? key found but no string value! */
- }
+ /*
+ Option - direct global option lookup (with globbing).
+ */
+ if (image_info == (ImageInfo *) NULL )
+ {
+ (void) ThrowMagickException(exception,GetMagickModule(),
+ OptionWarning,"NoImageForProperty","\"%%[%s]\"",pattern);
+ continue; /* else no image to retrieve artifact */
+ }
+ if (IsGlob(pattern+7) != MagickFalse)
+ {
+ ResetImageOptionIterator(image_info);
+ while ((key=GetNextImageOption(image_info)) != (const char *) NULL)
+ if (GlobExpression(key,pattern+7,MagickTrue) != MagickFalse)
+ {
+ string=GetImageOption(image_info,key);
+ if (string != (const char *) NULL)
+ AppendKeyValue2Text(key,string);
+ /* else - assertion failure? key found but no string value! */
+ }
+ continue;
+ }
+ string=GetImageOption(image_info,pattern+7);
+ if (string == (char *) NULL)
+ goto PropertyLookupFailure; /* no artifact of this specifc name */
+ AppendString2Text(string);
continue;
}
- string=GetImageOption(image_info,pattern+7);
- if (string == (char *) NULL)
- goto PropertyLookupFailure; /* no artifact of this specifc name */
- AppendString2Text(string);
- continue;
- }
- /* artifact - direct image artifact lookup (with glob) */
if (LocaleNCompare("artifact:",pattern,9) == 0)
- {
- if (image == (Image *) NULL ) {
- (void) ThrowMagickException(exception,GetMagickModule(),
- OptionWarning,"NoImageForProperty","\"%%[%s]\"",pattern);
- continue; /* else no image to retrieve artifact */
- }
- if( IfMagickTrue(IsGlob(pattern+9)) )
{
- ResetImageArtifactIterator(image);
- while ((key=GetNextImageArtifact(image)) != (const char *) NULL)
- if( IfMagickTrue(GlobExpression(key,pattern+9,MagickTrue)) )
- {
- string=GetImageArtifact(image,key);
- if (string != (const char *) NULL)
- AppendKeyValue2Text(key,string);
- /* else - assertion failure? key found but no string value! */
- }
+ /*
+ Artifact - direct image artifact lookup (with glob).
+ */
+ if (image == (Image *) NULL)
+ {
+ (void) ThrowMagickException(exception,GetMagickModule(),
+ OptionWarning,"NoImageForProperty","\"%%[%s]\"",pattern);
+ continue; /* else no image to retrieve artifact */
+ }
+ if (IsGlob(pattern+9) != MagickFalse)
+ {
+ ResetImageArtifactIterator(image);
+ while ((key=GetNextImageArtifact(image)) != (const char *) NULL)
+ if (GlobExpression(key,pattern+9,MagickTrue) != MagickFalse)
+ {
+ string=GetImageArtifact(image,key);
+ if (string != (const char *) NULL)
+ AppendKeyValue2Text(key,string);
+ /* else - assertion failure? key found but no string value! */
+ }
+ continue;
+ }
+ string=GetImageArtifact(image,pattern+9);
+ if (string == (char *) NULL)
+ goto PropertyLookupFailure; /* no artifact of this specifc name */
+ AppendString2Text(string);
continue;
}
- string=GetImageArtifact(image,pattern+9);
- if (string == (char *) NULL)
- goto PropertyLookupFailure; /* no artifact of this specifc name */
- AppendString2Text(string);
- continue;
- }
- /* property - direct image property lookup (with glob) */
if (LocaleNCompare("property:",pattern,9) == 0)
- {
- if (image == (Image *) NULL ) {
- (void) ThrowMagickException(exception,GetMagickModule(),
- OptionWarning,"NoImageForProperty","\"%%[%s]\"",pattern);
- continue; /* else no image to retrieve artifact */
- }
- if( IfMagickTrue(IsGlob(pattern+9)) )
{
- ResetImagePropertyIterator(image);
- while ((key=GetNextImageProperty(image)) != (const char *) NULL)
- if( IfMagickTrue(GlobExpression(key,pattern,MagickTrue)) )
- {
- string=GetImageProperty(image,key,exception);
- if (string != (const char *) NULL)
- AppendKeyValue2Text(key,string);
- /* else - assertion failure? */
- }
+ /*
+ Property - direct image property lookup (with glob).
+ */
+ if (image == (Image *) NULL)
+ {
+ (void) ThrowMagickException(exception,GetMagickModule(),
+ OptionWarning,"NoImageForProperty","\"%%[%s]\"",pattern);
+ continue; /* else no image to retrieve artifact */
+ }
+ if (IsGlob(pattern+9) != MagickFalse)
+ {
+ ResetImagePropertyIterator(image);
+ while ((key=GetNextImageProperty(image)) != (const char *) NULL)
+ if (GlobExpression(key,pattern,MagickTrue) != MagickFalse)
+ {
+ string=GetImageProperty(image,key,exception);
+ if (string != (const char *) NULL)
+ AppendKeyValue2Text(key,string);
+ /* else - assertion failure? */
+ }
+ continue;
+ }
+ string=GetImageProperty(image,pattern+9,exception);
+ if (string == (char *) NULL)
+ goto PropertyLookupFailure; /* no artifact of this specifc name */
+ AppendString2Text(string);
continue;
}
- string=GetImageProperty(image,pattern+9,exception);
- if (string == (char *) NULL)
- goto PropertyLookupFailure; /* no artifact of this specifc name */
- AppendString2Text(string);
- continue;
- }
- /* Properties without special prefix.
- This handles attributes, properties, and profiles such as %[exif:...]
- Note the profile properties may also include a glob expansion pattern.
- */
- if ( image != (Image *) NULL )
+ if (image != (Image *) NULL)
{
+ /*
+ Properties without special prefix. This handles attributes,
+ properties, and profiles such as %[exif:...]. Note the profile
+ properties may also include a glob expansion pattern.
+ */
string=GetImageProperty(image,pattern,exception);
if (string != (const char *) NULL)
{
continue;
}
}
- /*
- Handle property 'glob' patterns
- Such as: %[*] %[user:array_??] %[filename:e*]
- */
- if( IfMagickTrue(IsGlob(pattern)) )
+ if (IsGlob(pattern) != MagickFalse)
{
+ /*
+ Handle property 'glob' patterns such as:
+ %[*] %[user:array_??] %[filename:e*]>
+ */
if (image == (Image *) NULL)
continue; /* else no image to retrieve proprty - no list */
ResetImagePropertyIterator(image);
while ((key=GetNextImageProperty(image)) != (const char *) NULL)
- if( IfMagickTrue(GlobExpression(key,pattern,MagickTrue)) )
+ if (GlobExpression(key,pattern,MagickTrue) != MagickFalse)
{
string=GetImageProperty(image,key,exception);
if (string != (const char *) NULL)
continue;
}
/*
- Look for a known property or image attribute
- Such as %[basename] %[denisty] %[delay]
- Also handles a braced single letter: %[b] %[G] %[g]
+ Look for a known property or image attribute such as
+ %[basename] %[denisty] %[delay]. Also handles a braced single
+ letter: %[b] %[G] %[g].
*/
string=GetMagickProperty(image_info,image,pattern,exception);
if (string != (const char *) NULL)
continue;
}
/*
- Look for a per-image Artifact
- This includes option lookup (FUTURE: interpreted according to image)
+ Look for a per-image artifact. This includes option lookup
+ (FUTURE: interpreted according to image).
*/
if (image != (Image *) NULL)
{
}
}
else
- /* no image, so direct 'option' lookup (no delayed percent escapes) */
if (image_info != (ImageInfo *) NULL)
{
+ /*
+ No image, so direct 'option' lookup (no delayed percent escapes).
+ */
string=GetImageOption(image_info,pattern);
if (string != (char *) NULL)
{
/*
Failed to find any match anywhere!
*/
- if (len >= 64) { /* truncate string for error message */
- pattern[61] = '.';
- pattern[62] = '.';
- pattern[63] = '.';
- pattern[64] = '\0';
- }
- (void) ThrowMagickException(exception,GetMagickModule(),
- OptionWarning,"UnknownImageProperty","\"%%[%s]\"",pattern);
- /* continue */
- } /* Braced Percent Escape */
-
- } /* for each char in 'embed_text' */
+ if (len >= 64)
+ {
+ pattern[61] = '.'; /* truncate string for error message */
+ pattern[62] = '.';
+ pattern[63] = '.';
+ pattern[64] = '\0';
+ }
+ (void) ThrowMagickException(exception,GetMagickModule(),OptionWarning,
+ "UnknownImageProperty","\"%%[%s]\"",pattern);
+ }
+ }
*q='\0';
return(interpret_text);
}
% o property: the image property.
%
*/
-MagickExport char *RemoveImageProperty(Image *image,
- const char *property)
+MagickExport char *RemoveImageProperty(Image *image,const char *property)
{
char
*value;
assert(image != (Image *) NULL);
- assert(image->signature == MagickSignature);
+ assert(image->signature == MagickCoreSignature);
if (image->debug != MagickFalse)
- (void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",
- image->filename);
+ (void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",image->filename);
if (image->properties == (void *) NULL)
return((char *) NULL);
value=(char *) RemoveNodeFromSplayTree((SplayTreeInfo *) image->properties,
MagickExport void ResetImagePropertyIterator(const Image *image)
{
assert(image != (Image *) NULL);
- assert(image->signature == MagickSignature);
+ assert(image->signature == MagickCoreSignature);
if (image->debug != MagickFalse)
- (void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",
- image->filename);
+ (void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",image->filename);
if (image->properties == (void *) NULL)
return;
ResetSplayTreeIterator((SplayTreeInfo *) image->properties);
flags;
assert(image != (Image *) NULL);
- assert(image->signature == MagickSignature);
+ assert(image->signature == MagickCoreSignature);
if (image->debug != MagickFalse)
(void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",image->filename);
if (image->properties == (void *) NULL)
{
if (LocaleNCompare("8bim:",property,5) == 0)
{
- (void) ThrowMagickException(exception,GetMagickModule(),
- OptionError,"SetReadOnlyProperty","`%s'",property);
+ (void) ThrowMagickException(exception,GetMagickModule(),OptionError,
+ "SetReadOnlyProperty","`%s'",property);
return(MagickFalse);
}
break;
}
if (LocaleCompare("delay_units",property) == 0)
{
- (void) ThrowMagickException(exception,GetMagickModule(),
- OptionError,"SetReadOnlyProperty","`%s'",property);
+ (void) ThrowMagickException(exception,GetMagickModule(),OptionError,
+ "SetReadOnlyProperty","`%s'",property);
return(MagickFalse);
}
if (LocaleCompare("density",property) == 0)
{
if (LocaleNCompare("exif:",property,5) == 0)
{
- (void) ThrowMagickException(exception,GetMagickModule(),
- OptionError,"SetReadOnlyProperty","`%s'",property);
+ (void) ThrowMagickException(exception,GetMagickModule(),OptionError,
+ "SetReadOnlyProperty","`%s'",property);
return(MagickFalse);
}
break; /* not an attribute, add as a property */
{
if (LocaleNCompare("fx:",property,3) == 0)
{
- (void) ThrowMagickException(exception,GetMagickModule(),
- OptionError,"SetReadOnlyProperty","`%s'",property);
+ (void) ThrowMagickException(exception,GetMagickModule(),OptionError,
+ "SetReadOnlyProperty","`%s'",property);
return(MagickFalse);
}
break; /* not an attribute, add as a property */
{
if (LocaleCompare("height",property) == 0)
{
- (void) ThrowMagickException(exception,GetMagickModule(),
- OptionError,"SetReadOnlyProperty","`%s'",property);
+ (void) ThrowMagickException(exception,GetMagickModule(),OptionError,
+ "SetReadOnlyProperty","`%s'",property);
return(MagickFalse);
}
break; /* not an attribute, add as a property */
ssize_t
intensity;
- intensity=ParseCommandOption(MagickIntentOptions,MagickFalse,
- value);
+ intensity=ParseCommandOption(MagickIntentOptions,MagickFalse,value);
if (intensity < 0)
return(MagickFalse);
image->intensity=(PixelIntensityMethod) intensity;
Throwing an exception causes this setting to fail */
if (LocaleNCompare("iptc:",property,5) == 0)
{
- (void) ThrowMagickException(exception,GetMagickModule(),
- OptionError,"SetReadOnlyProperty","`%s'",property);
+ (void) ThrowMagickException(exception,GetMagickModule(),OptionError,
+ "SetReadOnlyProperty","`%s'",property);
return(MagickFalse);
}
#endif
case 'k':
if (LocaleCompare("kurtosis",property) == 0)
{
- (void) ThrowMagickException(exception,GetMagickModule(),
- OptionError,"SetReadOnlyProperty","`%s'",property);
+ (void) ThrowMagickException(exception,GetMagickModule(),OptionError,
+ "SetReadOnlyProperty","`%s'",property);
return(MagickFalse);
}
break; /* not an attribute, add as a property */
}
case 'M':
case 'm':
- if ( (LocaleCompare("magick",property) == 0) ||
- (LocaleCompare("max",property) == 0) ||
- (LocaleCompare("mean",property) == 0) ||
- (LocaleCompare("min",property) == 0) ||
- (LocaleCompare("min",property) == 0) )
+ if ((LocaleCompare("magick",property) == 0) ||
+ (LocaleCompare("max",property) == 0) ||
+ (LocaleCompare("mean",property) == 0) ||
+ (LocaleCompare("min",property) == 0) ||
+ (LocaleCompare("min",property) == 0))
{
(void) ThrowMagickException(exception,GetMagickModule(),OptionError,
"SetReadOnlyProperty","`%s'",property);
case 'o':
if (LocaleCompare("opaque",property) == 0)
{
- (void) ThrowMagickException(exception,GetMagickModule(),
- OptionError,"SetReadOnlyProperty","`%s'",property);
+ (void) ThrowMagickException(exception,GetMagickModule(),OptionError,
+ "SetReadOnlyProperty","`%s'",property);
return(MagickFalse);
}
break; /* not an attribute, add as a property */
Throwing an exception causes this setting to fail */
if (LocaleNCompare("pixel:",property,6) == 0)
{
- (void) ThrowMagickException(exception,GetMagickModule(),
- OptionError,"SetReadOnlyProperty","`%s'",property);
+ (void) ThrowMagickException(exception,GetMagickModule(),OptionError,
+ "SetReadOnlyProperty","`%s'",property);
return(MagickFalse);
}
#endif
*profile;
image_info=AcquireImageInfo();
- (void) CopyMagickString(image_info->filename,value,MaxTextExtent);
+ (void) CopyMagickString(image_info->filename,value,MagickPathExtent);
(void) SetImageInfo(image_info,1,exception);
profile=FileToStringInfo(image_info->filename,~0UL,exception);
if (profile != (StringInfo *) NULL)
}
case 'S':
case 's':
- if ( (LocaleCompare("size",property) == 0) ||
- (LocaleCompare("skewness",property) == 0) ||
- (LocaleCompare("scenes",property) == 0) ||
- (LocaleCompare("standard-deviation",property) == 0) )
+ if ((LocaleCompare("size",property) == 0) ||
+ (LocaleCompare("skewness",property) == 0) ||
+ (LocaleCompare("scenes",property) == 0) ||
+ (LocaleCompare("standard-deviation",property) == 0))
{
- (void) ThrowMagickException(exception,GetMagickModule(),
- OptionError,"SetReadOnlyProperty","`%s'",property);
+ (void) ThrowMagickException(exception,GetMagickModule(),OptionError,
+ "SetReadOnlyProperty","`%s'",property);
return(MagickFalse);
}
break; /* not an attribute, add as a property */
{
if (LocaleCompare("version",property) == 0)
{
- (void) ThrowMagickException(exception,GetMagickModule(),
- OptionError,"SetReadOnlyProperty","`%s'",property);
+ (void) ThrowMagickException(exception,GetMagickModule(),OptionError,
+ "SetReadOnlyProperty","`%s'",property);
return(MagickFalse);
}
break; /* not an attribute, add as a property */
{
if (LocaleCompare("width",property) == 0)
{
- (void) ThrowMagickException(exception,GetMagickModule(),
- OptionError,"SetReadOnlyProperty","`%s'",property);
+ (void) ThrowMagickException(exception,GetMagickModule(),OptionError,
+ "SetReadOnlyProperty","`%s'",property);
return(MagickFalse);
}
break; /* not an attribute, add as a property */
{
if (LocaleNCompare("xmp:",property,4) == 0)
{
- (void) ThrowMagickException(exception,GetMagickModule(),
- OptionError,"SetReadOnlyProperty","`%s'",property);
+ (void) ThrowMagickException(exception,GetMagickModule(),OptionError,
+ "SetReadOnlyProperty","`%s'",property);
return(MagickFalse);
}
break; /* not an attribute, add as a property */