[poppler] fofi/FoFiEncodings.cc fofi/FoFiEncodings.h fofi/FoFiType1C.cc poppler/Gfx.cc poppler/Gfx.h poppler/JArithmeticDecoder.cc poppler/JArithmeticDecoder.h poppler/JBIG2Stream.cc poppler/JBIG2Stream.h poppler/PDFDocEncoding.cc poppler/PDFDocEncoding.h poppler/Stream.cc poppler/Stream.h poppler/UnicodeMap.cc poppler/UnicodeMap.h poppler/UnicodeMapTables.h

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Sun Sep 29 15:29:26 UTC 2019


 fofi/FoFiEncodings.cc         |    6 ++--
 fofi/FoFiEncodings.h          |    6 ++--
 fofi/FoFiType1C.cc            |    6 ++--
 poppler/Gfx.cc                |    6 ++--
 poppler/Gfx.h                 |    4 +-
 poppler/JArithmeticDecoder.cc |    8 ++---
 poppler/JArithmeticDecoder.h  |    8 ++---
 poppler/JBIG2Stream.cc        |   62 +++++++++++++++++++++---------------------
 poppler/JBIG2Stream.h         |   18 ++++++------
 poppler/PDFDocEncoding.cc     |    2 -
 poppler/PDFDocEncoding.h      |    2 -
 poppler/Stream.cc             |   14 ++++-----
 poppler/Stream.h              |    6 ++--
 poppler/UnicodeMap.cc         |    4 +-
 poppler/UnicodeMap.h          |    2 -
 poppler/UnicodeMapTables.h    |    8 ++---
 16 files changed, 81 insertions(+), 81 deletions(-)

New commits:
commit 7ee694c461e35639842b88a6ce4b8b828b733a63
Author: Volker Krause <vkrause at kde.org>
Date:   Sun Sep 29 16:52:55 2019 +0200

    Make some static data tables const
    
    This moves 14.4kB from .data to .rodata, and another 11.6kB from .data to
    .data.rel.ro.

diff --git a/fofi/FoFiEncodings.cc b/fofi/FoFiEncodings.cc
index 905a3d9c..43a715e9 100644
--- a/fofi/FoFiEncodings.cc
+++ b/fofi/FoFiEncodings.cc
@@ -945,7 +945,7 @@ const char *fofiType1CStdStrings[391] = {
   "Semibold"
 };
 
