]> granicus.if.org Git - imagemagick/commitdiff
(no commit message)
authorcristy <urban-warrior@git.imagemagick.org>
Wed, 21 Oct 2009 17:58:01 +0000 (17:58 +0000)
committercristy <urban-warrior@git.imagemagick.org>
Wed, 21 Oct 2009 17:58:01 +0000 (17:58 +0000)
magick/coder.c
magick/color.c
magick/configure.c
magick/configure.h
magick/magic.c
magick/policy.c
magick/version.h

index 25c3b40106813474a621a47d9bc7712c9923c7d6..6b065855de5ca6845884d08ca74a1764eab42f0d 100644 (file)
@@ -64,7 +64,7 @@
 #define MagickCoderFilename  "coder.xml"
 \f
 /*
-  Static declarations.
+  Typedef declarations.
 */
 typedef struct _CoderMapInfo
 {
@@ -72,7 +72,10 @@ typedef struct _CoderMapInfo
     *magick,
     *name;
 } CoderMapInfo;
-
+\f
+/*
+  Static declarations.
+*/
 static const CoderMapInfo
   CoderMap[] =
   {
@@ -213,8 +216,7 @@ static const CoderMapInfo
     { "XTRNSTREAM", "XTRN" },
     { "XV", "VIFF" },
     { "Y", "RAW" },
-    { "YCbCrA", "YCbCr" },
-    { (const char *) NULL, (const char *) NULL }
+    { "YCbCrA", "YCbCr" }
  };
 
 static SemaphoreInfo
