MagickExport void AppendImageFormat(const char *format,char *filename)
{
char
+ extension[MaxTextExtent],
root[MaxTextExtent];
assert(format != (char *) NULL);
(void) CopyMagickString(filename,message,MaxTextExtent);
return;
}
+ GetPathComponent(filename,ExtensionPath,extension);
+ if ((LocaleCompare(extension,"Z") == 0) ||
+ (LocaleCompare(extension,"bz2") == 0) ||
+ (LocaleCompare(extension,"gz") == 0) ||
+ (LocaleCompare(extension,"wmz") == 0) ||
+ (LocaleCompare(extension,"svgz") == 0))
+ {
+ GetPathComponent(filename,RootPath,root);
+ (void) CopyMagickString(filename,root,MaxTextExtent);
+ GetPathComponent(filename,RootPath,root);
+ (void) FormatMagickString(filename,MaxTextExtent,"%s.%s.%s",root,format,
+ extension);
+ return;
+ }
GetPathComponent(filename,RootPath,root);
(void) FormatMagickString(filename,MaxTextExtent,"%s.%s",root,format);
}
*exception;
int
- number_images;
+ length;
/*
Generate file list from file list (e.g. @filelist.txt).
if (files == (char *) NULL)
continue;
StripString(files);
- filelist=StringToArgv(files,&number_images);
+ filelist=StringToArgv(files,&length);
+ if (filelist == (char **) NULL)
+ continue;
files=DestroyString(files);
- number_files=(size_t) number_images;
- if (filelist != (char **) NULL)
- {
- number_files--;
- for (j=0; j < (ssize_t) number_files; j++)
- filelist[j]=filelist[j+1];
- }
- count--;
+ filelist[0]=DestroyString(filelist[0]);
+ for (j=0; j < (ssize_t) (length-1); j++)
+ filelist[j]=filelist[j+1];
+ number_files=(size_t) length-1;
}
if (filelist == (char **) NULL)
continue;
ssize_t
count;
- (void) FormatMagickString(link_path,MaxTextExtent,"/proc/%ld/exe",
- (long) getpid());
+ (void) FormatMagickString(link_path,MaxTextExtent,"/proc/%.20g/exe",
+ (double) getpid());
count=readlink(link_path,execution_path,PATH_MAX);
if (count == -1)
{
- (void) FormatMagickString(link_path,MaxTextExtent,"/proc/%ld/file",
- (long) getpid());
+ (void) FormatMagickString(link_path,MaxTextExtent,"/proc/%.20g/file",
+ (double) getpid());
count=readlink(link_path,execution_path,PATH_MAX);
}
if ((count > 0) && (count <= (ssize_t) PATH_MAX))
/*
Save the current and change to the new directory.
*/
- buffer=(struct dirent *) AcquireAlignedMemory(1,sizeof(*buffer)+FILENAME_MAX+1);
+ buffer=(struct dirent *) AcquireAlignedMemory(1,sizeof(*buffer)+
+ FILENAME_MAX+1);
if (buffer == (struct dirent *) NULL)
ThrowFatalException(ResourceLimitFatalError,"MemoryAllocationFailed");
while ((MagickReadDirectory(current_directory,buffer,&entry) == 0) &&
}
#endif
filelist[*number_entries]=(char *) AcquireString(entry->d_name);
- if (IsPathDirectory(entry->d_name) > 0)
- (void) ConcatenateMagickString(filelist[*number_entries],
- DirectorySeparator,MaxTextExtent);
(*number_entries)++;
}
}
% %
% %
% %
+% M a g i c k D e l a y %
+% %
+% %
+% %
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%
+% MagickDelay() suspends program execution for the number of milliseconds
+% specified.
+%
+% The format of the Delay method is:
+%
+% void MagickDelay(const MagickSizeType milliseconds)
+%
+% A description of each parameter follows:
+%
+% o milliseconds: Specifies the number of milliseconds to delay before
+% returning.
+%
+*/
+MagickExport void MagickDelay(const MagickSizeType milliseconds)
+{
+ if (milliseconds == 0)
+ return;
+#if defined(MAGICKCORE_HAVE_NANOSLEEP)
+ {
+ struct timespec
+ timer;
+
+ timer.tv_sec=(time_t) (milliseconds/1000);
+ timer.tv_nsec=(milliseconds % 1000)*1000*1000;
+ (void) nanosleep(&timer,(struct timespec *) NULL);
+ }
+#elif defined(MAGICKCORE_HAVE_USLEEP)
+ usleep(1000*milliseconds);
+#elif defined(MAGICKCORE_HAVE_SELECT)
+ {
+ struct timeval
+ timer;
+
+ timer.tv_sec=(long) milliseconds/1000;
+ timer.tv_usec=(long) (milliseconds % 1000)*1000;
+ (void) select(0,(XFD_SET *) NULL,(XFD_SET *) NULL,(XFD_SET *) NULL,&timer);
+ }
+#elif defined(MAGICKCORE_HAVE_POLL)
+ (void) poll((struct pollfd *) NULL,0,(int) milliseconds);
+#elif defined(MAGICKCORE_WINDOWS_SUPPORT)
+ Sleep((long) milliseconds);
+#elif defined(vms)
+ {
+ float
+ timer;
+
+ timer=milliseconds/1000.0;
+ lib$wait(&timer);
+ }
+#elif defined(__BEOS__)
+ snooze(1000*milliseconds);
+#else
+# error "Time delay method not defined."
+#endif
+}
+\f
+/*
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+% %
+% %
+% %
% M u l t i l i n e C e n s u s %
% %
% %