#include "MagickCore/utility.h"
#include "MagickCore/utility-private.h"
#include "MagickCore/xml-tree.h"
+#include "MagickCore/xml-tree-private.h"
\f
/*
Define declarations.
(void) CopyMagickString(path,token,MaxTextExtent);
else
(void) ConcatenateMagickString(path,token,MaxTextExtent);
- xml=FileToString(path,~0UL,exception);
+ xml=FileToXML(path,~0UL);
if (xml != (char *) NULL)
{
status&=LoadCoderCache(coder_cache,xml,path,depth+1,
#include "MagickCore/utility.h"
#include "MagickCore/utility-private.h"
#include "MagickCore/xml-tree.h"
+#include "MagickCore/xml-tree-private.h"
\f
/*
Define declarations.
(void) CopyMagickString(path,token,MaxTextExtent);
else
(void) ConcatenateMagickString(path,token,MaxTextExtent);
- xml=FileToString(path,~0UL,exception);
+ xml=FileToXML(path,~0UL);
if (xml != (char *) NULL)
{
status=LoadColorCache(xml,path,depth+1,exception);
#include "MagickCore/utility.h"
#include "MagickCore/utility-private.h"
#include "MagickCore/xml-tree.h"
+#include "MagickCore/xml-tree-private.h"
\f
/*
Define declarations.
(void) CopyMagickString(path,token,MaxTextExtent);
else
(void) ConcatenateMagickString(path,token,MaxTextExtent);
- xml=FileToString(path,~0UL,exception);
+ xml=FileToXML(path,~0UL);
if (xml != (char *) NULL)
{
status=LoadConfigureCache(xml,path,depth+1,exception);
#include "MagickCore/utility.h"
#include "MagickCore/utility-private.h"
#include "MagickCore/xml-tree.h"
+#include "MagickCore/xml-tree-private.h"
\f
/*
Define declarations.
(void) CopyMagickString(path,token,MaxTextExtent);
else
(void) ConcatenateMagickString(path,token,MaxTextExtent);
- xml=FileToString(path,~0UL,exception);
+ xml=FileToXML(path,~0UL);
if (xml != (char *) NULL)
{
status=LoadDelegateCache(xml,path,depth+1,exception);
#include "MagickCore/utility.h"
#include "MagickCore/utility-private.h"
#include "MagickCore/xml-tree.h"
+#include "MagickCore/xml-tree-private.h"
\f
/*
Define declarations.
(void) CopyMagickString(path,token,MaxTextExtent);
else
(void) ConcatenateMagickString(path,token,MaxTextExtent);
- xml=FileToString(path,~0UL,exception);
+ xml=FileToXML(path,~0UL);
if (xml != (char *) NULL)
{
status=LoadLocaleCache(xml,path,locale,depth+1,exception);
#include "MagickCore/utility-private.h"
#include "MagickCore/version.h"
#include "MagickCore/xml-tree.h"
+#include "MagickCore/xml-tree-private.h"
\f
/*
Define declarations.
(void) CopyMagickString(path,token,MaxTextExtent);
else
(void) ConcatenateMagickString(path,token,MaxTextExtent);
- xml=FileToString(path,~0UL,exception);
+ xml=FileToXML(path,~0UL);
if (xml != (char *) NULL)
{
status&=LoadLogCache(xml,path,depth+1,exception);
#include "MagickCore/utility.h"
#include "MagickCore/utility-private.h"
#include "MagickCore/xml-tree.h"
+#include "MagickCore/xml-tree-private.h"
\f
/*
Define declarations.
(void) CopyMagickString(path,token,MaxTextExtent);
else
(void) ConcatenateMagickString(path,token,MaxTextExtent);
- xml=FileToString(path,~0UL,exception);
+ xml=FileToXML(path,~0UL);
if (xml != (char *) NULL)
{
status=LoadMagicCache(xml,path,depth+1,exception);
(void) CopyMagickString(path,attribute,MaxTextExtent);
else
(void) ConcatenateMagickString(path,attribute,MaxTextExtent);
- xml=FileToString(path,~0UL,exception);
+ xml=FileToXML(path,~0UL);
if (xml != (char *) NULL)
{
status=LoadMimeCache(xml,path,depth+1,exception);
#include "MagickCore/utility.h"
#include "MagickCore/utility-private.h"
#include "MagickCore/xml-tree.h"
+#include "MagickCore/xml-tree-private.h"
\f
/*
Define declarations.
(void) CopyMagickString(path,token,MaxTextExtent);
else
(void) ConcatenateMagickString(path,token,MaxTextExtent);
- xml=FileToString(path,~0UL,exception);
+ xml=FileToXML(path,~0UL);
if (xml != (char *) NULL)
{
status=LoadPolicyCache(xml,path,depth+1,exception);
*/
#define MagickPackageName "ImageMagick"
#define MagickCopyright "Copyright (C) 1999-2014 ImageMagick Studio LLC"
-#define MagickSVNRevision "15038M"
+#define MagickSVNRevision "15136:15146M"
#define MagickLibVersion 0x700
#define MagickLibVersionText "7.0.0"
#define MagickLibVersionNumber 1,0,0
#define MagickppLibAddendum "-0"
#define MagickppLibInterface 1
#define MagickppLibMinInterface 1
-#define MagickReleaseDate "2014-03-07"
+#define MagickReleaseDate "2014-03-16"
#define MagickChangeDate "20120427"
#define MagickAuthoritativeURL "http://www.imagemagick.org"
#define MagickFeatures "DPC HDRI OpenMP"
#endif
extern MagickPrivate char
- *CanonicalXMLContent(const char *,const MagickBooleanType);
+ *CanonicalXMLContent(const char *,const MagickBooleanType),
+ *FileToXML(const char *,const size_t);
extern MagickPrivate const char
**GetXMLTreeProcessingInstructions(XMLTreeInfo *,const char *);
*/
#include "MagickCore/studio.h"
#include "MagickCore/blob.h"
+#include "MagickCore/blob-private.h"
#include "MagickCore/exception.h"
#include "MagickCore/exception-private.h"
#include "MagickCore/log.h"
% %
% %
% %
+% F i l e T o X M L %
+% %
+% %
+% %
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%
+% FileToXML() returns the contents of a file as a XML string.
+%
+% The format of the FileToXML method is:
+%
+% char *FileToXML(const char *filename,const size_t extent)
+%
+% A description of each parameter follows:
+%
+% o filename: the filename.
+%
+% o extent: Maximum length of the string.
+%
+*/
+
+static inline size_t MagickMin(const size_t x,const size_t y)
+{
+ if (x < y)
+ return(x);
+ return(y);
+}
+
+MagickPrivate char *FileToXML(const char *filename,const size_t extent)
+{
+ char
+ *xml;
+
+ int
+ file;
+
+ MagickOffsetType
+ offset;
+
+ register size_t
+ i;
+
+ size_t
+ length;
+
+ ssize_t
+ count;
+
+ void
+ *map;
+
+ assert(filename != (const char *) NULL);
+ length=0;
+ file=fileno(stdin);
+ if (LocaleCompare(filename,"-") != 0)
+ file=open_utf8(filename,O_RDONLY | O_BINARY,0);
+ if (file == -1)
+ return((char *) NULL);
+ offset=(MagickOffsetType) lseek(file,0,SEEK_END);
+ count=0;
+ if ((file == fileno(stdin)) || (offset < 0) ||
+ (offset != (MagickOffsetType) ((ssize_t) offset)))
+ {
+ size_t
+ quantum;
+
+ struct stat
+ file_stats;
+
+ /*
+ Stream is not seekable.
+ */
+ offset=(MagickOffsetType) lseek(file,0,SEEK_SET);
+ quantum=(size_t) MagickMaxBufferExtent;
+ if ((fstat(file,&file_stats) == 0) && (file_stats.st_size != 0))
+ quantum=(size_t) MagickMin((MagickSizeType) file_stats.st_size,
+ MagickMaxBufferExtent);
+ xml=(char *) AcquireQuantumMemory(quantum,sizeof(*xml));
+ for (i=0; xml != (char *) NULL; i+=count)
+ {
+ count=read(file,xml+i,quantum);
+ if (count <= 0)
+ {
+ count=0;
+ if (errno != EINTR)
+ break;
+ }
+ if (~((size_t) i) < (quantum+1))
+ {
+ xml=(char *) RelinquishMagickMemory(xml);
+ break;
+ }
+ xml=(char *) ResizeQuantumMemory(xml,i+quantum+1,sizeof(*xml));
+ if ((size_t) (i+count) >= extent)
+ break;
+ }
+ if (LocaleCompare(filename,"-") != 0)
+ file=close(file);
+ if (xml == (char *) NULL)
+ return((char *) NULL);
+ if (file == -1)
+ {
+ xml=(char *) RelinquishMagickMemory(xml);
+ return((char *) NULL);
+ }
+ length=(size_t) MagickMin(i+count,extent);
+ xml[length]='\0';
+ return(xml);
+ }
+ length=(size_t) MagickMin((MagickSizeType) offset,extent);
+ xml=(char *) NULL;
+ if (~length >= (MaxTextExtent-1))
+ xml=(char *) AcquireQuantumMemory(length+MaxTextExtent,sizeof(*xml));
+ if (xml == (char *) NULL)
+ {
+ file=close(file);
+ return((char *) NULL);
+ }
+ map=MapBlob(file,ReadMode,0,length);
+ if (map != (char *) NULL)
+ {
+ (void) memcpy(xml,map,length);
+ (void) UnmapBlob(map,length);
+ }
+ else
+ {
+ (void) lseek(file,0,SEEK_SET);
+ for (i=0; i < length; i+=count)
+ {
+ count=read(file,xml+i,(size_t) MagickMin(length-i,(MagickSizeType)
+ SSIZE_MAX));
+ if (count <= 0)
+ {
+ count=0;
+ if (errno != EINTR)
+ break;
+ }
+ }
+ if (i < length)
+ {
+ file=close(file)-1;
+ xml=(char *) RelinquishMagickMemory(xml);
+ return((char *) NULL);
+ }
+ }
+ xml[length]='\0';
+ if (LocaleCompare(filename,"-") != 0)
+ file=close(file);
+ if (file == -1)
+ xml=(char *) RelinquishMagickMemory(xml);
+ return(xml);
+}
+\f
+/*
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+% %
+% %
+% %
% G e t N e x t X M L T r e e T a g %
% %
% %
MAGICK_VERSION=7.0.0-0
-MAGICK_SVN_REVISION=15038M
+MAGICK_SVN_REVISION=15136:15146M
# Substitute library versioning