And here is the corresponding patch for stable/squeeze.
Luckily it is a bit simpler.

Regards,
Wolfram.
description: fix type clash GlobalParam xpdf vs. poppler
author: Wolfram Gloger <[email protected]> 
debian-bug: http://bugs.debian.org/658264
Index: xpdf-3.02/xpdf/GlobalParams.cc
===================================================================
--- xpdf-3.02.orig/xpdf/GlobalParams.cc	2012-02-09 14:25:22.000000000 +0100
+++ xpdf-3.02/xpdf/GlobalParams.cc	2012-02-09 17:20:35.000000000 +0100
@@ -48,19 +48,11 @@
 #endif
 
 #if MULTITHREADED
-#  define lockGlobalParams            gLockMutex(&mutex)
-#  define lockUnicodeMapCache         gLockMutex(&unicodeMapCacheMutex)
-#  define lockCMapCache               gLockMutex(&cMapCacheMutex)
-#  define unlockGlobalParams          gUnlockMutex(&mutex)
-#  define unlockUnicodeMapCache       gUnlockMutex(&unicodeMapCacheMutex)
-#  define unlockCMapCache             gUnlockMutex(&cMapCacheMutex)
+#  define lockGlobalParams            gLockMutex(&xpdf_mutex)
+#  define unlockGlobalParams          gUnlockMutex(&xpdf_mutex)
 #else
 #  define lockGlobalParams
-#  define lockUnicodeMapCache
-#  define lockCMapCache
 #  define unlockGlobalParams
-#  define unlockUnicodeMapCache
-#  define unlockCMapCache
 #endif
 
 #include "NameToUnicodeTable.h"
@@ -601,20 +593,26 @@
 // parsing
 //------------------------------------------------------------------------
 
