diff --git a/MagickCore/coder.c b/MagickCore/coder.c
index 46ef8da..b5d29d8 100644
--- a/MagickCore/coder.c
+++ b/MagickCore/coder.c
@@ -59,6 +59,7 @@
#include "MagickCore/utility.h"
#include "MagickCore/utility-private.h"
#include "MagickCore/xml-tree.h"
+#include "MagickCore/xml-tree-private.h"
/*
Define declarations.
@@ -857,7 +858,7 @@
(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,
diff --git a/MagickCore/color.c b/MagickCore/color.c
index 2b8c1df..672e568 100644
--- a/MagickCore/color.c
+++ b/MagickCore/color.c
@@ -69,6 +69,7 @@
#include "MagickCore/utility.h"
#include "MagickCore/utility-private.h"
#include "MagickCore/xml-tree.h"
+#include "MagickCore/xml-tree-private.h"
/*
Define declarations.
@@ -2012,7 +2013,7 @@
(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);
diff --git a/MagickCore/configure.c b/MagickCore/configure.c
index 563e0c6..0ce4160 100644
--- a/MagickCore/configure.c
+++ b/MagickCore/configure.c
@@ -56,6 +56,7 @@
#include "MagickCore/utility.h"
#include "MagickCore/utility-private.h"
#include "MagickCore/xml-tree.h"
+#include "MagickCore/xml-tree-private.h"
/*
Define declarations.
@@ -1208,7 +1209,7 @@
(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);
diff --git a/MagickCore/delegate.c b/MagickCore/delegate.c
index 7544bd9..d83953a 100644
--- a/MagickCore/delegate.c
+++ b/MagickCore/delegate.c
@@ -67,6 +67,7 @@
#include "MagickCore/utility.h"
#include "MagickCore/utility-private.h"
#include "MagickCore/xml-tree.h"
+#include "MagickCore/xml-tree-private.h"
/*
Define declarations.
@@ -1361,7 +1362,7 @@
(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);
diff --git a/MagickCore/locale.c b/MagickCore/locale.c
index 3c2a247..3715caf 100644
--- a/MagickCore/locale.c
+++ b/MagickCore/locale.c
@@ -59,6 +59,7 @@
#include "MagickCore/utility.h"
#include "MagickCore/utility-private.h"
#include "MagickCore/xml-tree.h"
+#include "MagickCore/xml-tree-private.h"
/*
Define declarations.
@@ -1266,7 +1267,7 @@
(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);
diff --git a/MagickCore/log.c b/MagickCore/log.c
index c7b3051..457ff11 100644
--- a/MagickCore/log.c
+++ b/MagickCore/log.c
@@ -63,6 +63,7 @@
#include "MagickCore/utility-private.h"
#include "MagickCore/version.h"
#include "MagickCore/xml-tree.h"
+#include "MagickCore/xml-tree-private.h"
/*
Define declarations.
@@ -1484,7 +1485,7 @@
(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);
diff --git a/MagickCore/magic.c b/MagickCore/magic.c
index abab71d..39402b3 100644
--- a/MagickCore/magic.c
+++ b/MagickCore/magic.c
@@ -57,6 +57,7 @@
#include "MagickCore/utility.h"
#include "MagickCore/utility-private.h"
#include "MagickCore/xml-tree.h"
+#include "MagickCore/xml-tree-private.h"
/*
Define declarations.
@@ -845,7 +846,7 @@
(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);
diff --git a/MagickCore/mime.c b/MagickCore/mime.c
index c558581..ada6eb7 100644
--- a/MagickCore/mime.c
+++ b/MagickCore/mime.c
@@ -853,7 +853,7 @@
(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);
diff --git a/MagickCore/policy.c b/MagickCore/policy.c
index 2db65d1..6db2320 100644
--- a/MagickCore/policy.c
+++ b/MagickCore/policy.c
@@ -58,6 +58,7 @@
#include "MagickCore/utility.h"
#include "MagickCore/utility-private.h"
#include "MagickCore/xml-tree.h"
+#include "MagickCore/xml-tree-private.h"
/*
Define declarations.
@@ -822,7 +823,7 @@
(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);
diff --git a/MagickCore/version.h b/MagickCore/version.h
index a876602..6883fdd 100644
--- a/MagickCore/version.h
+++ b/MagickCore/version.h
@@ -27,7 +27,7 @@
*/
#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
@@ -48,7 +48,7 @@
#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"
diff --git a/MagickCore/xml-tree-private.h b/MagickCore/xml-tree-private.h
index a954ced..e40def9 100644
--- a/MagickCore/xml-tree-private.h
+++ b/MagickCore/xml-tree-private.h
@@ -26,7 +26,8 @@
#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 *);
diff --git a/MagickCore/xml-tree.c b/MagickCore/xml-tree.c
index 7518cc8..b7cadf3 100644
--- a/MagickCore/xml-tree.c
+++ b/MagickCore/xml-tree.c
@@ -49,6 +49,7 @@
*/
#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"
@@ -541,6 +542,163 @@
% %
% %
% %
+% 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);
+}
+
+/*
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+% %
+% %
+% %
% G e t N e x t X M L T r e e T a g %
% %
% %
diff --git a/configure b/configure
index a482eaf..153c2c1 100755
--- a/configure
+++ b/configure
@@ -3702,7 +3702,7 @@
MAGICK_VERSION=7.0.0-0
-MAGICK_SVN_REVISION=15038M
+MAGICK_SVN_REVISION=15136:15146M
# Substitute library versioning