X-Git-Url: http://git.asbjorn.biz/?a=blobdiff_plain;f=pdf2swf%2Fxpdf%2Fgfile.cc;h=11f5cf69e200715f1ff3252c950213743288d89c;hb=c7432833fe3a6469d63fad135151a92e12877b94;hp=18489086de6e0f630b89acda2e8a5879db440425;hpb=2eb549d27d295e3023f06ce027c0e673430c31ed;p=swftools.git diff --git a/pdf2swf/xpdf/gfile.cc b/pdf2swf/xpdf/gfile.cc index 1848908..11f5cf6 100644 --- a/pdf2swf/xpdf/gfile.cc +++ b/pdf2swf/xpdf/gfile.cc @@ -4,20 +4,13 @@ // // Miscellaneous file and directory name manipulation. // -// Copyright 1996-2002 Glyph & Cog, LLC +// Copyright 1996-2003 Glyph & Cog, LLC // //======================================================================== #include -#include "../../config.h" -#ifdef WIN32 - extern "C" { -# ifndef _MSC_VER -# include -# endif - } -#else // !WIN32 +#ifndef WIN32 # if defined(MACOS) # include # elif !defined(ACORN) @@ -443,30 +436,11 @@ 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) //---------- Win32 ---------- char *s; - char buf[_MAX_PATH]; - char *fp; if (!(s = _tempnam(getenv("TEMP"), NULL))) { return gFalse; @@ -664,36 +638,48 @@ GDir::~GDir() { } GDirEntry *GDir::getNextEntry() { - struct dirent *ent; GDirEntry *e; - e = NULL; #if defined(WIN32) - e = new GDirEntry(path->getCString(), ffd.cFileName, doStat); - if (hnd && !FindNextFile(hnd, &ffd)) { - FindClose(hnd); - hnd = NULL; + if (hnd) { + e = new GDirEntry(path->getCString(), ffd.cFileName, doStat); + if (hnd && !FindNextFile(hnd, &ffd)) { + FindClose(hnd); + hnd = NULL; + } + } else { + e = NULL; } #elif defined(ACORN) #elif defined(MACOS) -#else +#elif defined(VMS) + struct dirent *ent; + e = NULL; if (dir) { -#ifdef VMS if (needParent) { e = new GDirEntry(path->getCString(), "-", doStat); needParent = gFalse; return e; } -#endif ent = readdir(dir); -#ifndef VMS - if (ent && !strcmp(ent->d_name, ".")) + if (ent) { + e = new GDirEntry(path->getCString(), ent->d_name, doStat); + } + } +#else + struct dirent *ent; + e = NULL; + if (dir) { + ent = readdir(dir); + if (ent && !strcmp(ent->d_name, ".")) { ent = readdir(dir); -#endif - if (ent) + } + if (ent) { e = new GDirEntry(path->getCString(), ent->d_name, doStat); + } } #endif + return e; } @@ -706,6 +692,7 @@ void GDir::rewind() { tmp = path->copy(); tmp->append("/*.*"); hnd = FindFirstFile(tmp->getCString(), &ffd); + delete tmp; #elif defined(ACORN) #elif defined(MACOS) #else