-GlobalParams::GlobalParams(char *cfgFileName) {
-  UnicodeMap *map;
+GlobalParams::GlobalParams(char *cfgFileName)
+#if POPPLER_GLOBAL
+: poppler_GlobalParams()
+#endif
+{
   GString *fileName;
   FILE *f;
-  int i;
+
+#if POPPLER_GLOBAL
+#undef globalParams
+  globalParams = this;
+#endif
 
 #if MULTITHREADED
-  gInitMutex(&mutex);
-  gInitMutex(&unicodeMapCacheMutex);
-  gInitMutex(&cMapCacheMutex);
+  gInitMutex(&xpdf_mutex);
 #endif
 
   initBuiltinFontTables();
 
+#if !POPPLER_GLOBAL
   // scan the encoding in reverse because we want the lowest-numbered
   // index for each char name ('space' is encoded twice)
   macRomanReverseMap = new NameToCharCode();
@@ -637,6 +635,7 @@
   unicodeMaps = new GHash(gTrue);
   cMapDirs = new GHash(gTrue);
   toUnicodeDirs = new GList();
+#endif
   displayFonts = new GHash();
   displayCIDFonts = new GHash();
   displayNamedCIDFonts = new GHash();
@@ -662,11 +661,6 @@
   psImageableURX = psPaperWidth;
   psImageableURY = psPaperHeight;
   psCrop = gTrue;
-  psExpandSmaller = gFalse;
-  psShrinkLarger = gTrue;
-  psCenter = gTrue;
-  psDuplex = gFalse;
-  psLevel = psLevel2;
   psFile = NULL;
   psFonts = new GHash();
   psNamedFonts16 = new GList();
@@ -675,6 +669,7 @@
   psEmbedTrueType = gTrue;
   psEmbedCIDPostScript = gTrue;
   psEmbedCIDTrueType = gTrue;
+#if !POPPLER_GLOBAL
   psPreload = gFalse;
   psOPI = gFalse;
   psASCIIHex = gFalse;
@@ -688,10 +683,12 @@
 #endif
   textPageBreaks = gTrue;
   textKeepTinyChars = gFalse;
+#endif
   fontDirs = new GList();
   initialZoom = new GString("125");
   continuousView = gFalse;
   enableT1lib = gTrue;
+#if !POPPLER_GLOBAL
   enableFreeType = gTrue;
   antialias = gTrue;
   vectorAntialias = gTrue;
@@ -702,8 +699,10 @@
   screenGamma = 1.0;
   screenBlackThreshold = 0.0;
   screenWhiteThreshold = 1.0;
+#endif
   urlCommand = NULL;
   movieCommand = NULL;
+#if !POPPLER_GLOBAL
   mapNumericCharNames = gTrue;
   mapUnknownCharNames = gFalse;
   createDefaultKeyBindings();
@@ -747,6 +746,9 @@
   residentUnicodeMaps->add(map->getEncodingName(), map);
   map = new UnicodeMap("UCS-2", gTrue, &mapUCS2);
   residentUnicodeMaps->add(map->getEncodingName(), map);
+#else
+  createDefaultKeyBindings();
+#endif
 
   // look for a user config file, then a system-wide config file
   f = NULL;
@@ -928,6 +930,9 @@
   GString *cmd, *incFile;
   char *p1, *p2;
   FILE *f2;
+  GBool  pBool;
+  int    pInt;
+  double pDouble;
 
   // break the line into tokens
   tokens = new GList();
@@ -1009,12 +1014,15 @@
     } else if (!cmd->cmp("psCrop")) {
       parseYesNo("psCrop", &psCrop, tokens, fileName, line);
     } else if (!cmd->cmp("psExpandSmaller")) {
-      parseYesNo("psExpandSmaller", &psExpandSmaller,
-		 tokens, fileName, line);
+	if (parseYesNo("psExpandSmaller", &pBool,
+		       tokens, fileName, line))
+	    setPSExpandSmaller(pBool);
     } else if (!cmd->cmp("psShrinkLarger")) {
-      parseYesNo("psShrinkLarger", &psShrinkLarger, tokens, fileName, line);
+	if (parseYesNo("psShrinkLarger", &pBool, tokens, fileName, line))
+	    setPSShrinkLarger(pBool);
     } else if (!cmd->cmp("psCenter")) {
-      parseYesNo("psCenter", &psCenter, tokens, fileName, line);
+	if (parseYesNo("psCenter", &pBool, tokens, fileName, line))
+	    setPSCenter(pBool);
     } else if (!cmd->cmp("psDuplex")) {
       parseYesNo("psDuplex", &psDuplex, tokens, fileName, line);
     } else if (!cmd->cmp("psLevel")) {
@@ -1031,21 +1039,25 @@
       parseYesNo("psEmbedCIDTrueType", &psEmbedCIDTrueType,
 		 tokens, fileName, line);
     } else if (!cmd->cmp("psPreload")) {
-      parseYesNo("psPreload", &psPreload, tokens, fileName, line);
+      if (parseYesNo("psPreload", &pBool, tokens, fileName, line))
+	  setPSPreload(pBool);
     } else if (!cmd->cmp("psOPI")) {
-      parseYesNo("psOPI", &psOPI, tokens, fileName, line);
+      if (parseYesNo("psOPI", &pBool, tokens, fileName, line))
+	  setPSOPI(pBool);
     } else if (!cmd->cmp("psASCIIHex")) {
-      parseYesNo("psASCIIHex", &psASCIIHex, tokens, fileName, line);
+      if (parseYesNo("psASCIIHex", &pBool, tokens, fileName, line))
+	  setPSASCIIHex(pBool);
     } else if (!cmd->cmp("textEncoding")) {
       parseTextEncoding(tokens, fileName, line);
     } else if (!cmd->cmp("textEOL")) {
       parseTextEOL(tokens, fileName, line);
     } else if (!cmd->cmp("textPageBreaks")) {
-      parseYesNo("textPageBreaks", &textPageBreaks,
-		 tokens, fileName, line);
+      if (parseYesNo("textPageBreaks", &pBool, tokens, fileName, line))
+	  setTextPageBreaks(pBool);
     } else if (!cmd->cmp("textKeepTinyChars")) {
-      parseYesNo("textKeepTinyChars", &textKeepTinyChars,
-		 tokens, fileName, line);
+      if (parseYesNo("textKeepTinyChars", &pBool,
+		     tokens, fileName, line))
+	  setTextKeepTinyChars(pBool);
     } else if (!cmd->cmp("fontDir")) {
       parseFontDir(tokens, fileName, line);
     } else if (!cmd->cmp("initialZoom")) {
@@ -1055,30 +1067,40 @@
     } else if (!cmd->cmp("enableT1lib")) {
       parseYesNo("enableT1lib", &enableT1lib, tokens, fileName, line);
     } else if (!cmd->cmp("enableFreeType")) {
-      parseYesNo("enableFreeType", &enableFreeType, tokens, fileName, line);
+	char *t = parseYesNo("enableFreeType", &pBool, tokens, fileName, line);
+	if (t)
+	    setEnableFreeType(t);
     } else if (!cmd->cmp("antialias")) {
-      parseYesNo("antialias", &antialias, tokens, fileName, line);
+	char *t = parseYesNo("antialias", &pBool, tokens, fileName, line);
+	if (t)
+	    setAntialias(t);
     } else if (!cmd->cmp("vectorAntialias")) {
-      parseYesNo("vectorAntialias", &vectorAntialias,
-		 tokens, fileName, line);
+	char *t = parseYesNo("vectorAntialias", &pBool,
+			     tokens, fileName, line);
+	if (t)
+	    setVectorAntialias(t);
     } else if (!cmd->cmp("strokeAdjust")) {
-      parseYesNo("strokeAdjust", &strokeAdjust, tokens, fileName, line);
+	if (parseYesNo("strokeAdjust", &pBool, tokens, fileName, line))
+	    setStrokeAdjust(pBool);
     } else if (!cmd->cmp("screenType")) {
       parseScreenType(tokens, fileName, line);
     } else if (!cmd->cmp("screenSize")) {
-      parseInteger("screenSize", &screenSize, tokens, fileName, line);
+	if (parseInteger("screenSize", &pInt, tokens, fileName, line))
+	    setScreenSize(pInt);
     } else if (!cmd->cmp("screenDotRadius")) {
-      parseInteger("screenDotRadius", &screenDotRadius,
-		   tokens, fileName, line);
+	if (parseInteger("screenDotRadius", &pInt, tokens, fileName, line))
+	    setScreenDotRadius(pInt);
     } else if (!cmd->cmp("screenGamma")) {
-      parseFloat("screenGamma", &screenGamma,
-		 tokens, fileName, line);
+	if (parseFloat("screenGamma", &pDouble, tokens, fileName, line))
+	    setScreenGamma(pDouble);
     } else if (!cmd->cmp("screenBlackThreshold")) {
-      parseFloat("screenBlackThreshold", &screenBlackThreshold,
-		 tokens, fileName, line);
+	if (parseFloat("screenBlackThreshold", &pDouble,
+		       tokens, fileName, line))
+	    setScreenBlackThreshold(pDouble);
     } else if (!cmd->cmp("screenWhiteThreshold")) {
-      parseFloat("screenWhiteThreshold", &screenWhiteThreshold,
-		 tokens, fileName, line);
+	if (parseFloat("screenWhiteThreshold", &pDouble,
+		       tokens, fileName, line))
+	    setScreenWhiteThreshold(pDouble);
     } else if (!cmd->cmp("urlCommand")) {
       parseCommand("urlCommand", &urlCommand, tokens, fileName, line);
     } else if (!cmd->cmp("movieCommand")) {
@@ -1094,9 +1116,11 @@
     } else if (!cmd->cmp("unbind")) {
       parseUnbind(tokens, fileName, line);
     } else if (!cmd->cmp("printCommands")) {
-      parseYesNo("printCommands", &printCommands, tokens, fileName, line);
+	if (parseYesNo("printCommands", &pBool, tokens, fileName, line))
+	    setPrintCommands(pBool);
     } else if (!cmd->cmp("errQuiet")) {
-      parseYesNo("errQuiet", &errQuiet, tokens, fileName, line);
+	if (parseYesNo("errQuiet", &pBool, tokens, fileName, line))
+	    setErrQuiet(pBool);
     } else {
       error(-1, "Unknown config file command '%s' (%s:%d)",
 	    cmd->getCString(), fileName->getCString(), line);
@@ -1116,6 +1140,8 @@
   deleteGList(tokens, GString);
 }
 
+#if !POPPLER_GLOBAL
+
 void GlobalParams::parseNameToUnicode(GList *tokens, GString *fileName,
 					 int line) {
   GString *name;
@@ -1230,6 +1256,22 @@
   toUnicodeDirs->append(((GString *)tokens->get(1))->copy());
 }
 
+#else // POPPLER_GLOBAL
+
+// provide dummys as unicode parsing is handled by poppler
+void GlobalParams::parseNameToUnicode(GList *tokens, GString *fileName,
+				      int line) {}
+void GlobalParams::parseCIDToUnicode(GList *tokens, GString *fileName,
+				     int line) {}
+void GlobalParams::parseUnicodeToUnicode(GList *tokens, GString *fileName,
+					 int line) {}
+void GlobalParams::parseUnicodeMap(GList *tokens, GString *fileName,
+				   int line) {}
+void GlobalParams::parseCMapDir(GList *tokens, GString *fileName, int line) {}
+void GlobalParams::parseToUnicodeDir(GList *tokens, GString *fileName,
+				     int line) {}
+#endif
+
 void GlobalParams::parseDisplayFont(GList *tokens, GHash *fontHash,
 				    DisplayFontParamKind kind,
 				    GString *fileName, int line) {
@@ -1315,17 +1357,17 @@
   }
   tok = (GString *)tokens->get(1);
   if (!tok->cmp("level1")) {
-    psLevel = psLevel1;
+      setPSLevel(psLevel1);
   } else if (!tok->cmp("level1sep")) {
-    psLevel = psLevel1Sep;
+      setPSLevel(psLevel1Sep);
   } else if (!tok->cmp("level2")) {
-    psLevel = psLevel2;
+      setPSLevel(psLevel2);
   } else if (!tok->cmp("level2sep")) {
-    psLevel = psLevel2Sep;
+      setPSLevel(psLevel2Sep);
   } else if (!tok->cmp("level3")) {
-    psLevel = psLevel3;
+      setPSLevel(psLevel3);
   } else if (!tok->cmp("level3Sep")) {
-    psLevel = psLevel3Sep;
+      setPSLevel(psLevel3Sep);
   } else {
     error(-1, "Bad 'psLevel' config file command (%s:%d)",
 	  fileName->getCString(), line);
@@ -1392,8 +1434,7 @@
 	  fileName->getCString(), line);
     return;
   }
