]> granicus.if.org Git - imagemagick/commitdiff
Adding coder headers with magic.xml will no longer be supported.
authorDirk Lemstra <dirk@lemstra.org>
Thu, 4 Oct 2018 05:31:36 +0000 (07:31 +0200)
committerDirk Lemstra <dirk@lemstra.org>
Thu, 4 Oct 2018 05:31:53 +0000 (07:31 +0200)
ChangeLog
MagickCore/image.c
MagickCore/magic.c
Make.com
Makefile.in
QuickStart.txt
config/ImageMagick.rc
config/Makefile.am
config/magic.xml [deleted file]

index e21916908a888404eef8a9339612c01aaba5ab0f..0b451cb5f25e61d692afa07b127f09483f3017b3 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,6 @@
+2018-10-04  7.0.8-13 Dirk Lemstra <dirk@lem.....org>
+  * Adding coder headers with magic.xml will no longer be supported.
+
 2018-09-16  7.0.8-12 Cristy  <quetzlzacatenango@image...>
   * Release ImageMagick version 7.0.8-12, GIT revision 14843:cb5cf1959:20180923
 
index 06911a396a36dd35458ef56c13d3ad94348e9814..a5c58c1da7e11fff9633ea67dfe328358bfd62b1 100644 (file)
@@ -2998,7 +2998,7 @@ MagickExport MagickBooleanType SetImageInfo(ImageInfo *image_info,
       (void) CloseBlob(image);
       image=DestroyImage(image);
       /*
-        Check magic.xml configuration file.
+        Check magic cache.
       */
       sans_exception=AcquireExceptionInfo();
       magic_info=GetMagicInfo(magick,(size_t) count,sans_exception);
index c48ef29a7d7b70f53afa663ef147c83ba5cdb2a0..a95e8d7bc966e17bf3adbffd3d2907b31fe3d29c 100644 (file)
@@ -63,7 +63,6 @@
 /*
   Define declarations.
 */
-#define MagicFilename  "magic.xml"
 #define MagicPattern(magic)  (const unsigned char *) (magic), sizeof(magic)-1
 \f
 /*
@@ -217,9 +216,7 @@ static SemaphoreInfo
   Forward declarations.
 */
 static MagickBooleanType
-  IsMagicCacheInstantiated(ExceptionInfo *),
-  LoadMagicCache(LinkedListInfo *,const char *,const char *,const size_t,
-    ExceptionInfo *);
+  IsMagicCacheInstantiated(ExceptionInfo *);
 \f
 /*
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
@@ -260,8 +257,7 @@ static int CompareMagickInfoSize(const void *a,const void *b)
   return((int) (mb->length-ma->length));
 }
 
-static LinkedListInfo *AcquireMagicCache(const char *filename,
-  ExceptionInfo *exception)
+static LinkedListInfo *AcquireMagicCache(ExceptionInfo *exception)
 {
   LinkedListInfo
     *cache;
@@ -272,35 +268,8 @@ static LinkedListInfo *AcquireMagicCache(const char *filename,
   register ssize_t
     i;
 
-  /*
-    Load external magic map.
-  */
   cache=NewLinkedList(0);
   status=MagickTrue;
-#if !defined(MAGICKCORE_ZERO_CONFIGURATION_SUPPORT)
-  {
-    char
-      path[MagickPathExtent];
-
-    const StringInfo
-      *option;
-
-    LinkedListInfo
-      *options;
-
-    *path='\0';
-    options=GetConfigureOptions(filename,exception);
-    option=(const StringInfo *) GetNextValueInLinkedList(options);
-    while (option != (const StringInfo *) NULL)
-    {
-      (void) CopyMagickString(path,GetStringInfoPath(option),MagickPathExtent);
-      status&=LoadMagicCache(cache,(const char *)
-        GetStringInfoDatum(option),GetStringInfoPath(option),0,exception);
-      option=(const StringInfo *) GetNextValueInLinkedList(options);
-    }
-    options=DestroyConfigureOptions(options);
-  }
-#endif
   /*
     Load built-in magic map.
   */
@@ -705,7 +674,7 @@ static MagickBooleanType IsMagicCacheInstantiated(ExceptionInfo *exception)
         ActivateSemaphoreInfo(&magic_semaphore);
       LockSemaphoreInfo(magic_semaphore);
       if (magic_cache == (LinkedListInfo *) NULL)
-        magic_cache=AcquireMagicCache(MagicFilename,exception);
+        magic_cache=AcquireMagicCache(exception);
       UnlockSemaphoreInfo(magic_semaphore);
     }
   return(magic_cache != (LinkedListInfo *) NULL ? MagickTrue : MagickFalse);
