]> granicus.if.org Git - imagemagick/blobdiff - MagickCore/string.c
(no commit message)
[imagemagick] / MagickCore / string.c
index a12aece9703f8d9b8073ca5fe27638b39e6eb85b..31023be8916bf1825211e22e69b2d5f3b7d9425b 100644 (file)
 %                        MagickCore String Methods                            %
 %                                                                             %
 %                             Software Design                                 %
-%                               John Cristy                                   %
+%                                  Cristy                                     %
 %                               August 2003                                   %
 %                                                                             %
 %                                                                             %
-%  Copyright 1999-2013 ImageMagick Studio LLC, a non-profit organization      %
+%  Copyright 1999-2014 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  %
@@ -61,7 +61,7 @@
 */
 #if !defined(MAGICKCORE_HAVE_STRCASECMP) || !defined(MAGICKCORE_HAVE_STRNCASECMP)
 static const unsigned char
-  asciimap[] =
+  AsciiMap[] =
   {
     0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0a, 0x0b,
     0x0c, 0x0d, 0x0e, 0x0f, 0x10, 0x11, 0x12, 0x13, 0x14, 0x15, 0x16, 0x17,
@@ -267,7 +267,6 @@ MagickExport char *CloneString(char **destination,const char *source)
   size_t
     length;
 
-  (void) LogMagickEvent(TraceEvent,GetMagickModule(),"...");
   assert(destination != (char **) NULL);
   if (source == (const char *) NULL)
     {
@@ -320,7 +319,6 @@ MagickExport StringInfo *CloneStringInfo(const StringInfo *string_info)
   StringInfo
     *clone_info;
 
-  (void) LogMagickEvent(TraceEvent,GetMagickModule(),"...");
   assert(string_info != (StringInfo *) NULL);
   assert(string_info->signature == MagickSignature);
   clone_info=AcquireStringInfo(string_info->length);
@@ -369,7 +367,6 @@ MagickExport int CompareStringInfo(const StringInfo *target,
   int
     status;
 
-  (void) LogMagickEvent(TraceEvent,GetMagickModule(),"...");
   assert(target != (StringInfo *) NULL);
   assert(target->signature == MagickSignature);
   assert(source != (StringInfo *) NULL);
@@ -544,7 +541,6 @@ MagickExport void ConcatenateStringInfo(StringInfo *string_info,
   size_t
     length;
 
-  (void) LogMagickEvent(TraceEvent,GetMagickModule(),"...");
   assert(string_info != (StringInfo *) NULL);
   assert(string_info->signature == MagickSignature);
   assert(source != (const StringInfo *) NULL);
@@ -840,7 +836,6 @@ MagickExport char *DestroyString(char *string)
 */
 MagickExport StringInfo *DestroyStringInfo(StringInfo *string_info)
 {
-  (void) LogMagickEvent(TraceEvent,GetMagickModule(),"...");
   assert(string_info != (StringInfo *) NULL);
   assert(string_info->signature == MagickSignature);
   if (string_info->datum != (unsigned char *) NULL)
@@ -928,7 +923,6 @@ MagickExport char *EscapeString(const char *source,const char escape)
   size_t
     length;
 
-  (void) LogMagickEvent(TraceEvent,GetMagickModule(),"...");
   assert(source != (const char *) NULL);
   length=strlen(source);
   for (p=source; *p != '\0'; p++)
@@ -1735,7 +1729,6 @@ MagickExport void PrintStringInfo(FILE *file,const char *id,
     j;
 
   assert(id != (const char *) NULL);
-  (void) LogMagickEvent(TraceEvent,GetMagickModule(),"%s",id);
   assert(string_info != (StringInfo *) NULL);
   assert(string_info->signature == MagickSignature);
   p=(char *) string_info->datum;
@@ -1746,6 +1739,7 @@ MagickExport void PrintStringInfo(FILE *file,const char *id,
       break;
     p++;
   }
+  (void) FormatLocaleFile(file,"%s(%.20g): ",id,(double) string_info->length);
   if (i == string_info->length)
     {
       for (i=0; i < string_info->length; i++)
@@ -1810,7 +1804,6 @@ MagickExport void PrintStringInfo(FILE *file,const char *id,
 */
 MagickExport void ResetStringInfo(StringInfo *string_info)
 {
-  (void) LogMagickEvent(TraceEvent,GetMagickModule(),"...");
   assert(string_info != (StringInfo *) NULL);
   assert(string_info->signature == MagickSignature);
   (void) ResetMagickMemory(string_info->datum,0,string_info->length);
@@ -1843,7 +1836,6 @@ MagickExport void ResetStringInfo(StringInfo *string_info)
 MagickExport void SetStringInfo(StringInfo *string_info,
   const StringInfo *source)
 {
-  (void) LogMagickEvent(TraceEvent,GetMagickModule(),"...");
   assert(string_info != (StringInfo *) NULL);
   assert(string_info->signature == MagickSignature);
   assert(source != (StringInfo *) NULL);
@@ -1884,7 +1876,6 @@ MagickExport void SetStringInfo(StringInfo *string_info,
 MagickExport void SetStringInfoDatum(StringInfo *string_info,
   const unsigned char *source)
 {
-  (void) LogMagickEvent(TraceEvent,GetMagickModule(),"...");
   assert(string_info != (StringInfo *) NULL);
   assert(string_info->signature == MagickSignature);
   if (string_info->length != 0)
@@ -1918,7 +1909,6 @@ MagickExport void SetStringInfoDatum(StringInfo *string_info,
 MagickExport void SetStringInfoLength(StringInfo *string_info,
   const size_t length)
 {
-  (void) LogMagickEvent(TraceEvent,GetMagickModule(),"...");
   assert(string_info != (StringInfo *) NULL);
   assert(string_info->signature == MagickSignature);
   if (~length < MaxTextExtent)
@@ -1960,7 +1950,6 @@ MagickExport void SetStringInfoLength(StringInfo *string_info,
 */
 MagickExport void SetStringInfoPath(StringInfo *string_info,const char *path)
 {
-  (void) LogMagickEvent(TraceEvent,GetMagickModule(),"...");
   assert(string_info != (StringInfo *) NULL);
   assert(string_info->signature == MagickSignature);
   assert(path != (const char *) NULL);
@@ -1995,7 +1984,6 @@ MagickExport StringInfo *SplitStringInfo(StringInfo *string_info,
   StringInfo
     *split_info;
 
-  (void) LogMagickEvent(TraceEvent,GetMagickModule(),"...");
   assert(string_info != (StringInfo *) NULL);
   assert(string_info->signature == MagickSignature);
   if (offset > string_info->length)
@@ -2250,7 +2238,7 @@ MagickExport char **StringToArgv(const char *text,int *argc)
 %                                                                             %
 %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
 %
-%  StringToArrayOfDoubles() converts a string of space or comma seperated
+%  StringToArrayOfDoubles() converts a string of space or comma separated
 %  numbers into array of floating point numbers (doubles). Any number that
 %  failes to parse properly will produce a syntax error. As will two commas
 %  without a  number between them.  However a final comma at the end will
@@ -2262,16 +2250,15 @@ MagickExport char **StringToArgv(const char *text,int *argc)
 %
 %  The format of the StringToArrayOfDoubles method is:
 %
-%     double *StringToArrayOfDoubles(const char *string,size_t *count,
-%       ExceptionInfo *exception)
+%     double *StringToArrayOfDoubles(const char *string,size_t *count)
 %
 %  A description of each parameter follows:
 %
-%    o string: the string containing the comma/space seperated values.
+%    o string: the string containing the comma/space separated values.
 %
 %    o count: returns number of arguments in returned array
 %
-%    o exception: return 'memory failure' exceptions
+%    o exception: return any errors or warnings in this structure.
 %
 */
 MagickExport double *StringToArrayOfDoubles(const char *string,ssize_t *count,
@@ -2317,7 +2304,11 @@ MagickExport double *StringToArrayOfDoubles(const char *string,ssize_t *count,
   *count=i;
   array=(double *) AcquireQuantumMemory((size_t) i,sizeof(*array));
   if (array == (double *) NULL)
-    ThrowFatalException(ResourceLimitFatalError,"MemoryAllocationFailed");
+    {
+      (void) ThrowMagickException(exception,GetMagickModule(),
+        ResourceLimitError,"MemoryAllocationFailed","`%s'","");
+      return((double *) NULL);
+    }
   /*
     Fill in the floating point values.
   */
@@ -2570,7 +2561,6 @@ MagickExport StringInfo *StringToStringInfo(const char *string)
   StringInfo
     *string_info;
 
-  (void) LogMagickEvent(TraceEvent,GetMagickModule(),"...");
   assert(string != (const char *) NULL);
   string_info=AcquireStringInfo(strlen(string));
   SetStringInfoDatum(string_info,(const unsigned char *) string);