Add some const

Suggested by clang-tidy readability-non-const-parameter check
diff --git a/fofi/FoFiTrueType.cc b/fofi/FoFiTrueType.cc
index c9c353c..8213c1d 100644
--- a/fofi/FoFiTrueType.cc
+++ b/fofi/FoFiTrueType.cc
@@ -572,7 +572,7 @@
 }
 
 void FoFiTrueType::convertToCIDType2(const char *psName,
-				     int *cidMap, int nCIDs,
+				     const int *cidMap, int nCIDs,
 				     bool needVerticalMetrics,
 				     FoFiOutputFunc outputFunc,
 				     void *outputStream) const {
@@ -880,7 +880,7 @@
 }
 
 void FoFiTrueType::cvtCharStrings(char **encoding,
-				  int *codeToGID,
+				  const int *codeToGID,
 				  FoFiOutputFunc outputFunc,
 				  void *outputStream) const {
   const char *name;
diff --git a/fofi/FoFiTrueType.h b/fofi/FoFiTrueType.h
index ee35e4f..7ef0cab 100644
--- a/fofi/FoFiTrueType.h
+++ b/fofi/FoFiTrueType.h
@@ -125,7 +125,7 @@
   // name (so we don't need to depend on the 'name' table in the
   // font).  The <cidMap> array maps CIDs to GIDs; it has <nCIDs>
   // entries.  (Not useful for OpenType CFF fonts.)
-  void convertToCIDType2(const char *psName, int *cidMap, int nCIDs,
+  void convertToCIDType2(const char *psName, const int *cidMap, int nCIDs,
 			 bool needVerticalMetrics,
 			 FoFiOutputFunc outputFunc, void *outputStream) const;
 
@@ -169,7 +169,7 @@
 		   FoFiOutputFunc outputFunc,
 		   void *outputStream) const;
   void cvtCharStrings(char **encoding,
-		      int *codeToGID,
+		      const int *codeToGID,
 		      FoFiOutputFunc outputFunc,
 		      void *outputStream) const;
   void cvtSfnts(FoFiOutputFunc outputFunc,
diff --git a/fofi/FoFiType1C.cc b/fofi/FoFiType1C.cc
index 522b86a..96b0586 100644
--- a/fofi/FoFiType1C.cc
+++ b/fofi/FoFiType1C.cc
@@ -489,7 +489,7 @@
   (*outputFunc)(outputStream, "cleartomark\n", 12);
 }
 
-void FoFiType1C::convertToCIDType0(const char *psName, int *codeMap, int nCodes,
+void FoFiType1C::convertToCIDType0(const char *psName, const int *codeMap, int nCodes,
 				   FoFiOutputFunc outputFunc,
 				   void *outputStream) {
   int *cidMap;
@@ -834,7 +834,7 @@
   gfree(cidMap);
 }
 
-void FoFiType1C::convertToType0(const char *psName, int *codeMap, int nCodes,
+void FoFiType1C::convertToType0(const char *psName, const int *codeMap, int nCodes,
 				FoFiOutputFunc outputFunc,
 				void *outputStream) {
   int *cidMap;
diff --git a/fofi/FoFiType1C.h b/fofi/FoFiType1C.h
index 920abdd..a1f8edc 100644
--- a/fofi/FoFiType1C.h
+++ b/fofi/FoFiType1C.h
@@ -186,7 +186,7 @@
   //     font's internal CID-to-GID mapping is used
   // (3) is <codeMap> is NULL and this is an 8-bit CFF font, then
   //     the identity CID-to-GID mapping is used
-  void convertToCIDType0(const char *psName, int *codeMap, int nCodes,
+  void convertToCIDType0(const char *psName, const int *codeMap, int nCodes,
 			 FoFiOutputFunc outputFunc, void *outputStream);
 
   // Convert to a Type 0 (but non-CID) composite font, suitable for
@@ -198,7 +198,7 @@
   //     font's internal CID-to-GID mapping is used
   // (3) is <codeMap> is NULL and this is an 8-bit CFF font, then
   //     the identity CID-to-GID mapping is used
-  void convertToType0(const char *psName, int *codeMap, int nCodes,
+  void convertToType0(const char *psName, const int *codeMap, int nCodes,
 		      FoFiOutputFunc outputFunc, void *outputStream);
 
 private:
diff --git a/poppler/CairoOutputDev.cc b/poppler/CairoOutputDev.cc
index d09cab5..2571041 100644
--- a/poppler/CairoOutputDev.cc
+++ b/poppler/CairoOutputDev.cc
@@ -3068,7 +3068,7 @@
   GfxRGB *lookup;
   int width;
   GfxImageColorMap *colorMap;
-  int *maskColors;
+  const int *maskColors;
   int current_row;
   bool imageError;
 
@@ -3078,7 +3078,7 @@
                                   int scaledWidth, int scaledHeight,
                                   bool printing,
                                   GfxImageColorMap *colorMapA,
-                                  int *maskColorsA) {
+                                  const int *maskColorsA) {
     cairo_surface_t *image = nullptr;
     int i;
 
@@ -3253,7 +3253,7 @@
 			       int widthA, int heightA,
 			       GfxImageColorMap *colorMap,
 			       bool interpolate,
-			       int *maskColors, bool inlineImg)
+			       const int *maskColors, bool inlineImg)
 {
   cairo_surface_t *image;
   cairo_pattern_t *pattern, *maskPattern;
@@ -3474,7 +3474,7 @@
 
 void CairoImageOutputDev::drawImage(GfxState *state, Object *ref, Stream *str,
 				    int width, int height, GfxImageColorMap *colorMap,
-				    bool interpolate, int *maskColors, bool inlineImg)
+				    bool interpolate, const int *maskColors, bool inlineImg)
 {
   cairo_t *cr;
   cairo_surface_t *surface;
diff --git a/poppler/CairoOutputDev.h b/poppler/CairoOutputDev.h
index 0fbbf0d..b6ff839 100644
--- a/poppler/CairoOutputDev.h
+++ b/poppler/CairoOutputDev.h
@@ -221,7 +221,7 @@
 
   void drawImage(GfxState *state, Object *ref, Stream *str,
 		 int width, int height, GfxImageColorMap *colorMap,
-		 bool interpolate, int *maskColors, bool inlineImg) override;
+		 bool interpolate, const int *maskColors, bool inlineImg) override;
   void drawSoftMaskedImage(GfxState *state, Object *ref, Stream *str,
 			   int width, int height,
 			   GfxImageColorMap *colorMap,
@@ -469,7 +469,7 @@
 		     bool interpolate, bool inlineImg) override;
   void drawImage(GfxState *state, Object *ref, Stream *str,
 		 int width, int height, GfxImageColorMap *colorMap,
-		 bool interpolate, int *maskColors, bool inlineImg) override;
+		 bool interpolate, const int *maskColors, bool inlineImg) override;
   void drawSoftMaskedImage(GfxState *state, Object *ref, Stream *str,
 			   int width, int height,
 			   GfxImageColorMap *colorMap,
diff --git a/poppler/CairoRescaleBox.cc b/poppler/CairoRescaleBox.cc
index 7fd0704..04b0955 100644
--- a/poppler/CairoRescaleBox.cc
+++ b/poppler/CairoRescaleBox.cc
@@ -62,8 +62,8 @@
 
 static void downsample_row_box_filter (
         int start, int width,
-        uint32_t *src, uint32_t *src_limit, uint32_t *dest,
-        int coverage[], int pixel_coverage)
+        uint32_t *src, const uint32_t *src_limit, uint32_t *dest,
+        const int coverage[], int pixel_coverage)
 {
     /* we need an array of the pixel contribution of each destination pixel on the boundaries.
      * we invert the value to get the value on the other size of the box */
diff --git a/poppler/CharCodeToUnicode.cc b/poppler/CharCodeToUnicode.cc
index 90d1bac..3faeaee 100644
--- a/poppler/CharCodeToUnicode.cc
+++ b/poppler/CharCodeToUnicode.cc
@@ -603,7 +603,7 @@
   return 0;
 }
 
-int CharCodeToUnicode::mapToCharCode(Unicode* u, CharCode *c, int usize) const {
+int CharCodeToUnicode::mapToCharCode(const Unicode* u, CharCode *c, int usize) const {
   //look for charcode in map
   if (usize == 1 || (usize > 1 && !(*u & ~0xff))) {
     if (isIdentity) {
diff --git a/poppler/CharCodeToUnicode.h b/poppler/CharCodeToUnicode.h
index 9c57fb2..187fa8a 100644
--- a/poppler/CharCodeToUnicode.h
+++ b/poppler/CharCodeToUnicode.h
@@ -91,7 +91,7 @@
   int mapToUnicode(CharCode c, Unicode **u);
 
   // Map a Unicode to CharCode.
-  int mapToCharCode(Unicode* u, CharCode *c, int usize) const;
+  int mapToCharCode(const Unicode* u, CharCode *c, int usize) const;
 
   // Return the mapping's length, i.e., one more than the max char
   // code supported by the mapping.
diff --git a/poppler/DateInfo.cc b/poppler/DateInfo.cc
index 4cbc095..394325e 100644
--- a/poppler/DateInfo.cc
+++ b/poppler/DateInfo.cc
@@ -76,7 +76,7 @@
    return false;
 }
 
-GooString *timeToDateString(time_t *timeA)
+GooString *timeToDateString(const time_t *timeA)
 {
   const time_t timet = timeA ? *timeA : time(nullptr);
 
diff --git a/poppler/DateInfo.h b/poppler/DateInfo.h
index d726b31..feb9be0 100644
--- a/poppler/DateInfo.h
+++ b/poppler/DateInfo.h
@@ -33,7 +33,7 @@
  * If timet is NULL, current time is used.
  * Returns new GooString. Free with delete.
  */
-GooString *timeToDateString(time_t *timet);
+GooString *timeToDateString(const time_t *timet);
 
 /* Convert PDF date string to time.
  * Returns -1 if conversion fails.
diff --git a/poppler/Decrypt.cc b/poppler/Decrypt.cc
index cc343a5..60daf40 100644
--- a/poppler/Decrypt.cc
+++ b/poppler/Decrypt.cc
@@ -37,18 +37,18 @@
 #include "Decrypt.h"
 #include "Error.h"
 
-static void rc4InitKey(unsigned char *key, int keyLen, unsigned char *state);
+static void rc4InitKey(const unsigned char *key, int keyLen, unsigned char *state);
 static unsigned char rc4DecryptByte(unsigned char *state, unsigned char *x, unsigned char *y, unsigned char c);
 
 static bool aesReadBlock(Stream  *str, unsigned char *in, bool addPadding);
 
-static void aesKeyExpansion(DecryptAESState *s, unsigned char *objKey, int objKeyLen, bool decrypt);
-static void aesEncryptBlock(DecryptAESState *s, unsigned char *in);
-static void aesDecryptBlock(DecryptAESState *s, unsigned char *in, bool last);
+static void aesKeyExpansion(DecryptAESState *s, const unsigned char *objKey, int objKeyLen, bool decrypt);
+static void aesEncryptBlock(DecryptAESState *s, const unsigned char *in);
+static void aesDecryptBlock(DecryptAESState *s, const unsigned char *in, bool last);
 
-static void aes256KeyExpansion(DecryptAES256State *s, unsigned char *objKey, int objKeyLen, bool decrypt);
-static void aes256EncryptBlock(DecryptAES256State *s, unsigned char *in);
-static void aes256DecryptBlock(DecryptAES256State *s, unsigned char *in, bool last);
+static void aes256KeyExpansion(DecryptAES256State *s, const unsigned char *objKey, int objKeyLen, bool decrypt);
+static void aes256EncryptBlock(DecryptAES256State *s, const unsigned char *in);
+static void aes256DecryptBlock(DecryptAES256State *s, const unsigned char *in, bool last);
 
 static void sha256(unsigned char *msg, int msgLen, unsigned char *hash);
 static void sha384(unsigned char *msg, int msgLen, unsigned char *hash);
@@ -574,7 +574,7 @@
 // RC4-compatible decryption
 //------------------------------------------------------------------------
 
-static void rc4InitKey(unsigned char *key, int keyLen, unsigned char *state) {
+static void rc4InitKey(const unsigned char *key, int keyLen, unsigned char *state) {
   unsigned char index1, index2;
   unsigned char t;
   int i;
@@ -925,7 +925,7 @@
   }
 }
 
-static inline void addRoundKey(unsigned char *state, unsigned int *w) {
+static inline void addRoundKey(unsigned char *state, const unsigned int *w) {
   int c;
 
   for (c = 0; c < 4; ++c) {
@@ -937,7 +937,7 @@
 }
 
 static void aesKeyExpansion(DecryptAESState *s,
-			    unsigned char *objKey, int /*objKeyLen*/, bool decrypt) {
+			    const unsigned char *objKey, int /*objKeyLen*/, bool decrypt) {
   unsigned int temp;
   int i, round;
 
@@ -963,7 +963,7 @@
   }
 }
 
-static void aesEncryptBlock(DecryptAESState *s, unsigned char *in) {
+static void aesEncryptBlock(DecryptAESState *s, const unsigned char *in) {
   int c, round;
 
   // initial state (input is xor'd with previous output because of CBC)
@@ -1000,7 +1000,7 @@
   s->bufIdx = 0;
 }
 
-static void aesDecryptBlock(DecryptAESState *s, unsigned char *in, bool last) {
+static void aesDecryptBlock(DecryptAESState *s, const unsigned char *in, bool last) {
   int c, round, n, i;
 
   // initial state
@@ -1059,7 +1059,7 @@
 //------------------------------------------------------------------------
 
 static void aes256KeyExpansion(DecryptAES256State *s,
-			       unsigned char *objKey, int objKeyLen, bool decrypt) {
+			       const unsigned char *objKey, int objKeyLen, bool decrypt) {
   unsigned int temp;
   int i, round;
 
@@ -1087,7 +1087,7 @@
   }
 }
 
-static void aes256EncryptBlock(DecryptAES256State *s, unsigned char *in) {
+static void aes256EncryptBlock(DecryptAES256State *s, const unsigned char *in) {
   int c, round;
 
   // initial state (input is xor'd with previous output because of CBC)
@@ -1124,7 +1124,7 @@
   s->bufIdx = 0;
 }
 
-static void aes256DecryptBlock(DecryptAES256State *s, unsigned char *in, bool last) {
+static void aes256DecryptBlock(DecryptAES256State *s, const unsigned char *in, bool last) {
   int c, round, n, i;
 
   // initial state
@@ -1411,7 +1411,7 @@
   return rotr(x, 17) ^ rotr(x, 19) ^ (x >> 10);
 }
 
-static void sha256HashBlock(unsigned char *blk, unsigned int *H) {
+static void sha256HashBlock(const unsigned char *blk, unsigned int *H) {
   unsigned int W[64];
   unsigned int a, b, c, d, e, f, g, h;
   unsigned int T1, T2;
@@ -1561,7 +1561,7 @@
   return rotr(x, 19) ^ rotr(x, 61) ^ (x >> 6);
 }
 
-static void sha512HashBlock(unsigned char *blk, uint64_t *H) {
+static void sha512HashBlock(const unsigned char *blk, uint64_t *H) {
   uint64_t W[80];
   uint64_t a, b, c, d, e, f, g, h;
   uint64_t T1, T2;
diff --git a/poppler/GfxState.cc b/poppler/GfxState.cc
index 5a95386..43c9131 100644
--- a/poppler/GfxState.cc
+++ b/poppler/GfxState.cc
@@ -3401,8 +3401,8 @@
 }
 
 GfxTilingPattern::GfxTilingPattern(int paintTypeA, int tilingTypeA,
-				   double *bboxA, double xStepA, double yStepA,
-				   Object *resDictA, double *matrixA,
+				   const double *bboxA, double xStepA, double yStepA,
+				   Object *resDictA, const double *matrixA,
 				   Object *contentStreamA, int patternRefNumA) :
   GfxPattern(1, patternRefNumA)
 {
@@ -3468,7 +3468,7 @@
   return new GfxShadingPattern(shadingA, matrixA, patternRefNum);
 }
 
-GfxShadingPattern::GfxShadingPattern(GfxShading *shadingA, double *matrixA, int patternRefNumA):
+GfxShadingPattern::GfxShadingPattern(GfxShading *shadingA, const double *matrixA, int patternRefNumA):
   GfxPattern(2, patternRefNumA)
 {
   int i;
@@ -3652,7 +3652,7 @@
 
 GfxFunctionShading::GfxFunctionShading(double x0A, double y0A,
 				       double x1A, double y1A,
-				       double *matrixA,
+				       const double *matrixA,
 				       Function **funcsA, int nFuncsA):
   GfxShading(1)
 {
@@ -5893,7 +5893,7 @@
   gfree(byte_lookup);
 }
 
-void GfxImageColorMap::getGray(unsigned char *x, GfxGray *gray) {
+void GfxImageColorMap::getGray(const unsigned char *x, GfxGray *gray) {
   GfxColor color;
   int i;
 
@@ -5910,7 +5910,7 @@
   }
 }
 
-void GfxImageColorMap::getRGB(unsigned char *x, GfxRGB *rgb) {
+void GfxImageColorMap::getRGB(const unsigned char *x, GfxRGB *rgb) {
   GfxColor color;
   int i;
 
@@ -6191,7 +6191,7 @@
 
 }
 
-void GfxImageColorMap::getCMYK(unsigned char *x, GfxCMYK *cmyk) {
+void GfxImageColorMap::getCMYK(const unsigned char *x, GfxCMYK *cmyk) {
   GfxColor color;
   int i;
 
@@ -6208,7 +6208,7 @@
   }
 }
 
-void GfxImageColorMap::getDeviceN(unsigned char *x, GfxColor *deviceN) {
+void GfxImageColorMap::getDeviceN(const unsigned char *x, GfxColor *deviceN) {
   GfxColor color;
   int i;
 
@@ -6225,7 +6225,7 @@
   }
 }
 
-void GfxImageColorMap::getColor(unsigned char *x, GfxColor *color) {
+void GfxImageColorMap::getColor(const unsigned char *x, GfxColor *color) {
   int maxPixel, i;
 
   maxPixel = (1 << bits) - 1;
diff --git a/poppler/GfxState.h b/poppler/GfxState.h
index 5a66a18..7a6e403 100644
--- a/poppler/GfxState.h
+++ b/poppler/GfxState.h
@@ -806,8 +806,8 @@
 private:
 
   GfxTilingPattern(int paintTypeA, int tilingTypeA,
-		   double *bboxA, double xStepA, double yStepA,
-		   Object *resDictA, double *matrixA,
+		   const double *bboxA, double xStepA, double yStepA,
+		   Object *resDictA, const double *matrixA,
 		   Object *contentStreamA, int patternRefNumA);
 
   int paintType;
@@ -836,7 +836,7 @@
 
 private:
 
-  GfxShadingPattern(GfxShading *shadingA, double *matrixA, int patternRefNumA);
+  GfxShadingPattern(GfxShading *shadingA, const double *matrixA, int patternRefNumA);
 
   GfxShading *shading;
   double matrix[6];
@@ -943,7 +943,7 @@
 
   GfxFunctionShading(double x0A, double y0A,
 		     double x1A, double y1A,
-		     double *matrixA,
+		     const double *matrixA,
 		     Function **funcsA, int nFuncsA);
   GfxFunctionShading(GfxFunctionShading *shading);
   ~GfxFunctionShading();
@@ -1206,17 +1206,17 @@
   bool useDeviceNLine() const { return (colorSpace2 && colorSpace2->useGetDeviceNLine ()) || (!colorSpace2 && colorSpace->useGetDeviceNLine ()); }
 
   // Convert an image pixel to a color.
-  void getGray(unsigned char *x, GfxGray *gray);
-  void getRGB(unsigned char *x, GfxRGB *rgb);
+  void getGray(const unsigned char *x, GfxGray *gray);
+  void getRGB(const unsigned char *x, GfxRGB *rgb);
   void getRGBLine(unsigned char *in, unsigned int *out, int length);
   void getRGBLine(unsigned char *in, unsigned char *out, int length);
   void getRGBXLine(unsigned char *in, unsigned char *out, int length);
   void getGrayLine(unsigned char *in, unsigned char *out, int length);
   void getCMYKLine(unsigned char *in, unsigned char *out, int length);
   void getDeviceNLine(unsigned char *in, unsigned char *out, int length);
-  void getCMYK(unsigned char *x, GfxCMYK *cmyk);
-  void getDeviceN(unsigned char *x, GfxColor *deviceN);
-  void getColor(unsigned char *x, GfxColor *color);
+  void getCMYK(const unsigned char *x, GfxCMYK *cmyk);
+  void getDeviceN(const unsigned char *x, GfxColor *deviceN);
+  void getColor(const unsigned char *x, GfxColor *color);
 
   // Matte color ops
   void setMatteColor(const GfxColor *color) { useMatte = true; matteColor = *color; }
diff --git a/poppler/OutputDev.cc b/poppler/OutputDev.cc
index 15ab4a1..de550d0 100644
--- a/poppler/OutputDev.cc
+++ b/poppler/OutputDev.cc
@@ -126,7 +126,7 @@
 
 void OutputDev::drawImage(GfxState *state, Object *ref, Stream *str,
 			  int width, int height, GfxImageColorMap *colorMap,
-			  bool interpolate, int *maskColors, bool inlineImg) {
+			  bool interpolate, const int *maskColors, bool inlineImg) {
   int i, j;
 
   if (inlineImg) {
diff --git a/poppler/OutputDev.h b/poppler/OutputDev.h
index b7b113d..01858f9 100644
--- a/poppler/OutputDev.h
+++ b/poppler/OutputDev.h
@@ -299,7 +299,7 @@
   virtual void unsetSoftMaskFromImageMask(GfxState *state, double *baseMatrix);
   virtual void drawImage(GfxState *state, Object *ref, Stream *str,
 			 int width, int height, GfxImageColorMap *colorMap,
-			 bool interpolate, int *maskColors, bool inlineImg);
+			 bool interpolate, const int *maskColors, bool inlineImg);
   virtual void drawMaskedImage(GfxState *state, Object *ref, Stream *str,
 			       int width, int height,
 			       GfxImageColorMap *colorMap, bool interpolate,
diff --git a/poppler/PSOutputDev.cc b/poppler/PSOutputDev.cc
index 694d059..52fd822 100644
--- a/poppler/PSOutputDev.cc
+++ b/poppler/PSOutputDev.cc
@@ -5247,7 +5247,7 @@
 
 void PSOutputDev::drawImage(GfxState *state, Object *ref, Stream *str,
 			    int width, int height, GfxImageColorMap *colorMap,
-			    bool interpolate, int *maskColors, bool inlineImg) {
+			    bool interpolate, const int *maskColors, bool inlineImg) {
   int len;
 
   len = height * ((width * colorMap->getNumPixelComps() *
@@ -5314,7 +5314,7 @@
 void PSOutputDev::doImageL1(Object *ref, GfxImageColorMap *colorMap,
 			    bool invert, bool inlineImg,
 			    Stream *str, int width, int height, int len,
-			    int *maskColors, Stream *maskStr,
+			    const int *maskColors, Stream *maskStr,
 			    int maskWidth, int maskHeight, bool maskInvert) {
   ImageStream *imgStr;
   unsigned char pixBuf[gfxColorMaxComps];
@@ -5470,7 +5470,7 @@
 void PSOutputDev::doImageL1Sep(Object *ref, GfxImageColorMap *colorMap,
 			       bool invert, bool inlineImg,
 			       Stream *str, int width, int height, int len,
-			       int *maskColors, Stream *maskStr,
+			       const int *maskColors, Stream *maskStr,
 			       int maskWidth, int maskHeight, bool maskInvert) {
   ImageStream *imgStr;
   unsigned char *lineBuf;
@@ -5696,7 +5696,7 @@
 void PSOutputDev::doImageL2(Object *ref, GfxImageColorMap *colorMap,
 			    bool invert, bool inlineImg,
 			    Stream *str, int width, int height, int len,
-			    int *maskColors, Stream *maskStr,
+			    const int *maskColors, Stream *maskStr,
 			    int maskWidth, int maskHeight, bool maskInvert) {
   Stream *str2;
   ImageStream *imgStr;
@@ -6176,7 +6176,7 @@
 void PSOutputDev::doImageL3(Object *ref, GfxImageColorMap *colorMap,
 			    bool invert, bool inlineImg,
 			    Stream *str, int width, int height, int len,
-			    int *maskColors, Stream *maskStr,
+			    const int *maskColors, Stream *maskStr,
 			    int maskWidth, int maskHeight, bool maskInvert) {
   Stream *str2;
   GooString *s;
diff --git a/poppler/PSOutputDev.h b/poppler/PSOutputDev.h
index 44dacf8..7e6d170 100644
--- a/poppler/PSOutputDev.h
+++ b/poppler/PSOutputDev.h
@@ -271,7 +271,7 @@
   void unsetSoftMaskFromImageMask(GfxState *state, double *baseMatrix) override;
   void drawImage(GfxState *state, Object *ref, Stream *str,
 			 int width, int height, GfxImageColorMap *colorMap,
-			 bool interpolate, int *maskColors, bool inlineImg) override;
+			 bool interpolate, const int *maskColors, bool inlineImg) override;
   void drawMaskedImage(GfxState *state, Object *ref, Stream *str,
 			       int width, int height,
 			       GfxImageColorMap *colorMap,
@@ -388,22 +388,22 @@
   void doImageL1(Object *ref, GfxImageColorMap *colorMap,
 		 bool invert, bool inlineImg,
 		 Stream *str, int width, int height, int len,
-		 int *maskColors, Stream *maskStr,
+		 const int *maskColors, Stream *maskStr,
 		 int maskWidth, int maskHeight, bool maskInvert);
   void doImageL1Sep(Object *ref, GfxImageColorMap *colorMap,
 		    bool invert, bool inlineImg,
 		    Stream *str, int width, int height, int len,
-		    int *maskColors, Stream *maskStr,
+		    const int *maskColors, Stream *maskStr,
 		    int maskWidth, int maskHeight, bool maskInvert);
   void doImageL2(Object *ref, GfxImageColorMap *colorMap,
 		 bool invert, bool inlineImg,
 		 Stream *str, int width, int height, int len,
-		 int *maskColors, Stream *maskStr,
+		 const int *maskColors, Stream *maskStr,
 		 int maskWidth, int maskHeight, bool maskInvert);
   void doImageL3(Object *ref, GfxImageColorMap *colorMap,
 		 bool invert, bool inlineImg,
 		 Stream *str, int width, int height, int len,
-		 int *maskColors, Stream *maskStr,
+		 const int *maskColors, Stream *maskStr,
 		 int maskWidth, int maskHeight, bool maskInvert);
   void dumpColorSpaceL2(GfxColorSpace *colorSpace,
 			bool genXform, bool updateColors,
diff --git a/poppler/PreScanOutputDev.cc b/poppler/PreScanOutputDev.cc
index 9c46049..7812cf2 100644
--- a/poppler/PreScanOutputDev.cc
+++ b/poppler/PreScanOutputDev.cc
@@ -218,7 +218,7 @@
 void PreScanOutputDev::drawImage(GfxState *state, Object * /*ref*/, Stream *str,
 				 int width, int height,
 				 GfxImageColorMap *colorMap,
-				 bool /*interpolate*/, int * /*maskColors*/, bool inlineImg) {
+				 bool /*interpolate*/, const int * /*maskColors*/, bool inlineImg) {
   GfxColorSpace *colorSpace;
   int i, j;
 
diff --git a/poppler/PreScanOutputDev.h b/poppler/PreScanOutputDev.h
index cd62479..a2ec027 100644
--- a/poppler/PreScanOutputDev.h
+++ b/poppler/PreScanOutputDev.h
@@ -108,7 +108,7 @@
 		     bool interpolate, bool inlineImg) override;
   void drawImage(GfxState *state, Object *ref, Stream *str,
 		 int width, int height, GfxImageColorMap *colorMap,
-		 bool interpolate, int *maskColors, bool inlineImg) override;
+		 bool interpolate, const int *maskColors, bool inlineImg) override;
   void drawMaskedImage(GfxState *state, Object *ref, Stream *str,
 		      int width, int height,
 		      GfxImageColorMap *colorMap,
diff --git a/poppler/SplashOutputDev.cc b/poppler/SplashOutputDev.cc
index aba4578..440ee30 100644
--- a/poppler/SplashOutputDev.cc
+++ b/poppler/SplashOutputDev.cc
@@ -2831,7 +2831,7 @@
   ImageStream *imgStr;
   GfxImageColorMap *colorMap;
   SplashColorPtr lookup;
-  int *maskColors;
+  const int *maskColors;
   SplashColorMode colorMode;
   int width, height, y;
   ImageStream *maskStr;
@@ -3317,7 +3317,7 @@
 				int width, int height,
 				GfxImageColorMap *colorMap,
 				bool interpolate,
-				int *maskColors, bool inlineImg) {
+				const int *maskColors, bool inlineImg) {
   SplashCoord mat[6];
   SplashOutImageData imgData;
   SplashColorMode srcMode;
diff --git a/poppler/SplashOutputDev.h b/poppler/SplashOutputDev.h
index 72ad9f0..b3070ce 100644
--- a/poppler/SplashOutputDev.h
+++ b/poppler/SplashOutputDev.h
@@ -306,7 +306,7 @@
   void unsetSoftMaskFromImageMask(GfxState *state, double *baseMatrix) override;
   void drawImage(GfxState *state, Object *ref, Stream *str,
 			 int width, int height, GfxImageColorMap *colorMap,
-			 bool interpolate, int *maskColors, bool inlineImg) override;
+			 bool interpolate, const int *maskColors, bool inlineImg) override;
   void drawMaskedImage(GfxState *state, Object *ref, Stream *str,
 			       int width, int height,
 			       GfxImageColorMap *colorMap,
diff --git a/poppler/UTF.cc b/poppler/UTF.cc
index 9a205f3..0129c93 100644
--- a/poppler/UTF.cc
+++ b/poppler/UTF.cc
@@ -431,7 +431,7 @@
 };
 
 void unicodeToAscii7(Unicode *in, int len, Unicode **ucs4_out,
-                     int *out_len, int *in_idx, int **indices)
+                     int *out_len, const int *in_idx, int **indices)
 {
   static Ascii7Map uMap;
   int *idx = nullptr;
diff --git a/poppler/UTF.h b/poppler/UTF.h
index 566bfb3..c3d6325 100644
--- a/poppler/UTF.h
+++ b/poppler/UTF.h
@@ -87,6 +87,6 @@
 //              of length @out_len + 1, for each character in the ascii string giving the index
 //              of the corresponding character in the text of the line (thanks to this info
 //              being passed in @in_idx parameter).
-void unicodeToAscii7(Unicode *in, int len, Unicode **ucs4_out, int *out_len, int *in_idx, int **indices);
+void unicodeToAscii7(Unicode *in, int len, Unicode **ucs4_out, int *out_len, const int *in_idx, int **indices);
 
 #endif
diff --git a/poppler/XRef.cc b/poppler/XRef.cc
index 22ce7f9..7b94a83 100644
--- a/poppler/XRef.cc
+++ b/poppler/XRef.cc
@@ -733,7 +733,7 @@
   return more;
 }
 
-bool XRef::readXRefStreamSection(Stream *xrefStr, int *w, int first, int n) {
+bool XRef::readXRefStreamSection(Stream *xrefStr, const int *w, int first, int n) {
   unsigned long long offset, gen;
   int type, c, i, j;
 
diff --git a/poppler/XRef.h b/poppler/XRef.h
index fc5c838..2e72ae5 100644
--- a/poppler/XRef.h
+++ b/poppler/XRef.h
@@ -242,7 +242,7 @@
   int resize(int newSize);
   bool readXRef(Goffset *pos, std::vector<Goffset> *followedXRefStm, std::vector<int> *xrefStreamObjsNum);
   bool readXRefTable(Parser *parser, Goffset *pos, std::vector<Goffset> *followedXRefStm, std::vector<int> *xrefStreamObjsNum);
-  bool readXRefStreamSection(Stream *xrefStr, int *w, int first, int n);
+  bool readXRefStreamSection(Stream *xrefStr, const int *w, int first, int n);
   bool readXRefStream(Stream *xrefStr, Goffset *pos);
   bool constructXRef(bool *wasReconstructed, bool needCatalogDict = false);
   bool parseEntry(Goffset offset, XRefEntry *entry);
diff --git a/qt5/src/ArthurOutputDev.cc b/qt5/src/ArthurOutputDev.cc
index faa6407..2636bbe 100644
--- a/qt5/src/ArthurOutputDev.cc
+++ b/qt5/src/ArthurOutputDev.cc
@@ -1054,7 +1054,7 @@
 void ArthurOutputDev::drawImage(GfxState *state, Object *ref, Stream *str,
 				int width, int height,
 				GfxImageColorMap *colorMap,
-				bool interpolate, int *maskColors, bool inlineImg)
+				bool interpolate, const int *maskColors, bool inlineImg)
 {
   unsigned int *data;
   unsigned int *line;
diff --git a/qt5/src/ArthurOutputDev.h b/qt5/src/ArthurOutputDev.h
index 396ce57..f877bc6 100644
--- a/qt5/src/ArthurOutputDev.h
+++ b/qt5/src/ArthurOutputDev.h
@@ -150,7 +150,7 @@
 		     bool interpolate, bool inlineImg) override;
   void drawImage(GfxState *state, Object *ref, Stream *str,
 		 int width, int height, GfxImageColorMap *colorMap,
-		 bool interpolate, int *maskColors, bool inlineImg) override;
+		 bool interpolate, const int *maskColors, bool inlineImg) override;
 
   void drawSoftMaskedImage(GfxState *state, Object *ref, Stream *str,
                            int width, int height,
diff --git a/qt5/src/poppler-annotation-helper.h b/qt5/src/poppler-annotation-helper.h
index 45611fd..b1f61bb 100644
--- a/qt5/src/poppler-annotation-helper.h
+++ b/qt5/src/poppler-annotation-helper.h
@@ -53,7 +53,7 @@
         static inline void lookupDate( Dict *, char *, QDateTime & dest );
         // transform from user coords to normalized ones using the matrix M
         static inline void transform( double * M, double x, double y, QPointF &res );
-        static inline void invTransform( double * M, const QPointF p, double &x, double &y );
+        static inline void invTransform( const double * M, const QPointF p, double &x, double &y );
 };
 
 void XPDFReader::lookupName( Dict * dict, char * type, QString & dest )
@@ -170,7 +170,7 @@
     res.setY( M[1] * x + M[3] * y + M[5] );
 }
 
-void XPDFReader::invTransform( double * M, const QPointF p, double &x, double &y )
+void XPDFReader::invTransform( const double * M, const QPointF p, double &x, double &y )
 {
     const double det = M[0]*M[3] - M[1]*M[2];
     Q_ASSERT(det != 0);
diff --git a/splash/Splash.cc b/splash/Splash.cc
index c3e54b8..6e30fd8 100644
--- a/splash/Splash.cc
+++ b/splash/Splash.cc
@@ -1553,7 +1553,7 @@
 //------------------------------------------------------------------------
 
 // Transform a point from user space to device space.
-inline void Splash::transform(SplashCoord *matrix,
+inline void Splash::transform(const SplashCoord *matrix,
 			      SplashCoord xi, SplashCoord yi,
 			      SplashCoord *xo, SplashCoord *yo) {
   //                          [ m[0] m[1] 0 ]
@@ -5291,7 +5291,7 @@
   return splashOk;
 }
 
-void Splash::compositeBackground(SplashColorPtr color) {
+void Splash::compositeBackground(SplashColorConstPtr color) {
   SplashColorPtr p;
   unsigned char *q;
   unsigned char alpha, alpha1, c, color0, color1, color2;
diff --git a/splash/Splash.h b/splash/Splash.h
index f18d7ae..251a100 100644
--- a/splash/Splash.h
+++ b/splash/Splash.h
@@ -222,7 +222,7 @@
 
   // Composite this Splash object onto a background color.  The
   // background alpha is assumed to be 1.
-  void compositeBackground(SplashColorPtr color);
+  void compositeBackground(SplashColorConstPtr color);
 
   // Copy a rectangular region from <src> onto the bitmap belonging to
   // this Splash object.  The destination alpha values are all set to
@@ -306,7 +306,7 @@
   void drawAAPixel(SplashPipe *pipe, int x, int y);
   void drawSpan(SplashPipe *pipe, int x0, int x1, int y, bool noClip);
   void drawAALine(SplashPipe *pipe, int x0, int x1, int y, bool adjustLine = false, unsigned char lineOpacity = 0);
-  void transform(SplashCoord *matrix, SplashCoord xi, SplashCoord yi,
+  void transform(const SplashCoord *matrix, SplashCoord xi, SplashCoord yi,
 		 SplashCoord *xo, SplashCoord *yo);
   void updateModX(int x);
   void updateModY(int y);
diff --git a/splash/SplashFont.cc b/splash/SplashFont.cc
index db168bf..da81b52 100644
--- a/splash/SplashFont.cc
+++ b/splash/SplashFont.cc
@@ -42,7 +42,7 @@
 // SplashFont
 //------------------------------------------------------------------------
 
-SplashFont::SplashFont(SplashFontFile *fontFileA, SplashCoord *matA,
+SplashFont::SplashFont(SplashFontFile *fontFileA, const SplashCoord *matA,
 		       const SplashCoord *textMatA, bool aaA) {
   fontFile = fontFileA;
   fontFile->incRefCnt();
diff --git a/splash/SplashFont.h b/splash/SplashFont.h
index 45875c9..8677f01 100644
--- a/splash/SplashFont.h
+++ b/splash/SplashFont.h
@@ -46,7 +46,7 @@
 class SplashFont {
 public:
 
-  SplashFont(SplashFontFile *fontFileA, SplashCoord *matA,
+  SplashFont(SplashFontFile *fontFileA, const SplashCoord *matA,
 	     const SplashCoord *textMatA, bool aaA);
 
   // This must be called after the constructor, so that the subclass
@@ -61,7 +61,7 @@
   SplashFontFile *getFontFile() { return fontFile; }
 
   // Return true if <this> matches the specified font file and matrix.
-  bool matches(SplashFontFile *fontFileA, SplashCoord *matA,
+  bool matches(SplashFontFile *fontFileA, const SplashCoord *matA,
 		const SplashCoord *textMatA) const {
     return fontFileA == fontFile &&
            matA[0] == mat[0] && matA[1] == mat[1] &&
diff --git a/splash/SplashTypes.h b/splash/SplashTypes.h
index b00693f..0e41ade 100644
--- a/splash/SplashTypes.h
+++ b/splash/SplashTypes.h
@@ -85,6 +85,7 @@
 
 typedef unsigned char SplashColor[splashMaxColorComps];
 typedef unsigned char *SplashColorPtr;
+typedef const unsigned char *SplashColorConstPtr;
 
 // RGB8
 static inline unsigned char splashRGB8R(SplashColorPtr rgb8) { return rgb8[0]; }
@@ -118,7 +119,7 @@
     dest[i] = 0;
 }
 
-static inline void splashColorCopy(SplashColorPtr dest, SplashColorPtr src) {
+static inline void splashColorCopy(SplashColorPtr dest, SplashColorConstPtr src) {
   dest[0] = src[0];
   dest[1] = src[1];
   dest[2] = src[2];
@@ -127,7 +128,7 @@
     dest[i] = src[i];
 }
 
-static inline void splashColorXor(SplashColorPtr dest, SplashColorPtr src) {
+static inline void splashColorXor(SplashColorPtr dest, SplashColorConstPtr src) {
   dest[0] ^= src[0];
   dest[1] ^= src[1];
   dest[2] ^= src[2];
diff --git a/utils/HtmlOutputDev.cc b/utils/HtmlOutputDev.cc
index 954a477..7cabd5f 100644
--- a/utils/HtmlOutputDev.cc
+++ b/utils/HtmlOutputDev.cc
@@ -1507,7 +1507,7 @@
 
 void HtmlOutputDev::drawImage(GfxState *state, Object *ref, Stream *str,
 			      int width, int height, GfxImageColorMap *colorMap,
-			      bool interpolate, int *maskColors, bool inlineImg) {
+			      bool interpolate, const int *maskColors, bool inlineImg) {
 
   if (ignore||(complexMode && !xml)) {
     OutputDev::drawImage(state, ref, str, width, height, colorMap, interpolate,
diff --git a/utils/HtmlOutputDev.h b/utils/HtmlOutputDev.h
index e35c2c9..49651b3 100644
--- a/utils/HtmlOutputDev.h
+++ b/utils/HtmlOutputDev.h
@@ -303,7 +303,7 @@
 		     bool interpolate, bool inlineImg) override;
   void drawImage(GfxState *state, Object *ref, Stream *str,
 		 int width, int height, GfxImageColorMap *colorMap,
-		 bool interpolate, int *maskColors, bool inlineImg) override;
+		 bool interpolate, const int *maskColors, bool inlineImg) override;
 
   //new feature    
   virtual int DevType() {return 1234;}
diff --git a/utils/ImageOutputDev.cc b/utils/ImageOutputDev.cc
index 850eb10..99b3b08 100644
--- a/utils/ImageOutputDev.cc
+++ b/utils/ImageOutputDev.cc
@@ -695,7 +695,7 @@
 void ImageOutputDev::drawImage(GfxState *state, Object *ref, Stream *str,
 			       int width, int height,
 			       GfxImageColorMap *colorMap,
-			       bool interpolate, int *maskColors, bool inlineImg) {
+			       bool interpolate, const int *maskColors, bool inlineImg) {
   if (listImages)
     listImage(state, ref, str, width, height, colorMap, interpolate, inlineImg, imgImage);
   else
diff --git a/utils/ImageOutputDev.h b/utils/ImageOutputDev.h
index d13bfe1..74700cb 100644
--- a/utils/ImageOutputDev.h
+++ b/utils/ImageOutputDev.h
@@ -127,7 +127,7 @@
 		     bool interpolate, bool inlineImg) override;
   void drawImage(GfxState *state, Object *ref, Stream *str,
 		 int width, int height, GfxImageColorMap *colorMap,
-		 bool interpolate, int *maskColors, bool inlineImg) override;
+		 bool interpolate, const int *maskColors, bool inlineImg) override;
   void drawMaskedImage(GfxState *state, Object *ref, Stream *str,
 		       int width, int height,
 		       GfxImageColorMap *colorMap,