% July 2000 %
% %
% %
-% Copyright 1999-2010 ImageMagick Studio LLC, a non-profit organization %
+% Copyright 1999-2011 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 %
EndianType
endian;
- long
- value;
-
register const MimeInfo
*p;
size_t
lsb_first;
+ ssize_t
+ value;
+
assert(exception != (ExceptionInfo *) NULL);
if ((mime_list == (LinkedListInfo *) NULL) ||
(instantiate_mime == MagickFalse))
if ((size_t) (p->offset+4) > length)
break;
q=magic+p->offset;
- value=(*q++);
+ value=(ssize_t) (*q++);
if (p->mask == 0)
{
if (p->value == value)
endian=(*(char *) &lsb_first) == 1 ? LSBEndian : MSBEndian;
if (endian == LSBEndian)
{
- value=(*q++);
+ value=(ssize_t) (*q++);
value|=(*q++) << 8;
}
else
{
- value=(*q++) << 8;
+ value=(ssize_t) (*q++) << 8;
value|=(*q++);
}
if (p->mask == 0)
endian=(*(char *) &lsb_first) == 1 ? LSBEndian : MSBEndian;
if (endian == LSBEndian)
{
- value=(*q++);
+ value=(ssize_t) (*q++);
value|=(*q++) << 8;
value|=(*q++) << 16;
value|=(*q++) << 24;
}
else
{
- value=(*q++) << 24;
+ value=(ssize_t) (*q++) << 24;
value|=(*q++) << 16;
value|=(*q++) << 8;
value|=(*q++);
const MimeInfo
**mime_info;
- ssize_t
- j;
-
register ssize_t
i;
size_t
number_aliases;
+ ssize_t
+ j;
+
if (file == (const FILE *) NULL)
file=stdout;
mime_info=GetMimeInfoList("*",&number_aliases,exception);
(strcasecmp(path,mime_info[i]->path) != 0))
{
if (mime_info[i]->path != (char *) NULL)
- (void) fprintf(file,"\nPath: %s\n\n",mime_info[i]->path);
- (void) fprintf(file,"Type Description\n");
- (void) fprintf(file,"-------------------------------------------------"
+ (void) FormatLocaleFile(file,"\nPath: %s\n\n",mime_info[i]->path);
+ (void) FormatLocaleFile(file,"Type Description\n");
+ (void) FormatLocaleFile(file,
+ "-------------------------------------------------"
"------------------------------\n");
}
path=mime_info[i]->path;
- (void) fprintf(file,"%s",mime_info[i]->type);
+ (void) FormatLocaleFile(file,"%s",mime_info[i]->type);
if (strlen(mime_info[i]->type) <= 25)
{
for (j=(ssize_t) strlen(mime_info[i]->type); j <= 27; j++)
- (void) fprintf(file," ");
+ (void) FormatLocaleFile(file," ");
}
else
{
- (void) fprintf(file,"\n");
+ (void) FormatLocaleFile(file,"\n");
for (j=0; j <= 27; j++)
- (void) fprintf(file," ");
+ (void) FormatLocaleFile(file," ");
}
if (mime_info[i]->description != (char *) NULL)
- (void) fprintf(file,"%s",mime_info[i]->description);
- (void) fprintf(file,"\n");
+ (void) FormatLocaleFile(file,"%s",mime_info[i]->description);
+ (void) FormatLocaleFile(file,"\n");
}
(void) fflush(file);
mime_info=(const MimeInfo **) RelinquishMagickMemory((void *) mime_info);
/*
Process mime element.
*/
- mime_info=(MimeInfo *) AcquireAlignedMemory(1,sizeof(*mime_info));
+ mime_info=(MimeInfo *) AcquireMagickMemory(sizeof(*mime_info));
if (mime_info == (MimeInfo *) NULL)
ThrowFatalException(ResourceLimitFatalError,"MemoryAllocationFailed");
(void) ResetMagickMemory(mime_info,0,sizeof(*mime_info));
mime_info->signature=MagickSignature;
attribute=GetXMLTreeAttribute(mime,"data-type");
if (attribute != (const char *) NULL)
- mime_info->data_type=(DataType) ParseMagickOption(MagickDataTypeOptions,
+ mime_info->data_type=(DataType) ParseCommandOption(MagickDataTypeOptions,
MagickTrue,attribute);
attribute=GetXMLTreeAttribute(mime,"description");
if (attribute != (const char *) NULL)
mime_info->description=ConstantString(attribute);
attribute=GetXMLTreeAttribute(mime,"endian");
if (attribute != (const char *) NULL)
- mime_info->endian=(EndianType) ParseMagickOption(MagickEndianOptions,
+ mime_info->endian=(EndianType) ParseCommandOption(MagickEndianOptions,
MagickTrue,attribute);
attribute=GetXMLTreeAttribute(mime,"magic");
if (attribute != (const char *) NULL)
}
token=DestroyString(token);
if (mime_info->data_type != StringData)
- mime_info->value=strtol((char *) mime_info->magic,(char **) NULL,0);
+ mime_info->value=(ssize_t) strtoul((char *) mime_info->magic,
+ (char **) NULL,0);
}
attribute=GetXMLTreeAttribute(mime,"mask");
if (attribute != (const char *) NULL)
- mime_info->mask=strtol(attribute,(char **) NULL,0);
+ mime_info->mask=(ssize_t) strtoul(attribute,(char **) NULL,0);
attribute=GetXMLTreeAttribute(mime,"offset");
if (attribute != (const char *) NULL)
{
mime_info->pattern=ConstantString(attribute);
attribute=GetXMLTreeAttribute(mime,"priority");
if (attribute != (const char *) NULL)
- mime_info->priority=strtol(attribute,(char **) NULL,0);
+ mime_info->priority=(ssize_t) strtol(attribute,(char **) NULL,0);
attribute=GetXMLTreeAttribute(mime,"stealth");
if (attribute != (const char *) NULL)
mime_info->stealth=IsMagickTrue(attribute);
ExceptionInfo
*exception;
- (void) FormatMagickString(filename,MaxTextExtent,"file.%s",magick);
+ (void) FormatLocaleString(filename,MaxTextExtent,"file.%s",magick);
LocaleLower(filename);
exception=AcquireExceptionInfo();
mime_info=GetMimeInfo(filename,(unsigned char *) " ",1,exception);
exception=DestroyExceptionInfo(exception);
if (mime_info != (const MimeInfo *) NULL)
return(ConstantString(GetMimeType(mime_info)));
- (void) FormatMagickString(media,MaxTextExtent,"image/x-%s",magick);
+ (void) FormatLocaleString(media,MaxTextExtent,"image/x-%s",magick);
LocaleLower(media+8);
return(ConstantString(media));
}