]> granicus.if.org Git - imagemagick/blobdiff - MagickCore/resource.c
(no commit message)
[imagemagick] / MagickCore / resource.c
index 4601ac59787589a0d1227ad1517df9619e66f133..2415099abea80a442e801de58572d020c3c354eb 100644 (file)
@@ -17,7 +17,7 @@
 %                               September 2002                                %
 %                                                                             %
 %                                                                             %
-%  Copyright 1999-2011 ImageMagick Studio LLC, a non-profit organization      %
+%  Copyright 1999-2012 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  %
@@ -104,7 +104,7 @@ static ResourceInfo
     MagickULLConstant(0),
     MagickULLConstant(0),
     MagickULLConstant(0),
-    MagickULLConstant(3072)*1024*1024/sizeof(PixelPacket),
+    MagickULLConstant(3072)*1024*1024,
     MagickULLConstant(1536)*1024*1024,
     MagickULLConstant(3072)*1024*1024,
     MagickResourceInfinity,
@@ -301,7 +301,7 @@ MagickPrivate void AsynchronousResourceComponentTerminus(void)
   path=(const char *) GetNextKeyInSplayTree(temporary_resources);
   while (path != (const char *) NULL)
   {
-    (void) remove(path);
+    (void) remove_utf8(path);
     path=(const char *) GetNextKeyInSplayTree(temporary_resources);
   }
 }
@@ -333,7 +333,7 @@ MagickPrivate void AsynchronousResourceComponentTerminus(void)
 
 static void *DestroyTemporaryResources(void *temporary_resource)
 {
-  (void) remove((char *) temporary_resource);
+  (void) remove_utf8((char *) temporary_resource);
   temporary_resource=DestroyString((char *) temporary_resource);
   return((void *) NULL);
 }
@@ -474,7 +474,7 @@ MagickExport int AcquireUniqueFileResource(char *path)
       *p++=portable_filename[c];
     }
     key=DestroyStringInfo(key);
-    file=open(path,O_RDWR | O_CREAT | O_EXCL | O_BINARY | O_NOFOLLOW,S_MODE);
+    file=open_utf8(path,O_RDWR | O_CREAT | O_EXCL | O_BINARY | O_NOFOLLOW,S_MODE);
     if ((file >= 0) || (errno != EEXIST))
       break;
   }
@@ -863,8 +863,8 @@ MagickExport MagickBooleanType RelinquishUniqueFileResource(const char *path)
     }
   (void) CopyMagickString(cache_path,path,MaxTextExtent);
   AppendImageFormat("cache",cache_path);
-  (void) remove(cache_path);
-  return(remove(path) == 0 ? MagickTrue : MagickFalse);
+  (void) remove_utf8(cache_path);
+  return(remove_utf8(path) == 0 ? MagickTrue : MagickFalse);
 }
 \f
 /*
@@ -899,7 +899,7 @@ static inline MagickSizeType StringToSizeType(const char *string,
   double
     value;
 
-  value=SiPrefixToDouble(string,interval);
+  value=SiPrefixToDoubleInterval(string,interval);
   if (value >= (double) MagickULLConstant(~0))
     return(MagickULLConstant(~0));
   return((MagickSizeType) value);
@@ -933,7 +933,7 @@ MagickPrivate MagickBooleanType ResourceComponentGenesis(void)
 #if defined(PixelCacheThreshold)
   memory=PixelCacheThreshold;
 #endif
-  (void) SetMagickResourceLimit(AreaResource,2*memory/sizeof(PixelPacket));
+  (void) SetMagickResourceLimit(AreaResource,2*memory);
   (void) SetMagickResourceLimit(MemoryResource,memory);
   (void) SetMagickResourceLimit(MapResource,2*memory);
   limit=GetEnvironmentValue("MAGICK_AREA_LIMIT");
@@ -996,7 +996,8 @@ MagickPrivate MagickBooleanType ResourceComponentGenesis(void)
     limit=GetPolicyValue("file");
   if (limit != (char *) NULL)
     {
-      (void) SetMagickResourceLimit(FileResource,StringToSizeType(limit,100.0));
+      (void) SetMagickResourceLimit(FileResource,StringToSizeType(limit,
+        100.0));
       limit=DestroyString(limit);
     }
   (void) SetMagickResourceLimit(ThreadResource,GetOpenMPMaximumThreads());
@@ -1094,6 +1095,7 @@ MagickExport MagickBooleanType SetMagickResourceLimit(const ResourceType type,
   if (resource_semaphore == (SemaphoreInfo *) NULL)
     AcquireSemaphoreInfo(&resource_semaphore);
   LockSemaphoreInfo(resource_semaphore);
+  value=(char *) NULL;
   switch (type)
   {
     case AreaResource:
@@ -1158,6 +1160,8 @@ MagickExport MagickBooleanType SetMagickResourceLimit(const ResourceType type,
     default:
       break;
   }
+  if (value != (char *) NULL)
+    value=DestroyString(value);
   UnlockSemaphoreInfo(resource_semaphore);
   return(MagickTrue);
 }