[poppler] goo/gfile.cc goo/gfile.h poppler/CairoFontEngine.cc splash/SplashFTFontEngine.cc splash/SplashT1FontEngine.cc splash/SplashT1FontFile.cc
Albert Astals Cid
aacid at kemper.freedesktop.org
Wed May 13 15:31:30 PDT 2009
goo/gfile.cc | 58 +++++++++----------------------------------
goo/gfile.h | 3 +-
poppler/CairoFontEngine.cc | 6 ++--
splash/SplashFTFontEngine.cc | 3 +-
splash/SplashT1FontEngine.cc | 3 +-
splash/SplashT1FontFile.cc | 3 +-
6 files changed, 24 insertions(+), 52 deletions(-)
New commits:
commit d1c0e8a6c63361304cd453bb4c51e84a1aab7efa
Author: Albert Astals Cid <aacid at kde.org>
Date: Thu May 14 00:29:18 2009 +0200
Kill support for specifying extension in openTmpFile
We don't use it and it would not work anyway, see bug #21713
diff --git a/goo/gfile.cc b/goo/gfile.cc
index d0627d2..e95e52c 100644
--- a/goo/gfile.cc
+++ b/goo/gfile.cc
@@ -19,6 +19,7 @@
// Copyright (C) 2006 Kristian Høgsberg <krh at redhat.com>
// Copyright (C) 2008 Adam Batkin <adam at batkin.net>
// Copyright (C) 2008 Hib Eris <hib at hiberis.nl>
+// Copyright (C) 2009 Albert Astals Cid <aacid at kde.org>
//
// To see a description of the changes please see the Changelog file that
// came with your tarball or type make ChangeLog if you are building from git
@@ -456,7 +457,7 @@ time_t getModTime(char *fileName) {
#endif
}
-GBool openTempFile(GooString **name, FILE **f, char *mode, char *ext) {
+GBool openTempFile(GooString **name, FILE **f, char *mode) {
#if defined(WIN32)
//---------- Win32 ----------
char *tempDir;
@@ -479,9 +480,6 @@ GBool openTempFile(GooString **name, FILE **f, char *mode, char *ext) {
for (i = 0; i < 1000; ++i) {
sprintf(buf, "%d", t + i);
s2 = s->copy()->append(buf);
- if (ext) {
- s2->append(ext);
- }
if (!(f2 = fopen(s2->getCString(), "r"))) {
if (!(f2 = fopen(s2->getCString(), mode))) {
delete s2;
@@ -510,9 +508,6 @@ GBool openTempFile(GooString **name, FILE **f, char *mode, char *ext) {
return gFalse;
}
*name = new GooString(s);
- if (ext) {
- (*name)->append(ext);
- }
if (!(*f = fopen((*name)->getCString(), mode))) {
delete (*name);
return gFalse;
@@ -523,48 +518,21 @@ GBool openTempFile(GooString **name, FILE **f, char *mode, char *ext) {
char *s;
int fd;
- if (ext) {
-#if HAVE_MKSTEMPS
- if ((s = getenv("TMPDIR"))) {
- *name = new GooString(s);
- } else {
- *name = new GooString("/tmp");
- }
- (*name)->append("/XXXXXX")->append(ext);
- fd = mkstemps((*name)->getCString(), strlen(ext));
-#elif defined(HAVE_MKSTEMP)
- if ((s = getenv("TMPDIR"))) {
- *name = new GooString(s);
- } else {
- *name = new GooString("/tmp");
- }
- (*name)->append("/XXXXXX")->append(ext);
- fd = mkstemp((*name)->getCString());
-#else
- if (!(s = tmpnam(NULL))) {
- return gFalse;
- }
+#if HAVE_MKSTEMP
+ if ((s = getenv("TMPDIR"))) {
*name = new GooString(s);
- (*name)->append(ext);
- fd = open((*name)->getCString(), O_WRONLY | O_CREAT | O_EXCL, 0600);
-#endif
} else {
-#if HAVE_MKSTEMP
- if ((s = getenv("TMPDIR"))) {
- *name = new GooString(s);
- } else {
- *name = new GooString("/tmp");
- }
- (*name)->append("/XXXXXX");
- fd = mkstemp((*name)->getCString());
+ *name = new GooString("/tmp");
+ }
+ (*name)->append("/XXXXXX");
+ fd = mkstemp((*name)->getCString());
#else // HAVE_MKSTEMP
- if (!(s = tmpnam(NULL))) {
- return gFalse;
- }
- *name = new GooString(s);
- fd = open((*name)->getCString(), O_WRONLY | O_CREAT | O_EXCL, 0600);
-#endif // HAVE_MKSTEMP
+ if (!(s = tmpnam(NULL))) {
+ return gFalse;
}
+ *name = new GooString(s);
+ fd = open((*name)->getCString(), O_WRONLY | O_CREAT | O_EXCL, 0600);
+#endif // HAVE_MKSTEMP
if (fd < 0 || !(*f = fdopen(fd, mode))) {
delete *name;
return gFalse;
diff --git a/goo/gfile.h b/goo/gfile.h
index e416243..aaa2a16 100644
--- a/goo/gfile.h
+++ b/goo/gfile.h
@@ -16,6 +16,7 @@
// under GPL version 2 or later
//
// Copyright (C) 2006 Kristian Høgsberg <krh at redhat.com>
+// Copyright (C) 2009 Albert Astals Cid <aacid at kde.org>
//
// To see a description of the changes please see the Changelog file that
// came with your tarball or type make ChangeLog if you are building from git
@@ -99,7 +100,7 @@ extern time_t getModTime(char *fileName);
// should be done to the returned file pointer; the file may be
// reopened later for reading, but not for writing. The <mode> string
// should be "w" or "wb". Returns true on success.
-extern GBool openTempFile(GooString **name, FILE **f, char *mode, char *ext);
+extern GBool openTempFile(GooString **name, FILE **f, char *mode);
// Execute <command>. Returns true on success.
extern GBool executeCommand(char *cmd);
diff --git a/poppler/CairoFontEngine.cc b/poppler/CairoFontEngine.cc
index 57e3465..a4edd12 100644
--- a/poppler/CairoFontEngine.cc
+++ b/poppler/CairoFontEngine.cc
@@ -17,7 +17,7 @@
// Copyright (C) 2005-2007 Jeff Muizelaar <jeff at infidigm.net>
// Copyright (C) 2005, 2006 Kristian Høgsberg <krh at redhat.com>
// Copyright (C) 2005 Martin Kretzschmar <martink at gnome.org>
-// Copyright (C) 2005 Albert Astals Cid <aacid at kde.org>
+// Copyright (C) 2005, 2009 Albert Astals Cid <aacid at kde.org>
// Copyright (C) 2006, 2007 Carlos Garcia Campos <carlosgc at gnome.org>
// Copyright (C) 2007 Koji Otani <sho at bbr.jp>
// Copyright (C) 2008 Chris Wilson <chris at chris-wilson.co.uk>
@@ -392,7 +392,7 @@ CairoFreeTypeFont *CairoFreeTypeFont::create(GfxFont *gfxFont, XRef *xref,
tmpFileName = NULL;
if (gfxFont->getEmbeddedFontID(&embRef)) {
- if (!openTempFile(&tmpFileName, &tmpFile, "wb", NULL)) {
+ if (!openTempFile(&tmpFileName, &tmpFile, "wb")) {
error(-1, "Couldn't create temporary font file");
goto err2;
}
@@ -489,7 +489,7 @@ CairoFreeTypeFont *CairoFreeTypeFont::create(GfxFont *gfxFont, XRef *xref,
codeToGID = ((Gfx8BitFont *)gfxFont)->getCodeToGIDMap(ff);
codeToGIDLen = 256;
}
- if (!openTempFile(&tmpFileName2, &tmpFile, "wb", NULL)) {
+ if (!openTempFile(&tmpFileName2, &tmpFile, "wb")) {
delete ff;
error(-1, "failed to open truetype tempfile\n");
goto err2;
diff --git a/splash/SplashFTFontEngine.cc b/splash/SplashFTFontEngine.cc
index a090132..2296f5d 100644
--- a/splash/SplashFTFontEngine.cc
+++ b/splash/SplashFTFontEngine.cc
@@ -12,6 +12,7 @@
// under GPL version 2 or later
//
// Copyright (C) 2006 Takashi Iwai <tiwai at suse.de>
+// Copyright (C) 2009 Albert Astals Cid <aacid at kde.org>
//
// To see a description of the changes please see the Changelog file that
// came with your tarball or type make ChangeLog if you are building from git
@@ -178,7 +179,7 @@ SplashFontFile *SplashFTFontEngine::loadTrueTypeFont(SplashFontFileID *idA,
return NULL;
}
tmpFileName = NULL;
- if (!openTempFile(&tmpFileName, &tmpFile, "wb", NULL)) {
+ if (!openTempFile(&tmpFileName, &tmpFile, "wb")) {
delete ff;
return NULL;
}
diff --git a/splash/SplashT1FontEngine.cc b/splash/SplashT1FontEngine.cc
index 7417863..a09a883 100644
--- a/splash/SplashT1FontEngine.cc
+++ b/splash/SplashT1FontEngine.cc
@@ -12,6 +12,7 @@
// under GPL version 2 or later
//
// Copyright (C) 2006 Takashi Iwai <tiwai at suse.de>
+// Copyright (C) 2009 Albert Astals Cid <aacid at kde.org>
//
// To see a description of the changes please see the Changelog file that
// came with your tarball or type make ChangeLog if you are building from git
@@ -119,7 +120,7 @@ SplashFontFile *SplashT1FontEngine::loadType1CFont(SplashFontFileID *idA,
return NULL;
tmpFileName = NULL;
- if (!openTempFile(&tmpFileName, &tmpFile, "wb", NULL)) {
+ if (!openTempFile(&tmpFileName, &tmpFile, "wb")) {
delete ff;
return NULL;
}
diff --git a/splash/SplashT1FontFile.cc b/splash/SplashT1FontFile.cc
index a7e8e72..3f46ba6 100644
--- a/splash/SplashT1FontFile.cc
+++ b/splash/SplashT1FontFile.cc
@@ -12,6 +12,7 @@
// under GPL version 2 or later
//
// Copyright (C) 2006 Takashi Iwai <tiwai at suse.de>
+// Copyright (C) 2009 Albert Astals Cid <aacid at kde.org>
//
// To see a description of the changes please see the Changelog file that
// came with your tarball or type make ChangeLog if you are building from git
@@ -57,7 +58,7 @@ SplashFontFile *SplashT1FontFile::loadType1Font(SplashT1FontEngine *engineA,
if (! src->isFile) {
GooString *tmpFileName;
FILE *tmpFile;
- if (!openTempFile(&tmpFileName, &tmpFile, "wb", NULL))
+ if (!openTempFile(&tmpFileName, &tmpFile, "wb"))
return NULL;
fwrite(src->buf, 1, src->bufLen, tmpFile);
fclose(tmpFile);
More information about the poppler
mailing list