-unsigned short fofiType1CISOAdobeCharset[229] = {
+const unsigned short fofiType1CISOAdobeCharset[229] = {
     0,   1,   2,   3,   4,   5,   6,   7,   8,   9,
    10,  11,  12,  13,  14,  15,  16,  17,  18,  19,
    20,  21,  22,  23,  24,  25,  26,  27,  28,  29,
@@ -971,7 +971,7 @@ unsigned short fofiType1CISOAdobeCharset[229] = {
   220, 221, 222, 223, 224, 225, 226, 227, 228
 };
 
-unsigned short fofiType1CExpertCharset[166] = {
+const unsigned short fofiType1CExpertCharset[166] = {
     0,   1, 229, 230, 231, 232, 233, 234, 235, 236,
   237, 238,  13,  14,  15,  99, 239, 240, 241, 242,
   243, 244, 245, 246, 247, 248,  27,  28, 249, 250,
@@ -991,7 +991,7 @@ unsigned short fofiType1CExpertCharset[166] = {
   373, 374, 375, 376, 377, 378
 };
 
-unsigned short fofiType1CExpertSubsetCharset[87] = {
+const unsigned short fofiType1CExpertSubsetCharset[87] = {
     0,   1, 231, 232, 235, 236, 237, 238,  13,  14,
    15,  99, 239, 240, 241, 242, 243, 244, 245, 246,
   247, 248,  27,  28, 249, 250, 251, 253, 254, 255,
diff --git a/fofi/FoFiEncodings.h b/fofi/FoFiEncodings.h
index c4fbf48d..72a438b5 100644
--- a/fofi/FoFiEncodings.h
+++ b/fofi/FoFiEncodings.h
@@ -35,8 +35,8 @@ extern const char * const fofiType1ExpertEncoding[256];
 //------------------------------------------------------------------------
 
 extern const char *fofiType1CStdStrings[391];
-extern unsigned short fofiType1CISOAdobeCharset[229];
-extern unsigned short fofiType1CExpertCharset[166];
-extern unsigned short fofiType1CExpertSubsetCharset[87];
+extern const unsigned short fofiType1CISOAdobeCharset[229];
+extern const unsigned short fofiType1CExpertCharset[166];
+extern const unsigned short fofiType1CExpertSubsetCharset[87];
 
 #endif
diff --git a/fofi/FoFiType1C.cc b/fofi/FoFiType1C.cc
index c3d47b4f..03223863 100644
--- a/fofi/FoFiType1C.cc
+++ b/fofi/FoFiType1C.cc
@@ -2502,13 +2502,13 @@ bool FoFiType1C::readCharset() {
   int nLeft, i, j;
 
   if (topDict.charsetOffset == 0) {
-    charset = fofiType1CISOAdobeCharset;
+    charset = const_cast<unsigned short*>(fofiType1CISOAdobeCharset);
     charsetLength = sizeof(fofiType1CISOAdobeCharset) / sizeof(unsigned short);
   } else if (topDict.charsetOffset == 1) {
-    charset = fofiType1CExpertCharset;
+    charset = const_cast<unsigned short*>(fofiType1CExpertCharset);
     charsetLength = sizeof(fofiType1CExpertCharset) / sizeof(unsigned short);
   } else if (topDict.charsetOffset == 2) {
-    charset = fofiType1CExpertSubsetCharset;
+    charset = const_cast<unsigned short*>(fofiType1CExpertSubsetCharset);
     charsetLength = sizeof(fofiType1CExpertSubsetCharset) / sizeof(unsigned short);
   } else {
     charset = (unsigned short *)gmallocn(nGlyphs, sizeof(unsigned short));
diff --git a/poppler/Gfx.cc b/poppler/Gfx.cc
index 47627ad3..1288f038 100644
--- a/poppler/Gfx.cc
+++ b/poppler/Gfx.cc
@@ -133,7 +133,7 @@
 // Operator table
 //------------------------------------------------------------------------
 
-Operator Gfx::opTab[] = {
+const Operator Gfx::opTab[] = {
   {"\"",  3, {tchkNum,    tchkNum,    tchkString},
           &Gfx::opMoveSetShowText},
   {"'",   1, {tchkString},
@@ -823,7 +823,7 @@ void Gfx::go(bool topLevel) {
 }
 
 void Gfx::execOp(Object *cmd, Object args[], int numArgs) {
-  Operator *op;
+  const Operator *op;
   Object *argPtr;
   int i;
 
@@ -870,7 +870,7 @@ void Gfx::execOp(Object *cmd, Object args[], int numArgs) {
   (this->*op->func)(argPtr, numArgs);
 }
 
-Operator *Gfx::findOp(const char *name) {
+const Operator *Gfx::findOp(const char *name) {
   int a, b, m, cmp;
 
   a = -1;
diff --git a/poppler/Gfx.h b/poppler/Gfx.h
index 19462e8d..df4a2eab 100644
--- a/poppler/Gfx.h
+++ b/poppler/Gfx.h
@@ -240,11 +240,11 @@ private:
     (*abortCheckCbk)(void *data);
   void *abortCheckCbkData;
 
-  static Operator opTab[];	// table of operators
+  static const Operator opTab[]; // table of operators
 
   void go(bool topLevel);
   void execOp(Object *cmd, Object args[], int numArgs);
-  Operator *findOp(const char *name);
+  const Operator *findOp(const char *name);
   bool checkArg(Object *arg, TchkType type);
   Goffset getPos();
 
diff --git a/poppler/JArithmeticDecoder.cc b/poppler/JArithmeticDecoder.cc
index 404f233e..cba1cec5 100644
--- a/poppler/JArithmeticDecoder.cc
+++ b/poppler/JArithmeticDecoder.cc
@@ -50,7 +50,7 @@ void JArithmeticDecoderStats::setEntry(unsigned int cx, int i, int mps) {
 // JArithmeticDecoder
 //------------------------------------------------------------------------
 
-unsigned int JArithmeticDecoder::qeTab[47] = {
+unsigned const int JArithmeticDecoder::qeTab[47] = {
   0x56010000, 0x34010000, 0x18010000, 0x0AC10000,
   0x05210000, 0x02210000, 0x56010000, 0x54010000,
   0x48010000, 0x38010000, 0x30010000, 0x24010000,
@@ -65,19 +65,19 @@ unsigned int JArithmeticDecoder::qeTab[47] = {
   0x00050000, 0x00010000, 0x56010000
 };
 
-int JArithmeticDecoder::nmpsTab[47] = {
+const int JArithmeticDecoder::nmpsTab[47] = {
    1,  2,  3,  4,  5, 38,  7,  8,  9, 10, 11, 12, 13, 29, 15, 16,
   17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32,
   33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 44, 45, 45, 46
 };
 
-int JArithmeticDecoder::nlpsTab[47] = {
+const int JArithmeticDecoder::nlpsTab[47] = {
    1,  6,  9, 12, 29, 33,  6, 14, 14, 14, 17, 18, 20, 21, 14, 14,
   15, 16, 17, 18, 19, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29,
   30, 31, 32, 33, 34, 35, 36, 37, 38, 39, 40, 41, 42, 43, 46
 };
 
-int JArithmeticDecoder::switchTab[47] = {
+const int JArithmeticDecoder::switchTab[47] = {
   1, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 0,
   0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
   0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0
diff --git a/poppler/JArithmeticDecoder.h b/poppler/JArithmeticDecoder.h
index 993901a9..2c9c5258 100644
--- a/poppler/JArithmeticDecoder.h
+++ b/poppler/JArithmeticDecoder.h
@@ -103,10 +103,10 @@ private:
   int decodeIntBit(JArithmeticDecoderStats *stats);
   void byteIn();
 
-  static unsigned int qeTab[47];
-  static int nmpsTab[47];
-  static int nlpsTab[47];
-  static int switchTab[47];
+  static const unsigned int qeTab[47];
+  static const int nmpsTab[47];
+  static const int nlpsTab[47];
+  static const int switchTab[47];
 
   unsigned int buf0, buf1;
   unsigned int c, a;
diff --git a/poppler/JBIG2Stream.cc b/poppler/JBIG2Stream.cc
index 56f97fd5..f86e9243 100644
--- a/poppler/JBIG2Stream.cc
+++ b/poppler/JBIG2Stream.cc
@@ -63,7 +63,7 @@ struct JBIG2HuffmanTable {
   unsigned int prefix;
 };
 
-static JBIG2HuffmanTable huffTableA[] = {
+static const JBIG2HuffmanTable huffTableA[] = {
   {     0, 1,  4,              0x000 },
   {    16, 2,  8,              0x002 },
   {   272, 3, 16,              0x006 },
@@ -71,7 +71,7 @@ static JBIG2HuffmanTable huffTableA[] = {
   {     0, 0, jbig2HuffmanEOT, 0     }
 };
 
-static JBIG2HuffmanTable huffTableB[] = {
+static const JBIG2HuffmanTable huffTableB[] = {
   {     0, 1,  0,              0x000 },
   {     1, 2,  0,              0x002 },
   {     2, 3,  0,              0x006 },
@@ -82,7 +82,7 @@ static JBIG2HuffmanTable huffTableB[] = {
   {     0, 0, jbig2HuffmanEOT, 0     }
 };
 
-static JBIG2HuffmanTable huffTableC[] = {
+static const JBIG2HuffmanTable huffTableC[] = {
   {     0, 1,  0,              0x000 },
   {     1, 2,  0,              0x002 },
   {     2, 3,  0,              0x006 },
@@ -95,7 +95,7 @@ static JBIG2HuffmanTable huffTableC[] = {
   {     0, 0, jbig2HuffmanEOT, 0     }
 };
 
-static JBIG2HuffmanTable huffTableD[] = {
+static const JBIG2HuffmanTable huffTableD[] = {
   {     1, 1,  0,              0x000 },
   {     2, 2,  0,              0x002 },
   {     3, 3,  0,              0x006 },
@@ -105,7 +105,7 @@ static JBIG2HuffmanTable huffTableD[] = {
   {     0, 0, jbig2HuffmanEOT, 0     }
 };
 
-static JBIG2HuffmanTable huffTableE[] = {
+static const JBIG2HuffmanTable huffTableE[] = {
   {     1, 1,  0,              0x000 },
   {     2, 2,  0,              0x002 },
   {     3, 3,  0,              0x006 },
@@ -117,7 +117,7 @@ static JBIG2HuffmanTable huffTableE[] = {
   {     0, 0, jbig2HuffmanEOT, 0     }
 };
 
-static JBIG2HuffmanTable huffTableF[] = {
+static const JBIG2HuffmanTable huffTableF[] = {
   {     0, 2,  7,              0x000 },
   {   128, 3,  7,              0x002 },
   {   256, 3,  8,              0x003 },
@@ -135,7 +135,7 @@ static JBIG2HuffmanTable huffTableF[] = {
   {     0, 0, jbig2HuffmanEOT, 0     }
 };
 
-static JBIG2HuffmanTable huffTableG[] = {
+static const JBIG2HuffmanTable huffTableG[] = {
   {  -512, 3,  8,              0x000 },
   {   256, 3,  8,              0x001 },
   {   512, 3,  9,              0x002 },
@@ -154,7 +154,7 @@ static JBIG2HuffmanTable huffTableG[] = {
   {     0, 0, jbig2HuffmanEOT, 0     }
 };
 
-static JBIG2HuffmanTable huffTableH[] = {
+static const JBIG2HuffmanTable huffTableH[] = {
   {     0, 2,  1,              0x000 },
   {     0, 2, jbig2HuffmanOOB, 0x001 },
   {     4, 3,  4,              0x004 },
@@ -179,7 +179,7 @@ static JBIG2HuffmanTable huffTableH[] = {
   {     0, 0, jbig2HuffmanEOT, 0     }
 };
 
-static JBIG2HuffmanTable huffTableI[] = {
+static const JBIG2HuffmanTable huffTableI[] = {
   {     0, 2, jbig2HuffmanOOB, 0x000 },
   {    -1, 3,  1,              0x002 },
   {     1, 3,  1,              0x003 },
@@ -205,7 +205,7 @@ static JBIG2HuffmanTable huffTableI[] = {
   {     0, 0, jbig2HuffmanEOT, 0     }
 };
 
-static JBIG2HuffmanTable huffTableJ[] = {
+static const JBIG2HuffmanTable huffTableJ[] = {
   {    -2, 2,  2,              0x000 },
   {     6, 2,  6,              0x001 },
   {     0, 2, jbig2HuffmanOOB, 0x002 },
@@ -230,7 +230,7 @@ static JBIG2HuffmanTable huffTableJ[] = {
   {     0, 0, jbig2HuffmanEOT, 0     }
 };
 
-static JBIG2HuffmanTable huffTableK[] = {
+static const JBIG2HuffmanTable huffTableK[] = {
   {     1, 1,  0,              0x000 },
   {     2, 2,  1,              0x002 },
   {     4, 4,  0,              0x00c },
@@ -247,7 +247,7 @@ static JBIG2HuffmanTable huffTableK[] = {
   {     0, 0, jbig2HuffmanEOT, 0     }
 };
 
-static JBIG2HuffmanTable huffTableL[] = {
+static const JBIG2HuffmanTable huffTableL[] = {
   {     1, 1,  0,              0x000 },
   {     2, 2,  0,              0x002 },
   {     3, 3,  1,              0x006 },
@@ -264,7 +264,7 @@ static JBIG2HuffmanTable huffTableL[] = {
   {     0, 0, jbig2HuffmanEOT, 0     }
 };
 
-static JBIG2HuffmanTable huffTableM[] = {
+static const JBIG2HuffmanTable huffTableM[] = {
   {     1, 1,  0,              0x000 },
   {     2, 3,  0,              0x004 },
   {     7, 3,  3,              0x005 },
@@ -281,7 +281,7 @@ static JBIG2HuffmanTable huffTableM[] = {
   {     0, 0, jbig2HuffmanEOT, 0     }
 };
 
-static JBIG2HuffmanTable huffTableN[] = {
+static const JBIG2HuffmanTable huffTableN[] = {
   {     0, 1,  0,              0x000 },
   {    -2, 3,  0,              0x004 },
   {    -1, 3,  0,              0x005 },
@@ -290,7 +290,7 @@ static JBIG2HuffmanTable huffTableN[] = {
   {     0, 0, jbig2HuffmanEOT, 0     }
 };
 
-static JBIG2HuffmanTable huffTableO[] = {
+static const JBIG2HuffmanTable huffTableO[] = {
   {     0, 1,  0,              0x000 },
   {    -1, 3,  0,              0x004 },
   {     1, 3,  0,              0x005 },
@@ -321,7 +321,7 @@ public:
   void reset();
 
   // Returns false for OOB, otherwise sets *<x> and returns true.
-  bool decodeInt(int *x, JBIG2HuffmanTable *table);
+  bool decodeInt(int *x, const JBIG2HuffmanTable *table);
 
   unsigned int readBits(unsigned int n);
   unsigned int readBit();
@@ -350,7 +350,7 @@ void JBIG2HuffmanDecoder::reset() {
 }
 
 //~ optimize this
-bool JBIG2HuffmanDecoder::decodeInt(int *x, JBIG2HuffmanTable *table) {
+bool JBIG2HuffmanDecoder::decodeInt(int *x, const JBIG2HuffmanTable *table) {
   unsigned int i, len, prefix;
 
   i = 0;
@@ -1559,8 +1559,8 @@ void JBIG2Stream::readSegments() {
 bool JBIG2Stream::readSymbolDictSeg(unsigned int segNum, unsigned int length,
 				     unsigned int *refSegs, unsigned int nRefSegs) {
   JBIG2SymbolDict *symbolDict;
-  JBIG2HuffmanTable *huffDHTable, *huffDWTable;
-  JBIG2HuffmanTable *huffBMSizeTable, *huffAggInstTable;
+  const JBIG2HuffmanTable *huffDHTable, *huffDWTable;
+  const JBIG2HuffmanTable *huffBMSizeTable, *huffAggInstTable;
   JBIG2Segment *seg;
   std::vector<JBIG2Segment*> *codeTables;
   JBIG2SymbolDict *inputSymbolDict;
@@ -2021,9 +2021,9 @@ void JBIG2Stream::readTextRegionSeg(unsigned int segNum, bool imm,
   JBIG2Bitmap *bitmap;
   JBIG2HuffmanTable runLengthTab[36];
   JBIG2HuffmanTable *symCodeTab = nullptr;
-  JBIG2HuffmanTable *huffFSTable, *huffDSTable, *huffDTTable;
-  JBIG2HuffmanTable *huffRDWTable, *huffRDHTable;
-  JBIG2HuffmanTable *huffRDXTable, *huffRDYTable, *huffRSizeTable;
+  const JBIG2HuffmanTable *huffFSTable, *huffDSTable, *huffDTTable;
+  const JBIG2HuffmanTable *huffRDWTable, *huffRDHTable;
+  const JBIG2HuffmanTable *huffRDXTable, *huffRDYTable, *huffRSizeTable;
   JBIG2Segment *seg;
   std::vector<JBIG2Segment*> *codeTables;
   JBIG2SymbolDict *symbolDict;
@@ -2340,20 +2340,20 @@ JBIG2Bitmap *JBIG2Stream::readTextRegion(bool huff, bool refine,
 					 unsigned int numInstances,
 					 unsigned int logStrips,
 					 int numSyms,
-					 JBIG2HuffmanTable *symCodeTab,
+					 const JBIG2HuffmanTable *symCodeTab,
 					 unsigned int symCodeLen,
 					 JBIG2Bitmap **syms,
 					 unsigned int defPixel, unsigned int combOp,
 					 unsigned int transposed, unsigned int refCorner,
 					 int sOffset,
-					 JBIG2HuffmanTable *huffFSTable,
-					 JBIG2HuffmanTable *huffDSTable,
-					 JBIG2HuffmanTable *huffDTTable,
-					 JBIG2HuffmanTable *huffRDWTable,
-					 JBIG2HuffmanTable *huffRDHTable,
-					 JBIG2HuffmanTable *huffRDXTable,
-					 JBIG2HuffmanTable *huffRDYTable,
-					 JBIG2HuffmanTable *huffRSizeTable,
+					 const JBIG2HuffmanTable *huffFSTable,
+					 const JBIG2HuffmanTable *huffDSTable,
+					 const JBIG2HuffmanTable *huffDTTable,
+					 const JBIG2HuffmanTable *huffRDWTable,
+					 const JBIG2HuffmanTable *huffRDHTable,
+					 const JBIG2HuffmanTable *huffRDXTable,
+					 const JBIG2HuffmanTable *huffRDYTable,
+					 const JBIG2HuffmanTable *huffRSizeTable,
 					 unsigned int templ,
 					 int *atx, int *aty) {
   JBIG2Bitmap *bitmap;
diff --git a/poppler/JBIG2Stream.h b/poppler/JBIG2Stream.h
index 9222e8f6..b50703dd 100644
--- a/poppler/JBIG2Stream.h
+++ b/poppler/JBIG2Stream.h
@@ -70,20 +70,20 @@ private:
 			      unsigned int numInstances,
 			      unsigned int logStrips,
 			      int numSyms,
-			      JBIG2HuffmanTable *symCodeTab,
+			      const JBIG2HuffmanTable *symCodeTab,
 			      unsigned int symCodeLen,
 			      JBIG2Bitmap **syms,
 			      unsigned int defPixel, unsigned int combOp,
 			      unsigned int transposed, unsigned int refCorner,
 			      int sOffset,
-			      JBIG2HuffmanTable *huffFSTable,
-			      JBIG2HuffmanTable *huffDSTable,
-			      JBIG2HuffmanTable *huffDTTable,
-			      JBIG2HuffmanTable *huffRDWTable,
-			      JBIG2HuffmanTable *huffRDHTable,
-			      JBIG2HuffmanTable *huffRDXTable,
-			      JBIG2HuffmanTable *huffRDYTable,
-			      JBIG2HuffmanTable *huffRSizeTable,
+			      const JBIG2HuffmanTable *huffFSTable,
+			      const JBIG2HuffmanTable *huffDSTable,
+			      const JBIG2HuffmanTable *huffDTTable,
+			      const JBIG2HuffmanTable *huffRDWTable,
+			      const JBIG2HuffmanTable *huffRDHTable,
+			      const JBIG2HuffmanTable *huffRDXTable,
+			      const JBIG2HuffmanTable *huffRDYTable,
+			      const JBIG2HuffmanTable *huffRSizeTable,
 			      unsigned int templ,
 			      int *atx, int *aty);
   void readPatternDictSeg(unsigned int segNum, unsigned int length);
diff --git a/poppler/PDFDocEncoding.cc b/poppler/PDFDocEncoding.cc
index 79408346..422a79fe 100644
--- a/poppler/PDFDocEncoding.cc
+++ b/poppler/PDFDocEncoding.cc
@@ -33,7 +33,7 @@
 // the corresponding Unicode values.  Other control characters are left
 // undefined.
 
-Unicode pdfDocEncoding[256] = {
+const Unicode pdfDocEncoding[256] = {
   0x0000, 0x0001, 0x0002, 0x0003, 0x0004, 0x0005, 0x0006, 0x0007, // 00
   0x0008, 0x0009, 0x000a, 0x000b, 0x000c, 0x000d, 0x000e, 0x000f,
   0x0010, 0x0011, 0x0012, 0x0013, 0x0014, 0x0015, 0x0016, 0x0017, // 10
diff --git a/poppler/PDFDocEncoding.h b/poppler/PDFDocEncoding.h
index eed599fa..e404c125 100644
--- a/poppler/PDFDocEncoding.h
+++ b/poppler/PDFDocEncoding.h
@@ -27,7 +27,7 @@
 
 class GooString;
 
-extern Unicode pdfDocEncoding[256];
+extern const Unicode pdfDocEncoding[256];
 
 char* pdfDocEncodingToUTF16 (const GooString* orig, int* length);
 
diff --git a/poppler/Stream.cc b/poppler/Stream.cc
index 99ccbd22..7bd6b2de 100644
--- a/poppler/Stream.cc
+++ b/poppler/Stream.cc
@@ -3845,11 +3845,11 @@ bool DCTStream::isBinary(bool last) {
 // FlateStream
 //------------------------------------------------------------------------
 
-int FlateStream::codeLenCodeMap[flateMaxCodeLenCodes] = {
+const int FlateStream::codeLenCodeMap[flateMaxCodeLenCodes] = {
   16, 17, 18, 0, 8, 7, 9, 6, 10, 5, 11, 4, 12, 3, 13, 2, 14, 1, 15
 };
 
-FlateDecode FlateStream::lengthDecode[flateMaxLitCodes-257] = {
+const FlateDecode FlateStream::lengthDecode[flateMaxLitCodes-257] = {
   {0,   3},
   {0,   4},
   {0,   5},
@@ -3883,7 +3883,7 @@ FlateDecode FlateStream::lengthDecode[flateMaxLitCodes-257] = {
   {0, 258}
 };
 
-FlateDecode FlateStream::distDecode[flateMaxDistCodes] = {
+const FlateDecode FlateStream::distDecode[flateMaxDistCodes] = {
   { 0,     1},
   { 0,     2},
   { 0,     3},
@@ -3916,7 +3916,7 @@ FlateDecode FlateStream::distDecode[flateMaxDistCodes] = {
   {13, 24577}
 };
 
-static FlateCode flateFixedLitCodeTabCodes[512] = {
+static const FlateCode flateFixedLitCodeTabCodes[512] = {
   {7, 0x0100},
   {8, 0x0050},
   {8, 0x0010},
@@ -4432,10 +4432,10 @@ static FlateCode flateFixedLitCodeTabCodes[512] = {
 };
 
 FlateHuffmanTab FlateStream::fixedLitCodeTab = {
-  flateFixedLitCodeTabCodes, 9
+  const_cast<FlateCode*>(flateFixedLitCodeTabCodes), 9
 };
 
-static FlateCode flateFixedDistCodeTabCodes[32] = {
+static const FlateCode flateFixedDistCodeTabCodes[32] = {
   {5, 0x0000},
   {5, 0x0010},
   {5, 0x0008},
@@ -4471,7 +4471,7 @@ static FlateCode flateFixedDistCodeTabCodes[32] = {
 };
 
 FlateHuffmanTab FlateStream::fixedDistCodeTab = {
-  flateFixedDistCodeTabCodes, 5
+  const_cast<FlateCode*>(flateFixedDistCodeTabCodes), 5
 };
 
 FlateStream::FlateStream(Stream *strA, int predictor, int columns,
diff --git a/poppler/Stream.h b/poppler/Stream.h
index 32987c48..36bdf530 100644
--- a/poppler/Stream.h
+++ b/poppler/Stream.h
@@ -1124,11 +1124,11 @@ private:
   bool endOfBlock;		// set when end of block is reached
   bool eof;			// set when end of stream is reached
 
-  static int			// code length code reordering
+  static const int		// code length code reordering
     codeLenCodeMap[flateMaxCodeLenCodes];
-  static FlateDecode		// length decoding info
+  static const FlateDecode	// length decoding info
     lengthDecode[flateMaxLitCodes-257];
-  static FlateDecode		// distance decoding info
+  static const FlateDecode	// distance decoding info
     distDecode[flateMaxDistCodes];
   static FlateHuffmanTab	// fixed literal code table
     fixedLitCodeTab;
diff --git a/poppler/UnicodeMap.cc b/poppler/UnicodeMap.cc
index 8f271d5a..09014a6a 100644
--- a/poppler/UnicodeMap.cc
+++ b/poppler/UnicodeMap.cc
@@ -139,11 +139,11 @@ UnicodeMap::UnicodeMap(GooString *encodingNameA) {
 }
 
 UnicodeMap::UnicodeMap(const char *encodingNameA, bool unicodeOutA,
-		       UnicodeMapRange *rangesA, int lenA) {
+		       const UnicodeMapRange *rangesA, int lenA) {
   encodingName = new GooString(encodingNameA);
   unicodeOut = unicodeOutA;
   kind = unicodeMapResident;
-  ranges = rangesA;
+  ranges = const_cast<UnicodeMapRange*>(rangesA);
   len = lenA;
   eMaps = nullptr;
   eMapsLen = 0;
diff --git a/poppler/UnicodeMap.h b/poppler/UnicodeMap.h
index 383a6933..4373c90a 100644
--- a/poppler/UnicodeMap.h
+++ b/poppler/UnicodeMap.h
@@ -61,7 +61,7 @@ public:
 
   // Create a resident UnicodeMap.
   UnicodeMap(const char *encodingNameA, bool unicodeOutA,
-	     UnicodeMapRange *rangesA, int lenA);
+	     const UnicodeMapRange *rangesA, int lenA);
 
   // Create a resident UnicodeMap that uses a function instead of a
   // list of ranges.
diff --git a/poppler/UnicodeMapTables.h b/poppler/UnicodeMapTables.h
index 073e474e..3733a63d 100644
--- a/poppler/UnicodeMapTables.h
+++ b/poppler/UnicodeMapTables.h
@@ -6,7 +6,7 @@
 //
 //========================================================================
 
-static UnicodeMapRange latin1UnicodeMapRanges[] = {
+static const UnicodeMapRange latin1UnicodeMapRanges[] = {
   { 0x000a, 0x000a, 0x0a, 1 },
   { 0x000c, 0x000d, 0x0c, 1 },
   { 0x0020, 0x007e, 0x20, 1 },
@@ -70,7 +70,7 @@ static UnicodeMapRange latin1UnicodeMapRanges[] = {
 };
 #define latin1UnicodeMapLen (sizeof(latin1UnicodeMapRanges) / sizeof(UnicodeMapRange))
 
-static UnicodeMapRange ascii7UnicodeMapRanges[] = {
+static const UnicodeMapRange ascii7UnicodeMapRanges[] = {
   { 0x000a, 0x000a, 0x0a, 1 },
   { 0x000c, 0x000d, 0x0c, 1 },
   { 0x0020, 0x005f, 0x20, 1 },
@@ -205,7 +205,7 @@ static UnicodeMapRange ascii7UnicodeMapRanges[] = {
 };
 #define ascii7UnicodeMapLen (sizeof(ascii7UnicodeMapRanges) / sizeof(UnicodeMapRange))
 
-static UnicodeMapRange symbolUnicodeMapRanges[] = {
+static const UnicodeMapRange symbolUnicodeMapRanges[] = {
   { 0x0020, 0x0021, 0x20, 1 },
   { 0x0023, 0x0023, 0x23, 1 },
   { 0x0025, 0x0026, 0x25, 1 },
@@ -330,7 +330,7 @@ static UnicodeMapRange symbolUnicodeMapRanges[] = {
 };
 #define symbolUnicodeMapLen (sizeof(symbolUnicodeMapRanges) / sizeof(UnicodeMapRange))
 
-static UnicodeMapRange zapfDingbatsUnicodeMapRanges[] = {
+static const UnicodeMapRange zapfDingbatsUnicodeMapRanges[] = {
   { 0x0020, 0x0020, 0x20, 1 },
   { 0x2192, 0x2192, 0xd5, 1 },
   { 0x2194, 0x2195, 0xd6, 1 },


More information about the poppler mailing list