From 2eb549d27d295e3023f06ce027c0e673430c31ed Mon Sep 17 00:00:00 2001 From: kramm Date: Mon, 27 May 2002 16:26:43 +0000 Subject: [PATCH] implement maketmpname(). --- pdf2swf/xpdf/gfile.cc | 18 ++++++++++++++++++ pdf2swf/xpdf/gfile.h | 3 +++ 2 files changed, 21 insertions(+) diff --git a/pdf2swf/xpdf/gfile.cc b/pdf2swf/xpdf/gfile.cc index d6d2363..1848908 100644 --- a/pdf2swf/xpdf/gfile.cc +++ b/pdf2swf/xpdf/gfile.cc @@ -9,6 +9,7 @@ //======================================================================== #include +#include "../../config.h" #ifdef WIN32 extern "C" { @@ -442,6 +443,23 @@ time_t getModTime(char *fileName) { return statBuf.st_mtime; #endif } + +static char tmpbuf[128]; + +char* mktmpname(char*ptr) { + // used to be mktemp. This does remove the warnings, but + // It's not exactly an improvement. +#ifdef HAVE_LRAND48 + sprintf(tmpbuf, "/tmp/%08x%08x",lrand48(),lrand48()); +#else +# ifdef HAVE_RAND + sprintf(tmpbuf, "/tmp/%08x%08x",rand(),rand()); +# else + sprintf(tmpbuf, "/tmp/%08x%08x",time(0),(unsigned int)tmpbuf); +# endif +#endif + return tmpbuf; +} GBool openTempFile(GString **name, FILE **f, char *mode, char *ext) { #if defined(WIN32) diff --git a/pdf2swf/xpdf/gfile.h b/pdf2swf/xpdf/gfile.h index bb6131d..49b0b7a 100644 --- a/pdf2swf/xpdf/gfile.h +++ b/pdf2swf/xpdf/gfile.h @@ -135,4 +135,7 @@ private: #endif }; +/* create a temporary filename */ +char* mktmpname(char*ptr); + #endif -- 1.7.10.4