[poppler] poppler/CharCodeToUnicode.cc poppler/CharCodeToUnicode.h poppler/GlobalParams.cc poppler/GlobalParams.h poppler/GlobalParamsWin.cc

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Thu Nov 28 14:42:16 UTC 2019


 poppler/CharCodeToUnicode.cc |    2 +-
 poppler/CharCodeToUnicode.h  |    2 +-
 poppler/GlobalParams.cc      |   32 ++++++++++++++++----------------
 poppler/GlobalParams.h       |   22 +++++++++++-----------
 poppler/GlobalParamsWin.cc   |    6 +++---
 5 files changed, 32 insertions(+), 32 deletions(-)

New commits:
commit e8e577df239350fadbcc19e7a52a834d42624187
Author: Albert Astals Cid <aacid at kde.org>
Date:   Thu Nov 28 15:14:43 2019 +0100

    Some more const

diff --git a/poppler/CharCodeToUnicode.cc b/poppler/CharCodeToUnicode.cc
index 4ca57290..6b993b19 100644
--- a/poppler/CharCodeToUnicode.cc
+++ b/poppler/CharCodeToUnicode.cc
@@ -665,7 +665,7 @@ CharCodeToUnicodeCache::~CharCodeToUnicodeCache() {
   gfree(cache);
 }
 
-CharCodeToUnicode *CharCodeToUnicodeCache::getCharCodeToUnicode(GooString *tag) {
+CharCodeToUnicode *CharCodeToUnicodeCache::getCharCodeToUnicode(const GooString *tag) {
   CharCodeToUnicode *ctu;
   int i, j;
 
diff --git a/poppler/CharCodeToUnicode.h b/poppler/CharCodeToUnicode.h
index 95eeb9a8..cbab6842 100644
--- a/poppler/CharCodeToUnicode.h
+++ b/poppler/CharCodeToUnicode.h
@@ -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);
diff --git a/poppler/GlobalParams.cc b/poppler/GlobalParams.cc
index 91866d03..187a308a 100644
--- a/poppler/GlobalParams.cc
+++ b/poppler/GlobalParams.cc
@@ -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);
 }
diff --git a/poppler/GlobalParams.h b/poppler/GlobalParams.h
index 2cbe4fb5..1867fc06 100644
--- a/poppler/GlobalParams.h
+++ b/poppler/GlobalParams.h
@@ -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 at kde.org>
+// Copyright (C) 2005, 2007-2010, 2012, 2015, 2017-2019 Albert Astals Cid <aacid at kde.org>
 // Copyright (C) 2005 Jonathan Blandford <jrb at redhat.com>
 // Copyright (C) 2006 Takashi Iwai <tiwai at suse.de>
 // Copyright (C) 2006 Kristian Høgsberg <krh at 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);
diff --git a/poppler/GlobalParamsWin.cc b/poppler/GlobalParamsWin.cc
index 96c65521..57097449 100644
--- a/poppler/GlobalParamsWin.cc
+++ b/poppler/GlobalParamsWin.cc
@@ -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) {


More information about the poppler mailing list