]> granicus.if.org Git - imagemagick/blobdiff - magick/magick.c
(no commit message)
[imagemagick] / magick / magick.c
index fb5681f4ca3ebe329305bb55ccd644b83d0c6c0e..01c145dbb0a1a05e4596019a85758cb51a595867 100644 (file)
@@ -18,7 +18,7 @@
 %                             November 1998                                   %
 %                                                                             %
 %                                                                             %
-%  Copyright 1999-2010 ImageMagick Studio LLC, a non-profit organization      %
+%  Copyright 1999-2011 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  %
@@ -41,7 +41,9 @@
   Include declarations.
 */
 #include "magick/studio.h"
+#include "magick/annotate.h"
 #include "magick/blob.h"
+#include "magick/blob-private.h"
 #include "magick/cache.h"
 #include "magick/coder.h"
 #include "magick/client.h"
@@ -59,7 +61,7 @@
 #include "magick/memory_.h"
 #include "magick/mime.h"
 #include "magick/module.h"
-#if defined(__WINDOWS__)
+#if defined(MAGICKCORE_WINDOWS_SUPPORT)
 # include "magick/nt-feature.h"
 #endif
 #include "magick/random_.h"
 #include "magick/resource_.h"
 #include "magick/policy.h"
 #include "magick/semaphore.h"
+#include "magick/semaphore-private.h"
 #include "magick/signature-private.h"
 #include "magick/splay-tree.h"
 #include "magick/string_.h"
+#include "magick/string-private.h"
 #include "magick/thread_.h"
 #include "magick/thread-private.h"
 #include "magick/token.h"
@@ -111,7 +115,8 @@ static SplayTreeInfo
   *magick_list = (SplayTreeInfo *) NULL;
 
 static volatile MagickBooleanType
-  instantiate_magick = MagickFalse;  /* double-checked locking pattern */
+  instantiate_magick = MagickFalse,
+  instantiate_magickcore = MagickFalse;
 \f
 /*
   Forward declarations.
@@ -228,7 +233,7 @@ MagickExport MagickBooleanType GetImageMagick(const unsigned char *magick,
   if (p == (const MagickInfo *) NULL)
     return(MagickFalse);
   status=MagickFalse;
-  (void) LockSemaphoreInfo(magick_semaphore);
+  LockSemaphoreInfo(magick_semaphore);
   ResetSplayTreeIterator(magick_list);
   p=(const MagickInfo *) GetNextValueInSplayTree(magick_list);
   while (p != (const MagickInfo *) NULL)
@@ -242,7 +247,7 @@ MagickExport MagickBooleanType GetImageMagick(const unsigned char *magick,
       }
     p=(const MagickInfo *) GetNextValueInSplayTree(magick_list);
   }
-  (void) UnlockSemaphoreInfo(magick_semaphore);
+  UnlockSemaphoreInfo(magick_semaphore);
   return(status);
 }
 \f
@@ -412,16 +417,16 @@ MagickExport const MagickInfo *GetMagickInfo(const char *name,
       if (LocaleCompare(name,"*") == 0)
         (void) OpenModules(exception);
 #endif
-      (void) LockSemaphoreInfo(magick_semaphore);
+      LockSemaphoreInfo(magick_semaphore);
       ResetSplayTreeIterator(magick_list);
       p=(const MagickInfo *) GetNextValueInSplayTree(magick_list);
-      (void) UnlockSemaphoreInfo(magick_semaphore);
+      UnlockSemaphoreInfo(magick_semaphore);
       return(p);
     }
   /*
     Find name in list.
   */
-  (void) LockSemaphoreInfo(magick_semaphore);
+  LockSemaphoreInfo(magick_semaphore);
   ResetSplayTreeIterator(magick_list);
   p=(const MagickInfo *) GetNextValueInSplayTree(magick_list);
   while (p != (const MagickInfo *) NULL)
