[poppler] 5 commits - fofi/FoFiTrueType.cc fofi/FoFiTrueType.h fofi/FoFiType1.cc fofi/FoFiType1C.cc fofi/FoFiType1C.h fofi/FoFiType1.h poppler/CairoFontEngine.cc poppler/CMap.cc poppler/CMap.h poppler/Decrypt.cc poppler/Decrypt.h poppler/Gfx.cc poppler/GfxFont.cc poppler/GfxFont.h poppler/GlobalParams.cc poppler/GlobalParams.h poppler/GlobalParamsWin.cc poppler/Object.h poppler/PDFDoc.cc poppler/PDFDoc.h poppler/PSOutputDev.cc poppler/SplashOutputDev.cc poppler/TextOutputDev.cc utils/HtmlOutputDev.cc

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Sun Sep 23 16:44:24 UTC 2018


 fofi/FoFiTrueType.cc       |   50 ++++++++++++++++++++++-----------------------
 fofi/FoFiTrueType.h        |   50 ++++++++++++++++++++++-----------------------
 fofi/FoFiType1.cc          |   10 ++++-----
 fofi/FoFiType1.h           |   10 ++++-----
 fofi/FoFiType1C.cc         |   22 +++++++++----------
 fofi/FoFiType1C.h          |   18 ++++++++--------
 poppler/CMap.cc            |   16 +++++++-------
 poppler/CMap.h             |   16 +++++++-------
 poppler/CairoFontEngine.cc |    7 ++----
 poppler/Decrypt.cc         |   26 +++++++++++------------
 poppler/Decrypt.h          |   24 ++++++++++-----------
 poppler/Gfx.cc             |    2 -
 poppler/GfxFont.cc         |    2 -
 poppler/GfxFont.h          |   46 ++++++++++++++++++++---------------------
 poppler/GlobalParams.cc    |   22 +++++++++----------
 poppler/GlobalParams.h     |   18 ++++++++--------
 poppler/GlobalParamsWin.cc |    2 -
 poppler/Object.h           |    8 +++----
 poppler/PDFDoc.cc          |    8 +++----
 poppler/PDFDoc.h           |    4 +--
 poppler/PSOutputDev.cc     |    2 -
 poppler/SplashOutputDev.cc |    4 +--
 poppler/TextOutputDev.cc   |    6 ++---
 utils/HtmlOutputDev.cc     |    5 +---
 24 files changed, 188 insertions(+), 190 deletions(-)

New commits:
commit 1b8a163fe13ddc6734e1c0cbf719947a83c86613
Author: Albert Astals Cid <aacid at kde.org>
Date:   Sun Sep 23 14:03:35 2018 +0200

    More const

