[poppler] goo/gfile.cc goo/gfile.h poppler/GfxState.cc poppler/GlobalParams.cc poppler/GlobalParams.h test/perf-test.cc
Albert Astals Cid
aacid at kemper.freedesktop.org
Thu May 10 14:01:15 PDT 2012
goo/gfile.cc | 46 ----------------------------------------------
goo/gfile.h | 3 ---
poppler/GfxState.cc | 16 ++--------------
poppler/GlobalParams.cc | 21 ---------------------
poppler/GlobalParams.h | 3 ---
test/perf-test.cc | 1 -
6 files changed, 2 insertions(+), 88 deletions(-)
New commits:
commit 44bf99a7b8683a077f2a5db50541099c109aa069
Author: Albert Astals Cid <aacid at kde.org>
Date: Thu May 10 22:59:18 2012 +0200
Kill the concept of "base dir"
We are a library so having a "common configuration folder" does not really
make much sense at a library level, and even less if it's called .xpdf :D
Fixes bug 49448
diff --git a/goo/gfile.cc b/goo/gfile.cc
index 1351de7..47d792b 100644
--- a/goo/gfile.cc
+++ b/goo/gfile.cc
@@ -60,52 +60,6 @@
//------------------------------------------------------------------------
-GooString *getHomeDir() {
-#ifdef VMS
- //---------- VMS ----------
- return new GooString("SYS$LOGIN:");
-
-#elif defined(__EMX__) || defined(_WIN32)
- //---------- OS/2+EMX and Win32 ----------
- char *s;
- GooString *ret;
-
- if ((s = getenv("HOME")))
- ret = new GooString(s);
- else
- ret = new GooString(".");
- return ret;
-
-#elif defined(ACORN)
- //---------- RISCOS ----------
- return new GooString("@");
-
-#elif defined(MACOS)
- //---------- MacOS ----------
- return new GooString(":");
-
-#else
- //---------- Unix ----------
- char *s;
- struct passwd *pw;
- GooString *ret;
-
- if ((s = getenv("HOME"))) {
- ret = new GooString(s);
- } else {
- if ((s = getenv("USER")))
- pw = getpwnam(s);
- else
- pw = getpwuid(getuid());
- if (pw)
- ret = new GooString(pw->pw_dir);
- else
- ret = new GooString(".");
- }
- return ret;
-#endif
-}
-
GooString *getCurrentDir() {
char buf[PATH_MAX+1];
diff --git a/goo/gfile.h b/goo/gfile.h
index 1eef058..be4be7a 100644
--- a/goo/gfile.h
+++ b/goo/gfile.h
@@ -71,9 +71,6 @@ class GooString;
//------------------------------------------------------------------------
-// Get home directory path.
-extern GooString *getHomeDir();
-
// Get current directory.
extern GooString *getCurrentDir();
diff --git a/poppler/GfxState.cc b/poppler/GfxState.cc
index 5962fcb..f6fa5d0 100644
--- a/poppler/GfxState.cc
+++ b/poppler/GfxState.cc
@@ -354,9 +354,8 @@ cmsHPROFILE loadColorProfile(const char *fileName)
}
return hp;
}
- // try to load from user directory
- GooString *path = globalParams->getBaseDir();
- path->append(COLOR_PROFILE_DIR);
+ // try to load from global directory
+ GooString *path = new GooString(GLOBAL_COLOR_PROFILE_DIR);
path->append(fileName);
// check if open the file
if ((fp = fopen(path->getCString(),"r")) != NULL) {
@@ -364,17 +363,6 @@ cmsHPROFILE loadColorProfile(const char *fileName)
hp = cmsOpenProfileFromFile(path->getCString(),"r");
}
delete path;
- if (hp == NULL) {
- // load from global directory
- path = new GooString(GLOBAL_COLOR_PROFILE_DIR);
- path->append(fileName);
- // check if open the file
- if ((fp = fopen(path->getCString(),"r")) != NULL) {
- fclose(fp);
- hp = cmsOpenProfileFromFile(path->getCString(),"r");
- }
- delete path;
- }
return hp;
}
diff --git a/poppler/GlobalParams.cc b/poppler/GlobalParams.cc
index 64d6133..5fefda9 100644
--- a/poppler/GlobalParams.cc
+++ b/poppler/GlobalParams.cc
@@ -571,11 +571,7 @@ GlobalParams::GlobalParams(const char *customPopplerDataDir)
}
#ifdef _WIN32
- // baseDir will be set by a call to setBaseDir
- baseDir = new GooString();
substFiles = new GooHash(gTrue);
-#else
- baseDir = appendToPath(getHomeDir(), ".xpdf");
#endif
nameToUnicode = new NameToCharCode();
cidToUnicodes = new GooHash(gTrue);
@@ -797,7 +793,6 @@ GlobalParams::~GlobalParams() {
delete macRomanReverseMap;
- delete baseDir;
delete nameToUnicode;
deleteGooHash(cidToUnicodes, GooString);
deleteGooHash(unicodeToUnicodes, GooString);
@@ -847,13 +842,6 @@ GlobalParams::~GlobalParams() {
}
//------------------------------------------------------------------------
-
-void GlobalParams::setBaseDir(const char *dir) {
- delete baseDir;
- baseDir = new GooString(dir);
-}
-
-//------------------------------------------------------------------------
// accessors
//------------------------------------------------------------------------
@@ -862,15 +850,6 @@ CharCode GlobalParams::getMacRomanCharCode(char *charName) {
return macRomanReverseMap->lookup(charName);
}
-GooString *GlobalParams::getBaseDir() {
- GooString *s;
-
- lockGlobalParams;
- s = baseDir->copy();
- unlockGlobalParams;
- return s;
-}
-
Unicode GlobalParams::mapNameToUnicode(const char *charName) {
// no need to lock - nameToUnicode is constant
return nameToUnicode->lookup(charName);
diff --git a/poppler/GlobalParams.h b/poppler/GlobalParams.h
index 375ac2c..a9637ce 100644
--- a/poppler/GlobalParams.h
+++ b/poppler/GlobalParams.h
@@ -133,14 +133,12 @@ public:
~GlobalParams();
- void setBaseDir(const char *dir);
void setupBaseFonts(char *dir);
//----- accessors
CharCode getMacRomanCharCode(char *charName);
- GooString *getBaseDir();
Unicode mapNameToUnicode(const char *charName);
UnicodeMap *getResidentUnicodeMap(GooString *encodingName);
FILE *getUnicodeMapFile(GooString *encodingName);
@@ -273,7 +271,6 @@ private:
//----- user-modifiable settings
- GooString *baseDir; // base directory - for plugins, etc.
NameToCharCode * // mapping from char name to Unicode
nameToUnicode;
GooHash *cidToUnicodes; // files for mappings from char collections
diff --git a/test/perf-test.cc b/test/perf-test.cc
index 6bdda97..21fbdee 100644
--- a/test/perf-test.cc
+++ b/test/perf-test.cc
@@ -1242,7 +1242,6 @@ int main(int argc, char **argv)
if (!globalParams)
return 1;
globalParams->setErrQuiet(gFalse);
- globalParams->setBaseDir("");
FILE * outFile = NULL;
if (gOutFileName) {
More information about the poppler
mailing list