@@ -878,8 +880,8 @@ static MagickBooleanType LoadCoderLists(const char *filename,
   MagickStatusType
     status;
 
-  register const CoderMapInfo
-    *p;
+  register long
+    i;
 
   /*
     Load built-in coder map.
@@ -896,11 +898,15 @@ static MagickBooleanType LoadCoderLists(const char *filename,
           return(MagickFalse);
         }
     }
-  for (p=CoderMap; p->magick != (const char *) NULL; p++)
+  for (i=0; i < (long) (sizeof(CoderMap)/sizeof(*CoderMap)); i++)
   {
     CoderInfo
       *coder_info;
 
+    register const CoderMapInfo
+      *p;
+
+    p=CoderMap+i;
     coder_info=(CoderInfo *) AcquireMagickMemory(sizeof(*coder_info));
     if (coder_info == (CoderInfo *) NULL)
       {
index 7235e25172748dd37cc2824c858da5d662b18e8e..46476c729b59ac03cbb2a749b94a24f643034467 100644 (file)
@@ -72,7 +72,7 @@
 #define ColorFilename  "colors.xml"
 \f
 /*
-  Static declarations.
+  Typedef declarations.
 */
 typedef struct _ColorMapInfo
 {
@@ -88,7 +88,10 @@ typedef struct _ColorMapInfo
   const long
     compliance;
 } ColorMapInfo;
-
+\f
+/*
+  Static declarations.
+*/
 static const ColorMapInfo
   ColorMap[] =
   {
@@ -771,8 +774,7 @@ static const ColorMapInfo
     { "yellow2", 238, 238, 0, 1, X11Compliance },
     { "yellow3", 205, 205, 0, 1, X11Compliance },
     { "yellow4", 139, 139, 0, 1, X11Compliance },
-    { "YellowGreen", 154, 205, 50, 1, SVGCompliance | X11Compliance | XPMCompliance },
-    { (const char *) NULL, 0, 0, 0, 0, UndefinedCompliance }
+    { "YellowGreen", 154, 205, 50, 1, SVGCompliance | X11Compliance | XPMCompliance }
   };
 \f
 /*
@@ -2143,8 +2145,8 @@ static MagickBooleanType LoadColorLists(const char *filename,
   MagickStatusType
     status;
 
-  register const ColorMapInfo
-    *p;
+  register long
+    i;
 
   /*
     Load built-in color map.
@@ -2161,11 +2163,15 @@ static MagickBooleanType LoadColorLists(const char *filename,
         }
     }
   scale=(MagickRealType) ScaleCharToQuantum(1);
-  for (p=ColorMap; p->name != (const char *) NULL; p++)
+  for (i=0; i < (long) (sizeof(ColorMap)/sizeof(*ColorMap)); i++)
   {
     ColorInfo
       *color_info;
 
+    register const ColorMapInfo
+      *p;
+
+    p=ColorMap+i;
     color_info=(ColorInfo *) AcquireMagickMemory(sizeof(*color_info));
     if (color_info == (ColorInfo *) NULL)
       {
index c58951dee4f9ecc9952dd8fe5e927aa660317e14..2d762b4d9b9976c35cd3f5cb9f40ede2555c3cca 100644 (file)
 */
 #define ConfigureFilename  "configure.xml"
 \f
+/*
+  Typedef declarations.
+*/
+typedef struct _ConfigureMapInfo
+{
+  const char
+    *name,
+    *value;
+} ConfigureMapInfo;
+\f
 /*
   Static declarations.
 */
-static const char
-  *ConfigureMap = (char *)
-    "<?xml version=\"1.0\"?>"
-    "<configuremap>"
-    "  <configure stealth=\"True\" />"
-    "</configuremap>";
+static const ConfigureMapInfo
+  ConfigureMap[] =
+  {
+  };
 
 static LinkedListInfo
   *configure_list = (LinkedListInfo *) NULL;
@@ -110,12 +118,15 @@ static void *DestroyConfigureElement(void *configure_info)
     *p;
 
   p=(ConfigureInfo *) configure_info;
-  if (p->path != (char *) NULL)
-    p->path=DestroyString(p->path);
-  if (p->name != (char *) NULL)
-    p->name=DestroyString(p->name);
-  if (p->value != (char *) NULL)
-    p->value=DestroyString(p->value);
+  if (p->exempt == MagickFalse)
+    {
+      if (p->value != (char *) NULL)
+        p->value=DestroyString(p->value);
+      if (p->name != (char *) NULL)
+        p->name=DestroyString(p->name);
+      if (p->path != (char *) NULL)
+        p->path=DestroyString(p->path);
+    }
   p=(ConfigureInfo *) RelinquishMagickMemory(p);
   return((void *) NULL);
 }
@@ -1014,10 +1025,7 @@ static MagickBooleanType LoadConfigureList(const char *xml,const char *filename,
     }
   status=MagickTrue;
   configure_info=(ConfigureInfo *) NULL;
