git.asbjorn.biz
/
swftools.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
added fontmatrix to swfoutput struct.
[swftools.git]
/
pdf2swf
/
xpdf
/
gfile.cc
diff --git
a/pdf2swf/xpdf/gfile.cc
b/pdf2swf/xpdf/gfile.cc
index
9c7d789
..
b4d88cd
100644
(file)
--- a/
pdf2swf/xpdf/gfile.cc
+++ b/
pdf2swf/xpdf/gfile.cc
@@
-13,9
+13,9
@@
#ifdef WIN32
extern "C" {
#ifdef WIN32
extern "C" {
-# ifndef _MSC_VER
-# include <kpathsea/win32lib.h>
-# endif
+//# ifndef _MSC_VER
+//# include <kpathsea/win32lib.h>
+//# endif
}
#else // !WIN32
# if defined(MACOS)
}
#else // !WIN32
# if defined(MACOS)
@@
-444,21
+444,49
@@
time_t getModTime(char *fileName) {
#endif
}
#endif
}
-static char tmpbuf[128];
+static char* getTempDir()
+{
+#ifdef WIN32
+ char*dir = getenv("TMP");
+ if(!dir) dir = getenv("TEMP");
+ if(!dir) dir = getenv("tmp");
+ if(!dir) dir = getenv("temp");
+ if(!dir) dir = "C:\\";
+#else
+ char* dir = "/tmp/";
+#endif
+ return dir;
+}
char* mktmpname(char*ptr) {
char* mktmpname(char*ptr) {
+ static char tmpbuf[128];
+ char*dir = getTempDir();
+ int l = strlen(dir);
+ char*sep = "";
+ if(!ptr)
+ ptr = tmpbuf;
+ if(l && dir[l-1]!='/' && dir[l-1]!='\\') {
+#ifdef WIN32
+ sep = "\\";
+#else
+ sep = "/";
+#endif
+ }
+
// used to be mktemp. This does remove the warnings, but
// It's not exactly an improvement.
#ifdef HAVE_LRAND48
// 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());
+ sprintf(ptr, "%s%s%08x%08x",dir,sep,lrand48(),lrand48());
#else
# ifdef HAVE_RAND
#else
# ifdef HAVE_RAND
- sprintf(tmpbuf, "/tmp/%08x%08x",rand(),rand());
+ sprintf(ptr, "%s%s%08x%08x",dir,sep,rand(),rand());
# else
# else
- sprintf(tmpbuf, "/tmp/%08x%08x",time(0),(unsigned int)tmpbuf);
+ static int count = 1;
+ sprintf(ptr, "%s%s%08x%04x%04x",dir,sep,time(0),(unsigned int)tmpbuf^((unsigned int)tmpbuf)>>16,count);
+ count ++;
# endif
#endif
# endif
#endif
- return tmpbuf;
+ return ptr;
}
GBool openTempFile(GString **name, FILE **f, char *mode, char *ext) {
}
GBool openTempFile(GString **name, FILE **f, char *mode, char *ext) {