]> granicus.if.org Git - imagemagick/blobdiff - MagickCore/coder.c
Update web pages
[imagemagick] / MagickCore / coder.c
index 46ef8da79418cfda37246e7f3fe31f614f46fe00..3b94c06c4cfa3161367e4f30337d76c028105e09 100644 (file)
@@ -17,7 +17,7 @@
 %                                 May 2001                                    %
 %                                                                             %
 %                                                                             %
-%  Copyright 1999-2014 ImageMagick Studio LLC, a non-profit organization      %
+%  Copyright 1999-2015 ImageMagick Studio LLC, a non-profit organization      %
 %  dedicated to making software imaging solutions freely available.           %
 %                                                                             %
 %  You may not use this file except in compliance with the License.  You may  %
@@ -59,6 +59,7 @@
 #include "MagickCore/utility.h"
 #include "MagickCore/utility-private.h"
 #include "MagickCore/xml-tree.h"
+#include "MagickCore/xml-tree-private.h"
 \f
 /*
   Define declarations.
@@ -98,16 +99,21 @@ static const CoderMapInfo
     { "B", "RAW" },
     { "BRF", "BRAILLE" },
     { "BGRA", "BGR" },
+    { "BGRO", "BGR" },
     { "CMYKA", "CMYK" },
     { "C", "RAW" },
     { "CAL", "CALS" },
     { "CANVAS", "XC" },
+    { "CMYKA", "CMYK" },
     { "CR2", "DNG" },
     { "CRW", "DNG" },
     { "CUR", "ICON" },
+    { "DATA", "INLINE" },
     { "DCR", "DNG" },
     { "DCX", "PCX" },
     { "DFONT", "TTF" },
+    { "DXT1", "DDS" },
+    { "DXT5", "DDS" },
     { "EPDF", "PDF" },
     { "EPI", "PS" },
     { "EPS2", "PS2" },
@@ -129,6 +135,10 @@ static const CoderMapInfo
     { "GRANITE", "MAGICK" },
     { "GROUP4", "TIFF" },
     { "GV", "DOT" },
+    { "HTM", "HTML" },
+    { "ICB", "TGA" },
+    { "ICO", "ICON" },
+    { "IIQ", "DNG" },
     { "K25", "DNG" },
     { "KDC", "DNG" },
     { "H", "MAGICK" },
@@ -147,15 +157,26 @@ static const CoderMapInfo
     { "JBG", "JBIG" },
     { "JNG", "PNG" },
     { "JPC", "JP2" },
+    { "JPT", "JP2" },
+    { "JPM", "JP2" },
     { "J2C", "JP2" },
     { "J2K", "JP2" },
+    { "JNG", "PNG" },
+    { "JPE", "JPEG" },
     { "JPG", "JPEG" },
+    { "JPM", "JP2" },
+    { "JPS", "JPEG" },
+    { "JPT", "JP2" },
     { "JPX", "JP2" },
     { "K", "RAW" },
+    { "K25", "DNG" },
+    { "KDC", "DNG" },
     { "LOGO", "MAGICK" },
+    { "M", "RAW" },
     { "M2V", "MPEG" },
     { "M4V", "MPEG" },
-    { "M", "RAW" },
+    { "MEF", "DNG" },
+    { "MKV", "MPEG" },
     { "MNG", "PNG" },
     { "MOV", "MPEG" },
     { "MP4", "MPEG" },
@@ -175,6 +196,7 @@ static const CoderMapInfo
     { "PAM", "PNM" },
     { "PBM", "PNM" },
     { "PCDS", "PCD" },
+    { "PCT", "PICT" },
     { "PDFA", "PDF" },
     { "PEF", "DNG" },
     { "PEF", "DNG" },
@@ -186,22 +208,27 @@ static const CoderMapInfo
     { "PICON", "XPM" },
     { "PJPEG", "JPEG" },
     { "PM", "XPM" },
+    { "PNG00", "PNG" },
     { "PNG24", "PNG" },
     { "PNG32", "PNG" },
+    { "PNG48", "PNG" },
+    { "PNG64", "PNG" },
     { "PNG8", "PNG" },
     { "PPM", "PNM" },
     { "PSB", "PSD" },
     { "PTIF", "TIFF" },
+    { "R", "RAW" },
     { "RADIAL-GRADIENT", "GRADIENT" },
     { "RAF", "DNG" },
     { "RAS", "SUN" },
+    { "RAW", "DNG" },
     { "RGBA", "RGB" },
     { "RGBO", "RGB" },
     { "RMF", "DNG" },
-    { "R", "RAW" },
     { "ROSE", "MAGICK" },
     { "RW2", "DNG" },
     { "SHTML", "HTML" },
+    { "SIX", "SIXEL" },
     { "SPARSE-COLOR", "TXT" },
     { "SR2", "DNG" },
     { "SRF", "DNG" },
@@ -249,14 +276,14 @@ static MagickBooleanType
 %                                                                             %
 %                                                                             %
 %                                                                             %
-%  A c q u i r e C o d e r S p l a y T r e e                                  %
++  A c q u i r e C o d e r C a c h e                                          %
 %                                                                             %
 %                                                                             %
 %                                                                             %
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 %
-%  AcquireCoderCache() caches one or more coder configurations which
-%  provides a mapping between coder attributes and a coder name.
+%  AcquireCoderCache() caches one or more coder configurations which provides a
+%  mapping between coder attributes and a coder name.
 %
 %  The format of the AcquireCoderCache coder is:
 %
@@ -319,8 +346,8 @@ static SplayTreeInfo *AcquireCoderCache(const char *filename,
   option=(const StringInfo *) GetNextValueInLinkedList(options);
   while (option != (const StringInfo *) NULL)
   {
-    status&=LoadCoderCache(coder_cache,(const char *) GetStringInfoDatum(option),
-      GetStringInfoPath(option),0,exception);
+    status&=LoadCoderCache(coder_cache,(const char *)
+      GetStringInfoDatum(option),GetStringInfoPath(option),0,exception);
     option=(const StringInfo *) GetNextValueInLinkedList(options);
   }
   options=DestroyConfigureOptions(options);
@@ -348,7 +375,7 @@ static SplayTreeInfo *AcquireCoderCache(const char *filename,
     coder_info->magick=(char *) p->magick;
     coder_info->name=(char *) p->name;
     coder_info->exempt=MagickTrue;
-    coder_info->signature=MagickSignature;
+    coder_info->signature=MagickCoreSignature;
     status&=AddValueToSplayTree(coder_cache,ConstantString(coder_info->magick),
       coder_info);
     if (status == MagickFalse)
@@ -378,7 +405,8 @@ static SplayTreeInfo *AcquireCoderCache(const char *filename,
 */
 MagickPrivate MagickBooleanType CoderComponentGenesis(void)
 {
-  coder_semaphore=AcquireSemaphoreInfo();
+  if (coder_semaphore == (SemaphoreInfo *) NULL)
+    coder_semaphore=AcquireSemaphoreInfo();
   return(MagickTrue);
 }
 \f