-  if (xml == (char *) NULL)
-    token=AcquireString(ConfigureMap);
-  else
-    token=AcquireString((char *) xml);
+  token=AcquireString((char *) xml);
   for (q=(char *) xml; *q != '\0'; )
   {
     /*
@@ -1098,6 +1106,7 @@ static MagickBooleanType LoadConfigureList(const char *xml,const char *filename,
           ThrowFatalException(ResourceLimitFatalError,"MemoryAllocationFailed");
         (void) ResetMagickMemory(configure_info,0,sizeof(*configure_info));
         configure_info->path=ConstantString(filename);
+        configure_info->exempt=MagickFalse;
         configure_info->signature=MagickSignature;
         continue;
       }
@@ -1189,9 +1198,6 @@ static MagickBooleanType LoadConfigureList(const char *xml,const char *filename,
 static MagickBooleanType LoadConfigureLists(const char *filename,
   ExceptionInfo *exception)
 {
-#if defined(MAGICKCORE_EMBEDDABLE_SUPPORT)
-  return(LoadConfigureList(ConfigureMap,"built-in",0,exception));
-#else
   const StringInfo
     *option;
 
@@ -1201,7 +1207,56 @@ static MagickBooleanType LoadConfigureLists(const char *filename,
   MagickStatusType
     status;
 
+  register long
+    i;
+
+  /*
+    Load built-in configure map.
+  */
   status=MagickFalse;
+  if (configure_list == (LinkedListInfo *) NULL)
+    {
+      configure_list=NewLinkedList(0);
+      if (configure_list == (LinkedListInfo *) NULL)
+        {
+          ThrowFileException(exception,ResourceLimitError,
+            "MemoryAllocationFailed",filename);
+          return(MagickFalse);
+        }
+    }
+  for (i=0; i < (long) (sizeof(ConfigureMap)/sizeof(*ConfigureMap)); i++)
+  {
+    ConfigureInfo
+      *configure_info;
+
+    register const ConfigureMapInfo
+      *p;
+
+    p=ConfigureMap+i;
+    configure_info=(ConfigureInfo *) AcquireMagickMemory(
+      sizeof(*configure_info));
+    if (configure_info == (ConfigureInfo *) NULL)
+      {
+        (void) ThrowMagickException(exception,GetMagickModule(),
+          ResourceLimitError,"MemoryAllocationFailed","`%s'",
+          configure_info->name);
+        continue;
+      }
+    (void) ResetMagickMemory(configure_info,0,sizeof(*configure_info));
+    configure_info->path=(char *) "[built-in]";
+    configure_info->name=(char *) p->name;
+    configure_info->value=(char *) p->value;
+    configure_info->exempt=MagickTrue;
+    configure_info->signature=MagickSignature;
+    status=AppendValueToLinkedList(configure_list,configure_info);
+    if (status == MagickFalse)
+      (void) ThrowMagickException(exception,GetMagickModule(),
+        ResourceLimitError,"MemoryAllocationFailed","`%s'",
+        configure_info->name);
+  }
+  /*
+    Load external configure map.
+  */
   options=GetConfigureOptions(filename,exception);
   option=(const StringInfo *) GetNextValueInLinkedList(options);
   while (option != (const StringInfo *) NULL)
@@ -1211,9 +1266,5 @@ static MagickBooleanType LoadConfigureLists(const char *filename,
     option=(const StringInfo *) GetNextValueInLinkedList(options);
   }
   options=DestroyConfigureOptions(options);
-  if ((configure_list == (LinkedListInfo *) NULL) ||
-      (IsLinkedListEmpty(configure_list) != MagickFalse))
-    status|=LoadConfigureList(ConfigureMap,"built-in",0,exception);
   return(status != 0 ? MagickTrue : MagickFalse);
-#endif
 }
index 0be05da78ad3d594c94facb357cd42c828f99420..058a39ebace526e9d31d91e526609b0d86caa28c 100644 (file)
@@ -32,6 +32,7 @@ typedef struct _ConfigureInfo
     *value;
                                                                                 
   MagickBooleanType
+    exempt,
     stealth;
                                                                                 
   struct _ConfigureInfo
index d5bd5f32b07c1b2a8ed4be82c20f112bad17985c..0c6b5a646c2e52bfba740f98c2e1ed6f722492be 100644 (file)
   Define declarations.
 */
 #define MagicFilename  "magic.xml"
+#define MagickString(magic)  (const unsigned char *) (magic), sizeof(magic)-1
 \f
 /*
-  Static declarations.
+  Typedef declarations.
 */
 typedef struct _MagicMapInfo
 {
@@ -75,9 +76,10 @@ typedef struct _MagicMapInfo
   const size_t
     length;
 } MagicMapInfo;
-
-#define MagickString(magic)  (const unsigned char *) (magic), sizeof(magic)-1
-
+\f
+/*
+  Static declarations.
+*/
 static const MagicMapInfo
   MagicMap[] =
   {
@@ -188,8 +190,7 @@ static const MagicMapInfo
     { "XEF", 0, MagickString("FOVb") },
     { "XPM", 1, MagickString("* XPM *") },
     { "XWD", 4, MagickString("\007\000\000") },
-    { "XWD", 5, MagickString("\000\000\007") },
-    { (const char *) NULL, 0, MagickString((const char *) NULL) }
+    { "XWD", 5, MagickString("\000\000\007") }
  };
 
 static LinkedListInfo