@@ -445,7 +450,7 @@ MagickExport const MagickInfo *GetMagickInfo(const char *name,
       }
     }
 #endif
-  (void) UnlockSemaphoreInfo(magick_semaphore);
+  UnlockSemaphoreInfo(magick_semaphore);
   return(p);
 }
 \f
@@ -466,7 +471,7 @@ MagickExport const MagickInfo *GetMagickInfo(const char *name,
 %  The format of the GetMagickInfoList function is:
 %
 %      const MagickInfo **GetMagickInfoList(const char *pattern,
-%        unsigned long *number_formats,ExceptionInfo *exception)
+%        size_t *number_formats,ExceptionInfo *exception)
 %
 %  A description of each parameter follows:
 %
@@ -498,7 +503,7 @@ static int MagickInfoCompare(const void *x,const void *y)
 #endif
 
 MagickExport const MagickInfo **GetMagickInfoList(const char *pattern,
-  unsigned long *number_formats,ExceptionInfo *exception)
+  size_t *number_formats,ExceptionInfo *exception)
 {
   const MagickInfo
     **formats;
@@ -506,7 +511,7 @@ MagickExport const MagickInfo **GetMagickInfoList(const char *pattern,
   register const MagickInfo
     *p;
 
-  register long
+  register ssize_t
     i;
 
   /*
@@ -514,7 +519,7 @@ MagickExport const MagickInfo **GetMagickInfoList(const char *pattern,
   */
   assert(pattern != (char *) NULL);
   (void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",pattern);
-  assert(number_formats != (unsigned long *) NULL);
+  assert(number_formats != (size_t *) NULL);
   *number_formats=0;
   p=GetMagickInfo("*",exception);
   if (p == (const MagickInfo *) NULL)
@@ -526,7 +531,7 @@ MagickExport const MagickInfo **GetMagickInfoList(const char *pattern,
   /*
     Generate magick list.
   */
-  (void) LockSemaphoreInfo(magick_semaphore);
+  LockSemaphoreInfo(magick_semaphore);
   ResetSplayTreeIterator(magick_list);
   p=(const MagickInfo *) GetNextValueInSplayTree(magick_list);
   for (i=0; p != (const MagickInfo *) NULL; )
@@ -536,10 +541,10 @@ MagickExport const MagickInfo **GetMagickInfoList(const char *pattern,
       formats[i++]=p;
     p=(const MagickInfo *) GetNextValueInSplayTree(magick_list);
   }
-  (void) UnlockSemaphoreInfo(magick_semaphore);
+  UnlockSemaphoreInfo(magick_semaphore);
   qsort((void *) formats,(size_t) i,sizeof(*formats),MagickInfoCompare);
   formats[i]=(MagickInfo *) NULL;
-  *number_formats=(unsigned long) i;
+  *number_formats=(size_t) i;
   return(formats);
 }
 \f
@@ -558,7 +563,7 @@ MagickExport const MagickInfo **GetMagickInfoList(const char *pattern,
 %
 %  The format of the GetMagickList function is:
 %
-%      char **GetMagickList(const char *pattern,unsigned long *number_formats,
+%      char **GetMagickList(const char *pattern,size_t *number_formats,
 %        ExceptionInfo *exception)
 %
 %  A description of each parameter follows:
@@ -591,7 +596,7 @@ static int MagickCompare(const void *x,const void *y)
 #endif
 
 MagickExport char **GetMagickList(const char *pattern,
-  unsigned long *number_formats,ExceptionInfo *exception)
+  size_t *number_formats,ExceptionInfo *exception)
 {
   char
     **formats;
@@ -599,7 +604,7 @@ MagickExport char **GetMagickList(const char *pattern,
   register const MagickInfo
     *p;
 
-  register long
+  register ssize_t
     i;
 
   /*
@@ -607,7 +612,7 @@ MagickExport char **GetMagickList(const char *pattern,
   */
   assert(pattern != (char *) NULL);
   (void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",pattern);
-  assert(number_formats != (unsigned long *) NULL);
+  assert(number_formats != (size_t *) NULL);
   *number_formats=0;
   p=GetMagickInfo("*",exception);
   if (p == (const MagickInfo *) NULL)
@@ -616,7 +621,7 @@ MagickExport char **GetMagickList(const char *pattern,
     GetNumberOfNodesInSplayTree(magick_list)+1UL,sizeof(*formats));
   if (formats == (char **) NULL)
     return((char **) NULL);
-  (void) LockSemaphoreInfo(magick_semaphore);
+  LockSemaphoreInfo(magick_semaphore);
   ResetSplayTreeIterator(magick_list);
   p=(const MagickInfo *) GetNextValueInSplayTree(magick_list);
   for (i=0; p != (const MagickInfo *) NULL; )
@@ -626,10 +631,10 @@ MagickExport char **GetMagickList(const char *pattern,
       formats[i++]=ConstantString(p->name);
     p=(const MagickInfo *) GetNextValueInSplayTree(magick_list);
   }
-  (void) UnlockSemaphoreInfo(magick_semaphore);
+  UnlockSemaphoreInfo(magick_semaphore);
   qsort((void *) formats,(size_t) i,sizeof(*formats),MagickCompare);
   formats[i]=(char *) NULL;
-  *number_formats=(unsigned long) i;
+  *number_formats=(size_t) i;
   return(formats);
 }
 \f
@@ -638,7 +643,49 @@ MagickExport char **GetMagickList(const char *pattern,
 %                                                                             %
 %                                                                             %
 %                                                                             %
-+   G e t M a g i c k E n d i a n S u p p o r t                               %
+%   G e t M a g i c k P r e c i s i o n                                       %
+%                                                                             %
+%                                                                             %
+%                                                                             %
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%
+%  GetMagickPrecision() returns the maximum number of significant digits to be
+%  printed.
+%
+%  The format of the GetMagickPrecision method is:
+%
+%      int GetMagickPrecision(void)
+%
+*/
+MagickExport int GetMagickPrecision(void)
+{
+#define MagickPrecision  6
+
+  (void) LogMagickEvent(TraceEvent,GetMagickModule(),"...");
+  if (SetMagickPrecision(0) == 0)
+    {
+      char
+        *limit;
+
+      (void) SetMagickPrecision(MagickPrecision);
+      limit=GetEnvironmentValue("MAGICK_PRECISION");
+      if (limit == (char *) NULL)
+        limit=GetPolicyValue("precision");
+      if (limit != (char *) NULL)
+        {
+          (void) SetMagickPrecision(StringToInteger(limit));
+          limit=DestroyString(limit);
+        }
+    }
+  return(SetMagickPrecision(0));
+}
+\f
+/*
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%                                                                             %
+%                                                                             %
+%                                                                             %
++   G e t M a g i c k R a w S u p p o r t                                     %
 %                                                                             %
 %                                                                             %
 %                                                                             %
@@ -777,7 +824,7 @@ static MagickBooleanType InitializeMagickList(ExceptionInfo *exception)
     {
       if (magick_semaphore == (SemaphoreInfo *) NULL)
         AcquireSemaphoreInfo(&magick_semaphore);
-      (void) LockSemaphoreInfo(magick_semaphore);
+      LockSemaphoreInfo(magick_semaphore);
       if ((magick_list == (SplayTreeInfo *) NULL) &&
           (instantiate_magick == MagickFalse))
         {
@@ -819,7 +866,7 @@ static MagickBooleanType InitializeMagickList(ExceptionInfo *exception)
 #endif
           instantiate_magick=MagickTrue;
         }
-      (void) UnlockSemaphoreInfo(magick_semaphore);
+      UnlockSemaphoreInfo(magick_semaphore);
     }
   return(magick_list != (SplayTreeInfo *) NULL ? MagickTrue : MagickFalse);
 }
@@ -835,8 +882,8 @@ static MagickBooleanType InitializeMagickList(ExceptionInfo *exception)
 %                                                                             %
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 %
-%  IsMagickConflict() returns MagickTrue if the image format is not a valid
-%  image format or conflicts with a logical drive (.e.g. X:).
+%  IsMagickConflict() returns MagickTrue if the image format conflicts with a
+%  logical drive (.e.g. X:).
 %
 %  The format of the IsMagickConflict method is:
 %
@@ -849,30 +896,12 @@ static MagickBooleanType InitializeMagickList(ExceptionInfo *exception)
 */
 MagickExport MagickBooleanType IsMagickConflict(const char *magick)
 {
-  const DelegateInfo
-    *delegate_info;
-
-  const MagickInfo
-    *magick_info;
-
-  ExceptionInfo
-    *exception;
-
   assert(magick != (char *) NULL);
-  exception=AcquireExceptionInfo();
-  magick_info=GetMagickInfo(magick,exception);
-  delegate_info=GetDelegateInfo(magick,(char *) NULL,exception);
-  if (delegate_info == (const DelegateInfo *) NULL)
-    delegate_info=GetDelegateInfo((char *) NULL,magick,exception);
-  exception=DestroyExceptionInfo(exception);
-  if ((magick_info == (const MagickInfo *) NULL) &&
-      (delegate_info == (const DelegateInfo *) NULL))
-    return(MagickTrue);
 #if defined(macintosh)
   return(MACIsMagickConflict(magick));
 #elif defined(vms)
   return(VMSIsMagickConflict(magick));
-#elif defined(__WINDOWS__)
+#elif defined(MAGICKCORE_WINDOWS_SUPPORT)
   return(NTIsMagickConflict(magick));
 #else
   return(MagickFalse);
@@ -909,15 +938,15 @@ MagickExport MagickBooleanType ListMagickInfo(FILE *file,
   const MagickInfo
     **magick_info;
 
-  long
-    j;
-
-  register long
+  register ssize_t
     i;
 
-  unsigned long
+  size_t
     number_formats;
 
+  ssize_t
+    j;
+
   if (file == (FILE *) NULL)
     file=stdout;
   magick_info=GetMagickInfoList("*",&number_formats,exception);
@@ -925,18 +954,19 @@ MagickExport MagickBooleanType ListMagickInfo(FILE *file,
     return(MagickFalse);
   ClearMagickException(exception);
 #if !defined(MAGICKCORE_MODULES_SUPPORT)
-  (void) fprintf(file,"   Format  Mode  Description\n");
+  (void) FormatLocaleFile(file,"   Format  Mode  Description\n");
 #else
-  (void) fprintf(file,"   Format  Module    Mode  Description\n");
+  (void) FormatLocaleFile(file,"   Format  Module    Mode  Description\n");
 #endif
-  (void) fprintf(file,"--------------------------------------------------------"
+  (void) FormatLocaleFile(file,
+    "--------------------------------------------------------"
     "-----------------------\n");
-  for (i=0; i < (long) number_formats; i++)
+  for (i=0; i < (ssize_t) number_formats; i++)
   {
     if (magick_info[i]->stealth != MagickFalse)
       continue;
-    (void) fprintf(file,"%9s%c ",magick_info[i]->name != (char *) NULL ?
-      magick_info[i]->name : "",
+    (void) FormatLocaleFile(file,"%9s%c ",
+      magick_info[i]->name != (char *) NULL ? magick_info[i]->name : "",
       magick_info[i]->blob_support != MagickFalse ? '*' : ' ');
 #if defined(MAGICKCORE_MODULES_SUPPORT)
     {
@@ -948,17 +978,17 @@ MagickExport MagickBooleanType ListMagickInfo(FILE *file,
         (void) CopyMagickString(module,magick_info[i]->module,MaxTextExtent);
       (void) ConcatenateMagickString(module,"          ",MaxTextExtent);
       module[9]='\0';
-      (void) fprintf(file,"%9s ",module);
+      (void) FormatLocaleFile(file,"%9s ",module);
     }
 #endif
-    (void) fprintf(file,"%c%c%c ",magick_info[i]->decoder ? 'r' : '-',
+    (void) FormatLocaleFile(file,"%c%c%c ",magick_info[i]->decoder ? 'r' : '-',
       magick_info[i]->encoder ? 'w' : '-',magick_info[i]->encoder != NULL &&
       magick_info[i]->adjoin != MagickFalse ? '+' : '-');
     if (magick_info[i]->description != (char *) NULL)
-      (void) fprintf(file,"  %s",magick_info[i]->description);
+      (void) FormatLocaleFile(file,"  %s",magick_info[i]->description);
     if (magick_info[i]->version != (char *) NULL)
-      (void) fprintf(file," (%s)",magick_info[i]->version);
-    (void) fprintf(file,"\n");
+      (void) FormatLocaleFile(file," (%s)",magick_info[i]->version);
+    (void) FormatLocaleFile(file,"\n");
     if (magick_info[i]->note != (char *) NULL)
       {
         char
@@ -969,17 +999,17 @@ MagickExport MagickBooleanType ListMagickInfo(FILE *file,
           {
             for (j=0; text[j] != (char *) NULL; j++)
             {
-              (void) fprintf(file,"           %s\n",text[j]);
+              (void) FormatLocaleFile(file,"           %s\n",text[j]);
               text[j]=DestroyString(text[j]);
             }
             text=(char **) RelinquishMagickMemory(text);
           }
       }
   }
-  (void) fprintf(file,"\n* native blob support\n");
-  (void) fprintf(file,"r read support\n");
-  (void) fprintf(file,"w write support\n");
-  (void) fprintf(file,"+ support for multiple images\n");
+  (void) FormatLocaleFile(file,"\n* native blob support\n");
+  (void) FormatLocaleFile(file,"r read support\n");
+  (void) FormatLocaleFile(file,"w write support\n");
+  (void) FormatLocaleFile(file,"+ support for multiple images\n");
   (void) fflush(file);
   magick_info=(const MagickInfo **) RelinquishMagickMemory((void *)
     magick_info);
@@ -1057,11 +1087,11 @@ MagickExport void MagickComponentTerminus(void)
 {
   if (magick_semaphore == (SemaphoreInfo *) NULL)
     AcquireSemaphoreInfo(&magick_semaphore);
-  (void) LockSemaphoreInfo(magick_semaphore);
+  LockSemaphoreInfo(magick_semaphore);
   if (magick_list != (SplayTreeInfo *) NULL)
     magick_list=DestroySplayTree(magick_list);
   instantiate_magick=MagickFalse;
-  (void) UnlockSemaphoreInfo(magick_semaphore);
+  UnlockSemaphoreInfo(magick_semaphore);
   DestroySemaphoreInfo(&magick_semaphore);
 }
 \f
@@ -1137,6 +1167,30 @@ static void MagickSignalHandler(int signal_number)
   if (signal_handlers[signal_number] != MagickSignalHandler)
     raise(signal_number);
 #endif
+#if defined(SIGQUIT)
+  if (signal_number == SIGQUIT)
+    abort();
+#endif
+#if defined(SIGABRT)
+  if (signal_number == SIGABRT)
+    abort();
+#endif
+#if defined(SIGFPE)
+  if (signal_number == SIGFPE)
+    abort();
+#endif
+#if defined(SIGXCPU)
+  if (signal_number == SIGXCPU)
+    abort();
+#endif
+#if defined(SIGXFSZ)
+  if (signal_number == SIGXFSZ)
+    abort();
+#endif
+#if defined(SIGSEGV)
+  if (signal_number == SIGSEGV)
+    abort();
+#endif
 #if !defined(MAGICKCORE_HAVE__EXIT)
   exit(signal_number);
 #else
@@ -1144,7 +1198,7 @@ static void MagickSignalHandler(int signal_number)
   if (signal_number == SIGHUP)
     exit(signal_number);
 #endif
-#if defined(SIGINT) && !defined(__WINDOWS__)
+#if defined(SIGINT) && !defined(MAGICKCORE_WINDOWS_SUPPORT)
   if (signal_number == SIGINT)
     exit(signal_number);
 #endif
@@ -1152,7 +1206,7 @@ static void MagickSignalHandler(int signal_number)
   if (signal_number == SIGTERM)
     exit(signal_number);
 #endif
-  _exit(signal_number);
+  _exit(signal_number);  /* do not invoke registered atexit() methods */
 #endif
 }
 
@@ -1183,8 +1237,12 @@ MagickExport void MagickCoreGenesis(const char *path,
   /*
     Initialize the Magick environment.
   */
-  (void) setlocale(LC_ALL,"");
-  (void) setlocale(LC_NUMERIC,"C");
+  LockMagickMutex();
+  if (instantiate_magickcore != MagickFalse)
+    {
+      UnlockMagickMutex();
+      return;
+    }
   (void) SemaphoreComponentGenesis();
   (void) LogComponentGenesis();
   (void) LocaleComponentGenesis();
@@ -1195,7 +1253,7 @@ MagickExport void MagickCoreGenesis(const char *path,
       (void) SetLogEventMask(events);
       events=DestroyString(events);
     }
-#if defined(__WINDOWS__)
+#if defined(MAGICKCORE_WINDOWS_SUPPORT)
 #if defined(_DEBUG) && !defined(__BORLANDC__) && !defined(__MINGW32__)
   if (IsEventLogging() != MagickFalse)
     {
@@ -1232,6 +1290,10 @@ MagickExport void MagickCoreGenesis(const char *path,
       if (signal_handlers[SIGABRT] == (SignalHandler *) NULL)
         signal_handlers[SIGABRT]=RegisterMagickSignalHandler(SIGABRT);
 #endif
+#if defined(SIGSEGV)
+      if (signal_handlers[SIGSEGV] == (SignalHandler *) NULL)
+        signal_handlers[SIGSEGV]=RegisterMagickSignalHandler(SIGSEGV);
+#endif
 #if defined(SIGFPE)
       if (signal_handlers[SIGFPE] == (SignalHandler *) NULL)
         signal_handlers[SIGFPE]=RegisterMagickSignalHandler(SIGFPE);
@@ -1240,7 +1302,7 @@ MagickExport void MagickCoreGenesis(const char *path,
       if (signal_handlers[SIGHUP] == (SignalHandler *) NULL)
         signal_handlers[SIGHUP]=RegisterMagickSignalHandler(SIGHUP);
 #endif
-#if defined(SIGINT) && !defined(__WINDOWS__)
+#if defined(SIGINT) && !defined(MAGICKCORE_WINDOWS_SUPPORT)
       if (signal_handlers[SIGINT] == (SignalHandler *) NULL)
         signal_handlers[SIGINT]=RegisterMagickSignalHandler(SIGINT);
 #endif
@@ -1280,7 +1342,12 @@ MagickExport void MagickCoreGenesis(const char *path,
   (void) TypeComponentGenesis();
   (void) MimeComponentGenesis();
   (void) ConstituteComponentGenesis();
+  (void) AnnotateComponentGenesis();
+#if defined(MAGICKCORE_X11_DELEGATE)
   (void) XComponentGenesis();
+#endif
+  instantiate_magickcore=MagickTrue;
+  UnlockMagickMutex();
 }
 \f
 /*
@@ -1303,14 +1370,21 @@ MagickExport void MagickCoreGenesis(const char *path,
 */
 MagickExport void MagickCoreTerminus(void)
 {
+  LockMagickMutex();
+  if (instantiate_magickcore == MagickFalse)
+    {
+      UnlockMagickMutex();
+      return;
+    }
 #if defined(MAGICKCORE_X11_DELEGATE)
   XComponentTerminus();
 #endif
+  AnnotateComponentTerminus();
   ConstituteComponentTerminus();
   MimeComponentTerminus();
   TypeComponentTerminus();
   ColorComponentTerminus();
-#if defined(__WINDOWS__)
+#if defined(MAGICKCORE_WINDOWS_SUPPORT)
   NTGhostscriptUnLoadDLL();
 #endif
   MagicComponentTerminus();
@@ -1332,7 +1406,8 @@ MagickExport void MagickCoreTerminus(void)
   LocaleComponentTerminus();
   LogComponentTerminus();
   SemaphoreComponentTerminus();
-  instantiate_magick=MagickFalse;
+  instantiate_magickcore=MagickFalse;
+  UnlockMagickMutex();
 }
 \f
 /*
@@ -1414,7 +1489,7 @@ MagickExport MagickInfo *SetMagickInfo(const char *name)
 
   assert(name != (const char *) NULL);
   (void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",name);
-  magick_info=(MagickInfo *) AcquireAlignedMemory(1,sizeof(*magick_info));
+  magick_info=(MagickInfo *) AcquireMagickMemory(sizeof(*magick_info));
   if (magick_info == (MagickInfo *) NULL)
     ThrowFatalException(ResourceLimitFatalError,"MemoryAllocationFailed");
   (void) ResetMagickMemory(magick_info,0,sizeof(*magick_info));
@@ -1432,6 +1507,40 @@ MagickExport MagickInfo *SetMagickInfo(const char *name)
 %                                                                             %
 %                                                                             %
 %                                                                             %
+%   S e t M a g i c k P r e c i s i o n                                       %
+%                                                                             %
+%                                                                             %
+%                                                                             %
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%
+%  SetMagickPrecision() sets the maximum number of significant digits to be
+%  printed and returns it.
+%
+%  The format of the SetMagickPrecision method is:
+%
+%      int SetMagickPrecision(const int precision)
+%
+%  A description of each parameter follows:
+%
+%    o precision: set the maximum number of significant digits to be printed.
+%
+*/
+MagickExport int SetMagickPrecision(const int precision)
+{
+  static int
+    magick_precision = 0;
+
+  (void) LogMagickEvent(TraceEvent,GetMagickModule(),"...");
+  if (precision != 0)
+    magick_precision=precision;
+  return(magick_precision);
+}
+\f
+/*
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%                                                                             %
+%                                                                             %
+%                                                                             %
 +   U n r e g i s t e r M a g i c k I n f o                                   %
 %                                                                             %
 %                                                                             %
@@ -1464,7 +1573,7 @@ MagickExport MagickBooleanType UnregisterMagickInfo(const char *name)
     return(MagickFalse);
   if (GetNumberOfNodesInSplayTree(magick_list) == 0)
     return(MagickFalse);
-  (void) LockSemaphoreInfo(magick_semaphore);
+  LockSemaphoreInfo(magick_semaphore);
   ResetSplayTreeIterator(magick_list);
   p=(const MagickInfo *) GetNextValueInSplayTree(magick_list);
   while (p != (const MagickInfo *) NULL)
@@ -1474,6 +1583,6 @@ MagickExport MagickBooleanType UnregisterMagickInfo(const char *name)
     p=(const MagickInfo *) GetNextValueInSplayTree(magick_list);
   }
   status=DeleteNodeByValueFromSplayTree(magick_list,p);
-  (void) UnlockSemaphoreInfo(magick_semaphore);
+  UnlockSemaphoreInfo(magick_semaphore);
   return(status);
 }