@@ -640,8 +668,8 @@ MagickExport char **GetCoderList(const char *pattern,
 %                                                                             %
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 %
-%  IsCoderTreeInstantiated() determines if the coder tree is instantiated.
-%  If not, it instantiates the tree and returns it.
+%  IsCoderTreeInstantiated() determines if the coder tree is instantiated.  If
+%  not, it instantiates the tree and returns it.
 %
 %  The format of the IsCoderInstantiated method is:
 %
@@ -660,7 +688,7 @@ static MagickBooleanType IsCoderTreeInstantiated(ExceptionInfo *exception)
         ActivateSemaphoreInfo(&coder_semaphore);
       LockSemaphoreInfo(coder_semaphore);
       if (coder_cache == (SplayTreeInfo *) NULL)
-        (void) AcquireCoderCache(MagickCoderFilename,exception);
+        coder_cache=AcquireCoderCache(MagickCoderFilename,exception);
       UnlockSemaphoreInfo(coder_semaphore);
     }
   return(coder_cache != (SplayTreeInfo *) NULL ? MagickTrue : MagickFalse);
@@ -777,7 +805,7 @@ static MagickBooleanType LoadCoderCache(SplayTreeInfo *coder_cache,
   ExceptionInfo *exception)
 {
   char
-    keyword[MaxTextExtent],
+    keyword[MagickPathExtent],
     *token;
 
   const char
@@ -786,7 +814,7 @@ static MagickBooleanType LoadCoderCache(SplayTreeInfo *coder_cache,
   CoderInfo
     *coder_info;
 
-  MagickBooleanType
+  MagickStatusType
     status;
 
   /*
@@ -807,7 +835,7 @@ static MagickBooleanType LoadCoderCache(SplayTreeInfo *coder_cache,
     GetMagickToken(q,&q,token);
     if (*token == '\0')
       break;
-    (void) CopyMagickString(keyword,token,MaxTextExtent);
+    (void) CopyMagickString(keyword,token,MagickPathExtent);
     if (LocaleNCompare(keyword,"<!DOCTYPE",9) == 0)
       {
         /*
@@ -833,7 +861,7 @@ static MagickBooleanType LoadCoderCache(SplayTreeInfo *coder_cache,
         */
         while (((*token != '/') && (*(token+1) != '>')) && (*q != '\0'))
         {
-          (void) CopyMagickString(keyword,token,MaxTextExtent);
+          (void) CopyMagickString(keyword,token,MagickPathExtent);
           GetMagickToken(q,&q,token);
           if (*token != '=')
             continue;
@@ -846,18 +874,18 @@ static MagickBooleanType LoadCoderCache(SplayTreeInfo *coder_cache,
               else
                 {
                   char
-                    path[MaxTextExtent],
+                    path[MagickPathExtent],
                     *xml;
 
                   GetPathComponent(filename,HeadPath,path);
                   if (*path != '\0')
                     (void) ConcatenateMagickString(path,DirectorySeparator,
-                      MaxTextExtent);
+                      MagickPathExtent);
                   if (*token == *DirectorySeparator)
-                    (void) CopyMagickString(path,token,MaxTextExtent);
+                    (void) CopyMagickString(path,token,MagickPathExtent);
                   else
-                    (void) ConcatenateMagickString(path,token,MaxTextExtent);
-                  xml=FileToString(path,~0UL,exception);
+                    (void) ConcatenateMagickString(path,token,MagickPathExtent);
+                  xml=FileToXML(path,~0UL);
                   if (xml != (char *) NULL)
                     {
                       status&=LoadCoderCache(coder_cache,xml,path,depth+1,
@@ -880,7 +908,7 @@ static MagickBooleanType LoadCoderCache(SplayTreeInfo *coder_cache,
         (void) ResetMagickMemory(coder_info,0,sizeof(*coder_info));
         coder_info->path=ConstantString(filename);
         coder_info->exempt=MagickFalse;
-        coder_info->signature=MagickSignature;
+        coder_info->signature=MagickCoreSignature;
         continue;
       }
     if (coder_info == (CoderInfo *) NULL)
@@ -938,5 +966,5 @@ static MagickBooleanType LoadCoderCache(SplayTreeInfo *coder_cache,
     }
   }
   token=(char *) RelinquishMagickMemory(token);
-  return(status);
+  return(status != 0 ? MagickTrue : MagickFalse);
 }