-  delete textEncoding;
-  textEncoding = ((GString *)tokens->get(1))->copy();
+  setTextEncoding(((GString *)tokens->get(1))->getCString());
 }
 
 void GlobalParams::parseTextEOL(GList *tokens, GString *fileName, int line) {
@@ -1405,13 +1446,7 @@
     return;
   }
   tok = (GString *)tokens->get(1);
-  if (!tok->cmp("unix")) {
-    textEOL = eolUnix;
-  } else if (!tok->cmp("dos")) {
-    textEOL = eolDOS;
-  } else if (!tok->cmp("mac")) {
-    textEOL = eolMac;
-  } else {
+  if (!setTextEOL(tok->getCString())) {
     error(-1, "Bad 'textEOL' config file command (%s:%d)",
 	  fileName->getCString(), line);
   }
@@ -1448,11 +1483,11 @@
   }
   tok = (GString *)tokens->get(1);
   if (!tok->cmp("dispersed")) {
-    screenType = screenDispersed;
+      setScreenType(screenDispersed);
   } else if (!tok->cmp("clustered")) {
-    screenType = screenClustered;
+      setScreenType(screenClustered);
   } else if (!tok->cmp("stochasticClustered")) {
-    screenType = screenStochasticClustered;
+      setScreenType(screenStochasticClustered);
   } else {
     error(-1, "Bad 'screenType' config file command (%s:%d)",
 	  fileName->getCString(), line);
@@ -1658,20 +1693,22 @@
   *val = ((GString *)tokens->get(1))->copy();
 }
 
