% %
% %
% %
+% B l o b T o S t r i n g I n f o %
+% %
+% %
+% %
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%
+% BlobToStringInfo() returns the contents of a blob as a string.
+%
+% The format of the BlobToStringInfo method is:
+%
+% StringInfo *BlobToStringInfo(const void *blob,const size_t length)
+%
+% A description of each parameter follows:
+%
+% o blob: the blob.
+%
+% o length: the length of the blob.
+%
+*/
+MagickExport StringInfo *BlobToStringInfo(const void *blob,const size_t length)
+{
+ StringInfo
+ *string_info;
+
+ string_info=AcquireStringInfo(0);
+ string_info->datum=(unsigned char *) AcquireQuantumMemory(length,
+ sizeof(*string_info->datum));
+ if (string_info->datum == (unsigned char *) NULL)
+ {
+ string_info=DestroyStringInfo(string_info);
+ return((StringInfo *) NULL);
+ }
+ if (blob != (const void *) NULL)
+ (void) memcpy(string_info->datum,blob,length);
+ return(string_info);
+}
+\f
+/*
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+% %
+% %
+% %
% C l o n e S t r i n g %
% %
% %
extern MagickExport StringInfo
*AcquireStringInfo(const size_t),
+ *BlobToStringInfo(const void *,const size_t),
*CloneStringInfo(const StringInfo *),
*ConfigureFileToStringInfo(const char *),
*DestroyStringInfo(StringInfo *),
length-=14;
error_manager=(ErrorManager *) jpeg_info->client_data;
image=error_manager->image;
- profile=AcquireStringInfo(length);
+ profile=BlobToStringInfo((const void *) NULL,length);
if (profile == (StringInfo *) NULL)
ThrowBinaryException(ResourceLimitError,"MemoryAllocationFailed",
image->filename);
return(MagickTrue);
error_manager=(ErrorManager *) jpeg_info->client_data;
image=error_manager->image;
- profile=AcquireStringInfo(length);
+ profile=BlobToStringInfo((const void *) NULL,length);
if (profile == (StringInfo *) NULL)
ThrowBinaryException(ResourceLimitError,"MemoryAllocationFailed",
image->filename);
(void) FormatLocaleString(name,MaxTextExtent,"APP%d",marker);
error_manager=(ErrorManager *) jpeg_info->client_data;
image=error_manager->image;
- profile=AcquireStringInfo(length);
+ profile=BlobToStringInfo((const void *) NULL,length);
if (profile == (StringInfo *) NULL)
ThrowBinaryException(ResourceLimitError,"MemoryAllocationFailed",
image->filename);
{
if (length == 0)
break;
- profile=AcquireStringInfo(length);
+ profile=BlobToStringInfo((const void *) NULL,length);
SetStringInfoDatum(profile,info);
status=SetImageProfile(image,"icc",profile);
profile=DestroyStringInfo(profile);
{
if (length == 0)
break;
- profile=AcquireStringInfo(length);
+ profile=BlobToStringInfo((const void *) NULL,length);
SetStringInfoDatum(profile,info);
status=SetImageProfile(image,"iptc",profile);
if (status == MagickFalse)
return(MagickFalse);
}
- profile=AcquireStringInfo(length);
+ profile=BlobToStringInfo((const void *) NULL,length);
if (profile == (StringInfo *) NULL)
{
if (count != 1)
continue;
length=extent;
- profile=AcquireStringInfo(length);
+ profile=BlobToStringInfo((const void *) NULL,length);
p=GetStringInfoDatum(profile);
for (i=0; i < (ssize_t) length; i++)
*p++=(unsigned char) ProfileInteger(image,hex_digits);
if (length < 16)
return(MagickFalse);
- profile=AcquireStringInfo(length);
+ profile=BlobToStringInfo((const void *) NULL,length);
SetStringInfoDatum(profile,blocks);
(void) SetImageProfile(image,"8bim",profile);
profile=DestroyStringInfo(profile);