]> granicus.if.org Git - imagemagick/blobdiff - MagickCore/utility.c
(no commit message)
[imagemagick] / MagickCore / utility.c
index ed40ae9d70467f2882c504ee1ee0ef0599998072..d74f4b0215b39ee778bfea8658553b32a25d62d1 100644 (file)
 %                       MagickCore Utility Methods                            %
 %                                                                             %
 %                             Software Design                                 %
-%                               John Cristy                                   %
+%                                  Cristy                                     %
 %                              January 1993                                   %
 %                                                                             %
 %                                                                             %
-%  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  %
@@ -149,7 +149,8 @@ MagickExport MagickBooleanType AcquireUniqueFilename(char *path)
 %
 */
 
-static inline size_t MagickMin(const size_t x,const size_t y)
+static inline MagickSizeType MagickMin(const MagickSizeType x,
+  const MagickSizeType y)
 {
   if (x < y)
     return(x);
@@ -212,7 +213,8 @@ MagickExport MagickBooleanType AcquireUniqueSymbolicLink(const char *source,
     }
   quantum=(size_t) MagickMaxBufferExtent;
   if ((fstat(source_file,&attributes) == 0) && (attributes.st_size != 0))
-    quantum=MagickMin((size_t) attributes.st_size,MagickMaxBufferExtent);
+    quantum=(size_t) MagickMin((size_t) attributes.st_size,
+      MagickMaxBufferExtent);
   buffer=(unsigned char *) AcquireQuantumMemory(quantum,sizeof(*buffer));
   if (buffer == (unsigned char *) NULL)
     {
@@ -774,6 +776,7 @@ MagickExport MagickBooleanType ExpandFilenames(int *number_arguments,
     *path='\0';
     *filename='\0';
     *subimage='\0';
+    number_files=0;
     vector[count++]=ConstantString(option);
     destroy=MagickTrue;
     parameters=ParseCommandOption(MagickCommandOptions,MagickFalse,option);
@@ -832,7 +835,7 @@ MagickExport MagickBooleanType ExpandFilenames(int *number_arguments,
           Generate file list from file list (e.g. @filelist.txt).
         */
         exception=AcquireExceptionInfo();
-        files=FileToString(option+1,~0,exception);
+        files=FileToString(option+1,~0UL,exception);
         exception=DestroyExceptionInfo(exception);
         if (files == (char *) NULL)
           continue;
@@ -891,7 +894,8 @@ MagickExport MagickBooleanType ExpandFilenames(int *number_arguments,
       if (*path != '\0')
         (void) ConcatenateMagickString(filename,DirectorySeparator,
           MaxTextExtent);
-      (void) ConcatenateMagickString(filename,filelist[j],MaxTextExtent);
+      if (filelist[j] != (char *) NULL)
+        (void) ConcatenateMagickString(filename,filelist[j],MaxTextExtent);
       filelist[j]=DestroyString(filelist[j]);
       if (strlen(filename) >= (MaxTextExtent-1))
         ThrowFatalException(OptionFatalError,"FilenameTruncated");
@@ -1073,6 +1077,14 @@ MagickPrivate MagickBooleanType GetExecutionPath(char *path,const size_t extent)
       program_name=(char *) RelinquishMagickMemory(program_name);
     execution_path=(char *) RelinquishMagickMemory(execution_path);
   }
+#endif
+#if defined(__OpenBSD__)
+  {
+    extern char
+      *__progname;
+
+    (void) CopyMagickString(path,__progname,extent);
+  }
 #endif
   return(IsPathAccessible(path));
 }
@@ -1782,9 +1794,6 @@ MagickPrivate MagickBooleanType ShredFile(const char *path)
   char
     *passes;
 
-  ExceptionInfo
-    *exception;
-
   int
     file,
     status;
@@ -1803,11 +1812,7 @@ MagickPrivate MagickBooleanType ShredFile(const char *path)
 
   if ((path == (const char *) NULL) || (*path == '\0'))
     return(MagickFalse);
-  exception=AcquireExceptionInfo();
-  passes=(char *) GetImageRegistry(StringRegistryType,"shred-passes",exception);
-  exception=DestroyExceptionInfo(exception);
-  if (passes == (char *) NULL)
-    passes=GetEnvironmentValue("MAGICK_SHRED_PASSES");
+  passes=GetEnvironmentValue("MAGICK_SHRED_PASSES");
   if (passes == (char *) NULL)
     {
       /*
@@ -1868,7 +1873,7 @@ MagickPrivate MagickBooleanType ShredFile(const char *path)
         }
     }
     random_info=DestroyRandomInfo(random_info);
-    if (j < length)
+    if (j < (MagickOffsetType) length)
       break;
   }
   status=close(file);