-void GlobalParams::parseYesNo(char *cmdName, GBool *flag,
+char *GlobalParams::parseYesNo(char *cmdName, GBool *flag,
 			      GList *tokens, GString *fileName, int line) {
   GString *tok;
 
   if (tokens->getLength() != 2) {
     error(-1, "Bad '%s' config file command (%s:%d)",
 	  cmdName, fileName->getCString(), line);
-    return;
+    return NULL;
   }
   tok = (GString *)tokens->get(1);
   if (!parseYesNo2(tok->getCString(), flag)) {
     error(-1, "Bad '%s' config file command (%s:%d)",
 	  cmdName, fileName->getCString(), line);
+    return NULL;
   }
+   return tok->getCString();
 }
 
 GBool GlobalParams::parseYesNo2(char *token, GBool *flag) {
@@ -1685,7 +1722,7 @@
   return gTrue;
 }
 
-void GlobalParams::parseInteger(char *cmdName, int *val,
+GBool GlobalParams::parseInteger(char *cmdName, int *val,
 				GList *tokens, GString *fileName, int line) {
   GString *tok;
   int i;
@@ -1693,13 +1730,13 @@
   if (tokens->getLength() != 2) {
     error(-1, "Bad '%s' config file command (%s:%d)",
 	  cmdName, fileName->getCString(), line);
-    return;
+    return gFalse;
   }
   tok = (GString *)tokens->get(1);
   if (tok->getLength() == 0) {
     error(-1, "Bad '%s' config file command (%s:%d)",
 	  cmdName, fileName->getCString(), line);
-    return;
+    return gFalse;
   }
   if (tok->getChar(0) == '-') {
     i = 1;
@@ -1710,13 +1747,14 @@
     if (tok->getChar(i) < '0' || tok->getChar(i) > '9') {
       error(-1, "Bad '%s' config file command (%s:%d)",
 	    cmdName, fileName->getCString(), line);
-      return;
+      return gFalse;
     }
   }
   *val = atoi(tok->getCString());
+  return gTrue;
 }
 
-void GlobalParams::parseFloat(char *cmdName, double *val,
+GBool GlobalParams::parseFloat(char *cmdName, double *val,
 			      GList *tokens, GString *fileName, int line) {
   GString *tok;
   int i;
@@ -1724,13 +1762,13 @@
   if (tokens->getLength() != 2) {
     error(-1, "Bad '%s' config file command (%s:%d)",
 	  cmdName, fileName->getCString(), line);
-    return;
+    return gFalse;
   }
   tok = (GString *)tokens->get(1);
   if (tok->getLength() == 0) {
     error(-1, "Bad '%s' config file command (%s:%d)",
 	  cmdName, fileName->getCString(), line);
-    return;
+    return gFalse;
   }
   if (tok->getChar(0) == '-') {
     i = 1;
@@ -1742,13 +1780,15 @@
 	  tok->getChar(i) == '.')) {
       error(-1, "Bad '%s' config file command (%s:%d)",
 	    cmdName, fileName->getCString(), line);
-      return;
+      return gFalse;
     }
   }
   *val = atof(tok->getCString());
+  return gTrue;
 }
 
 GlobalParams::~GlobalParams() {
+#if !POPPLER_GLOBAL
   GHashIter *iter;
   GString *key;
   GList *list;
@@ -1764,6 +1804,9 @@
   deleteGHash(residentUnicodeMaps, UnicodeMap);
   deleteGHash(unicodeMaps, GString);
   deleteGList(toUnicodeDirs, GString);
+#else
+  freeBuiltinFontTables();
+#endif
   deleteGHash(displayFonts, DisplayFontParam);
   deleteGHash(displayCIDFonts, DisplayFontParam);
   deleteGHash(displayNamedCIDFonts, DisplayFontParam);
@@ -1778,7 +1821,6 @@
   deleteGHash(psFonts, PSFontParam);
   deleteGList(psNamedFonts16, PSFontParam);
   deleteGList(psFonts16, PSFontParam);
-  delete textEncoding;
   deleteGList(fontDirs, GString);
   delete initialZoom;
   if (urlCommand) {
@@ -1789,6 +1831,7 @@
   }
   deleteGList(keyBindings, KeyBinding);
 
+#if !POPPLER_GLOBAL
   cMapDirs->startIter(&iter);
   while (cMapDirs->getNext(&iter, &key, (void **)&list)) {
     deleteGList(list, GString);
@@ -1804,21 +1847,15 @@
   delete securityHandlers;
   deleteGList(plugins, Plugin);
 #endif
+#endif
 
 #if MULTITHREADED
-  gDestroyMutex(&mutex);
-  gDestroyMutex(&unicodeMapCacheMutex);
-  gDestroyMutex(&cMapCacheMutex);
+  gDestroyMutex(&xpdf_mutex);
 #endif
 }
 
 //------------------------------------------------------------------------
 
-void GlobalParams::setBaseDir(char *dir) {
-  delete baseDir;
-  baseDir = new GString(dir);
-}
-
 void GlobalParams::setupBaseFonts(char *dir) {
   GString *fontName;
   GString *fileName;
@@ -1917,7 +1954,7 @@
     }
     dfp = new DisplayFontParam(fontName, kind);
     dfp->t1.fileName = fileName;
-    globalParams->addDisplayFont(dfp);
+    addDisplayFont(dfp);
   }
 
 #ifdef WIN32
@@ -1931,6 +1968,7 @@
 // accessors
 //------------------------------------------------------------------------
 
+#if !POPPLER_GLOBAL
 CharCode GlobalParams::getMacRomanCharCode(char *charName) {
   // no need to lock - macRomanReverseMap is constant
   return macRomanReverseMap->lookup(charName);
@@ -2021,6 +2059,7 @@
   unlockGlobalParams;
   return NULL;
 }
+#endif
 
 DisplayFontParam *GlobalParams::getDisplayFont(GString *fontName) {
   DisplayFontParam *dfp;
@@ -2036,6 +2075,7 @@
   return dfp;
 }
 
+#if !POPPLER_GLOBAL
 DisplayFontParam *GlobalParams::getDisplayCIDFont(GString *fontName,
 						  GString *collection) {
   DisplayFontParam *dfp;
@@ -2048,6 +2088,7 @@
   unlockGlobalParams;
   return dfp;
 }
+#endif
 
 GString *GlobalParams::getPSFile() {
   GString *s;
@@ -2094,6 +2135,7 @@
   return f;
 }
 
+#if !POPPLER_GLOBAL
 GBool GlobalParams::getPSExpandSmaller() {
   GBool f;
 
@@ -2120,6 +2162,7 @@
   unlockGlobalParams;
   return f;
 }
+#endif
 
 GBool GlobalParams::getPSDuplex() {
   GBool d;
@@ -2130,6 +2173,7 @@
   return d;
 }
 
+#if !POPPLER_GLOBAL
 PSLevel GlobalParams::getPSLevel() {
   PSLevel level;
 
@@ -2138,6 +2182,7 @@
   unlockGlobalParams;
   return level;
 }
+#endif
 
 PSFontParam *GlobalParams::getPSFont(GString *fontName) {
   PSFontParam *p;
@@ -2215,6 +2260,7 @@
   return e;
 }
 
+#if !POPPLER_GLOBAL
 GBool GlobalParams::getPSPreload() {
   GBool preload;
 
@@ -2301,6 +2347,7 @@
   unlockGlobalParams;
   return NULL;
 }
+#endif
 
 GString *GlobalParams::getInitialZoom() {
   GString *s;
@@ -2329,6 +2376,7 @@
   return f;
 }
 
+#if !POPPLER_GLOBAL
 GBool GlobalParams::getEnableFreeType() {
   GBool f;
 
@@ -2437,6 +2485,7 @@
   unlockGlobalParams;
   return map;
 }
+#endif
 
 GList *GlobalParams::getKeyBinding(int code, int mods, int context) {
   KeyBinding *binding;
@@ -2464,6 +2513,7 @@
   return cmds;
 }
 
+#if !POPPLER_GLOBAL
 GBool GlobalParams::getPrintCommands() {
   GBool p;
 
@@ -2549,6 +2599,7 @@
 UnicodeMap *GlobalParams::getTextEncoding() {
   return getUnicodeMap2(textEncoding);
 }
+#endif
 
 //------------------------------------------------------------------------
 // functions to set parameters
@@ -2632,6 +2683,7 @@
   unlockGlobalParams;
 }
 
+#if !POPPLER_GLOBAL
 void GlobalParams::setPSExpandSmaller(GBool expand) {
   lockGlobalParams;
   psExpandSmaller = expand;
@@ -2649,6 +2701,7 @@
   psCenter = center;
   unlockGlobalParams;
 }
+#endif
 
 void GlobalParams::setPSDuplex(GBool duplex) {
   lockGlobalParams;
@@ -2656,6 +2709,7 @@
   unlockGlobalParams;
 }
 
+#if !POPPLER_GLOBAL
 void GlobalParams::setPSLevel(PSLevel level) {
   lockGlobalParams;
   psLevel = level;
@@ -2738,6 +2792,7 @@
   textKeepTinyChars = keep;
   unlockGlobalParams;
 }
+#endif
 
 void GlobalParams::setInitialZoom(char *s) {
   lockGlobalParams;
@@ -2761,6 +2816,7 @@
   return ok;
 }
 
+#if !POPPLER_GLOBAL
 GBool GlobalParams::setEnableFreeType(char *s) {
   GBool ok;
 
@@ -2908,3 +2964,4 @@
 }
 
 #endif // ENABLE_PLUGINS
+#endif
Index: xpdf-3.02/xpdf/GlobalParams.h
===================================================================
--- xpdf-3.02.orig/xpdf/GlobalParams.h	2012-02-09 14:25:22.000000000 +0100
+++ xpdf-3.02/xpdf/GlobalParams.h	2012-02-09 16:33:57.000000000 +0100
@@ -6,24 +6,20 @@
 //
 //========================================================================
 
-#ifndef GLOBALPARAMS_H
-#define GLOBALPARAMS_H
+#ifndef XPDF_GLOBALPARAMS_H
+#define XPDF_GLOBALPARAMS_H
 
-#include <aconf.h>
+// poppler and xpdf have incompatible GlobalParams implementations
+#include <poppler/GlobalParams.h>
+typedef GlobalParams poppler_GlobalParams;
+class XpdfGlobalParams;
+#define POPPLER_GLOBAL 1
+#define GlobalParams   XpdfGlobalParams
+#define globalParams   xpdf_globalParams
 
-#ifdef USE_GCC_PRAGMAS
-#pragma interface
-#endif
-
-#include <stdio.h>
-#include "gtypes.h"
-#include "CharTypes.h"
 #include "config.h"
 
-#if MULTITHREADED
-#include "GMutex.h"
-#endif
-
+#if !POPPLER_GLOBAL
 class GString;
 class GList;
 class GHash;
@@ -40,12 +36,14 @@
 #ifdef WIN32
 class WinFontList;
 #endif
+#endif
 
 //------------------------------------------------------------------------
 
 // The global parameters object.
 extern GlobalParams *globalParams;
 
+#if !POPPLER_GLOBAL
 //------------------------------------------------------------------------
 
 enum DisplayFontParamKind {
@@ -122,6 +120,7 @@
   screenClustered,
   screenStochasticClustered
 };
+#endif
 
 //------------------------------------------------------------------------
 
@@ -191,7 +190,11 @@
 
 //------------------------------------------------------------------------
 
-class GlobalParams {
+class GlobalParams
+#if POPPLER_GLOBAL
+: public poppler_GlobalParams
+#endif
+{
 public:
 
   // Initialize the global parameters by attempting to read a config
@@ -200,13 +203,16 @@
 
   ~GlobalParams();
 
+#if !POPPLER_GLOBAL
   void setBaseDir(char *dir);
+#endif
   void setupBaseFonts(char *dir);
 
   void parseLine(char *buf, GString *fileName, int line);
 
   //----- accessors
 
+#if !POPPLER_GLOBAL
   CharCode getMacRomanCharCode(char *charName);
 
   GString *getBaseDir();
@@ -215,6 +221,7 @@
   FILE *getUnicodeMapFile(GString *encodingName);
   FILE *findCMapFile(GString *collection, GString *cMapName);
   FILE *findToUnicodeFile(GString *name);
+#endif
   DisplayFontParam *getDisplayFont(GString *fontName);
   DisplayFontParam *getDisplayCIDFont(GString *fontName, GString *collection);
   GString *getPSFile();
@@ -223,16 +230,19 @@
   void getPSImageableArea(int *llx, int *lly, int *urx, int *ury);
   GBool getPSDuplex();
   GBool getPSCrop();
+#if !POPPLER_GLOBAL
   GBool getPSExpandSmaller();
   GBool getPSShrinkLarger();
   GBool getPSCenter();
   PSLevel getPSLevel();
+#endif
   PSFontParam *getPSFont(GString *fontName);
   PSFontParam *getPSFont16(GString *fontName, GString *collection, int wMode);
   GBool getPSEmbedType1();
   GBool getPSEmbedTrueType();
   GBool getPSEmbedCIDPostScript();
   GBool getPSEmbedCIDTrueType();
+#if !POPPLER_GLOBAL
   GBool getPSPreload();
   GBool getPSOPI();
   GBool getPSASCIIHex();
@@ -241,9 +251,11 @@
   GBool getTextPageBreaks();
   GBool getTextKeepTinyChars();
   GString *findFontFile(GString *fontName, char **exts);
+#endif
   GString *getInitialZoom();
   GBool getContinuousView();
   GBool getEnableT1lib();
+#if !POPPLER_GLOBAL
   GBool getEnableFreeType();
   GBool getAntialias();
   GBool getVectorAntialias();
@@ -254,8 +266,10 @@
   double getScreenGamma();
   double getScreenBlackThreshold();
   double getScreenWhiteThreshold();
+#endif
   GString *getURLCommand() { return urlCommand; }
   GString *getMovieCommand() { return movieCommand; }
+#if !POPPLER_GLOBAL
   GBool getMapNumericCharNames();
   GBool getMapUnknownCharNames();
   GList *getKeyBinding(int code, int mods, int context);
@@ -267,6 +281,9 @@
   UnicodeMap *getUnicodeMap(GString *encodingName);
   CMap *getCMap(GString *collection, GString *cMapName, Stream *stream);
   UnicodeMap *getTextEncoding();
+#else
+  GList *getKeyBinding(int code, int mods, int context);
+#endif
 
   //----- functions to set parameters
 
@@ -278,6 +295,7 @@
   void setPSImageableArea(int llx, int lly, int urx, int ury);
   void setPSDuplex(GBool duplex);
   void setPSCrop(GBool crop);
+#if !POPPLER_GLOBAL
   void setPSExpandSmaller(GBool expand);
   void setPSShrinkLarger(GBool shrink);
   void setPSCenter(GBool center);
@@ -293,9 +311,13 @@
   GBool setTextEOL(char *s);
   void setTextPageBreaks(GBool pageBreaks);
   void setTextKeepTinyChars(GBool keep);
+#else
+  void setPSFontPassthrough(GBool passthrough);
+#endif
   void setInitialZoom(char *s);
   void setContinuousView(GBool cont);
   GBool setEnableT1lib(char *s);
+#if !POPPLER_GLOBAL
   GBool setEnableFreeType(char *s);
   GBool setAntialias(char *s);
   GBool setVectorAntialias(char *s);
@@ -314,6 +336,7 @@
 
   void addSecurityHandler(XpdfSecurityHandler *handler);
   XpdfSecurityHandler *getSecurityHandler(char *name);
+#endif
 
 private:
 
@@ -348,13 +371,14 @@
 		 GList *tokens, GString *fileName, int line);
   void parseCommand(char *cmdName, GString **val,
 		    GList *tokens, GString *fileName, int line);
-  void parseYesNo(char *cmdName, GBool *flag,
-		  GList *tokens, GString *fileName, int line);
+  char *parseYesNo(char *cmdName, GBool *flag,
+		   GList *tokens, GString *fileName, int line);
   GBool parseYesNo2(char *token, GBool *flag);
-  void parseInteger(char *cmdName, int *val,
-		    GList *tokens, GString *fileName, int line);
-  void parseFloat(char *cmdName, double *val,
-		  GList *tokens, GString *fileName, int line);
+  GBool parseInteger(char *cmdName, int *val,
+		     GList *tokens, GString *fileName, int line);
+  GBool parseFloat(char *cmdName, double *val,
+		   GList *tokens, GString *fileName, int line);
+#if !POPPLER_GLOBAL
   UnicodeMap *getUnicodeMap2(GString *encodingName);
 #ifdef ENABLE_PLUGINS
   GBool loadPlugin(char *type, char *name);
@@ -382,6 +406,7 @@
   GHash *cMapDirs;		// list of CMap dirs, indexed by collection
 				//   name [GList[GString]]
   GList *toUnicodeDirs;		// list of ToUnicode CMap dirs [GString]
+#endif
   GHash *displayFonts;		// display font info, indexed by font name
 				//   [DisplayFontParam]
 #ifdef WIN32
@@ -399,11 +424,15 @@
       psImageableURX,
       psImageableURY;
   GBool psCrop;			// crop PS output to CropBox
+#if !POPPLER_GLOBAL
   GBool psExpandSmaller;	// expand smaller pages to fill paper
   GBool psShrinkLarger;		// shrink larger pages to fit paper
   GBool psCenter;		// center pages on the paper
   GBool psDuplex;		// enable duplexing in PostScript?
   PSLevel psLevel;		// PostScript level to generate
+#else
+  GBool psDuplex;		// enable duplexing in PostScript?
+#endif
   GHash *psFonts;		// PostScript font info, indexed by PDF
 				//   font name [PSFontParam]
   GList *psNamedFonts16;	// named 16-bit fonts [PSFontParam]
@@ -412,6 +441,7 @@
   GBool psEmbedTrueType;	// embed TrueType fonts?
   GBool psEmbedCIDPostScript;	// embed CID PostScript fonts?
   GBool psEmbedCIDTrueType;	// embed CID TrueType fonts?
+#if !POPPLER_GLOBAL
   GBool psPreload;		// preload PostScript images and forms into
 				//   memory
   GBool psOPI;			// generate PostScript OPI comments?
@@ -422,10 +452,12 @@
 				//   output
   GBool textPageBreaks;		// insert end-of-page markers?
   GBool textKeepTinyChars;	// keep all characters in text output
+#endif
   GList *fontDirs;		// list of font dirs [GString]
   GString *initialZoom;		// initial zoom level
   GBool continuousView;		// continuous view mode
   GBool enableT1lib;		// t1lib enable flag
+#if !POPPLER_GLOBAL
   GBool enableFreeType;		// FreeType enable flag
   GBool antialias;		// font anti-aliasing enable flag
   GBool vectorAntialias;	// vector anti-aliasing enable flag
@@ -436,11 +468,13 @@
   double screenGamma;		// screen gamma correction
   double screenBlackThreshold;	// screen black clamping threshold
   double screenWhiteThreshold;	// screen white clamping threshold
+#endif
   GString *urlCommand;		// command executed for URL links
   GString *movieCommand;	// command executed for movie annotations
   GBool mapNumericCharNames;	// map numeric char names (from font subsets)?
   GBool mapUnknownCharNames;	// map unknown char names?
   GList *keyBindings;		// key & mouse button bindings [KeyBinding]
+#if !POPPLER_GLOBAL
   GBool printCommands;		// print the drawing commands
   GBool errQuiet;		// suppress error messages?
 
@@ -454,11 +488,16 @@
   GList *securityHandlers;	// list of loaded security handlers
 				//   [XpdfSecurityHandler]
 #endif
+#endif
 
 #if MULTITHREADED
+#if !POPPLER_GLOBAL
   GMutex mutex;
   GMutex unicodeMapCacheMutex;
   GMutex cMapCacheMutex;
+#else
+  GMutex xpdf_mutex;
+#endif
 #endif
 };
 

Reply via email to