diff --git a/fofi/FoFiTrueType.cc b/fofi/FoFiTrueType.cc
index 459fa0cb..759ade2d 100644
--- a/fofi/FoFiTrueType.cc
+++ b/fofi/FoFiTrueType.cc
@@ -888,7 +888,7 @@ void FoFiTrueType::cvtCharStrings(char **encoding,
 				  int *codeToGID,
 				  FoFiOutputFunc outputFunc,
 				  void *outputStream) const {
-  char *name;
+  const char *name;
   GooString *buf;
   char buf2[16];
   int i, k;
diff --git a/poppler/CMap.cc b/poppler/CMap.cc
index f38b3c73..9af6e241 100644
--- a/poppler/CMap.cc
+++ b/poppler/CMap.cc
@@ -64,7 +64,7 @@ static int getCharFromStream(void *data) {
 
 //------------------------------------------------------------------------
 
-CMap *CMap::parse(CMapCache *cache, GooString *collectionA, Object *obj) {
+CMap *CMap::parse(CMapCache *cache, const GooString *collectionA, Object *obj) {
   CMap *cMap;
   GooString *cMapNameA;
 
@@ -87,8 +87,8 @@ CMap *CMap::parse(CMapCache *cache, GooString *collectionA, Object *obj) {
   return cMap;
 }
 
-CMap *CMap::parse(CMapCache *cache, GooString *collectionA,
-		  GooString *cMapNameA) {
+CMap *CMap::parse(CMapCache *cache, const GooString *collectionA,
+		  const GooString *cMapNameA) {
   FILE *f;
   CMap *cMap;
 
@@ -116,7 +116,7 @@ CMap *CMap::parse(CMapCache *cache, GooString *collectionA,
   return cMap;
 }
 
-CMap *CMap::parse(CMapCache *cache, GooString *collectionA, Stream *str) {
+CMap *CMap::parse(CMapCache *cache, const GooString *collectionA, Stream *str) {
   CMap *cMap = new CMap(collectionA->copy(), nullptr);
   Object obj1 = str->getDict()->lookup("UseCMap");
   if (!obj1.isNull()) {
@@ -129,8 +129,8 @@ CMap *CMap::parse(CMapCache *cache, GooString *collectionA, Stream *str) {
   return cMap;
 }
 
-CMap *CMap::parse(CMapCache *cache, GooString *collectionA,
-		  GooString *cMapNameA, Stream *stream) {
+CMap *CMap::parse(CMapCache *cache, const GooString *collectionA,
+		  const GooString *cMapNameA, Stream *stream) {
   FILE *f = nullptr;
   CMap *cmap;
   PSTokenizer *pst;
@@ -450,7 +450,7 @@ void CMap::decRefCnt() {
   }
 }
 
-GBool CMap::match(GooString *collectionA, GooString *cMapNameA) {
+GBool CMap::match(const GooString *collectionA, const GooString *cMapNameA) {
   return !collection->cmp(collectionA) && !cMapName->cmp(cMapNameA);
 }
 
@@ -537,7 +537,7 @@ CMapCache::~CMapCache() {
   }
 }
 
-CMap *CMapCache::getCMap(GooString *collection, GooString *cMapName, Stream *stream) {
+CMap *CMapCache::getCMap(const GooString *collection, const GooString *cMapName, Stream *stream) {
   CMap *cmap;
   int i, j;
 
diff --git a/poppler/CMap.h b/poppler/CMap.h
index f2f09c99..75c6955b 100644
--- a/poppler/CMap.h
+++ b/poppler/CMap.h
@@ -48,24 +48,24 @@ public:
 
   // Parse a CMap from <obj>, which can be a name or a stream.  Sets
   // the initial reference count to 1.  Returns NULL on failure.
-  static CMap *parse(CMapCache *cache, GooString *collectionA, Object *obj);
+  static CMap *parse(CMapCache *cache, const GooString *collectionA, Object *obj);
 
   // Create the CMap specified by <collection> and <cMapName>.  Sets
   // the initial reference count to 1.  Returns NULL on failure.
-  static CMap *parse(CMapCache *cache, GooString *collectionA,
-		     GooString *cMapNameA);
+  static CMap *parse(CMapCache *cache, const GooString *collectionA,
+		     const GooString *cMapNameA);
 
   // Parse a CMap from <str>.  Sets the initial reference count to 1.
   // Returns NULL on failure.
-  static CMap *parse(CMapCache *cache, GooString *collectionA, Stream *str);
+  static CMap *parse(CMapCache *cache, const GooString *collectionA, Stream *str);
 
   // Create the CMap specified by <collection> and <cMapName>.  Sets
   // the initial reference count to 1.
   // Stream is a stream containing the CMap, can be NULL and 
   // this means the CMap will be searched in the CMap files
   // Returns NULL on failure.
-  static CMap *parse(CMapCache *cache, GooString *collectionA,
-		     GooString *cMapNameA, Stream *stream);
+  static CMap *parse(CMapCache *cache, const GooString *collectionA,
+		     const GooString *cMapNameA, Stream *stream);
 
   ~CMap();
 
@@ -82,7 +82,7 @@ public:
 
   // Return true if this CMap matches the specified <collectionA>, and
   // <cMapNameA>.
-  GBool match(GooString *collectionA, GooString *cMapNameA);
+  GBool match(const GooString *collectionA, const GooString *cMapNameA);
 
   // Return the CID corresponding to the character code starting at
   // <s>, which contains <len> bytes.  Sets *<c> to the char code, and
@@ -136,7 +136,7 @@ public:
   // Stream is a stream containing the CMap, can be NULL and 
   // this means the CMap will be searched in the CMap files
   // Returns NULL on failure.
-  CMap *getCMap(GooString *collection, GooString *cMapName, Stream *stream);
+  CMap *getCMap(const GooString *collection, const GooString *cMapName, Stream *stream);
 
 private:
 
diff --git a/poppler/CairoFontEngine.cc b/poppler/CairoFontEngine.cc
index 265e0dda..56ea9471 100644
--- a/poppler/CairoFontEngine.cc
+++ b/poppler/CairoFontEngine.cc
@@ -109,7 +109,7 @@ CairoFont::getSubstitutionCorrection(GfxFont *gfxFont)
 {
   double w1, w2, w3;
   CharCode code;
-  char *name;
+  const char *name;
 
   // for substituted fonts: adjust the font matrix -- compare the
   // width of 'm' in the original font and the substituted font
@@ -630,13 +630,12 @@ _init_type3_glyph (cairo_scaled_font_t  *scaled_font,
 {
   type3_font_info_t *info;
   GfxFont *font;
-  double *mat;
 
   info = (type3_font_info_t *)
     cairo_font_face_get_user_data (cairo_scaled_font_get_font_face (scaled_font),
 				   &type3_font_key);
   font = info->font;
-  mat = font->getFontBBox();
+  const double *mat = font->getFontBBox();
   extents->ascent = mat[3]; /* y2 */
   extents->descent = -mat[3]; /* -y1 */
   extents->height = extents->ascent + extents->descent;
@@ -656,7 +655,7 @@ _render_type3_glyph (cairo_scaled_font_t  *scaled_font,
   Object charProc;
   CairoOutputDev *output_dev;
   cairo_matrix_t matrix, invert_y_axis;
-  double *mat;
+  const double *mat;
   double wx, wy;
   PDFRectangle box;
   type3_font_info_t *info;
diff --git a/poppler/Decrypt.cc b/poppler/Decrypt.cc
index ddec68dd..12382bf8 100644
--- a/poppler/Decrypt.cc
+++ b/poppler/Decrypt.cc
@@ -57,7 +57,7 @@ static void sha256(Guchar *msg, int msgLen, Guchar *hash);
 static void sha384(Guchar *msg, int msgLen, Guchar *hash);
 static void sha512(Guchar *msg, int msgLen, Guchar *hash);
 
-static void revision6Hash(GooString *inputPassword, Guchar *K, const char *userKey);
+static void revision6Hash(const GooString *inputPassword, Guchar *K, const char *userKey);
 
 static const Guchar passwordPad[32] = {
   0x28, 0xbf, 0x4e, 0x5e, 0x4e, 0x75, 0x8a, 0x41,
@@ -71,10 +71,10 @@ static const Guchar passwordPad[32] = {
 //------------------------------------------------------------------------
 
 GBool Decrypt::makeFileKey(int encVersion, int encRevision, int keyLength,
-			   GooString *ownerKey, GooString *userKey,
-			   GooString *ownerEnc, GooString *userEnc,
-			   int permissions, GooString *fileID,
-			   GooString *ownerPassword, GooString *userPassword,
+			   const GooString *ownerKey, const GooString *userKey,
+			   const GooString *ownerEnc, const GooString *userEnc,
+			   int permissions, const GooString *fileID,
+			   const GooString *ownerPassword, const GooString *userPassword,
 			   Guchar *fileKey, GBool encryptMetadata,
 			   GBool *ownerPasswordOk) {
   DecryptAES256State state;
@@ -226,9 +226,9 @@ GBool Decrypt::makeFileKey(int encVersion, int encRevision, int keyLength,
 }
 
 GBool Decrypt::makeFileKey2(int encVersion, int encRevision, int keyLength,
-			    GooString *ownerKey, GooString *userKey,
-			    int permissions, GooString *fileID,
-			    GooString *userPassword, Guchar *fileKey,
+			    const GooString *ownerKey, const GooString *userKey,
+			    int permissions, const GooString *fileID,
+			    const GooString *userPassword, Guchar *fileKey,
 			    GBool encryptMetadata) {
   Guchar *buf;
   Guchar test[32];
@@ -307,7 +307,7 @@ GBool Decrypt::makeFileKey2(int encVersion, int encRevision, int keyLength,
 // BaseCryptStream
 //------------------------------------------------------------------------
 
-BaseCryptStream::BaseCryptStream(Stream *strA, Guchar *fileKey, CryptAlgorithm algoA,
+BaseCryptStream::BaseCryptStream(Stream *strA, const Guchar *fileKey, CryptAlgorithm algoA,
 				 int keyLength, int objNum, int objGen):
   FilterStream(strA)
 {
@@ -399,7 +399,7 @@ void BaseCryptStream::setAutoDelete(GBool val) {
 // EncryptStream
 //------------------------------------------------------------------------
 
-EncryptStream::EncryptStream(Stream *strA, Guchar *fileKey, CryptAlgorithm algoA,
+EncryptStream::EncryptStream(Stream *strA, const Guchar *fileKey, CryptAlgorithm algoA,
 			     int keyLength, int objNum, int objGen):
   BaseCryptStream(strA, fileKey, algoA, keyLength, objNum, objGen)
 {
@@ -491,7 +491,7 @@ int EncryptStream::lookChar() {
 // DecryptStream
 //------------------------------------------------------------------------
 
-DecryptStream::DecryptStream(Stream *strA, Guchar *fileKey, CryptAlgorithm algoA,
+DecryptStream::DecryptStream(Stream *strA, const Guchar *fileKey, CryptAlgorithm algoA,
 			     int keyLength, int objNum, int objGen):
   BaseCryptStream(strA, fileKey, algoA, keyLength, objNum, objGen)
 {
@@ -1151,7 +1151,7 @@ static inline Gulong md5Round4(Gulong a, Gulong b, Gulong c, Gulong d,
   return b + rotateLeft((a + (c ^ (b | ~d)) + Xk + Ti), s);
 }
 
-void md5(Guchar *msg, int msgLen, Guchar *digest) {
+void md5(const Guchar *msg, int msgLen, Guchar *digest) {
   Gulong x[16] = {};
   Gulong a, b, c, d, aa, bb, cc, dd;
   int n64;
@@ -1702,7 +1702,7 @@ static void sha384(Guchar *msg, int msgLen, Guchar *hash) {
 // Section 7.6.3.3 (Encryption Key algorithm) of ISO/DIS 32000-2
 // Algorithm 2.B:Computing a hash (for revision 6).
 //------------------------------------------------------------------------
-static void revision6Hash(GooString *inputPassword, Guchar *K, const char *userKey) {
+static void revision6Hash(const GooString *inputPassword, Guchar *K, const char *userKey) {
   Guchar K1[64*(127+64+48)];
   Guchar  E[64*(127+64+48)];
   DecryptAESState state;
diff --git a/poppler/Decrypt.h b/poppler/Decrypt.h
index 61b0b453..936e6b31 100644
--- a/poppler/Decrypt.h
+++ b/poppler/Decrypt.h
@@ -17,7 +17,7 @@
 // Copyright (C) 2009 David Benjamin <davidben at mit.edu>
 // Copyright (C) 2012 Fabio D'Urso <fabiodurso at hotmail.it>
 // Copyright (C) 2013 Adrian Johnson <ajohnson at redneon.com>
-// Copyright (C) 2013 Albert Astals Cid <aacid at kde.org>
+// Copyright (C) 2013, 2018 Albert Astals Cid <aacid at kde.org>
 // Copyright (C) 2013 Thomas Freitag <Thomas.Freitag at alfa.de>
 //
 // To see a description of the changes please see the Changelog file that
@@ -50,19 +50,19 @@ public:
   // the owner password was correct.  Either or both of the passwords
   // may be NULL, which is treated as an empty string.
   static GBool makeFileKey(int encVersion, int encRevision, int keyLength,
-			   GooString *ownerKey, GooString *userKey,
-			   GooString *ownerEnc, GooString *userEnc,
-			   int permissions, GooString *fileID,
-			   GooString *ownerPassword, GooString *userPassword,
+			   const GooString *ownerKey, const GooString *userKey,
+			   const GooString *ownerEnc, const GooString *userEnc,
+			   int permissions, const GooString *fileID,
+			   const GooString *ownerPassword, const GooString *userPassword,
 			   Guchar *fileKey, GBool encryptMetadata,
 			   GBool *ownerPasswordOk);
 
 private:
 
   static GBool makeFileKey2(int encVersion, int encRevision, int keyLength,
-			    GooString *ownerKey, GooString *userKey,
-			    int permissions, GooString *fileID,
-			    GooString *userPassword, Guchar *fileKey,
+			    const GooString *ownerKey, const GooString *userKey,
+			    int permissions, const GooString *fileID,
+			    const GooString *userPassword, Guchar *fileKey,
 			    GBool encryptMetadata);
 };
 
@@ -103,7 +103,7 @@ struct DecryptAES256State {
 class BaseCryptStream : public FilterStream {
 public:
 
-  BaseCryptStream(Stream *strA, Guchar *fileKey, CryptAlgorithm algoA,
+  BaseCryptStream(Stream *strA, const Guchar *fileKey, CryptAlgorithm algoA,
                   int keyLength, int objNum, int objGen);
   ~BaseCryptStream();
   StreamKind getKind() override { return strCrypt; }
@@ -137,7 +137,7 @@ protected:
 class EncryptStream : public BaseCryptStream {
 public:
 
-  EncryptStream(Stream *strA, Guchar *fileKey, CryptAlgorithm algoA,
+  EncryptStream(Stream *strA, const Guchar *fileKey, CryptAlgorithm algoA,
                 int keyLength, int objNum, int objGen);
   ~EncryptStream();
   void reset() override;
@@ -147,7 +147,7 @@ public:
 class DecryptStream : public BaseCryptStream {
 public:
 
-  DecryptStream(Stream *strA, Guchar *fileKey, CryptAlgorithm algoA,
+  DecryptStream(Stream *strA, const Guchar *fileKey, CryptAlgorithm algoA,
                 int keyLength, int objNum, int objGen);
   ~DecryptStream();
   void reset() override;
@@ -156,6 +156,6 @@ public:
  
 //------------------------------------------------------------------------
 
-extern void md5(Guchar *msg, int msgLen, Guchar *digest);
+extern void md5(const Guchar *msg, int msgLen, Guchar *digest);
 
 #endif
diff --git a/poppler/Gfx.cc b/poppler/Gfx.cc
index f64606ad..1c6a5de7 100644
--- a/poppler/Gfx.cc
+++ b/poppler/Gfx.cc
@@ -3885,7 +3885,7 @@ void Gfx::doShowText(const GooString *s) {
   double originX, originY, tOriginX, tOriginY;
   double x0, y0, x1, y1;
   double tmp[4], newCTM[6];
-  double *oldCTM, *mat;
+  const double *oldCTM, *mat;
   Dict *resDict;
   Parser *oldParser;
   GfxState *savedState;
diff --git a/poppler/GfxFont.cc b/poppler/GfxFont.cc
index b135d059..1ede4421 100644
--- a/poppler/GfxFont.cc
+++ b/poppler/GfxFont.cc
@@ -2087,7 +2087,7 @@ const CharCodeToUnicode *GfxCIDFont::getToUnicode() const {
   return ctu;
 }
 
-GooString *GfxCIDFont::getCollection() {
+const GooString *GfxCIDFont::getCollection() const {
   return cMap ? cMap->getCollection() : nullptr;
 }
 
diff --git a/poppler/GfxFont.h b/poppler/GfxFont.h
index 1ae0608b..7823046c 100644
--- a/poppler/GfxFont.h
+++ b/poppler/GfxFont.h
@@ -184,7 +184,7 @@ public:
   GfxFont(const GfxFont &) = delete;
   GfxFont& operator=(const GfxFont &other) = delete;
 
-  GBool isOk() { return ok; }
+  GBool isOk() const { return ok; }
 
   void incRefCnt();
   void decRefCnt();
@@ -199,7 +199,7 @@ public:
   GBool matches(const char *tagA) const { return !tag->cmp(tagA); }
 
   // Get font family name.
-  GooString *getFamily() { return family; }
+  GooString *getFamily() const { return family; }
   
   // Get font stretch.
   Stretch getStretch() const { return stretch; }
@@ -217,7 +217,7 @@ public:
 
   // Get embedded font ID, i.e., a ref for the font file stream.
   // Returns false if there is no embedded font.
-  GBool getEmbeddedFontID(Ref *embID)
+  GBool getEmbeddedFontID(Ref *embID) const
     { *embID = embFontID; return embFontID.num >= 0; }
 
   // Invalidate an embedded font
@@ -232,28 +232,28 @@ public:
 
   // Get the PostScript font name for the embedded font.  Returns
   // NULL if there is no embedded font.
-  GooString *getEmbeddedFontName() { return embFontName; }
+  const GooString *getEmbeddedFontName() const { return embFontName; }
 
   // Get font descriptor flags.
-  int getFlags() { return flags; }
-  GBool isFixedWidth() { return flags & fontFixedWidth; }
-  GBool isSerif() { return flags & fontSerif; }
-  GBool isSymbolic() { return flags & fontSymbolic; }
-  GBool isItalic() { return flags & fontItalic; }
-  GBool isBold() { return flags & fontBold; }
+  int getFlags() const { return flags; }
+  GBool isFixedWidth() const { return flags & fontFixedWidth; }
+  GBool isSerif() const { return flags & fontSerif; }
+  GBool isSymbolic() const { return flags & fontSymbolic; }
+  GBool isItalic() const { return flags & fontItalic; }
+  GBool isBold() const { return flags & fontBold; }
 
   // Return the Unicode map.
   virtual const CharCodeToUnicode *getToUnicode() const = 0;
 
   // Return the font matrix.
-  double *getFontMatrix() { return fontMat; }
+  const double *getFontMatrix() const { return fontMat; }
 
   // Return the font bounding box.
-  double *getFontBBox() { return fontBBox; }
+  const double *getFontBBox() const { return fontBBox; }
 
   // Return the ascent and descent values.
-  double getAscent() { return ascent; }
-  double getDescent() { return descent; }
+  double getAscent() const { return ascent; }
+  double getDescent() const { return descent; }
 
   // Return the writing mode (0=horizontal, 1=vertical).
   virtual int getWMode() { return 0; }
@@ -279,10 +279,10 @@ public:
 			  double *dx, double *dy, double *ox, double *oy) const = 0;
 
   // Does this font have a toUnicode map?
-  GBool hasToUnicodeCMap() { return hasToUnicode; }
+  GBool hasToUnicodeCMap() const { return hasToUnicode; }
 
   // Return the name of the encoding
-  GooString *getEncodingName() { return encodingName; }
+  GooString *getEncodingName() const { return encodingName; }
 
   // Return AGLFN names of ligatures in the Standard and Expert encodings
   // for use with fonts that are not compatible with the Standard 14 fonts.
@@ -341,16 +341,16 @@ public:
   const CharCodeToUnicode *getToUnicode() const override;
 
   // Return the character name associated with <code>.
-  char *getCharName(int code) { return enc[code]; }
+  const char *getCharName(int code) const { return enc[code]; }
 
   // Returns true if the PDF font specified an encoding.
-  GBool getHasEncoding() { return hasEncoding; }
+  GBool getHasEncoding() const { return hasEncoding; }
 
   // Returns true if the PDF font specified MacRomanEncoding.
-  GBool getUsesMacRomanEnc() { return usesMacRomanEnc; }
+  GBool getUsesMacRomanEnc() const { return usesMacRomanEnc; }
 
   // Get width of a character.
-  double getWidth(Guchar c) { return widths[c]; }
+  double getWidth(Guchar c) const { return widths[c]; }
 
   // Return a char code-to-GID mapping for the provided font file.
   // (This is only useful for TrueType fonts.)
@@ -406,12 +406,12 @@ public:
   const CharCodeToUnicode *getToUnicode() const override;
 
   // Get the collection name (<registry>-<ordering>).
-  GooString *getCollection();
+  const GooString *getCollection() const;
 
   // Return the CID-to-GID mapping table.  These should only be called
   // if type is fontCIDType2.
-  int *getCIDToGID() { return cidToGID; }
-  int getCIDToGIDLen() { return cidToGIDLen; }
+  int *getCIDToGID() const { return cidToGID; }
+  int getCIDToGIDLen() const { return cidToGIDLen; }
 
   int *getCodeToGIDMap(FoFiTrueType *ff, int *length);
 
diff --git a/poppler/GlobalParams.cc b/poppler/GlobalParams.cc
index d7100094..0544a9ee 100644
--- a/poppler/GlobalParams.cc
+++ b/poppler/GlobalParams.cc
@@ -753,7 +753,7 @@ Unicode GlobalParams::mapNameToUnicodeText(const char *charName) {
   return nameToUnicodeText->lookup(charName);
 }
 
-UnicodeMap *GlobalParams::getResidentUnicodeMap(GooString *encodingName) {
+UnicodeMap *GlobalParams::getResidentUnicodeMap(const GooString *encodingName) {
   UnicodeMap *map = nullptr;
 
   globalParamsLocker();
@@ -766,7 +766,7 @@ UnicodeMap *GlobalParams::getResidentUnicodeMap(GooString *encodingName) {
   return map;
 }
 
-FILE *GlobalParams::getUnicodeMapFile(GooString *encodingName) {
+FILE *GlobalParams::getUnicodeMapFile(const GooString *encodingName) {
   FILE *file = nullptr;
 
   globalParamsLocker();
@@ -778,7 +778,7 @@ FILE *GlobalParams::getUnicodeMapFile(GooString *encodingName) {
   return file;
 }
 
-FILE *GlobalParams::findCMapFile(GooString *collection, GooString *cMapName) {
+FILE *GlobalParams::findCMapFile(const GooString *collection, const GooString *cMapName) {
   FILE *file = nullptr;
 
   globalParamsLocker();
@@ -796,7 +796,7 @@ FILE *GlobalParams::findCMapFile(GooString *collection, GooString *cMapName) {
   return file;
 }
 
-FILE *GlobalParams::findToUnicodeFile(GooString *name) {
+FILE *GlobalParams::findToUnicodeFile(const GooString *name) {
   GooString *dir, *fileName;
   FILE *f;
   int i;
@@ -840,7 +840,7 @@ static const char *getFontLang(GfxFont *font)
   // find the language we want the font to support
   if (font->isCIDFont())
   {
-    GooString *collection = ((GfxCIDFont *)font)->getCollection();
+    const GooString *collection = ((GfxCIDFont *)font)->getCollection();
     if (collection)
     {
       if (strcmp(collection->getCString(), "Adobe-GB1") == 0)
@@ -988,7 +988,7 @@ static FcPattern *buildFcPattern(GfxFont *font, const GooString *base14Name)
 }
 #endif
 
-GooString *GlobalParams::findFontFile(GooString *fontName) {
+GooString *GlobalParams::findFontFile(const GooString *fontName) {
   GooString *path = nullptr;
 
   setupBaseFonts(nullptr);
@@ -1009,7 +1009,7 @@ GooString *GlobalParams::findFontFile(GooString *fontName) {
 void GlobalParams::setupBaseFonts(char *) {
 }
 
-GooString *GlobalParams::findBase14FontFile(GooString *base14Name, GfxFont *font) {
+GooString *GlobalParams::findBase14FontFile(const GooString *base14Name, GfxFont *font) {
   SysFontType type;
   int fontNum;
   
@@ -1018,7 +1018,7 @@ GooString *GlobalParams::findBase14FontFile(GooString *base14Name, GfxFont *font
 
 GooString *GlobalParams::findSystemFontFile(GfxFont *font,
 					  SysFontType *type,
-					  int *fontNum, GooString *substituteFontName, GooString *base14Name) {
+					  int *fontNum, GooString *substituteFontName, const GooString *base14Name) {
   SysFontInfo *fi = nullptr;
   FcPattern *p=nullptr;
   GooString *path = nullptr;
@@ -1182,11 +1182,11 @@ fin:
 #elif WITH_FONTCONFIGURATION_WIN32
 #include "GlobalParamsWin.cc"
 
-GooString *GlobalParams::findBase14FontFile(GooString *base14Name, GfxFont *font) {
+GooString *GlobalParams::findBase14FontFile(const GooString *base14Name, GfxFont *font) {
   return findFontFile(base14Name);
 }
 #else
-GooString *GlobalParams::findBase14FontFile(GooString *base14Name, GfxFont *font) {
+GooString *GlobalParams::findBase14FontFile(const GooString *base14Name, GfxFont *font) {
   return findFontFile(base14Name);
 }
 
@@ -1367,7 +1367,7 @@ UnicodeMap *GlobalParams::getUnicodeMap2(GooString *encodingName) {
   return map;
 }
 
-CMap *GlobalParams::getCMap(GooString *collection, GooString *cMapName, Stream *stream) {
+CMap *GlobalParams::getCMap(const GooString *collection, GooString *cMapName, Stream *stream) {
   cMapCacheLocker();
   return cMapCache->getCMap(collection, cMapName, stream);
 }
diff --git a/poppler/GlobalParams.h b/poppler/GlobalParams.h
index 92d9b5a6..8850b246 100644
--- a/poppler/GlobalParams.h
+++ b/poppler/GlobalParams.h
@@ -124,15 +124,15 @@ public:
   // lookups or text extraction with ZapfDingbats fonts.
   Unicode mapNameToUnicodeAll(const char *charName);
 
-  UnicodeMap *getResidentUnicodeMap(GooString *encodingName);
-  FILE *getUnicodeMapFile(GooString *encodingName);
-  FILE *findCMapFile(GooString *collection, GooString *cMapName);
-  FILE *findToUnicodeFile(GooString *name);
-  GooString *findFontFile(GooString *fontName);
-  GooString *findBase14FontFile(GooString *base14Name, GfxFont *font);
+  UnicodeMap *getResidentUnicodeMap(const GooString *encodingName);
+  FILE *getUnicodeMapFile(const GooString *encodingName);
+  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,
-			      int *fontNum, GooString *substituteFontName = NULL, 
-		              GooString *base14Name = NULL);
+			      int *fontNum, GooString *substituteFontName = NULL,
+		              const GooString *base14Name = NULL);
   GBool getPSExpandSmaller();
   GBool getPSShrinkLarger();
   PSLevel getPSLevel();
@@ -147,7 +147,7 @@ public:
 
   CharCodeToUnicode *getCIDToUnicode(GooString *collection);
   UnicodeMap *getUnicodeMap(GooString *encodingName);
-  CMap *getCMap(GooString *collection, GooString *cMapName, Stream *stream = NULL);
+  CMap *getCMap(const GooString *collection, GooString *cMapName, Stream *stream = NULL);
   UnicodeMap *getTextEncoding();
 #ifdef ENABLE_PLUGINS
   GBool loadPlugin(char *type, char *name);
diff --git a/poppler/GlobalParamsWin.cc b/poppler/GlobalParamsWin.cc
index 5561f531..5479a56f 100644
--- a/poppler/GlobalParamsWin.cc
+++ b/poppler/GlobalParamsWin.cc
@@ -535,7 +535,7 @@ static const char *findSubstituteName(GfxFont *font, const std::unordered_map<st
 GooString *GlobalParams::findSystemFontFile(GfxFont *font,
 					  SysFontType *type,
 					  int *fontNum, GooString *substituteFontName,
-                                          GooString *base14Name) {
+                                          const GooString *base14Name) {
   SysFontInfo *fi;
   GooString *path = nullptr;
   const GooString *fontName = font->getName();
diff --git a/poppler/PDFDoc.cc b/poppler/PDFDoc.cc
index b0f8a197..aded0dad 100644
--- a/poppler/PDFDoc.cc
+++ b/poppler/PDFDoc.cc
@@ -1308,7 +1308,7 @@ void PDFDoc::writeRawStream (Stream* str, OutStream* outStr)
   outStr->printf("\r\nendstream\r\n");
 }
 
-void PDFDoc::writeString (const GooString* s, OutStream* outStr, Guchar *fileKey,
+void PDFDoc::writeString (const GooString* s, OutStream* outStr, const Guchar *fileKey,
                           CryptAlgorithm encAlgorithm, int keyLength, int objNum, int objGen)
 {
   // Encrypt string if encryption is enabled
@@ -1978,9 +1978,9 @@ PDFDoc *PDFDoc::ErrorPDFDoc(int errorCode, GooString *fileNameA)
   return doc;
 }
 
-long long PDFDoc::strToLongLong(char *s) {
+long long PDFDoc::strToLongLong(const char *s) {
   long long x, d;
-  char *p;
+  const char *p;
 
   x = 0;
   for (p = s; *p && isdigit(*p & 0xff); ++p) {
@@ -2024,7 +2024,7 @@ Goffset PDFDoc::getStartXRef(GBool tryingToReconstruct)
       }
     } else {
       char buf[xrefSearchSize+1];
-      char *p;
+      const char *p;
       int c, n, i;
 
       // read last xrefSearchSize bytes
diff --git a/poppler/PDFDoc.h b/poppler/PDFDoc.h
index 11cd4591..e57d96db 100644
--- a/poppler/PDFDoc.h
+++ b/poppler/PDFDoc.h
@@ -372,7 +372,7 @@ private:
   static void writeRawStream (Stream* str, OutStream* outStr);
   void writeXRefTableTrailer (Goffset uxrefOffset, XRef *uxref, GBool writeAllEntries,
                               int uxrefSize, OutStream* outStr, GBool incrUpdate);
-  static void writeString (const GooString* s, OutStream* outStr, Guchar *fileKey,
+  static void writeString (const GooString* s, OutStream* outStr, const Guchar *fileKey,
                            CryptAlgorithm encAlgorithm, int keyLength, int objNum, int objGen);
   void saveIncrementalUpdate (OutStream* outStr);
   void saveCompleteRewrite (OutStream* outStr);
@@ -395,7 +395,7 @@ private:
   // Get the offset of the entries in the main XRef table of a
   // linearized document (0 for non linearized documents).
   Goffset getMainXRefEntriesOffset(GBool tryingToReconstruct = gFalse);
-  long long strToLongLong(char *s);
+  long long strToLongLong(const char *s);
 
   // Mark the document's Info dictionary as modified.
   void setDocInfoModified(Object *infoObj);
diff --git a/poppler/PSOutputDev.cc b/poppler/PSOutputDev.cc
index 439b70bd..7ba28fc4 100644
--- a/poppler/PSOutputDev.cc
+++ b/poppler/PSOutputDev.cc
@@ -2772,7 +2772,7 @@ void PSOutputDev::setupType3Font(GfxFont *font, GooString *psName,
   Dict *charProcs;
   Gfx *gfx;
   PDFRectangle box;
-  double *m;
+  const double *m;
   GooString *buf;
   int i;
 
diff --git a/poppler/SplashOutputDev.cc b/poppler/SplashOutputDev.cc
index 5cc725a9..4350d908 100644
--- a/poppler/SplashOutputDev.cc
+++ b/poppler/SplashOutputDev.cc
@@ -2249,7 +2249,7 @@ reload:
   if (fontFile->doAdjustMatrix && !gfxFont->isCIDFont()) {
     double w1, w2, w3;
     CharCode code;
-    char *name;
+    const char *name;
     for (code = 0; code < 256; ++code) {
       if ((name = ((Gfx8BitFont *)gfxFont)->getCharName(code)) &&
           name[0] == 'm' && name[1] == '\0') {
@@ -2497,7 +2497,7 @@ GBool SplashOutputDev::beginType3Char(GfxState *state, double x, double y,
 				      CharCode code, Unicode *u, int uLen) {
   GfxFont *gfxFont;
   const Ref *fontID;
-  double *ctm, *bbox;
+  const double *ctm, *bbox;
   T3FontCache *t3Font;
   T3GlyphStack *t3gs;
   GBool validBBox;
diff --git a/poppler/TextOutputDev.cc b/poppler/TextOutputDev.cc
index 68542db3..f46db8bd 100644
--- a/poppler/TextOutputDev.cc
+++ b/poppler/TextOutputDev.cc
@@ -2459,8 +2459,8 @@ void TextPage::clear() {
 
 void TextPage::updateFont(GfxState *state) {
   GfxFont *gfxFont;
-  double *fm;
-  char *name;
+  const double *fm;
+  const char *name;
   int code, mCode, letterCode, anyCode;
   double w;
   int i;
@@ -2529,7 +2529,7 @@ void TextPage::updateFont(GfxState *state) {
 
 void TextPage::beginWord(GfxState *state) {
   GfxFont *gfxFont;
-  double *fontm;
+  const double *fontm;
   double m[4], m2[4];
   int rot;
 
diff --git a/utils/HtmlOutputDev.cc b/utils/HtmlOutputDev.cc
index 30d8ddd8..f695ee44 100644
--- a/utils/HtmlOutputDev.cc
+++ b/utils/HtmlOutputDev.cc
@@ -307,8 +307,7 @@ HtmlPage::~HtmlPage() {
 
 void HtmlPage::updateFont(GfxState *state) {
   GfxFont *font;
-  double *fm;
-  char *name;
+  const char *name;
   int code;
   double w;
   
@@ -334,7 +333,7 @@ void HtmlPage::updateFont(GfxState *state) {
 	fontSize *= w / 0.6;
       }
     }
-    fm = font->getFontMatrix();
+    const double *fm = font->getFontMatrix();
     if (fm[0] != 0) {
       fontSize *= fabs(fm[3] / fm[0]);
     }
commit 45c8888dcaf3da7981abc045835efd01a24e9e00
Author: Albert Astals Cid <aacid at kde.org>
Date:   Sun Sep 23 13:41:59 2018 +0200

    FoFiType1: Some more const

diff --git a/fofi/FoFiType1.cc b/fofi/FoFiType1.cc
index 889ea111..62d10c8c 100644
--- a/fofi/FoFiType1.cc
+++ b/fofi/FoFiType1.cc
@@ -45,7 +45,7 @@
 // FoFiType1
 //------------------------------------------------------------------------
 
-FoFiType1 *FoFiType1::make(char *fileA, int lenA) {
+FoFiType1 *FoFiType1::make(const char *fileA, int lenA) {
   return new FoFiType1(fileA, lenA, gFalse);
 }
 
@@ -59,7 +59,7 @@ FoFiType1 *FoFiType1::load(const char *fileName) {
   return new FoFiType1(fileA, lenA, gTrue);
 }
 
-FoFiType1::FoFiType1(char *fileA, int lenA, GBool freeFileDataA):
+FoFiType1::FoFiType1(const char *fileA, int lenA, GBool freeFileDataA):
   FoFiBase(fileA, lenA, freeFileDataA)
 {
   name = nullptr;
@@ -88,7 +88,7 @@ FoFiType1::~FoFiType1() {
   }
 }
 
-char *FoFiType1::getName() {
+const char *FoFiType1::getName() {
   if (!parsed) {
     parse();
   }
@@ -114,7 +114,7 @@ void FoFiType1::getFontMatrix(double *mat) {
 }
 
 void FoFiType1::writeEncoded(const char **newEncoding,
-			     FoFiOutputFunc outputFunc, void *outputStream) {
+			     FoFiOutputFunc outputFunc, void *outputStream) const {
   char buf[512];
   char *line, *line2, *p;
   int i;
@@ -196,7 +196,7 @@ void FoFiType1::writeEncoded(const char **newEncoding,
   }
 }
 
-char *FoFiType1::getNextLine(char *line) {
+char *FoFiType1::getNextLine(char *line) const {
   while (line < (char *)file + len && *line != '\x0a' && *line != '\x0d') {
     ++line;
   }
diff --git a/fofi/FoFiType1.h b/fofi/FoFiType1.h
index 167a5e43..f8a92cab 100644
--- a/fofi/FoFiType1.h
+++ b/fofi/FoFiType1.h
@@ -38,7 +38,7 @@ class FoFiType1: public FoFiBase {
 public:
 
   // Create a FoFiType1 object from a memory buffer.
-  static FoFiType1 *make(char *fileA, int lenA);
+  static FoFiType1 *make(const char *fileA, int lenA);
 
   // Create a FoFiType1 object from a file on disk.
   static FoFiType1 *load(const char *fileName);
@@ -46,7 +46,7 @@ public:
   ~FoFiType1();
 
   // Return the font name.
-  char *getName();
+  const char *getName();
 
   // Return the encoding, as an array of 256 names (any of which may
   // be NULL).
@@ -57,13 +57,13 @@ public:
 
   // Write a version of the Type 1 font file with a new encoding.
   void writeEncoded(const char **newEncoding,
-		    FoFiOutputFunc outputFunc, void *outputStream);
+		    FoFiOutputFunc outputFunc, void *outputStream) const;
 
 private:
 
-  FoFiType1(char *fileA, int lenA, GBool freeFileDataA);
+  FoFiType1(const char *fileA, int lenA, GBool freeFileDataA);
 
-  char *getNextLine(char *line);
+  char *getNextLine(char *line) const;
   void parse();
   void undoPFB();
 
commit 5c54abedbc15d373109b23bf61c4e229d9c0cd9f
Author: Albert Astals Cid <aacid at kde.org>
Date:   Sun Sep 23 13:35:45 2018 +0200

    FoFiType1C: more const

diff --git a/fofi/FoFiType1C.cc b/fofi/FoFiType1C.cc
index 52f9f5bb..d6a241d1 100644
--- a/fofi/FoFiType1C.cc
+++ b/fofi/FoFiType1C.cc
@@ -47,7 +47,7 @@ static char hexChars[17] = "0123456789ABCDEF";
 // FoFiType1C
 //------------------------------------------------------------------------
 
-FoFiType1C *FoFiType1C::make(char *fileA, int lenA) {
+FoFiType1C *FoFiType1C::make(const char *fileA, int lenA) {
   FoFiType1C *ff;
 
   ff = new FoFiType1C(fileA, lenA, gFalse);
@@ -74,7 +74,7 @@ FoFiType1C *FoFiType1C::load(const char *fileName) {
   return ff;
 }
 
-FoFiType1C::FoFiType1C(char *fileA, int lenA, GBool freeFileDataA):
+FoFiType1C::FoFiType1C(const char *fileA, int lenA, GBool freeFileDataA):
   FoFiBase(fileA, lenA, freeFileDataA)
 {
   name = nullptr;
@@ -1851,7 +1851,7 @@ void FoFiType1C::cvtGlyphWidth(GBool useOp, GooString *charBuf,
   charBuf->append((char)13);
 }
 
-void FoFiType1C::cvtNum(double x, GBool isFP, GooString *charBuf) {
+void FoFiType1C::cvtNum(double x, GBool isFP, GooString *charBuf) const {
   Guchar buf[12];
   int y, n;
 
@@ -1902,7 +1902,7 @@ void FoFiType1C::cvtNum(double x, GBool isFP, GooString *charBuf) {
   charBuf->append((char *)buf, n);
 }
 
-void FoFiType1C::eexecWrite(Type1CEexecBuf *eb, const char *s) {
+void FoFiType1C::eexecWrite(Type1CEexecBuf *eb, const char *s) const {
   Guchar *p;
   Guchar x;
 
@@ -1924,7 +1924,7 @@ void FoFiType1C::eexecWrite(Type1CEexecBuf *eb, const char *s) {
 }
 
 void FoFiType1C::eexecWriteCharstring(Type1CEexecBuf *eb,
-				      Guchar *s, int n) {
+				      const Guchar *s, int n) const {
   Guchar x;
   int i;
 
@@ -1946,10 +1946,10 @@ void FoFiType1C::eexecWriteCharstring(Type1CEexecBuf *eb,
   }
 }
 
-void FoFiType1C::writePSString(char *s, FoFiOutputFunc outputFunc,
-			       void *outputStream) {
+void FoFiType1C::writePSString(const char *s, FoFiOutputFunc outputFunc,
+			       void *outputStream) const {
   char buf[80];
-  char *p;
+  const char *p;
   int i, c;
 
   i = 0;
@@ -2664,7 +2664,7 @@ int FoFiType1C::getOp(int pos, GBool charstring, GBool *ok) {
 }
 
 // Convert the delta-encoded ops array to an array of ints.
-int FoFiType1C::getDeltaIntArray(int *arr, int maxLen) {
+int FoFiType1C::getDeltaIntArray(int *arr, int maxLen) const {
   int x;
   int n, i;
 
@@ -2687,7 +2687,7 @@ int FoFiType1C::getDeltaIntArray(int *arr, int maxLen) {
 }
 
 // Convert the delta-encoded ops array to an array of doubles.
-int FoFiType1C::getDeltaFPArray(double *arr, int maxLen) {
+int FoFiType1C::getDeltaFPArray(double *arr, int maxLen) const {
   double x;
   int n, i;
 
@@ -2702,7 +2702,7 @@ int FoFiType1C::getDeltaFPArray(double *arr, int maxLen) {
   return n;
 }
 
-void FoFiType1C::getIndex(int pos, Type1CIndex *idx, GBool *ok) {
+void FoFiType1C::getIndex(int pos, Type1CIndex *idx, GBool *ok) const {
   idx->pos = pos;
   idx->len = getU16BE(pos, ok);
   if (idx->len == 0) {
diff --git a/fofi/FoFiType1C.h b/fofi/FoFiType1C.h
index 58e2b9a2..6f2c696f 100644
--- a/fofi/FoFiType1C.h
+++ b/fofi/FoFiType1C.h
@@ -149,7 +149,7 @@ class FoFiType1C: public FoFiBase {
 public:
 
   // Create a FoFiType1C object from a memory buffer.
-  static FoFiType1C *make(char *fileA, int lenA);
+  static FoFiType1C *make(const char *fileA, int lenA);
 
   // Create a FoFiType1C object from a file on disk.
   static FoFiType1C *load(const char *fileName);
@@ -208,7 +208,7 @@ public:
 
 private:
 
-  FoFiType1C(char *fileA, int lenA, GBool freeFileDataA);
+  FoFiType1C(const char *fileA, int lenA, GBool freeFileDataA);
   void eexecCvtGlyph(Type1CEexecBuf *eb, const char *glyphName,
 		     int offset, int nBytes,
 		     Type1CIndex *subrIdx,
@@ -218,10 +218,10 @@ private:
 		GBool top);
   void cvtGlyphWidth(GBool useOp, GooString *charBuf,
 		     Type1CPrivateDict *pDict);
-  void cvtNum(double x, GBool isFP, GooString *charBuf);
-  void eexecWrite(Type1CEexecBuf *eb, const char *s);
-  void eexecWriteCharstring(Type1CEexecBuf *eb, Guchar *s, int n);
-  void writePSString(char *s, FoFiOutputFunc outputFunc, void *outputStream);
+  void cvtNum(double x, GBool isFP, GooString *charBuf) const;
+  void eexecWrite(Type1CEexecBuf *eb, const char *s) const;
+  void eexecWriteCharstring(Type1CEexecBuf *eb, const Guchar *s, int n) const;
+  void writePSString(const char *s, FoFiOutputFunc outputFunc, void *outputStream) const;
   GBool parse();
   void readTopDict();
   void readFD(int offset, int length, Type1CPrivateDict *pDict);
@@ -230,9 +230,9 @@ private:
   void buildEncoding();
   GBool readCharset();
   int getOp(int pos, GBool charstring, GBool *ok);
-  int getDeltaIntArray(int *arr, int maxLen);
-  int getDeltaFPArray(double *arr, int maxLen);
-  void getIndex(int pos, Type1CIndex *idx, GBool *ok);
+  int getDeltaIntArray(int *arr, int maxLen) const;
+  int getDeltaFPArray(double *arr, int maxLen) const;
+  void getIndex(int pos, Type1CIndex *idx, GBool *ok) const;
   void getIndexVal(const Type1CIndex *idx, int i, Type1CIndexVal *val, GBool *ok) const;
   char *getString(int sid, char *buf, GBool *ok) const;
 
commit 70575ed3c0286cda0e288d2aff2b4c2b0e0c640a
Author: Albert Astals Cid <aacid at kde.org>
Date:   Sun Sep 23 13:24:30 2018 +0200

    FoFiTrueType: More const

diff --git a/fofi/FoFiTrueType.cc b/fofi/FoFiTrueType.cc
index 9b25bb60..459fa0cb 100644
--- a/fofi/FoFiTrueType.cc
+++ b/fofi/FoFiTrueType.cc
@@ -271,7 +271,7 @@ static const char *macGlyphNames[258] = {
 // FoFiTrueType
 //------------------------------------------------------------------------
 
-FoFiTrueType *FoFiTrueType::make(char *fileA, int lenA, int faceIndexA) {
+FoFiTrueType *FoFiTrueType::make(const char *fileA, int lenA, int faceIndexA) {
   FoFiTrueType *ff;
 
   ff = new FoFiTrueType(fileA, lenA, gFalse, faceIndexA);
@@ -298,7 +298,7 @@ FoFiTrueType *FoFiTrueType::load(const char *fileName, int faceIndexA) {
   return ff;
 }
 
-FoFiTrueType::FoFiTrueType(char *fileA, int lenA, GBool freeFileDataA, int faceIndexA):
+FoFiTrueType::FoFiTrueType(const char *fileA, int lenA, GBool freeFileDataA, int faceIndexA):
   FoFiBase(fileA, lenA, freeFileDataA)
 {
   tables = nullptr;
@@ -318,19 +318,19 @@ FoFiTrueType::~FoFiTrueType() {
   gfree(cmaps);
 }
 
-int FoFiTrueType::getNumCmaps() {
+int FoFiTrueType::getNumCmaps() const {
   return nCmaps;
 }
 
-int FoFiTrueType::getCmapPlatform(int i) {
+int FoFiTrueType::getCmapPlatform(int i) const {
   return cmaps[i].platform;
 }
 
-int FoFiTrueType::getCmapEncoding(int i) {
+int FoFiTrueType::getCmapEncoding(int i) const {
   return cmaps[i].encoding;
 }
 
-int FoFiTrueType::findCmap(int platform, int encoding) {
+int FoFiTrueType::findCmap(int platform, int encoding) const {
   int i;
 
   for (i = 0; i < nCmaps; ++i) {
@@ -341,7 +341,7 @@ int FoFiTrueType::findCmap(int platform, int encoding) {
   return -1;
 }
 
-int FoFiTrueType::mapCodeToGID(int i, Guint c) {
+int FoFiTrueType::mapCodeToGID(int i, Guint c) const {
   int gid;
   Guint segCnt, segEnd, segStart, segDelta, segOffset;
   Guint cmapFirst, cmapLen;
@@ -438,7 +438,7 @@ int FoFiTrueType::mapCodeToGID(int i, Guint c) {
   return gid;
 }
 
-int FoFiTrueType::mapNameToGID(char *name) const {
+int FoFiTrueType::mapNameToGID(const char *name) const {
   const auto gid = nameToGID.find(name);
   if (gid == nameToGID.end()) {
     return 0;
@@ -446,7 +446,7 @@ int FoFiTrueType::mapNameToGID(char *name) const {
   return gid->second;
 }
 
-GBool FoFiTrueType::getCFFBlock(char **start, int *length) {
+GBool FoFiTrueType::getCFFBlock(char **start, int *length) const {
   int i;
 
   if (!openTypeCFF || !tables) {
@@ -461,7 +461,7 @@ GBool FoFiTrueType::getCFFBlock(char **start, int *length) {
   return gTrue;
 }
 
-int *FoFiTrueType::getCIDToGIDMap(int *nCIDs) {
+int *FoFiTrueType::getCIDToGIDMap(int *nCIDs) const {
   char *start;
   int length;
   FoFiType1C *ff;
@@ -479,7 +479,7 @@ int *FoFiTrueType::getCIDToGIDMap(int *nCIDs) {
   return map;
 }
 
-int FoFiTrueType::getEmbeddingRights() {
+int FoFiTrueType::getEmbeddingRights() const {
   int i, fsType;
   GBool ok;
 
@@ -503,7 +503,7 @@ int FoFiTrueType::getEmbeddingRights() {
   return 3;
 }
 
-void FoFiTrueType::getFontMatrix(double *mat) {
+void FoFiTrueType::getFontMatrix(double *mat) const {
   char *start;
   int length;
   FoFiType1C *ff;
@@ -521,7 +521,7 @@ void FoFiTrueType::getFontMatrix(double *mat) {
 void FoFiTrueType::convertToType42(const char *psName, char **encoding,
 				   int *codeToGID,
 				   FoFiOutputFunc outputFunc,
-				   void *outputStream) {
+				   void *outputStream) const {
   GooString *buf;
   int maxUsedGlyph;
   GBool ok;
@@ -561,7 +561,7 @@ void FoFiTrueType::convertToType42(const char *psName, char **encoding,
 
 void FoFiTrueType::convertToType1(const char *psName, const char **newEncoding,
 				  GBool ascii, FoFiOutputFunc outputFunc,
-				  void *outputStream) {
+				  void *outputStream) const {
   char *start;
   int length;
   FoFiType1C *ff;
@@ -580,7 +580,7 @@ void FoFiTrueType::convertToCIDType2(const char *psName,
 				     int *cidMap, int nCIDs,
 				     GBool needVerticalMetrics,
 				     FoFiOutputFunc outputFunc,
-				     void *outputStream) {
+				     void *outputStream) const {
   GooString *buf;
   int cid, maxUsedGlyph;
   GBool ok;
@@ -708,7 +708,7 @@ void FoFiTrueType::convertToCIDType2(const char *psName,
 
 void FoFiTrueType::convertToCIDType0(const char *psName, int *cidMap, int nCIDs,
 				     FoFiOutputFunc outputFunc,
-				     void *outputStream) {
+				     void *outputStream) const {
   char *start;
   int length;
   FoFiType1C *ff;
@@ -727,7 +727,7 @@ void FoFiTrueType::convertToType0(const char *psName, int *cidMap, int nCIDs,
 				  GBool needVerticalMetrics,
 				  int *maxValidGlyph,
 				  FoFiOutputFunc outputFunc,
-				  void *outputStream) {
+				  void *outputStream) const {
   GooString *buf;
   GooString *sfntsName;
   int maxUsedGlyph, n, i, j;
@@ -840,7 +840,7 @@ void FoFiTrueType::convertToType0(const char *psName, int *cidMap, int nCIDs,
 
 void FoFiTrueType::convertToType0(const char *psName, int *cidMap, int nCIDs,
 				  FoFiOutputFunc outputFunc,
-				  void *outputStream) {
+				  void *outputStream) const {
   char *start;
   int length;
   FoFiType1C *ff;
@@ -857,7 +857,7 @@ void FoFiTrueType::convertToType0(const char *psName, int *cidMap, int nCIDs,
 
 void FoFiTrueType::cvtEncoding(char **encoding,
 			       FoFiOutputFunc outputFunc,
-			       void *outputStream) {
+			       void *outputStream) const {
   const char *name;
   GooString *buf;
   int i;
@@ -887,7 +887,7 @@ void FoFiTrueType::cvtEncoding(char **encoding,
 void FoFiTrueType::cvtCharStrings(char **encoding,
 				  int *codeToGID,
 				  FoFiOutputFunc outputFunc,
-				  void *outputStream) {
+				  void *outputStream) const {
   char *name;
   GooString *buf;
   char buf2[16];
@@ -939,7 +939,7 @@ void FoFiTrueType::cvtCharStrings(char **encoding,
 void FoFiTrueType::cvtSfnts(FoFiOutputFunc outputFunc,
 			    void *outputStream, GooString *name,
 			    GBool needVerticalMetrics,
-                            int *maxUsedGlyph) {
+                            int *maxUsedGlyph) const {
   Guchar headData[54];
   TrueTypeLoca *locaTable;
   Guchar *locaData;
@@ -1260,7 +1260,7 @@ void FoFiTrueType::cvtSfnts(FoFiOutputFunc outputFunc,
 
 void FoFiTrueType::dumpString(const Guchar *s, int length,
 			      FoFiOutputFunc outputFunc,
-			      void *outputStream) {
+			      void *outputStream) const {
   GooString *buf;
   int pad, i, j;
 
@@ -1287,7 +1287,7 @@ void FoFiTrueType::dumpString(const Guchar *s, int length,
   (*outputFunc)(outputStream, "00>\n", 4);
 }
 
-Guint FoFiTrueType::computeTableChecksum(const Guchar *data, int length) {
+Guint FoFiTrueType::computeTableChecksum(const Guchar *data, int length) const {
   Guint checksum, word;
   int i;
 
@@ -1521,7 +1521,7 @@ void FoFiTrueType::readPostTable() {
   nameToGID.clear();
 }
 
-int FoFiTrueType::seekTable(const char *tag) {
+int FoFiTrueType::seekTable(const char *tag) const {
   Guint tagI;
   int i;
 
diff --git a/fofi/FoFiTrueType.h b/fofi/FoFiTrueType.h
index 269880da..3524b139 100644
--- a/fofi/FoFiTrueType.h
+++ b/fofi/FoFiTrueType.h
@@ -50,7 +50,7 @@ class FoFiTrueType: public FoFiBase {
 public:
 
   // Create a FoFiTrueType object from a memory buffer.
-  static FoFiTrueType *make(char *fileA, int lenA, int faceIndexA=0);
+  static FoFiTrueType *make(const char *fileA, int lenA, int faceIndexA=0);
 
   // Create a FoFiTrueType object from a file on disk.
   static FoFiTrueType *load(const char *fileName, int faceIndexA=0);
@@ -59,23 +59,23 @@ public:
 
   // Returns true if this an OpenType font containing CFF data, false
   // if it's a TrueType font (or OpenType font with TrueType data).
-  GBool isOpenTypeCFF() { return openTypeCFF; }
+  GBool isOpenTypeCFF() const { return openTypeCFF; }
 
   // Return the number of cmaps defined by this font.
-  int getNumCmaps();
+  int getNumCmaps() const;
 
   // Return the platform ID of the <i>th cmap.
-  int getCmapPlatform(int i);
+  int getCmapPlatform(int i) const;
 
   // Return the encoding ID of the <i>th cmap.
-  int getCmapEncoding(int i);
+  int getCmapEncoding(int i) const;
 
   // Return the index of the cmap for <platform>, <encoding>.  Returns
   // -1 if there is no corresponding cmap.
-  int findCmap(int platform, int encoding);
+  int findCmap(int platform, int encoding) const;
 
   // Return the GID corresponding to <c> according to the <i>th cmap.
-  int mapCodeToGID(int i, Guint c);
+  int mapCodeToGID(int i, Guint c) const;
 
   // map gid to vertical glyph gid if exist.
   //   if not exist return original gid
@@ -84,12 +84,12 @@ public:
   // Returns the GID corresponding to <name> according to the post
   // table.  Returns 0 if there is no mapping for <name> or if the
   // font does not have a post table.
-  int mapNameToGID(char *name) const;
+  int mapNameToGID(const char *name) const;
 
   // Return the mapping from CIDs to GIDs, and return the number of
   // CIDs in *<nCIDs>.  This is only useful for CID fonts.  (Only
   // useful for OpenType CFF fonts.)
-  int *getCIDToGIDMap(int *nCIDs);
+  int *getCIDToGIDMap(int *nCIDs) const;
 
   // Returns the least restrictive embedding licensing right (as
   // defined by the TrueType spec):
@@ -98,11 +98,11 @@ public:
   // * 2: editable embedding
   // * 1: preview & print embedding
   // * 0: restricted license embedding
-  int getEmbeddingRights();
+  int getEmbeddingRights() const;
 
   // Return the font matrix as an array of six numbers.  (Only useful
   // for OpenType CFF fonts.)
-  void getFontMatrix(double *mat);
+  void getFontMatrix(double *mat) const;
 
   // Convert to a Type 42 font, suitable for embedding in a PostScript
   // file.  <psName> will be used as the PostScript font name (so we
@@ -113,7 +113,7 @@ public:
   // (Not useful for OpenType CFF fonts.)
   void convertToType42(const char *psName, char **encoding,
 		       int *codeToGID,
-		       FoFiOutputFunc outputFunc, void *outputStream);
+		       FoFiOutputFunc outputFunc, void *outputStream) const;
 
   // Convert to a Type 1 font, suitable for embedding in a PostScript
   // file.  This is only useful with 8-bit fonts.  If <newEncoding> is
@@ -123,7 +123,7 @@ public:
   // non-NULL, it will be used as the PostScript font name.  (Only
   // useful for OpenType CFF fonts.)
   void convertToType1(const char *psName, const char **newEncoding, GBool ascii,
-		      FoFiOutputFunc outputFunc, void *outputStream);
+		      FoFiOutputFunc outputFunc, void *outputStream) const;
 
   // Convert to a Type 2 CIDFont, suitable for embedding in a
   // PostScript file.  <psName> will be used as the PostScript font
@@ -132,13 +132,13 @@ public:
   // entries.  (Not useful for OpenType CFF fonts.)
   void convertToCIDType2(const char *psName, int *cidMap, int nCIDs,
 			 GBool needVerticalMetrics,
-			 FoFiOutputFunc outputFunc, void *outputStream);
+			 FoFiOutputFunc outputFunc, void *outputStream) const;
 
   // Convert to a Type 0 CIDFont, suitable for embedding in a
   // PostScript file.  <psName> will be used as the PostScript font
   // name.  (Only useful for OpenType CFF fonts.)
   void convertToCIDType0(const char *psName, int *cidMap, int nCIDs,
-			 FoFiOutputFunc outputFunc, void *outputStream);
+			 FoFiOutputFunc outputFunc, void *outputStream) const;
 
   // Convert to a Type 0 (but non-CID) composite font, suitable for
   // embedding in a PostScript file.  <psName> will be used as the
@@ -148,18 +148,18 @@ public:
   void convertToType0(const char *psName, int *cidMap, int nCIDs,
 		      GBool needVerticalMetrics,
 		      int *maxValidGlyph,
-		      FoFiOutputFunc outputFunc, void *outputStream);
+		      FoFiOutputFunc outputFunc, void *outputStream) const;
 
   // Convert to a Type 0 (but non-CID) composite font, suitable for
   // embedding in a PostScript file.  <psName> will be used as the
   // PostScript font name.  (Only useful for OpenType CFF fonts.)
   void convertToType0(const char *psName, int *cidMap, int nCIDs,
-		      FoFiOutputFunc outputFunc, void *outputStream);
+		      FoFiOutputFunc outputFunc, void *outputStream) const;
 
   // Returns a pointer to the CFF font embedded in this OpenType font.
   // If successful, sets *<start> and *<length>, and returns true.
   // Otherwise returns false.  (Only useful for OpenType CFF fonts).
-  GBool getCFFBlock(char **start, int *length);
+  GBool getCFFBlock(char **start, int *length) const;
 
   // setup vert/vrt2 GSUB for default lang
   int setupGSUB(const char *scriptName);
@@ -169,25 +169,25 @@ public:
 
 private:
 
-  FoFiTrueType(char *fileA, int lenA, GBool freeFileDataA, int faceIndexA);
+  FoFiTrueType(const char *fileA, int lenA, GBool freeFileDataA, int faceIndexA);
   void cvtEncoding(char **encoding,
 		   FoFiOutputFunc outputFunc,
-		   void *outputStream);
+		   void *outputStream) const;
   void cvtCharStrings(char **encoding,
 		      int *codeToGID,
 		      FoFiOutputFunc outputFunc,
-		      void *outputStream);
+		      void *outputStream) const;
   void cvtSfnts(FoFiOutputFunc outputFunc,
 		void *outputStream, GooString *name,
 		GBool needVerticalMetrics,
-                int *maxUsedGlyph);
+                int *maxUsedGlyph) const;
   void dumpString(const Guchar *s, int length,
 		  FoFiOutputFunc outputFunc,
-		  void *outputStream);
-  Guint computeTableChecksum(const Guchar *data, int length);
+		  void *outputStream) const;
+  Guint computeTableChecksum(const Guchar *data, int length) const;
   void parse();
   void readPostTable();
-  int seekTable(const char *tag);
+  int seekTable(const char *tag) const;
   Guint charToTag(const char *tagName);
   Guint doMapToVertGID(Guint orgGID);
   Guint scanLookupList(Guint listIndex, Guint orgGID);
commit 3db883dec4c37d53f0b268970355fdd1b11b097f
Author: Albert Astals Cid <aacid at kde.org>
Date:   Sun Sep 23 13:09:34 2018 +0200

    Object: two more const char *

diff --git a/poppler/Object.h b/poppler/Object.h
index 7af91c33..392b80d6 100644
--- a/poppler/Object.h
+++ b/poppler/Object.h
@@ -229,7 +229,7 @@ public:
   GBool isName(const char *nameA) const
     { return type == objName && !strcmp(cString, nameA); }
   GBool isDict(const char *dictType) const;
-  GBool isStream(char *dictType) const;
+  GBool isStream(const char *dictType) const;
   GBool isCmd(const char *cmdA) const
     { return type == objCmd && !strcmp(cString, cmdA); }
 
@@ -285,7 +285,7 @@ public:
   Object dictGetValNF(int i) const;
 
   // Stream accessors.
-  GBool streamIs(char *dictType) const;
+  GBool streamIs(const char *dictType) const;
   void streamReset();
   void streamClose();
   int streamGetChar() const;
@@ -392,10 +392,10 @@ inline Object Object::dictGetValNF(int i) const
 
 #include "Stream.h"
 
-inline GBool Object::streamIs(char *dictType) const
+inline GBool Object::streamIs(const char *dictType) const
   { OBJECT_TYPE_CHECK(objStream); return stream->getDict()->is(dictType); }
 
-inline GBool Object::isStream(char *dictType) const
+inline GBool Object::isStream(const char *dictType) const
   { return type == objStream && streamIs(dictType); }
 
 inline void Object::streamReset()


More information about the poppler mailing list