Commit e8e577df authored by Albert Astals Cid's avatar Albert Astals Cid

Some more const

parent 72a8d1bf
......@@ -665,7 +665,7 @@ CharCodeToUnicodeCache::~CharCodeToUnicodeCache() {
gfree(cache);
}
CharCodeToUnicode *CharCodeToUnicodeCache::getCharCodeToUnicode(GooString *tag) {
CharCodeToUnicode *CharCodeToUnicodeCache::getCharCodeToUnicode(const GooString *tag) {
CharCodeToUnicode *ctu;
int i, j;
......
......@@ -132,7 +132,7 @@ public:
// Get the CharCodeToUnicode object for <tag>. Increments its
// reference count; there will be one reference for the cache plus
// one for the caller of this function. Returns NULL on failure.
CharCodeToUnicode *getCharCodeToUnicode(GooString *tag);
CharCodeToUnicode *getCharCodeToUnicode(const GooString *tag);
// Insert <ctu> into the cache, in the most-recently-used position.
void add(CharCodeToUnicode *ctu);
......
......@@ -574,7 +574,7 @@ GlobalParams::~GlobalParams() {
// accessors
//------------------------------------------------------------------------
CharCode GlobalParams::getMacRomanCharCode(char *charName) {
CharCode GlobalParams::getMacRomanCharCode(const char *charName) {
// no need to lock - macRomanReverseMap is constant
return macRomanReverseMap->lookup(charName);
}
......@@ -671,7 +671,7 @@ static bool findModifier(const char *name, const char *modifier, const char **st
}
}
static const char *getFontLang(GfxFont *font)
static const char *getFontLang(const GfxFont *font)
{
const char *lang;
......@@ -707,7 +707,7 @@ static const char *getFontLang(GfxFont *font)
return lang;
}
static FcPattern *buildFcPattern(GfxFont *font, const GooString *base14Name)
static FcPattern *buildFcPattern(const GfxFont *font, const GooString *base14Name)
{
int weight = -1,
slant = -1,
......@@ -840,17 +840,17 @@ GooString *GlobalParams::findFontFile(const GooString *fontName) {
*/
#ifdef WITH_FONTCONFIGURATION_FONTCONFIG
// not needed for fontconfig
void GlobalParams::setupBaseFonts(char *) {
void GlobalParams::setupBaseFonts(const char *) {
}
GooString *GlobalParams::findBase14FontFile(const GooString *base14Name, GfxFont *font) {
GooString *GlobalParams::findBase14FontFile(const GooString *base14Name, const GfxFont *font) {
SysFontType type;
int fontNum;
return findSystemFontFile(font, &type, &fontNum, nullptr, base14Name);
}
GooString *GlobalParams::findSystemFontFile(GfxFont *font,
GooString *GlobalParams::findSystemFontFile(const GfxFont *font,
SysFontType *type,
int *fontNum, GooString *substituteFontName, const GooString *base14Name) {
SysFontInfo *fi = nullptr;
......@@ -1016,11 +1016,11 @@ fin:
#elif WITH_FONTCONFIGURATION_WIN32
#include "GlobalParamsWin.cc"
GooString *GlobalParams::findBase14FontFile(const GooString *base14Name, GfxFont *font) {
GooString *GlobalParams::findBase14FontFile(const GooString *base14Name, const GfxFont *font) {
return findFontFile(base14Name);
}
#else
GooString *GlobalParams::findBase14FontFile(const GooString *base14Name, GfxFont *font) {
GooString *GlobalParams::findBase14FontFile(const GooString *base14Name, const GfxFont *font) {
return findFontFile(base14Name);
}
......@@ -1055,7 +1055,7 @@ static const char *displayFontDirs[] = {
nullptr
};
void GlobalParams::setupBaseFonts(char *dir) {
void GlobalParams::setupBaseFonts(const char *dir) {
GooString *fontName;
GooString *fileName;
FILE *f;
......@@ -1097,7 +1097,7 @@ void GlobalParams::setupBaseFonts(char *dir) {
}
GooString *GlobalParams::findSystemFontFile(GfxFont *font,
GooString *GlobalParams::findSystemFontFile(const GfxFont *font,
SysFontType *type,
int *fontNum, GooString * /*substituteFontName*/,
const GooString * /*base14Name*/) {
......@@ -1170,7 +1170,7 @@ bool GlobalParams::getErrQuiet() {
return errQuiet;
}
CharCodeToUnicode *GlobalParams::getCIDToUnicode(GooString *collection) {
CharCodeToUnicode *GlobalParams::getCIDToUnicode(const GooString *collection) {
CharCodeToUnicode *ctu;
globalParamsLocker();
......@@ -1201,7 +1201,7 @@ UnicodeMap *GlobalParams::getUnicodeMap2(GooString *encodingName) {
return map;
}
CMap *GlobalParams::getCMap(const GooString *collection, GooString *cMapName, Stream *stream) {
CMap *GlobalParams::getCMap(const GooString *collection, const GooString *cMapName, Stream *stream) {
cMapCacheLocker();
return cMapCache->getCMap(collection, cMapName, stream);
}
......@@ -1226,7 +1226,7 @@ std::vector<GooString*> *GlobalParams::getEncodingNames()
// functions to set parameters
//------------------------------------------------------------------------
void GlobalParams::addFontFile(GooString *fontName, GooString *path) {
void GlobalParams::addFontFile(const GooString *fontName, const GooString *path) {
globalParamsLocker();
fontFiles[fontName->toStr()] = path->toStr();
}
......@@ -1246,13 +1246,13 @@ void GlobalParams::setPSLevel(PSLevel level) {
psLevel = level;
}
void GlobalParams::setTextEncoding(char *encodingName) {
void GlobalParams::setTextEncoding(const char *encodingName) {
globalParamsLocker();
delete textEncoding;
textEncoding = new GooString(encodingName);
}
bool GlobalParams::setTextEOL(char *s) {
bool GlobalParams::setTextEOL(const char *s) {
globalParamsLocker();
if (!strcmp(s, "unix")) {
textEOL = eolUnix;
......@@ -1271,7 +1271,7 @@ void GlobalParams::setTextPageBreaks(bool pageBreaks) {
textPageBreaks = pageBreaks;
}
bool GlobalParams::setEnableFreeType(char *s) {
bool GlobalParams::setEnableFreeType(const char *s) {
globalParamsLocker();
return parseYesNo2(s, &enableFreeType);
}
......
......@@ -13,7 +13,7 @@
// All changes made under the Poppler project to this file are licensed
// under GPL version 2 or later
//
// Copyright (C) 2005, 2007-2010, 2012, 2015, 2017, 2018 Albert Astals Cid <aacid@kde.org>
// Copyright (C) 2005, 2007-2010, 2012, 2015, 2017-2019 Albert Astals Cid <aacid@kde.org>
// Copyright (C) 2005 Jonathan Blandford <jrb@redhat.com>
// Copyright (C) 2006 Takashi Iwai <tiwai@suse.de>
// Copyright (C) 2006 Kristian Høgsberg <krh@redhat.com>
......@@ -107,11 +107,11 @@ public:
GlobalParams(const GlobalParams &) = delete;
GlobalParams& operator=(const GlobalParams &) = delete;
void setupBaseFonts(char *dir);
void setupBaseFonts(const char *dir);
//----- accessors
CharCode getMacRomanCharCode(char *charName);
CharCode getMacRomanCharCode(const char *charName);
// Return Unicode values for character names. Used for general text
// extraction.
......@@ -126,8 +126,8 @@ public:
FILE *findCMapFile(const GooString *collection, const GooString *cMapName);
FILE *findToUnicodeFile(const GooString *name);
GooString *findFontFile(const GooString *fontName);
GooString *findBase14FontFile(const GooString *base14Name, GfxFont *font);
GooString *findSystemFontFile(GfxFont *font, SysFontType *type,
GooString *findBase14FontFile(const GooString *base14Name, const GfxFont *font);
GooString *findSystemFontFile(const GfxFont *font, SysFontType *type,
int *fontNum, GooString *substituteFontName = nullptr,
const GooString *base14Name = nullptr);
bool getPSExpandSmaller();
......@@ -142,22 +142,22 @@ public:
bool getProfileCommands();
bool getErrQuiet();
CharCodeToUnicode *getCIDToUnicode(GooString *collection);
CharCodeToUnicode *getCIDToUnicode(const GooString *collection);
UnicodeMap *getUnicodeMap(GooString *encodingName);
CMap *getCMap(const GooString *collection, GooString *cMapName, Stream *stream = nullptr);
CMap *getCMap(const GooString *collection, const GooString *cMapName, Stream *stream = nullptr);
UnicodeMap *getTextEncoding();
std::vector<GooString*> *getEncodingNames();
//----- functions to set parameters
void addFontFile(GooString *fontName, GooString *path);
void addFontFile(const GooString *fontName, const GooString *path);
void setPSExpandSmaller(bool expand);
void setPSShrinkLarger(bool shrink);
void setPSLevel(PSLevel level);
void setTextEncoding(char *encodingName);
bool setTextEOL(char *s);
void setTextEncoding(const char *encodingName);
bool setTextEOL(const char *s);
void setTextPageBreaks(bool pageBreaks);
bool setEnableFreeType(char *s);
bool setEnableFreeType(const char *s);
void setOverprintPreview(bool overprintPreviewA);
void setPrintCommands(bool printCommandsA);
void setProfileCommands(bool profileCommandsA);
......
......@@ -389,7 +389,7 @@ static GooString* replaceSuffix(GooString *path,
}
void GlobalParams::setupBaseFonts(char * dir)
void GlobalParams::setupBaseFonts(const char * dir)
{
const char *dataRoot = popplerDataDir ? popplerDataDir : POPPLER_DATADIR;
GooString *fileName = nullptr;
......@@ -477,7 +477,7 @@ void GlobalParams::setupBaseFonts(char * dir)
}
}
static const char *findSubstituteName(GfxFont *font, const std::unordered_map<std::string, std::string>& fontFiles,
static const char *findSubstituteName(const GfxFont *font, const std::unordered_map<std::string, std::string>& fontFiles,
const std::unordered_map<std::string, std::string>& substFiles,
const char *origName)
{
......@@ -528,7 +528,7 @@ static const char *findSubstituteName(GfxFont *font, const std::unordered_map<st
}
/* Windows implementation of external font matching code */
GooString *GlobalParams::findSystemFontFile(GfxFont *font,
GooString *GlobalParams::findSystemFontFile(const GfxFont *font,
SysFontType *type,
int *fontNum, GooString *substituteFontName,
const GooString *base14Name) {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment