tag 658264 patch thanks Michael Gilbert <michael.s.gilb...@gmail.com> writes:
> Since you're interested in > this, it would be great if you could spend some time trying to find a > solution. Ok, here is a patch, to be applied after all other debian patches. It is not nice, but IMHO should work. valgrind doesn't complain any more. An issue remains with the format string of the error() messages but that is a different, less serious bug. Regards, Wolfram. ===File fix-globalparams-clash.patch=== description: fix type clash GlobalParam xpdf vs. poppler author: Wolfram Gloger <bugzil...@malloc.de> debian-bug: http://bugs.debian.org/658264 Index: xpdf-3.03/xpdf/GlobalParams.cc =================================================================== --- xpdf-3.03.orig/xpdf/GlobalParams.cc 2012-02-08 16:42:24.000000000 +0100 +++ xpdf-3.03/xpdf/GlobalParams.cc 2012-02-08 21:26:51.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" @@ -626,20 +618,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(); @@ -662,6 +660,7 @@ unicodeMaps = new GHash(gTrue); cMapDirs = new GHash(gTrue); toUnicodeDirs = new GList(); +#endif fontFiles = new GHash(gTrue); fontDirs = new GList(); ccFontFiles = new GHash(gTrue); @@ -688,11 +687,6 @@ psImageableURX = psPaperWidth; psImageableURY = psPaperHeight; psCrop = gTrue; - psExpandSmaller = gFalse; - psShrinkLarger = gTrue; - psCenter = gTrue; - psDuplex = gFalse; - psLevel = psLevel2; psFile = NULL; psResidentFonts = new GHash(gTrue); psResidentFonts16 = new GList(); @@ -702,44 +696,27 @@ psEmbedCIDPostScript = gTrue; psEmbedCIDTrueType = gTrue; psFontPassthrough = gFalse; - psPreload = gFalse; - psOPI = gFalse; - psASCIIHex = gFalse; + psUncompressPreloadedImages = gFalse; psRasterResolution = 300; psRasterMono = gFalse; psAlwaysRasterize = gFalse; - textEncoding = new GString("Latin1"); -#if defined(WIN32) - textEOL = eolDOS; -#elif defined(MACOS) - textEOL = eolMac; -#else - textEOL = eolUnix; -#endif - textPageBreaks = gTrue; - textKeepTinyChars = gFalse; + initialZoom = new GString("125"); continuousView = gFalse; enableT1lib = gTrue; - enableFreeType = gTrue; + disableFreeTypeHinting = gFalse; - antialias = gTrue; - vectorAntialias = gTrue; + antialiasPrinting = gFalse; - strokeAdjust = gTrue; - screenType = screenUnset; - screenSize = -1; - screenDotRadius = -1; - screenGamma = 1.0; - screenBlackThreshold = 0.0; - screenWhiteThreshold = 1.0; + minLineWidth = 0.0; drawAnnotations = gTrue; overprintPreview = gFalse; launchCommand = NULL; urlCommand = NULL; movieCommand = NULL; +#if !POPPLER_GLOBAL mapNumericCharNames = gTrue; mapUnknownCharNames = gFalse; createDefaultKeyBindings(); @@ -779,6 +756,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; @@ -958,6 +938,9 @@ GString *cmd, *incFile; char *p1, *p2; FILE *f2; + GBool pBool; + int pInt; + double pDouble; // break the line into tokens tokens = new GList(); @@ -1023,12 +1006,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")) { @@ -1054,11 +1040,14 @@ parseYesNo("psFontPassthrough", &psFontPassthrough, 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("psUncompressPreloadedImages")) { parseYesNo("psUncompressPreloadedImages", &psUncompressPreloadedImages, tokens, fileName, line); @@ -1075,11 +1064,12 @@ } 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("initialZoom")) { parseInitialZoom(tokens, fileName, line); } else if (!cmd->cmp("continuousView")) { @@ -1087,36 +1077,46 @@ } 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("disableFreeTypeHinting")) { parseYesNo("disableFreeTypeHinting", &disableFreeTypeHinting, tokens, fileName, line); } 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("antialiasPrinting")) { parseYesNo("antialiasPrinting", &antialiasPrinting, tokens, fileName, line); } 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("minLineWidth")) { parseFloat("minLineWidth", &minLineWidth, tokens, fileName, line); @@ -1143,9 +1143,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(errConfig, -1, "Unknown config file command '{0:t}' ({1:t}:{2:d})", cmd, fileName, line); @@ -1166,6 +1168,8 @@ deleteGList(tokens, GString); } +#if !POPPLER_GLOBAL + void GlobalParams::parseNameToUnicode(GList *tokens, GString *fileName, int line) { GString *name; @@ -1284,6 +1288,23 @@ 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::parseFontFile(GList *tokens, GString *fileName, int line) { if (tokens->getLength() != 3) { error(errConfig, -1, "Bad 'fontFile' config file command ({0:t}:{1:d})", @@ -1375,17 +1396,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(errConfig, -1, "Bad 'psLevel' config file command ({0:t}:{1:d})", fileName, line); @@ -1467,8 +1488,7 @@ fileName, 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) { @@ -1480,13 +1500,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(errConfig, -1, "Bad 'textEOL' config file command ({0:t}:{1:d})", fileName, line); } @@ -1514,11 +1528,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(errConfig, -1, "Bad 'screenType' config file command ({0:t}:{1:d})", fileName, line); @@ -1732,20 +1746,22 @@ *val = ((GString *)tokens->get(1))->copy(); } -void GlobalParams::parseYesNo(const char *cmdName, GBool *flag, +char *GlobalParams::parseYesNo(const char *cmdName, GBool *flag, GList *tokens, GString *fileName, int line) { GString *tok; if (tokens->getLength() != 2) { error(errConfig, -1, "Bad '{0:s}' config file command ({1:t}:{2:d})", cmdName, fileName, line); - return; + return NULL; } tok = (GString *)tokens->get(1); if (!parseYesNo2(tok->getCString(), flag)) { error(errConfig, -1, "Bad '{0:s}' config file command ({1:t}:{2:d})", cmdName, fileName, line); + return NULL; } + return tok->getCString(); } GBool GlobalParams::parseYesNo2(char *token, GBool *flag) { @@ -1759,7 +1775,7 @@ return gTrue; } -void GlobalParams::parseInteger(const char *cmdName, int *val, +GBool GlobalParams::parseInteger(const char *cmdName, int *val, GList *tokens, GString *fileName, int line) { GString *tok; int i; @@ -1767,13 +1783,13 @@ if (tokens->getLength() != 2) { error(errConfig, -1, "Bad '{0:s}' config file command ({1:t}:{2:d})", cmdName, fileName, line); - return; + return gFalse; } tok = (GString *)tokens->get(1); if (tok->getLength() == 0) { error(errConfig, -1, "Bad '{0:s}' config file command ({1:t}:{2:d})", cmdName, fileName, line); - return; + return gFalse; } if (tok->getChar(0) == '-') { i = 1; @@ -1784,13 +1800,14 @@ if (tok->getChar(i) < '0' || tok->getChar(i) > '9') { error(errConfig, -1, "Bad '{0:s}' config file command ({1:t}:{2:d})", cmdName, fileName, line); - return; + return gFalse; } } *val = atoi(tok->getCString()); + return gTrue; } -void GlobalParams::parseFloat(const char *cmdName, double *val, +GBool GlobalParams::parseFloat(const char *cmdName, double *val, GList *tokens, GString *fileName, int line) { GString *tok; int i; @@ -1798,13 +1815,13 @@ if (tokens->getLength() != 2) { error(errConfig, -1, "Bad '{0:s}' config file command ({1:t}:{2:d})", cmdName, fileName, line); - return; + return gFalse; } tok = (GString *)tokens->get(1); if (tok->getLength() == 0) { error(errConfig, -1, "Bad '{0:s}' config file command ({1:t}:{2:d})", cmdName, fileName, line); - return; + return gFalse; } if (tok->getChar(0) == '-') { i = 1; @@ -1816,13 +1833,15 @@ tok->getChar(i) == '.')) { error(errConfig, -1, "Bad '{0:s}' config file command ({1:t}:{2:d})", cmdName, fileName, line); - return; + return gFalse; } } *val = atof(tok->getCString()); + return gTrue; } GlobalParams::~GlobalParams() { +#if !POPPLER_GLOBAL GHashIter *iter; GString *key; GList *list; @@ -1839,6 +1858,11 @@ deleteGHash(unicodeMaps, GString); deleteGList(toUnicodeDirs, GString); deleteGHash(fontFiles, GString); +#else + freeBuiltinFontTables(); + + deleteGHash(fontFiles, GString); +#endif deleteGList(fontDirs, GString); deleteGHash(ccFontFiles, GString); delete sysFonts; @@ -1848,7 +1872,7 @@ deleteGHash(psResidentFonts, GString); deleteGList(psResidentFonts16, PSFontParam16); deleteGList(psResidentFontsCC, PSFontParam16); - delete textEncoding; + delete initialZoom; if (launchCommand) { delete launchCommand; @@ -1861,6 +1885,7 @@ } deleteGList(keyBindings, KeyBinding); +#if !POPPLER_GLOBAL cMapDirs->startIter(&iter); while (cMapDirs->getNext(&iter, &key, (void **)&list)) { deleteGList(list, GString); @@ -1876,21 +1901,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; @@ -1994,6 +2013,7 @@ // accessors //------------------------------------------------------------------------ +#if !POPPLER_GLOBAL CharCode GlobalParams::getMacRomanCharCode(char *charName) { // no need to lock - macRomanReverseMap is constant return macRomanReverseMap->lookup(charName); @@ -2124,6 +2144,7 @@ unlockGlobalParams; return NULL; } +#endif GString *GlobalParams::findSystemFontFile(GString *fontName, SysFontType *type, @@ -2198,6 +2219,7 @@ return f; } +#if !POPPLER_GLOBAL GBool GlobalParams::getPSExpandSmaller() { GBool f; @@ -2224,6 +2246,7 @@ unlockGlobalParams; return f; } +#endif GBool GlobalParams::getPSDuplex() { GBool d; @@ -2234,15 +2257,6 @@ return d; } -PSLevel GlobalParams::getPSLevel() { - PSLevel level; - - lockGlobalParams; - level = psLevel; - unlockGlobalParams; - return level; -} - GString *GlobalParams::getPSResidentFont(GString *fontName) { GString *psName; @@ -2349,6 +2363,7 @@ return e; } +#if !POPPLER_GLOBAL GBool GlobalParams::getPSPreload() { GBool preload; @@ -2375,6 +2390,7 @@ unlockGlobalParams; return ah; } +#endif GBool GlobalParams::getPSUncompressPreloadedImages() { GBool ah; @@ -2412,6 +2428,7 @@ return rast; } +#if !POPPLER_GLOBAL GString *GlobalParams::getTextEncodingName() { GString *s; @@ -2447,6 +2464,7 @@ unlockGlobalParams; return tiny; } +#endif GString *GlobalParams::getInitialZoom() { GString *s; @@ -2475,15 +2493,6 @@ return f; } -GBool GlobalParams::getEnableFreeType() { - GBool f; - - lockGlobalParams; - f = enableFreeType; - unlockGlobalParams; - return f; -} - GBool GlobalParams::getDisableFreeTypeHinting() { GBool f; @@ -2493,7 +2502,7 @@ return f; } - +#if !POPPLER_GLOBAL GBool GlobalParams::getAntialias() { GBool f; @@ -2511,6 +2520,7 @@ unlockGlobalParams; return f; } +#endif GBool GlobalParams::getAntialiasPrinting() { GBool f; @@ -2521,6 +2531,7 @@ return f; } +#if !POPPLER_GLOBAL GBool GlobalParams::getStrokeAdjust() { GBool f; @@ -2583,6 +2594,7 @@ unlockGlobalParams; return thresh; } +#endif double GlobalParams::getMinLineWidth() { double w; @@ -2602,6 +2614,7 @@ return draw; } +#if !POPPLER_GLOBAL GBool GlobalParams::getMapNumericCharNames() { GBool map; @@ -2619,6 +2632,7 @@ unlockGlobalParams; return map; } +#endif GList *GlobalParams::getKeyBinding(int code, int mods, int context) { KeyBinding *binding; @@ -2646,6 +2660,7 @@ return cmds; } +#if !POPPLER_GLOBAL GBool GlobalParams::getPrintCommands() { GBool p; @@ -2731,6 +2746,7 @@ UnicodeMap *GlobalParams::getTextEncoding() { return getUnicodeMap2(textEncoding); } +#endif //------------------------------------------------------------------------ // functions to set parameters @@ -2809,6 +2825,7 @@ unlockGlobalParams; } +#if !POPPLER_GLOBAL void GlobalParams::setPSExpandSmaller(GBool expand) { lockGlobalParams; psExpandSmaller = expand; @@ -2826,6 +2843,7 @@ psCenter = center; unlockGlobalParams; } +#endif void GlobalParams::setPSDuplex(GBool duplex) { lockGlobalParams; @@ -2833,6 +2851,7 @@ unlockGlobalParams; } +#if !POPPLER_GLOBAL void GlobalParams::setPSLevel(PSLevel level) { lockGlobalParams; psLevel = level; @@ -2862,6 +2881,7 @@ psEmbedCIDTrueType = embed; unlockGlobalParams; } +#endif void GlobalParams::setPSFontPassthrough(GBool passthrough) { lockGlobalParams; @@ -2869,6 +2889,7 @@ unlockGlobalParams; } +#if !POPPLER_GLOBAL void GlobalParams::setPSPreload(GBool preload) { lockGlobalParams; psPreload = preload; @@ -2921,6 +2942,7 @@ textKeepTinyChars = keep; unlockGlobalParams; } +#endif void GlobalParams::setInitialZoom(char *s) { lockGlobalParams; @@ -2944,6 +2966,7 @@ return ok; } +#if !POPPLER_GLOBAL GBool GlobalParams::setEnableFreeType(char *s) { GBool ok; @@ -3091,3 +3114,4 @@ } #endif // ENABLE_PLUGINS +#endif Index: xpdf-3.03/xpdf/GlobalParams.h =================================================================== --- xpdf-3.03.orig/xpdf/GlobalParams.h 2012-02-08 16:42:24.000000000 +0100 +++ xpdf-3.03/xpdf/GlobalParams.h 2012-02-08 21:28:37.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; @@ -36,8 +32,9 @@ class CMapCache; struct XpdfSecurityHandler; class GlobalParams; -class SysFontList; class Stream; +#endif +class SysFontList; extern FILE *openFile(const char *path, const char *mode); @@ -73,6 +70,7 @@ //------------------------------------------------------------------------ +#if !POPPLER_GLOBAL enum PSLevel { psLevel1, psLevel1Sep, @@ -98,6 +96,7 @@ screenClustered, screenStochasticClustered }; +#endif //------------------------------------------------------------------------ @@ -172,7 +171,11 @@ //------------------------------------------------------------------------ -class GlobalParams { +class GlobalParams +#if POPPLER_GLOBAL +: public poppler_GlobalParams +#endif +{ public: // Initialize the global parameters by attempting to read a config @@ -181,13 +184,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(); @@ -197,6 +203,7 @@ FILE *findCMapFile(GString *collection, GString *cMapName); FILE *findToUnicodeFile(GString *name); GString *findFontFile(GString *fontName, char **throwaway); +#endif GString *findSystemFontFile(GString *fontName, SysFontType *type, int *fontNum); GString *findCCFontFile(GString *collection); @@ -206,10 +213,12 @@ 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 GString *getPSResidentFont(GString *fontName); GList *getPSResidentFonts(); PSFontParam16 *getPSResidentFont16(GString *fontName, int wMode); @@ -219,20 +228,25 @@ GBool getPSEmbedCIDPostScript(); GBool getPSEmbedCIDTrueType(); GBool getPSFontPassthrough(); +#if !POPPLER_GLOBAL GBool getPSPreload(); GBool getPSOPI(); GBool getPSASCIIHex(); +#endif GBool getPSUncompressPreloadedImages(); double getPSRasterResolution(); GBool getPSRasterMono(); GBool getPSAlwaysRasterize(); +#if !POPPLER_GLOBAL GString *getTextEncodingName(); EndOfLineKind getTextEOL(); GBool getTextPageBreaks(); GBool getTextKeepTinyChars(); +#endif GString *getInitialZoom(); GBool getContinuousView(); GBool getEnableT1lib(); +#if !POPPLER_GLOBAL GBool getEnableFreeType(); GBool getDisableFreeTypeHinting(); GBool getAntialias(); @@ -245,12 +259,17 @@ double getScreenGamma(); double getScreenBlackThreshold(); double getScreenWhiteThreshold(); +#else + GBool getDisableFreeTypeHinting(); + GBool getAntialiasPrinting(); +#endif double getMinLineWidth(); GBool getDrawAnnotations(); GBool getOverprintPreview() { return overprintPreview; } GString *getLaunchCommand() { return launchCommand; } GString *getURLCommand() { return urlCommand; } GString *getMovieCommand() { return movieCommand; } +#if !POPPLER_GLOBAL GBool getMapNumericCharNames(); GBool getMapUnknownCharNames(); GList *getKeyBinding(int code, int mods, int context); @@ -262,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 @@ -273,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); @@ -289,9 +312,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); @@ -310,6 +337,7 @@ void addSecurityHandler(XpdfSecurityHandler *handler); XpdfSecurityHandler *getSecurityHandler(char *name); +#endif private: @@ -344,13 +372,14 @@ GList *tokens, GString *fileName, int line); void parseCommand(const char *cmdName, GString **val, GList *tokens, GString *fileName, int line); - void parseYesNo(const char *cmdName, GBool *flag, - GList *tokens, GString *fileName, int line); + char *parseYesNo(const char *cmdName, GBool *flag, + GList *tokens, GString *fileName, int line); GBool parseYesNo2(char *token, GBool *flag); - void parseInteger(const char *cmdName, int *val, - GList *tokens, GString *fileName, int line); - void parseFloat(const char *cmdName, double *val, - GList *tokens, GString *fileName, int line); + GBool parseInteger(const char *cmdName, int *val, + GList *tokens, GString *fileName, int line); + GBool parseFloat(const 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); @@ -378,6 +407,7 @@ GHash *cMapDirs; // list of CMap dirs, indexed by collection // name [GList[GString]] GList *toUnicodeDirs; // list of ToUnicode CMap dirs [GString] +#endif GHash *fontFiles; // font files: font name mapped to path // [GString] GList *fontDirs; // list of font dirs [GString] @@ -392,11 +422,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 *psResidentFonts; // 8-bit fonts resident in printer: // PDF font name mapped to PS font name // [GString] @@ -411,25 +445,30 @@ GBool psEmbedCIDPostScript; // embed CID PostScript fonts? GBool psEmbedCIDTrueType; // embed CID TrueType fonts? GBool psFontPassthrough; // pass all fonts through as-is? +#if !POPPLER_GLOBAL GBool psPreload; // preload PostScript images and forms into // memory GBool psOPI; // generate PostScript OPI comments? GBool psASCIIHex; // use ASCIIHex instead of ASCII85? +#endif GBool psUncompressPreloadedImages; // uncompress all preloaded images double psRasterResolution; // PostScript rasterization resolution (dpi) GBool psRasterMono; // true to do PostScript rasterization // in monochrome (gray); false to do it // in color (RGB/CMYK) GBool psAlwaysRasterize; // force PostScript rasterization +#if !POPPLER_GLOBAL GString *textEncoding; // encoding (unicodeMap) to use for text // output EndOfLineKind textEOL; // type of EOL marker to use for text // output GBool textPageBreaks; // insert end-of-page markers? GBool textKeepTinyChars; // keep all characters in text output +#endif GString *initialZoom; // initial zoom level GBool continuousView; // continuous view mode GBool enableT1lib; // t1lib enable flag +#if !POPPLER_GLOBAL GBool enableFreeType; // FreeType enable flag GBool disableFreeTypeHinting; // FreeType hinting disable flag GBool antialias; // font anti-aliasing enable flag @@ -442,6 +481,10 @@ double screenGamma; // screen gamma correction double screenBlackThreshold; // screen black clamping threshold double screenWhiteThreshold; // screen white clamping threshold +#else + GBool disableFreeTypeHinting; // FreeType hinting disable flag + GBool antialiasPrinting; // allow anti-aliasing when printing +#endif double minLineWidth; // minimum line width GBool drawAnnotations; // draw annotations or not GBool overprintPreview; // enable overprint preview @@ -451,6 +494,7 @@ 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? @@ -464,11 +508,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 }; ============================================================ -- To UNSUBSCRIBE, email to debian-bugs-dist-requ...@lists.debian.org with a subject of "unsubscribe". Trouble? Contact listmas...@lists.debian.org