*quantum=(unsigned int) (*p++) << 24;
*quantum|=(unsigned int) (*p++) << 16;
*quantum|=(unsigned int) (*p++) << 8;
- *quantum|=(unsigned int) (*p++) << 0;
+ *quantum|=(unsigned int) (*p++);
return(p);
}
offset;
ssize_t
- extract_count;
+ extract_extent;
StringInfo
*extract_profile;
- extract_count=0;
+ extract_extent=0;
extent=(datum+length)-(p+count);
if (profile == (StringInfo *) NULL)
{
else
{
offset=(p-datum);
- extract_count=profile->length;
- if ((extract_count & 0x01) != 0)
- extract_count++;
- extract_profile=AcquireStringInfo(offset+extract_count+extent);
+ extract_extent=profile->length;
+ if ((extract_extent & 0x01) != 0)
+ extract_extent++;
+ extract_profile=AcquireStringInfo(offset+extract_extent+extent);
(void) CopyMagickMemory(extract_profile->datum,datum,offset-4);
- WriteResourceLong(extract_profile->datum+offset-4,
- (unsigned int)profile->length);
+ WriteResourceLong(extract_profile->datum+offset-4,(unsigned int)
+ profile->length);
(void) CopyMagickMemory(extract_profile->datum+offset,
profile->datum,profile->length);
}
- (void) CopyMagickMemory(extract_profile->datum+offset+extract_count,
+ (void) CopyMagickMemory(extract_profile->datum+offset+extract_extent,
p+count,extent);
(void) AddValueToSplayTree((SplayTreeInfo *) image->profiles,
ConstantString("8bim"),CloneStringInfo(extract_profile));
unsigned char
length_byte;
- unsigned int
- value;
+ unsigned int
+ value;
unsigned short
id;
if ((id == 0x3ED) && (count == 16))
{
if (image->units == PixelsPerCentimeterResolution)
- WriteProfileLong(MSBEndian, (unsigned int) (image->resolution.x*2.54*
+ WriteProfileLong(MSBEndian,(unsigned int) (image->resolution.x*2.54*
65536.0),p);
else
- WriteProfileLong(MSBEndian, (unsigned int) (image->resolution.x*
+ WriteProfileLong(MSBEndian,(unsigned int) (image->resolution.x*
65536.0),p);
WriteProfileShort(MSBEndian,(unsigned short) image->units,p+4);
if (image->units == PixelsPerCentimeterResolution)
- WriteProfileLong(MSBEndian, (unsigned int) (image->resolution.y*2.54*
+ WriteProfileLong(MSBEndian,(unsigned int) (image->resolution.y*2.54*
65536.0),p+8);
else
- WriteProfileLong(MSBEndian, (unsigned int) (image->resolution.y*
+ WriteProfileLong(MSBEndian,(unsigned int) (image->resolution.y*
65536.0),p+8);
WriteProfileShort(MSBEndian,(unsigned short) image->units,p+12);
}
length,
number_entries;
+ SplayTreeInfo
+ *exif_resources;
+
ssize_t
id,
level,
This the offset to the first IFD.
*/
offset=(ssize_t) ReadProfileLong(endian,exif+4);
- if ((offset < 0) || (size_t) offset >= length)
+ if ((offset < 0) || ((size_t) offset >= length))
return(MagickFalse);
directory=exif+offset;
level=0;
entry=0;
+ exif_resources=NewSplayTree((int (*)(const void *,const void *)) NULL,
+ (void *(*)(void *)) NULL,(void *(*)(void *)) NULL);
do
{
if (level > 0)
q=(unsigned char *) (directory+2+(12*entry));
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) ReadProfileShort(endian,q);
format=(ssize_t) ReadProfileShort(endian,q+2);
if ((format < 0) || ((format-1) >= EXIF_NUM_FORMATS))
break;
- components=(ssize_t) ReadProfileLong(endian,q+4);
+ components=(int) ReadProfileLong(endian,q+4);
if (components < 0)
break; /* corrupt EXIF */
number_bytes=(size_t) components*format_bytes[format];
/*
The directory entry contains an offset.
*/
- offset=(ssize_t) ReadProfileLong(endian,q+8);
+ offset=(ssize_t) ReadProfileLong(endian,q+8);
if ((offset < 0) || ((size_t) (offset+number_bytes) > length))
continue;
if (~length < number_bytes)
}
if ((tag_value == TAG_EXIF_OFFSET) || (tag_value == TAG_INTEROP_OFFSET))
{
- offset=(ssize_t) ReadProfileLong(endian,p);
+ offset=(ssize_t) ReadProfileLong(endian,p);
if (((size_t) offset < length) && (level < (MaxDirectoryStack-2)))
{
directory_stack[level].directory=directory;
level++;
if ((directory+2+(12*number_entries)) > (exif+length))
break;
- offset=(ssize_t) ReadProfileLong(endian,directory+2+(12*
+ offset=(ssize_t) ReadProfileLong(endian,directory+2+(12*
number_entries));
if ((offset != 0) && ((size_t) offset < length) &&
(level < (MaxDirectoryStack-2)))
}
}
} while (level > 0);
+ exif_resources=DestroySplayTree(exif_resources);
return(MagickTrue);
}
%
% 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:
%
component; \
\
size_t \
- length1; \
+ length; \
\
unsigned char \
*p1; \
\
- length1=0; \
+ length=0; \
p1=p; \
for (component=0; component < components; component++) \
{ \
- length1+=FormatLocaleString(buffer+length1,MagickPathExtent-length1, \
+ length+=FormatLocaleString(buffer+length,MagickPathExtent-length, \
format", ",arg); \
- if (length1 >= (MagickPathExtent-1)) \
- length1=MagickPathExtent-1; \
+ if (length >= (MagickPathExtent-1)) \
+ length=MagickPathExtent-1; \
p1+=size; \
} \
- if (length1 > 1) \
- buffer[length1-2]='\0'; \
+ if (length > 1) \
+ buffer[length-2]='\0'; \
value=AcquireString(buffer); \
}
component; \
\
size_t \
- length1; \
+ length; \
\
unsigned char \
*p1; \
\
- length1=0; \
+ length=0; \
p1=p; \
for (component=0; component < components; component++) \
{ \
- length1+=FormatLocaleString(buffer+length1,MagickPathExtent-length1, \
+ length+=FormatLocaleString(buffer+length,MagickPathExtent-length, \
format", ",(arg1),(arg2)); \
- if (length1 >= (MagickPathExtent-1)) \
- length1=MagickPathExtent-1; \
+ if (length >= (MagickPathExtent-1)) \
+ length=MagickPathExtent-1; \
p1+=size; \
} \
- if (length1 > 1) \
- buffer[length1-2]='\0'; \
+ if (length > 1) \
+ buffer[length-2]='\0'; \
value=AcquireString(buffer); \
}