@@ -1000,8 +1001,8 @@ static MagickBooleanType LoadMagicLists(const char *filename,
   MagickStatusType
     status;
 
-  register const MagicMapInfo
-    *p;
+  register long
+    i;
 
   /*
     Load built-in magic map.
@@ -1017,11 +1018,15 @@ static MagickBooleanType LoadMagicLists(const char *filename,
           return(MagickFalse);
         }
     }
-  for (p=MagicMap; p->name != (const char *) NULL; p++)
+  for (i=0; i < (long) (sizeof(MagicMap)/sizeof(*MagicMap)); i++)
   {
     MagicInfo
       *magic_info;
 
+    register const MagicMapInfo
+      *p;
+
+    p=MagicMap+i;
     magic_info=(MagicInfo *) AcquireMagickMemory(sizeof(*magic_info));
     if (magic_info == (MagicInfo *) NULL)
       {
index d5cc002f88ffbd32a83809378538ce85a8b3d478..650afa362d36fc89381feee0a203acc63da54f73 100644 (file)
 #define PolicyFilename  "policy.xml"
 \f
 /*
-  Declare policy map.
-*/
-static const char
-  *PolicyMap = (const char *)
-    "<?xml version=\"1.0\"?>"
-    "<policymap>"
-    "</policymap>";
-\f
-/*
-  Domaindef declarations.
+  Typedef declarations.
 */
 struct _PolicyInfo
 {
   char
-    *path,
-    *name;
+    *path;
 
   PolicyDomain
     domain;
@@ -86,10 +76,12 @@ struct _PolicyInfo
     rights;
 
   char
+    *name,
     *pattern,
     *value;
 
   MagickBooleanType
+    exempt,
     stealth,
     debug;
 
@@ -99,10 +91,29 @@ struct _PolicyInfo
   unsigned long
     signature;
 };
+
+typedef struct _PolicyMapInfo
+{
+  const PolicyDomain
+    domain;
+
+  const PolicyRights
+    rights;
+
+  const char
+    *name,
+    *pattern,
+    *value;
+} PolicyMapInfo;
 \f
 /*
   Static declarations.
 */
+static const PolicyMapInfo
+  PolicyMap[] =
+  {
+  };
+
 static LinkedListInfo
   *policy_list = (LinkedListInfo *) NULL;
 
@@ -144,14 +155,17 @@ static void *DestroyPolicyElement(void *policy_info)
     *p;
 
   p=(PolicyInfo *) policy_info;
-  if (p->value != (char *) NULL)
-    p->value=DestroyString(p->value);
-  if (p->pattern != (char *) NULL)
-    p->pattern=DestroyString(p->pattern);
-  if (p->name != (char *) NULL)
-    p->name=DestroyString(p->name);
-  if (p->path != (char *) NULL)
-    p->path=DestroyString(p->path);
+  if (p->exempt == MagickFalse)
+    {
+      if (p->value != (char *) NULL)
+        p->value=DestroyString(p->value);
+      if (p->pattern != (char *) NULL)
+        p->pattern=DestroyString(p->pattern);
+      if (p->name != (char *) NULL)
+        p->name=DestroyString(p->name);
+      if (p->path != (char *) NULL)
+        p->path=DestroyString(p->path);
+    }
   p=(PolicyInfo *) RelinquishMagickMemory(p);
   return((void *) NULL);
 }
