[poppler] 5 commits - fofi/FoFiBase.cc fofi/FoFiBase.h fofi/FoFiType1C.cc fofi/FoFiType1C.h goo/gdir.h goo/gfile.cc poppler/Function.cc poppler/GlobalParams.cc poppler/GlobalParams.h

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Sat Sep 22 22:49:46 UTC 2018


 fofi/FoFiBase.cc        |   20 ++++++++++----------
 fofi/FoFiBase.h         |   18 +++++++++---------
 fofi/FoFiType1C.cc      |   18 +++++++++---------
 fofi/FoFiType1C.h       |   18 +++++++++---------
 goo/gdir.h              |   10 +++++-----
 goo/gfile.cc            |    4 ++--
 poppler/Function.cc     |    3 +--
 poppler/GlobalParams.cc |    8 ++++----
 poppler/GlobalParams.h  |    8 ++++----
 9 files changed, 53 insertions(+), 54 deletions(-)

New commits:
commit 384276842ad147b3f65084aaf725a72d45227282
Author: Albert Astals Cid <aacid at kde.org>
Date:   Sun Sep 23 00:49:31 2018 +0200

    gdir: Add some const

diff --git a/goo/gdir.h b/goo/gdir.h
index 1eb1dae5..4df9db32 100644
--- a/goo/gdir.h
+++ b/goo/gdir.h
@@ -46,11 +46,11 @@ class GooString;
 class GDirEntry {
 public:
 
-  GDirEntry(char *dirPath, char *nameA, GBool doStat);
+  GDirEntry(const char *dirPath, const char *nameA, GBool doStat);
   ~GDirEntry();
-  GooString *getName() { return name; }
-  GooString *getFullPath() { return fullPath; }
-  GBool isDir() { return dir; }
+  const GooString *getName() const { return name; }
+  const GooString *getFullPath() const { return fullPath; }
+  GBool isDir() const { return dir; }
 
 private:
   GDirEntry(const GDirEntry &other);
@@ -64,7 +64,7 @@ private:
 class GDir {
 public:
 
-  GDir(char *name, GBool doStatA = gTrue);
+  GDir(const char *name, GBool doStatA = gTrue);
   ~GDir();
   GDirEntry *getNextEntry();
   void rewind();
diff --git a/goo/gfile.cc b/goo/gfile.cc
index 720f75aa..d49e7a18 100644
--- a/goo/gfile.cc
+++ b/goo/gfile.cc
@@ -741,7 +741,7 @@ bool GooFile::modificationTimeChangedSinceOpen() const
 // GDir and GDirEntry
 //------------------------------------------------------------------------
 
-GDirEntry::GDirEntry(char *dirPath, char *nameA, GBool doStat) {
+GDirEntry::GDirEntry(const char *dirPath, const char *nameA, GBool doStat) {
 #ifdef VMS
   char *p;
 #elif defined(_WIN32)
@@ -778,7 +778,7 @@ GDirEntry::~GDirEntry() {
   delete name;
 }
 
-GDir::GDir(char *name, GBool doStatA) {
+GDir::GDir(const char *name, GBool doStatA) {
   path = new GooString(name);
   doStat = doStatA;
 #if defined(_WIN32)
commit 646981275fcbb57568ea91529a847f779fba7578
Author: Albert Astals Cid <aacid at kde.org>
Date:   Sun Sep 23 00:46:59 2018 +0200

    GlobalParams: Make some GooString * const

diff --git a/poppler/GlobalParams.cc b/poppler/GlobalParams.cc
index 4671495e..d7100094 100644
--- a/poppler/GlobalParams.cc
+++ b/poppler/GlobalParams.cc
@@ -657,7 +657,7 @@ void GlobalParams::scanEncodingDirs() {
   delete[] dataPathBuffer;
 }
 
-void GlobalParams::parseNameToUnicode(GooString *name) {
+void GlobalParams::parseNameToUnicode(const GooString *name) {
   char *tok1, *tok2;
   FILE *f;
   char buf[256];
@@ -686,15 +686,15 @@ void GlobalParams::parseNameToUnicode(GooString *name) {
   fclose(f);
 }
 
-void GlobalParams::addCIDToUnicode(GooString *collection, GooString *fileName) {
+void GlobalParams::addCIDToUnicode(const GooString *collection, const GooString *fileName) {
   cidToUnicodes[collection->toStr()] = fileName->toStr();
 }
 
-void GlobalParams::addUnicodeMap(GooString *encodingName, GooString *fileName) {
+void GlobalParams::addUnicodeMap(const GooString *encodingName, const GooString *fileName) {
   unicodeMaps[encodingName->toStr()] = fileName->toStr();
 }
 
-void GlobalParams::addCMapDir(GooString *collection, GooString *dir) {
+void GlobalParams::addCMapDir(const GooString *collection, const GooString *dir) {
   cMapDirs.emplace(collection->toStr(), dir->toStr());
 }
 
diff --git a/poppler/GlobalParams.h b/poppler/GlobalParams.h
index 8c4b6a31..92d9b5a6 100644
--- a/poppler/GlobalParams.h
+++ b/poppler/GlobalParams.h
@@ -178,13 +178,13 @@ public:
 
 private:
 
-  void parseNameToUnicode(GooString *name);
+  void parseNameToUnicode(const GooString *name);
   UnicodeMap *getUnicodeMap2(GooString *encodingName);
 
   void scanEncodingDirs();
-  void addCIDToUnicode(GooString *collection, GooString *fileName);
-  void addUnicodeMap(GooString *encodingName, GooString *fileName);
-  void addCMapDir(GooString *collection, GooString *dir);
+  void addCIDToUnicode(const GooString *collection, const GooString *fileName);
+  void addUnicodeMap(const GooString *encodingName, const GooString *fileName);
+  void addCMapDir(const GooString *collection, const GooString *dir);
 
   //----- static tables
 
commit a28116539832cde87acd844aa0130df0eed405d6
Author: Albert Astals Cid <aacid at kde.org>
Date:   Sun Sep 23 00:43:11 2018 +0200

    FoFiType1C: Add some const

diff --git a/fofi/FoFiType1C.cc b/fofi/FoFiType1C.cc
index 6e42bb25..db7b98c6 100644
--- a/fofi/FoFiType1C.cc
+++ b/fofi/FoFiType1C.cc
@@ -113,15 +113,15 @@ FoFiType1C::~FoFiType1C() {
   }
 }
 
-char *FoFiType1C::getName() {
+const char *FoFiType1C::getName() const {
   return name ? name->getCString() : (char *)nullptr;
 }
 
-char **FoFiType1C::getEncoding() {
+char **FoFiType1C::getEncoding() const {
   return encoding;
 }
 
-GooString *FoFiType1C::getGlyphName(int gid) {
+GooString *FoFiType1C::getGlyphName(int gid) const {
   char buf[256];
   GBool ok;
 
@@ -135,7 +135,7 @@ GooString *FoFiType1C::getGlyphName(int gid) {
   return new GooString(buf);
 }
 
-int *FoFiType1C::getCIDToGIDMap(int *nCIDs) {
+int *FoFiType1C::getCIDToGIDMap(int *nCIDs) const {
   int *map;
   int n, i;
 
@@ -163,7 +163,7 @@ int *FoFiType1C::getCIDToGIDMap(int *nCIDs) {
   return map;
 }
 
-void FoFiType1C::getFontMatrix(double *mat) {
+void FoFiType1C::getFontMatrix(double *mat) const {
   int i;
 
   if (topDict.firstOp == 0x0c1e && privateDicts[0].hasFontMatrix) {
@@ -192,7 +192,7 @@ void FoFiType1C::getFontMatrix(double *mat) {
   }
 }
 
-void FoFiType1C::convertToType1(char *psName, const char **newEncoding, GBool ascii,
+void FoFiType1C::convertToType1(const char *psName, const char **newEncoding, GBool ascii,
 				FoFiOutputFunc outputFunc,
 				void *outputStream) {
   int psNameLen;
@@ -2726,8 +2726,8 @@ void FoFiType1C::getIndex(int pos, Type1CIndex *idx, GBool *ok) {
   }
 }
 
-void FoFiType1C::getIndexVal(Type1CIndex *idx, int i,
-			     Type1CIndexVal *val, GBool *ok) {
+void FoFiType1C::getIndexVal(const Type1CIndex *idx, int i,
+			     Type1CIndexVal *val, GBool *ok) const {
   int pos0, pos1;
 
   if (i < 0 || i >= idx->len) {
@@ -2747,7 +2747,7 @@ void FoFiType1C::getIndexVal(Type1CIndex *idx, int i,
   val->len = pos1 - pos0;
 }
 
-char *FoFiType1C::getString(int sid, char *buf, GBool *ok) {
+char *FoFiType1C::getString(int sid, char *buf, GBool *ok) const {
   Type1CIndexVal val;
   int n;
 
diff --git a/fofi/FoFiType1C.h b/fofi/FoFiType1C.h
index 03a16004..541c193d 100644
--- a/fofi/FoFiType1C.h
+++ b/fofi/FoFiType1C.h
@@ -157,22 +157,22 @@ public:
   virtual ~FoFiType1C();
 
   // Return the font name.
-  char *getName();
+  const char *getName() const;
 
   // Return the encoding, as an array of 256 names (any of which may
   // be NULL).  This is only useful with 8-bit fonts.
-  char **getEncoding();
+  char **getEncoding() const;
 
   // Get the glyph names.
-  int getNumGlyphs() { return nGlyphs; }
-  GooString *getGlyphName(int gid);
+  int getNumGlyphs() const { return nGlyphs; }
+  GooString *getGlyphName(int gid) const;
 
   // Return the mapping from CIDs to GIDs, and return the number of
   // CIDs in *<nCIDs>.  This is only useful for CID fonts.
-  int *getCIDToGIDMap(int *nCIDs);
+  int *getCIDToGIDMap(int *nCIDs) const;
 
   // Return the font matrix as an array of six numbers.
-  void getFontMatrix(double *mat);
+  void getFontMatrix(double *mat) 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
@@ -180,7 +180,7 @@ public:
   // font.  If <ascii> is true the eexec section will be hex-encoded,
   // otherwise it will be left as binary data.  If <psName> is non-NULL,
   // it will be used as the PostScript font name.
-  void convertToType1(char *psName, const char **newEncoding, GBool ascii,
+  void convertToType1(const char *psName, const char **newEncoding, GBool ascii,
 		      FoFiOutputFunc outputFunc, void *outputStream);
 
   // Convert to a Type 0 CIDFont, suitable for embedding in a
@@ -233,8 +233,8 @@ private:
   int getDeltaIntArray(int *arr, int maxLen);
   int getDeltaFPArray(double *arr, int maxLen);
   void getIndex(int pos, Type1CIndex *idx, GBool *ok);
-  void getIndexVal(Type1CIndex *idx, int i, Type1CIndexVal *val, GBool *ok);
-  char *getString(int sid, char *buf, GBool *ok);
+  void getIndexVal(const Type1CIndex *idx, int i, Type1CIndexVal *val, GBool *ok) const;
+  char *getString(int sid, char *buf, GBool *ok) const;
 
   GooString *name;
   char **encoding;
commit da87b12ef125e3c2d43822004f1f9f2a7f45aaf3
Author: Albert Astals Cid <aacid at kde.org>
Date:   Sun Sep 23 00:42:51 2018 +0200

    FoFiBase: Add some const

diff --git a/fofi/FoFiBase.cc b/fofi/FoFiBase.cc
index 2fa71d13..6d7697c2 100644
--- a/fofi/FoFiBase.cc
+++ b/fofi/FoFiBase.cc
@@ -15,7 +15,7 @@
 //
 // Copyright (C) 2008 Ed Avis <eda at waniasset.com>
 // Copyright (C) 2011 Jim Meyering <jim at meyering.net>
-// Copyright (C) 2016 Albert Astals Cid <aacid at kde.org>
+// Copyright (C) 2016, 2018 Albert Astals Cid <aacid at kde.org>
 //
 // To see a description of the changes please see the Changelog file that
 // came with your tarball or type make ChangeLog if you are building from git
@@ -86,7 +86,7 @@ char *FoFiBase::readFile(char *fileName, int *fileLen) {
   return buf;
 }
 
-int FoFiBase::getS8(int pos, GBool *ok) {
+int FoFiBase::getS8(int pos, GBool *ok) const {
   int x;
 
   if (pos < 0 || pos >= len) {
@@ -100,7 +100,7 @@ int FoFiBase::getS8(int pos, GBool *ok) {
   return x;
 }
 
-int FoFiBase::getU8(int pos, GBool *ok) {
+int FoFiBase::getU8(int pos, GBool *ok) const {
   if (pos < 0 || pos >= len) {
     *ok = gFalse;
     return 0;
@@ -108,7 +108,7 @@ int FoFiBase::getU8(int pos, GBool *ok) {
   return file[pos];
 }
 
-int FoFiBase::getS16BE(int pos, GBool *ok) {
+int FoFiBase::getS16BE(int pos, GBool *ok) const {
   int x;
 
   if (pos < 0 || pos+1 >= len || pos > INT_MAX - 1) {
@@ -123,7 +123,7 @@ int FoFiBase::getS16BE(int pos, GBool *ok) {
   return x;
 }
 
-int FoFiBase::getU16BE(int pos, GBool *ok) {
+int FoFiBase::getU16BE(int pos, GBool *ok) const {
   int x;
 
   if (pos < 0 || pos+1 >= len || pos > INT_MAX - 1) {
@@ -135,7 +135,7 @@ int FoFiBase::getU16BE(int pos, GBool *ok) {
   return x;
 }
 
-int FoFiBase::getS32BE(int pos, GBool *ok) {
+int FoFiBase::getS32BE(int pos, GBool *ok) const {
   int x;
 
   if (pos < 0 || pos+3 >= len || pos > INT_MAX - 3) {
@@ -152,7 +152,7 @@ int FoFiBase::getS32BE(int pos, GBool *ok) {
   return x;
 }
 
-Guint FoFiBase::getU32BE(int pos, GBool *ok) {
+Guint FoFiBase::getU32BE(int pos, GBool *ok) const {
   Guint x;
 
   if (pos < 0 || pos+3 >= len || pos > INT_MAX - 3) {
@@ -166,7 +166,7 @@ Guint FoFiBase::getU32BE(int pos, GBool *ok) {
   return x;
 }
 
-Guint FoFiBase::getU32LE(int pos, GBool *ok) {
+Guint FoFiBase::getU32LE(int pos, GBool *ok) const {
   Guint x;
 
   if (pos < 0 || pos+3 >= len || pos > INT_MAX - 3) {
@@ -180,7 +180,7 @@ Guint FoFiBase::getU32LE(int pos, GBool *ok) {
   return x;
 }
 
-Guint FoFiBase::getUVarBE(int pos, int size, GBool *ok) {
+Guint FoFiBase::getUVarBE(int pos, int size, GBool *ok) const {
   Guint x;
   int i;
 
@@ -195,7 +195,7 @@ Guint FoFiBase::getUVarBE(int pos, int size, GBool *ok) {
   return x;
 }
 
-GBool FoFiBase::checkRegion(int pos, int size) {
+GBool FoFiBase::checkRegion(int pos, int size) const {
   return pos >= 0 &&
          pos < INT_MAX - size &&
          size < INT_MAX - pos &&
diff --git a/fofi/FoFiBase.h b/fofi/FoFiBase.h
index be4e7025..d7e77b0f 100644
--- a/fofi/FoFiBase.h
+++ b/fofi/FoFiBase.h
@@ -52,16 +52,16 @@ protected:
   // S = signed / U = unsigned
   // 8/16/32/Var = word length, in bytes
   // BE = big endian
-  int getS8(int pos, GBool *ok);
-  int getU8(int pos, GBool *ok);
-  int getS16BE(int pos, GBool *ok);
-  int getU16BE(int pos, GBool *ok);
-  int getS32BE(int pos, GBool *ok);
-  Guint getU32BE(int pos, GBool *ok);
-  Guint getU32LE(int pos, GBool *ok);
-  Guint getUVarBE(int pos, int size, GBool *ok);
+  int getS8(int pos, GBool *ok) const;
+  int getU8(int pos, GBool *ok) const;
+  int getS16BE(int pos, GBool *ok) const;
+  int getU16BE(int pos, GBool *ok) const;
+  int getS32BE(int pos, GBool *ok) const;
+  Guint getU32BE(int pos, GBool *ok) const;
+  Guint getU32LE(int pos, GBool *ok) const;
+  Guint getUVarBE(int pos, int size, GBool *ok) const;
 
-  GBool checkRegion(int pos, int size);
+  GBool checkRegion(int pos, int size) const;
 
   Guchar *fileData;
   Guchar *file;
commit 1b48d72ad9b5e73334d330b94917a351c5305e61
Author: Albert Astals Cid <aacid at kde.org>
Date:   Sun Sep 23 00:35:55 2018 +0200

    Function: make variable const char * instead of char *

diff --git a/poppler/Function.cc b/poppler/Function.cc
index 6918fbcd..69abe81a 100644
--- a/poppler/Function.cc
+++ b/poppler/Function.cc
@@ -1263,7 +1263,6 @@ void PostScriptFunction::transform(double *in, double *out) {
 
 GBool PostScriptFunction::parseCode(Stream *str, int *codePtr) {
   GooString *tok;
-  char *p;
   GBool isReal;
   int opPtr, elsePtr;
   int a, b, mid, cmp;
@@ -1273,7 +1272,7 @@ GBool PostScriptFunction::parseCode(Stream *str, int *codePtr) {
       error(errSyntaxError, -1, "Unexpected end of PostScript function stream");
       return gFalse;
     }
-    p = tok->getCString();
+    const char *p = tok->getCString();
     if (isdigit(*p) || *p == '.' || *p == '-') {
       isReal = gFalse;
       for (; *p; ++p) {


More information about the poppler mailing list