@@ -799,267 +768,6 @@ MagickExport MagickBooleanType ListMagicInfo(FILE *file,
 %                                                                             %
 %                                                                             %
 %                                                                             %
-+   L o a d M a g i c C a c h e                                               %
-%                                                                             %
-%                                                                             %
-%                                                                             %
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-%
-%  LoadMagicCache() loads the magic configurations which provides a mapping
-%  between magic attributes and a magic name.
-%
-%  The format of the LoadMagicCache method is:
-%
-%      MagickBooleanType LoadMagicCache(LinkedListInfo *cache,const char *xml,
-%        const char *filename,const size_t depth,ExceptionInfo *exception)
-%
-%  A description of each parameter follows:
-%
-%    o xml: The magic list in XML format.
-%
-%    o filename: The magic list filename.
-%
-%    o depth: depth of <include /> statements.
-%
-%    o exception: return any errors or warnings in this structure.
-%
-*/
-static MagickBooleanType LoadMagicCache(LinkedListInfo *cache,const char *xml,
-  const char *filename,const size_t depth,ExceptionInfo *exception)
-{
-  char
-    keyword[MagickPathExtent],
-    *token;
-
-  const char
-    *q;
-
-  MagicInfo
-    *magic_info;
-
-  MagickStatusType
-    status;
-
-  size_t
-    extent;
-
-  /*
-    Load the magic map file.
-  */
-  (void) LogMagickEvent(ConfigureEvent,GetMagickModule(),
-    "Loading magic configure file \"%s\" ...",filename);
-  if (xml == (char *) NULL)
-    return(MagickFalse);
-  status=MagickTrue;
-  magic_info=(MagicInfo *) NULL;
-  token=AcquireString(xml);
-  extent=strlen(token)+MagickPathExtent;
-  for (q=(char *) xml; *q != '\0'; )
-  {
-    /*
-      Interpret XML.
-    */
-    GetNextToken(q,&q,extent,token);
-    if (*token == '\0')
-      break;
-    (void) CopyMagickString(keyword,token,MagickPathExtent);
-    if (LocaleNCompare(keyword,"<!DOCTYPE",9) == 0)
-      {
-        /*
-          Doctype element.
-        */
-        while ((LocaleNCompare(q,"]>",2) != 0) && (*q != '\0'))
-          GetNextToken(q,&q,extent,token);
-        continue;
-      }
-    if (LocaleNCompare(keyword,"<!--",4) == 0)
-      {
-        /*
-          Comment element.
-        */
-        while ((LocaleNCompare(q,"->",2) != 0) && (*q != '\0'))
-          GetNextToken(q,&q,extent,token);
-        continue;
-      }
-    if (LocaleCompare(keyword,"<include") == 0)
-      {
-        /*
-          Include element.
-        */
-        while (((*token != '/') && (*(token+1) != '>')) && (*q != '\0'))
-        {
-          (void) CopyMagickString(keyword,token,MagickPathExtent);
-          GetNextToken(q,&q,extent,token);
-          if (*token != '=')
-            continue;
-          GetNextToken(q,&q,extent,token);
-          if (LocaleCompare(keyword,"file") == 0)
-            {
-              if (depth > MagickMaxRecursionDepth)
-                (void) ThrowMagickException(exception,GetMagickModule(),
-                  ConfigureError,"IncludeElementNestedTooDeeply","`%s'",token);
-              else
-                {
-                  char
-                    path[MagickPathExtent],
-                    *file_xml;
-
-                  GetPathComponent(filename,HeadPath,path);
-                  if (*path != '\0')
-                    (void) ConcatenateMagickString(path,DirectorySeparator,
-                      MagickPathExtent);
-                  if (*token == *DirectorySeparator)
-                    (void) CopyMagickString(path,token,MagickPathExtent);
-                  else
-                    (void) ConcatenateMagickString(path,token,MagickPathExtent);
-                  file_xml=FileToXML(path,~0UL);
-                  if (xml != (char *) NULL)
-                    {
-                      status&=LoadMagicCache(cache,file_xml,path,depth+1,
-                        exception);
-                      file_xml=DestroyString(file_xml);
-                    }
-                }
-            }
-        }
-        continue;
-      }
-    if (LocaleCompare(keyword,"<magic") == 0)
-      {
-        /*
-          Magic element.
-        */
-        magic_info=(MagicInfo *) AcquireCriticalMemory(sizeof(*magic_info));
-        (void) memset(magic_info,0,sizeof(*magic_info));
-        magic_info->path=ConstantString(filename);
-        magic_info->exempt=MagickFalse;
-        magic_info->signature=MagickCoreSignature;
-        continue;
-      }
-    if (magic_info == (MagicInfo *) NULL)
-      continue;
-    if ((LocaleCompare(keyword,"/>") == 0) ||
-        (LocaleCompare(keyword,"</policy>") == 0))
-      {
-        status=InsertValueInSortedLinkedList(cache,CompareMagickInfoSize,
-          NULL,magic_info);
-        if (status == MagickFalse)
-          (void) ThrowMagickException(exception,GetMagickModule(),
-            ResourceLimitError,"MemoryAllocationFailed","`%s'",
-            magic_info->name);
-        magic_info=(MagicInfo *) NULL;
-        continue;
-      }
-    GetNextToken(q,(const char **) NULL,extent,token);
-    if (*token != '=')
-      continue;
-    GetNextToken(q,&q,extent,token);
-    GetNextToken(q,&q,extent,token);
-    switch (*keyword)
-    {
-      case 'N':
-      case 'n':
-      {
-        if (LocaleCompare((char *) keyword,"name") == 0)
-          {
-            magic_info->name=ConstantString(token);
-            break;
-          }
-        break;
-      }
-      case 'O':
-      case 'o':
-      {
-        if (LocaleCompare((char *) keyword,"offset") == 0)
-          {
-            magic_info->offset=(MagickOffsetType) StringToLong(token);
-            break;
-          }
-        break;
-      }
-      case 'S':
-      case 's':
-      {
-        if (LocaleCompare((char *) keyword,"stealth") == 0)
-          {
-            magic_info->stealth=IsStringTrue(token);
-            break;
-          }
-        break;
-      }
-      case 'T':
-      case 't':
-      {
-        if (LocaleCompare((char *) keyword,"target") == 0)
-          {
-            char
-              *p;
-
-            register unsigned char
-              *r;
-
-            size_t
-              length;
-
-            length=strlen(token);
-            magic_info->target=ConstantString(token);
-            magic_info->magic=(unsigned char *) ConstantString(token);
-            r=magic_info->magic;
-            for (p=magic_info->target; *p != '\0'; )
-            {
-              if (*p == '\\')
-                {
-                  p++;
-                  if (isdigit((int) ((unsigned char) *p)) != 0)
-                    {
-                      char
-                        *end;
-
-                      *r++=(unsigned char) strtol(p,&end,8);
-                      p+=(end-p);
-                      magic_info->length++;
-                      continue;
-                    }
-                  switch (*p)
-                  {
-                    case 'b': *r='\b'; break;
-                    case 'f': *r='\f'; break;
-                    case 'n': *r='\n'; break;
-                    case 'r': *r='\r'; break;
-                    case 't': *r='\t'; break;
-                    case 'v': *r='\v'; break;
-                    case 'a': *r='a'; break;
-                    case '?': *r='\?'; break;
-                    default: *r=(unsigned char) (*p); break;
-                  }
-                  p++;
-                  r++;
-                  magic_info->length++;
-                  continue;
-                }
-              else
-                if (LocaleNCompare(p,"&amp;",5) == 0)
-                  (void) CopyMagickString(p+1,p+5,length-magic_info->length);
-              *r++=(unsigned char) (*p++);
-              magic_info->length++;
-            }
-            break;
-          }
-        break;
-      }
-      default:
-        break;
-    }
-  }
-  token=(char *) RelinquishMagickMemory(token);
-  return(status != 0 ? MagickTrue : MagickFalse);
-}
-\f
-/*
-%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
-%                                                                             %
-%                                                                             %
-%                                                                             %
 +   M a g i c C o m p o n e n t G e n e s i s                                 %
 %                                                                             %
 %                                                                             %
index 6a74f9f39ae3de8203301d31e5b310d8b5f04abb..b5a6a84a88a6dc6d4fda1dce745004f778cc65d0 100644 (file)
--- a/Make.com
+++ b/Make.com
@@ -212,7 +212,6 @@ $composite:==$'f$environment("default")'composite
 $write sys$output "..symbol COMPOSITE defined."
 $SkipComposite:
 $set def [-]
-$copy [.config]magic.xml sys$login:magic.xml
 $copy [.config]colors.xml sys$login:colors.xml
 $copy [.config]log.xml sys$login:log.xml
 $copy [.www.source]delegates.xml sys$login:delegates.xml
index 9c2144e2f1c0913a7513346498e450e66d07bcdc..c1047aec357bdf37520580e027f426b95daf26ed 100644 (file)
@@ -3048,7 +3048,6 @@ configlib_DATA = \
        config/colors.xml \
        config/delegates.xml \
        config/log.xml \
-       config/magic.xml \
        config/mime.xml \
        config/policy.xml \
        config/quantization-table.xml \
@@ -3074,7 +3073,6 @@ CONFIG_EXTRA_DIST = \
        config/locale.md \
        config/locale.xml \
        config/log.xml \
-       config/magic.xml \
        config/mime.xml \
        config/policy.xml \
        config/quantization-table.xml \
index 46d3f901f9b2def6c3c4a34dce8fd3f4f3cb7357..c96a6153d65cccc01d813f048b751b931e918ab1 100644 (file)
@@ -62,7 +62,7 @@ Unix/Linux/Darwin/Mac OS X/Cygwin/MinGW Install:
     Configuration Files
 
       ImageMagick depends on a number of external configuration files which
-      include colors.xml, delegates.xml, magic.xml, coder.xml, and others.
+      include colors.xml, delegates.xml, coder.xml, and others.
       ImageMagick searches for configuration files in the following order, and
       loads them if found:
 
index b2eaf7d48871f92fa9a1489175e2f2af2301ed73..6450188fb62941a8c90ff1e968ddcdb5f38755db 100644 (file)
@@ -56,7 +56,6 @@ DELEGATES.XML  IMAGEMAGICK DISCARDABLE "..\\bin\\delegates.xml"
 ENGLISH.XML    IMAGEMAGICK DISCARDABLE "..\\bin\\english.xml"
 LOCALE.XML     IMAGEMAGICK DISCARDABLE "..\\bin\\locale.xml"
 LOG.XML        IMAGEMAGICK DISCARDABLE "..\\bin\\log.xml"
-MAGIC.XML      IMAGEMAGICK DISCARDABLE "..\\bin\\magic.xml"
 THRESHOLDS.XML  IMAGEMAGICK DISCARDABLE "..\\bin\\thresholds.xml"
 TYPE.XML       IMAGEMAGICK DISCARDABLE "..\\bin\\type.xml"
 TYPE-GHOSTSCRIPT.XML  IMAGEMAGICK DISCARDABLE "..\\bin\\type-ghostscript.xml"
index 29717bb6ce243e0262db9ac733833a248e3b1b57..4ce78fdd48bc11bc5ca670ed6fa04c3c09008a43 100644 (file)
@@ -36,7 +36,6 @@ configlib_DATA = \
        config/colors.xml \
        config/delegates.xml \
        config/log.xml \
-       config/magic.xml \
        config/mime.xml \
        config/policy.xml \
        config/quantization-table.xml \
@@ -62,7 +61,6 @@ CONFIG_EXTRA_DIST = \
        config/locale.md \
        config/locale.xml \
        config/log.xml \
-       config/magic.xml \
        config/mime.xml \
        config/policy.xml \
        config/quantization-table.xml \
diff --git a/config/magic.xml b/config/magic.xml
deleted file mode 100644 (file)
index 7f17731..0000000
+++ /dev/null
@@ -1,23 +0,0 @@
-<?xml version="1.0" encoding="UTF-8"?>
-<!DOCTYPE magicmap [
-<!ELEMENT magicmap (magic)+>
-<!ELEMENT magic (#PCDATA)>
-<!ATTLIST magic name CDATA #REQUIRED>
-<!ATTLIST magic offset CDATA "0">
-<!ATTLIST magic target CDATA #REQUIRED>
-]>
-<!--
-  Associate an image format with a unique identifier. 
-
-  Many image formats have identifiers that uniquely identify a particular
-  image format. For example, the GIF image format always begins with GIF8
-  as the first 4 characters of the image. ImageMagick uses this information
-  to quickly determine the type of image it is dealing with when it reads
-  an image.
--->
-<magicmap>
-  <!-- <magic name="GIF" offset="0" target="GIF8"/> -->
-  <!-- <magic name="JPEG" offset="0" target="\377\330\377"/> -->
-  <!-- <magic name="PNG" offset="0" target="\211PNG\r\n\032\n"/> -->
-  <!-- <magic name="TIFF" offset="0" target="\115\115\000\052"/> -->
-</magicmap>