@@ -811,6 +825,7 @@ static MagickBooleanType LoadPolicyList(const char *xml,const char *filename,
           ThrowFatalException(ResourceLimitFatalError,"MemoryAllocationFailed");
         (void) ResetMagickMemory(policy_info,0,sizeof(*policy_info));
         policy_info->path=ConstantString(filename);
+        policy_info->exempt=MagickFalse;
         policy_info->signature=MagickSignature;
         continue;
       }
@@ -931,9 +946,6 @@ static MagickBooleanType LoadPolicyList(const char *xml,const char *filename,
 static MagickBooleanType LoadPolicyLists(const char *filename,
   ExceptionInfo *exception)
 {
-#if defined(MAGICKCORE_EMBEDDABLE_SUPPORT)
-  return(LoadPolicyList(PolicyMap,"built-in",0,exception));
-#else
   const StringInfo
     *option;
 
@@ -943,7 +955,56 @@ static MagickBooleanType LoadPolicyLists(const char *filename,
   MagickStatusType
     status;
 
+  register long
+    i;
+
+  /*
+    Load built-in policy map.
+  */
   status=MagickFalse;
+  if (policy_list == (LinkedListInfo *) NULL)
+    {
+      policy_list=NewLinkedList(0);
+      if (policy_list == (LinkedListInfo *) NULL)
+        {
+          ThrowFileException(exception,ResourceLimitError,
+            "MemoryAllocationFailed",filename);
+          return(MagickFalse);
+        }
+    }
+  for (i=0; i < (long) (sizeof(PolicyMap)/sizeof(*PolicyMap)); i++)
+  {
+    PolicyInfo
+      *policy_info;
+
+    register const PolicyMapInfo
+      *p;
+
+    p=PolicyMap+i;
+    policy_info=(PolicyInfo *) AcquireMagickMemory(sizeof(*policy_info));
+    if (policy_info == (PolicyInfo *) NULL)
+      {
+        (void) ThrowMagickException(exception,GetMagickModule(),
+          ResourceLimitError,"MemoryAllocationFailed","`%s'",policy_info->name);
+        continue;
+      }
+    (void) ResetMagickMemory(policy_info,0,sizeof(*policy_info));
+    policy_info->path=(char *) "[built-in]";
+    policy_info->domain=p->domain;
+    policy_info->rights=p->rights;
+    policy_info->name=(char *) p->name;
+    policy_info->pattern=(char *) p->pattern;
+    policy_info->value=(char *) p->value;
+    policy_info->exempt=MagickTrue;
+    policy_info->signature=MagickSignature;
+    status=AppendValueToLinkedList(policy_list,policy_info);
+    if (status == MagickFalse)
+      (void) ThrowMagickException(exception,GetMagickModule(),
+        ResourceLimitError,"MemoryAllocationFailed","`%s'",policy_info->name);
+  }
+  /*
+    Load external policy map.
+  */
   options=GetConfigureOptions(filename,exception);
   option=(const StringInfo *) GetNextValueInLinkedList(options);
   while (option != (const StringInfo *) NULL)
@@ -953,9 +1014,5 @@ static MagickBooleanType LoadPolicyLists(const char *filename,
     option=(const StringInfo *) GetNextValueInLinkedList(options);
   }
   options=DestroyConfigureOptions(options);
-  if ((policy_list == (LinkedListInfo *) NULL) ||
-      (IsLinkedListEmpty(policy_list) != MagickFalse))
-    status|=LoadPolicyList(PolicyMap,"built-in",0,exception);
   return(status != 0 ? MagickTrue : MagickFalse);
-#endif
 }
index 2156d650a5b698578cf23d18fd674974d12b6d45..6fd3cda5100a20c291e873a64eb3e61fd4c34c8d 100644 (file)
@@ -77,6 +77,7 @@ extern MagickExport char
 
 extern MagickExport const char
   *GetMagickCopyright(void),
+  *GetMagickFeatures(void),
   *GetMagickPackageName(void),
   *GetMagickQuantumDepth(unsigned long *),
   *GetMagickQuantumRange(unsigned long *),