%
% The format of the DiscardBlobBytes method is:
%
-% MagickBooleanType DiscardBlobBytes(Image *image,const size_t length)
+% MagickBooleanType DiscardBlobBytes(Image *image,
+% const MagickSizeType length)
%
% A description of each parameter follows.
%
if (image->blob->synchronize != MagickFalse)
{
int
+ file,
status;
- status=posix_fallocate(fileno(image->blob->file_info.file),offset,
- extent-offset);
+ file=fileno(image->blob->file_info.file);
+ if (file == -1)
+ return(MagickFalse);
+ status=posix_fallocate(file,offset,extent-offset);
if (status != 0)
return(MagickFalse);
}
if (entities[i++] == (char *) NULL)
xml++;
else
- {
- /*
- Found a match.
- */
- length=strlen(entities[i]);
- entity=strchr(xml,';');
- if ((length-1L) >= (size_t) (entity-xml))
- {
- offset=(ssize_t) (xml-p);
- extent=(size_t) (offset+length+strlen(entity));
- if (p != q)
- p=(char *) ResizeQuantumMemory(p,extent,sizeof(*p));
- else
- {
- char
- *xml;
-
- xml=(char *) AcquireQuantumMemory(extent,sizeof(*xml));
- if (xml != (char *) NULL)
- {
- (void) CopyMagickString(xml,p,extent*sizeof(*xml));
- p=xml;
- }
- }
- if (p == (char *) NULL)
- ThrowFatalException(ResourceLimitFatalError,
- "MemoryAllocationFailed");
- xml=p+offset;
- entity=strchr(xml,';');
- }
- if (entity != (char *) NULL)
- (void) CopyMagickMemory(xml+length,entity+1,strlen(entity));
- (void) strncpy(xml,entities[i],length);
- }
+ if (entities[i] != (char *) NULL)
+ {
+ /*
+ Found a match.
+ */
+ length=strlen(entities[i]);
+ entity=strchr(xml,';');
+ if ((length-1L) >= (size_t) (entity-xml))
+ {
+ offset=(ssize_t) (xml-p);
+ extent=(size_t) (offset+length+strlen(entity));
+ if (p != q)
+ p=(char *) ResizeQuantumMemory(p,extent,sizeof(*p));
+ else
+ {
+ char
+ *xml;
+
+ xml=(char *) AcquireQuantumMemory(extent,sizeof(*xml));
+ if (xml != (char *) NULL)
+ {
+ (void) CopyMagickString(xml,p,extent*sizeof(*xml));
+ p=xml;
+ }
+ }
+ if (p == (char *) NULL)
+ ThrowFatalException(ResourceLimitFatalError,
+ "MemoryAllocationFailed");
+ xml=p+offset;
+ entity=strchr(xml,';');
+ }
+ if (entity != (char *) NULL)
+ (void) CopyMagickMemory(xml+length,entity+1,strlen(entity));
+ (void) strncpy(xml,entities[i],length);
+ }
}
else
if (((state == ' ') || (state == '*')) &&
if ((count != 0) && (LocaleNCompare(type,"Lr16",4) == 0))
size=GetPSDSize(psd_info,image);
else
- if (DiscardBlobBytes(image,size-(ssize_t) quantum-12) == MagickFalse)
+ if (DiscardBlobBytes(image,(MagickSizeType) size-quantum-12) == MagickFalse)
ThrowFileException(exception,CorruptImageError,
"UnexpectedEndOfFile",image->filename);
}
}
-
status=MagickTrue;
if (size != 0)
{