[poppler] glib/poppler-page.cc poppler/GfxState.h poppler/TextOutputDev.cc poppler/TextOutputDev.h poppler/UnicodeMap.cc poppler/UnicodeMap.h qt5/src utils/pdftotext.cc

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Sun Nov 24 11:14:17 UTC 2019


 glib/poppler-page.cc     |   12 +--
 poppler/GfxState.h       |    2 
 poppler/TextOutputDev.cc |  158 +++++++++++++++++++++---------------------
 poppler/TextOutputDev.h  |  174 +++++++++++++++++++++++------------------------
 poppler/UnicodeMap.cc    |    2 
 poppler/UnicodeMap.h     |    2 
 qt5/src/poppler-page.cc  |    2 
 utils/pdftotext.cc       |   12 +--
 8 files changed, 182 insertions(+), 182 deletions(-)

New commits:
commit 14280c6161108798cd7e60066bd012c87a308cf3
Author: Albert Astals Cid <aacid at kde.org>
Date:   Sun Nov 24 12:04:23 2019 +0100

    Add const to TextOutputDev & friends

diff --git a/glib/poppler-page.cc b/glib/poppler-page.cc
index 8b5b4da0..0c43e768 100644
--- a/glib/poppler-page.cc
+++ b/glib/poppler-page.cc
@@ -1723,9 +1723,9 @@ poppler_text_attributes_new (void)
 }
 
 static gchar *
-get_font_name_from_word (TextWord *word, gint word_i)
+get_font_name_from_word (const TextWord *word, gint word_i)
 {
-  GooString *font_name = word->getFontName(word_i);
+  const GooString *font_name = word->getFontName(word_i);
   const gchar *name;
   gboolean subset;
   gint i;
@@ -1751,7 +1751,7 @@ get_font_name_from_word (TextWord *word, gint word_i)
  * Allocates a new PopplerTextAttributes with word attributes
  */
 static PopplerTextAttributes *
-poppler_text_attributes_new_from_word (TextWord *word, gint i)
+poppler_text_attributes_new_from_word (const TextWord *word, gint i)
 {
   PopplerTextAttributes *attrs = poppler_text_attributes_new ();
   gdouble r, g, b;
@@ -2238,7 +2238,7 @@ poppler_page_get_text_layout_for_area (PopplerPage       *page,
       for (std::size_t j = 0; j < line_words->size(); j++)
         {
           TextWordSelection *word_sel = (*line_words)[j];
-          TextWord *word = word_sel->getWord();
+          const TextWord *word = word_sel->getWord();
           int end = word_sel->getEnd();
 
           for (k = word_sel->getBegin(); k < end; k++)
@@ -2311,7 +2311,7 @@ poppler_page_free_text_attributes (GList *list)
 }
 
 static gboolean
-word_text_attributes_equal (TextWord *a, gint ai, TextWord *b, gint bi)
+word_text_attributes_equal (const TextWord *a, gint ai, const TextWord *b, gint bi)
 {
   double ar, ag, ab, br, bg, bb;
 
@@ -2382,7 +2382,7 @@ poppler_page_get_text_attributes_for_area (PopplerPage      *page,
   PDFRectangle selection;
   int n_lines;
   PopplerTextAttributes *attrs = nullptr;
-  TextWord *word, *prev_word = nullptr;
+  const TextWord *word, *prev_word = nullptr;
   gint word_i, prev_word_i;
   gint i;
   gint offset = 0;
diff --git a/poppler/GfxState.h b/poppler/GfxState.h
index 733e7e62..dd6ce8f6 100644
--- a/poppler/GfxState.h
+++ b/poppler/GfxState.h
@@ -1493,7 +1493,7 @@ public:
   bool getStrokeAdjust() const { return strokeAdjust; }
   bool getAlphaIsShape() const { return alphaIsShape; }
   bool getTextKnockout() const { return textKnockout; }
-  GfxFont *getFont() { return font; }
+  GfxFont *getFont() const { return font; }
   double getFontSize() const { return fontSize; }
   const double *getTextMat() const { return textMat; }
   double getCharSpace() const { return charSpace; }
diff --git a/poppler/TextOutputDev.cc b/poppler/TextOutputDev.cc
index 61781cdc..722f0cbb 100644
--- a/poppler/TextOutputDev.cc
+++ b/poppler/TextOutputDev.cc
@@ -190,7 +190,7 @@ inline bool isAscii7 (Unicode uchar) {
 
 }
 
-static int reorderText(Unicode *text, int len, UnicodeMap *uMap, bool primaryLR, GooString *s, Unicode* u) {
+static int reorderText(const Unicode *text, int len, const UnicodeMap *uMap, bool primaryLR, GooString *s, Unicode* u) {
   char lre[8], rle[8], popdf[8], buf[8];
   int lreLen = 0, rleLen = 0, popdfLen = 0, n;
   int nCols, i, j, k;
@@ -312,7 +312,7 @@ public:
 // TextFontInfo
 //------------------------------------------------------------------------
 
-TextFontInfo::TextFontInfo(GfxState *state) {
+TextFontInfo::TextFontInfo(const GfxState *state) {
   gfxFont = state->getFont();
   if (gfxFont)
     gfxFont->incRefCnt();
@@ -333,7 +333,7 @@ TextFontInfo::~TextFontInfo() {
 #endif
 }
 
-bool TextFontInfo::matches(GfxState *state) const {
+bool TextFontInfo::matches(const GfxState *state) const {
   return state->getFont() == gfxFont;
 }
 
@@ -396,7 +396,7 @@ TextWord::~TextWord() {
   gfree(textMat);
 }
 
-void TextWord::addChar(GfxState *state, TextFontInfo *fontA, double x, double y,
+void TextWord::addChar(const GfxState *state, TextFontInfo *fontA, double x, double y,
 		       double dx, double dy, int charPosA, int charLen,
 		       CharCode c, Unicode u, const Matrix &textMatA) {
   ensureCapacity(len+1);
@@ -583,7 +583,7 @@ static Unicode getCombiningChar(Unicode u) {
   return 0;
 }
 
-bool TextWord::addCombining(GfxState *state, TextFontInfo *fontA, double fontSizeA, double x, double y,
+bool TextWord::addCombining(const GfxState *state, TextFontInfo *fontA, double fontSizeA, double x, double y,
 			     double dx, double dy, int charPosA, int charLen,
 			     CharCode c, Unicode u, const Matrix &textMatA) {
   if (len == 0 || wMode != 0 || fontA->getWMode() != 0)
@@ -745,7 +745,7 @@ void TextWord::merge(TextWord *word) {
   len += word->len;
 }
 
-inline int TextWord::primaryCmp(TextWord *word) {
+inline int TextWord::primaryCmp(const TextWord *word) const {
   double cmp;
 
   cmp = 0; // make gcc happy
@@ -766,7 +766,7 @@ inline int TextWord::primaryCmp(TextWord *word) {
   return cmp < 0 ? -1 : cmp > 0 ? 1 : 0;
 }
 
-double TextWord::primaryDelta(TextWord *word) {
+double TextWord::primaryDelta(const TextWord *word) const {
   double delta;
 
   delta = 0; // make gcc happy
@@ -801,7 +801,7 @@ int TextWord::cmpYX(const void *p1, const void *p2) {
 
 #ifdef TEXTOUT_WORD_LIST
 
-GooString *TextWord::getText() {
+GooString *TextWord::getText() const {
   GooString *s;
   UnicodeMap *uMap;
   char buf[8];
@@ -820,7 +820,7 @@ GooString *TextWord::getText() {
 }
 
 void TextWord::getCharBBox(int charIdx, double *xMinA, double *yMinA,
-			   double *xMaxA, double *yMaxA) {
+			   double *xMaxA, double *yMaxA) const {
   if (charIdx < 0 || charIdx >= len) {
     return;
   }
@@ -879,7 +879,7 @@ TextPool::~TextPool() {
   gfree(pool);
 }
 
-int TextPool::getBaseIdx(double base) {
+int TextPool::getBaseIdx(double base) const {
   const double baseIdxDouble = base / textPoolStep;
   if (baseIdxDouble < minBaseIdx) {
     return minBaseIdx;
@@ -1038,7 +1038,7 @@ void TextLine::addWord(TextWord *word) {
   }
 }
 
-double TextLine::primaryDelta(TextLine *line) {
+double TextLine::primaryDelta(const TextLine *line) const {
   double delta;
 
   delta = 0; // make gcc happy
@@ -1059,7 +1059,7 @@ double TextLine::primaryDelta(TextLine *line) {
   return delta;
 }
 
-int TextLine::primaryCmp(TextLine *line) {
+int TextLine::primaryCmp(const TextLine *line) const {
   double cmp;
 
   cmp = 0; // make gcc happy
@@ -1080,14 +1080,14 @@ int TextLine::primaryCmp(TextLine *line) {
   return cmp < 0 ? -1 : cmp > 0 ? 1 : 0;
 }
 
-int TextLine::secondaryCmp(TextLine *line) {
+int TextLine::secondaryCmp(const TextLine *line) const {
   double cmp;
 
   cmp = (rot == 0 || rot == 3) ? base - line->base : line->base - base;
   return cmp < 0 ? -1 : cmp > 0 ? 1 : 0;
 }
 
-int TextLine::cmpYX(TextLine *line) {
+int TextLine::cmpYX(const TextLine *line) const {
   int cmp;
 
   if ((cmp = secondaryCmp(line))) {
@@ -1107,7 +1107,7 @@ int TextLine::cmpXY(const void *p1, const void *p2) {
   return line1->secondaryCmp(line2);
 }
 
-void TextLine::coalesce(UnicodeMap *uMap) {
+void TextLine::coalesce(const UnicodeMap *uMap) {
   TextWord *word0, *word1;
   double space, delta, minSpace;
   bool isUnicode;
@@ -1565,7 +1565,7 @@ void TextBlock::addWord(TextWord *word) {
   }
 }
 
-void TextBlock::coalesce(UnicodeMap *uMap, double fixedPitch) {
+void TextBlock::coalesce(const UnicodeMap *uMap, double fixedPitch) {
   TextWord *word0, *word1, *word2, *bestWord0, *bestWord1, *lastWord;
   TextLine *line, *line0, *line1;
   int poolMinBaseIdx, startBaseIdx, minBaseIdx, maxBaseIdx;
@@ -1839,7 +1839,7 @@ void TextBlock::coalesce(UnicodeMap *uMap, double fixedPitch) {
   gfree(lineArray);
 }
 
-void TextBlock::updatePriMinMax(TextBlock *blk) {
+void TextBlock::updatePriMinMax(const TextBlock *blk) {
   double newPriMin, newPriMax;
   bool gotPriMin, gotPriMax;
 
@@ -1953,7 +1953,7 @@ int TextBlock::cmpYXPrimaryRot(const void *p1, const void *p2) {
   return cmp < 0 ? -1 : cmp > 0 ? 1 : 0;
 }
 
-int TextBlock::primaryCmp(TextBlock *blk) {
+int TextBlock::primaryCmp(const TextBlock *blk) const {
   double cmp;
 
   cmp = 0; // make gcc happy
@@ -1974,7 +1974,7 @@ int TextBlock::primaryCmp(TextBlock *blk) {
   return cmp < 0 ? -1 : cmp > 0 ? 1 : 0;
 }
 
-double TextBlock::secondaryDelta(TextBlock *blk) {
+double TextBlock::secondaryDelta(const TextBlock *blk) const {
   double delta;
 
   delta = 0; // make gcc happy
@@ -1995,7 +1995,7 @@ double TextBlock::secondaryDelta(TextBlock *blk) {
   return delta;
 }
 
-bool TextBlock::isBelow(TextBlock *blk) {
+bool TextBlock::isBelow(const TextBlock *blk) const {
   bool below;
 
   below = false; // make gcc happy
@@ -2021,7 +2021,7 @@ bool TextBlock::isBelow(TextBlock *blk) {
   return below;
 }
 
-bool TextBlock::isBeforeByRule1(TextBlock *blk1) {
+bool TextBlock::isBeforeByRule1(const TextBlock *blk1) {
   bool before = false;
   bool overlap = false;
 
@@ -2058,7 +2058,7 @@ bool TextBlock::isBeforeByRule1(TextBlock *blk1) {
   return before;
 }
 
-bool TextBlock::isBeforeByRule2(TextBlock *blk1) {
+bool TextBlock::isBeforeByRule2(const TextBlock *blk1) {
   double cmp = 0;
   int rotLR = rot;
 
@@ -2250,7 +2250,7 @@ void TextFlow::addBlock(TextBlock *blk) {
   }
 }
 
-bool TextFlow::blockFits(TextBlock *blk, TextBlock *prevBlk) {
+bool TextFlow::blockFits(const TextBlock *blk, const TextBlock *prevBlk) const {
   bool fits;
 
   // lower blocks must use smaller fonts
@@ -2282,7 +2282,7 @@ bool TextFlow::blockFits(TextBlock *blk, TextBlock *prevBlk) {
 // TextWordList
 //------------------------------------------------------------------------
 
-TextWordList::TextWordList(TextPage *text, bool physLayout) {
+TextWordList::TextWordList(const TextPage *text, bool physLayout) {
   TextFlow *flow;
   TextBlock *blk;
   TextLine *line;
@@ -2344,7 +2344,7 @@ TextWordList::~TextWordList() {
   delete words;
 }
 
-int TextWordList::getLength() {
+int TextWordList::getLength() const {
   return words->size();
 }
 
@@ -2421,7 +2421,7 @@ void TextPage::decRefCnt() {
     delete this;
 }
 
-void TextPage::startPage(GfxState *state) {
+void TextPage::startPage(const GfxState *state) {
   clear();
   if (state) {
     pageWidth = state->getPageWidth();
@@ -2497,7 +2497,7 @@ void TextPage::clear() {
   links = new std::vector<TextLink*>();
 }
 
-void TextPage::updateFont(GfxState *state) {
+void TextPage::updateFont(const GfxState *state) {
   GfxFont *gfxFont;
   const double *fm;
   const char *name;
@@ -2566,7 +2566,7 @@ void TextPage::updateFont(GfxState *state) {
   }
 }
 
-void TextPage::beginWord(GfxState *state) {
+void TextPage::beginWord(const GfxState *state) {
   GfxFont *gfxFont;
   const double *fontm;
   double m[4], m2[4];
@@ -2614,7 +2614,7 @@ void TextPage::beginWord(GfxState *state) {
   curWord = new TextWord(state, rot, curFontSize);
 }
 
-void TextPage::addChar(GfxState *state, double x, double y,
+void TextPage::addChar(const GfxState *state, double x, double y,
 		       double dx, double dy,
 		       CharCode c, int nBytes, const Unicode *u, int uLen) {
   double x1, y1, w1, h1, dx2, dy2, base, sp, delta;
@@ -3895,7 +3895,7 @@ void TextPage::coalesce(bool physLayout, double fixedPitch, bool doHTML) {
   }
 }
 
-bool TextPage::findText(Unicode *s, int len,
+bool TextPage::findText(const Unicode *s, int len,
 			 bool startAtTop, bool stopAtBottom,
 			 bool startAtLast, bool stopAtLast,
 			 bool caseSensitive, bool backward,
@@ -3907,7 +3907,7 @@ bool TextPage::findText(Unicode *s, int len,
 		  xMin, yMin, xMax, yMax);
 }
 
-bool TextPage::findText(Unicode *s, int len,
+bool TextPage::findText(const Unicode *s, int len,
 			 bool startAtTop, bool stopAtBottom,
 			 bool startAtLast, bool stopAtLast,
 			 bool caseSensitive, bool ignoreDiacritics,
@@ -4171,7 +4171,7 @@ bool TextPage::findText(Unicode *s, int len,
 }
 
 GooString *TextPage::getText(double xMin, double yMin,
-			   double xMax, double yMax) {
+			   double xMax, double yMax) const {
   GooString *s;
   UnicodeMap *uMap;
   TextBlock *blk;
@@ -4419,15 +4419,15 @@ public:
   virtual void visitBlock (TextBlock *block,
 			   TextLine *begin,
 			   TextLine *end,
-			   PDFRectangle *selection) = 0;
+			   const PDFRectangle *selection) = 0;
   virtual void visitLine (TextLine *line, 
 			  TextWord *begin,
 			  TextWord *end,
 			  int edge_begin,
 			  int edge_end,
-			  PDFRectangle *selection) = 0;
+			  const PDFRectangle *selection) = 0;
   virtual void visitWord (TextWord *word, int begin, int end,
-			  PDFRectangle *selection) = 0;
+			  const PDFRectangle *selection) = 0;
 
 protected:
   TextPage *page;
@@ -4447,15 +4447,15 @@ public:
   void visitBlock (TextBlock *block, 
 			   TextLine *begin,
 			   TextLine *end,
-			   PDFRectangle *selection) override { };
+			   const PDFRectangle *selection) override { };
   void visitLine (TextLine *line,
 			  TextWord *begin,
 			  TextWord *end,
 			  int edge_begin,
 			  int edge_end,
-			  PDFRectangle *selection) override;
+			  const PDFRectangle *selection) override;
   void visitWord (TextWord *word, int begin, int end,
-			  PDFRectangle *selection) override;
+			  const PDFRectangle *selection) override;
   void endPage();
 
   GooString *getText(void);
@@ -4521,7 +4521,7 @@ void TextSelectionDumper::visitLine (TextLine *line,
 				     TextWord *end,
 				     int edge_begin,
 				     int edge_end,
-				     PDFRectangle *selection)
+				     const PDFRectangle *selection)
 {
   TextLineFrag frag;
 
@@ -4554,7 +4554,7 @@ void TextSelectionDumper::visitLine (TextLine *line,
 }
 
 void TextSelectionDumper::visitWord (TextWord *word, int begin, int end,
-                                     PDFRectangle *selection)
+                                     const PDFRectangle *selection)
 {
   words->push_back(new TextWordSelection(word, begin, end));
 }
@@ -4620,15 +4620,15 @@ public:
   void visitBlock (TextBlock *block,
 			   TextLine *begin,
 			   TextLine *end,
-			   PDFRectangle *selection) override { };
+			   const PDFRectangle *selection) override { };
   void visitLine (TextLine *line, 
 			  TextWord *begin,
 			  TextWord *end,
 			  int edge_begin,
 			  int edge_end,
-			  PDFRectangle *selection) override;
+			  const PDFRectangle *selection) override;
   void visitWord (TextWord *word, int begin, int end,
-			  PDFRectangle *selection) override { };
+			  const PDFRectangle *selection) override { };
 
   std::vector<PDFRectangle*> *getRegion () { return list; }
 
@@ -4649,7 +4649,7 @@ void TextSelectionSizer::visitLine (TextLine *line,
 				    TextWord *end,
 				    int edge_begin,
 				    int edge_end,
-				    PDFRectangle *selection)
+				    const PDFRectangle *selection)
 {
   PDFRectangle *rect;
   double x1, y1, x2, y2, margin;
@@ -4674,27 +4674,27 @@ public:
 		       double scale,
 		       int rotation,
 		       OutputDev *out,
-		       GfxColor *box_color,
-		       GfxColor *glyph_color);
+		       const GfxColor *box_color,
+		       const GfxColor *glyph_color);
   ~TextSelectionPainter();
 
   void visitBlock (TextBlock *block,
 			   TextLine *begin,
 			   TextLine *end,
-			   PDFRectangle *selection) override { };
+			   const PDFRectangle *selection) override { };
   void visitLine (TextLine *line, 
 			  TextWord *begin,
 			  TextWord *end,
 			  int edge_begin,
 			  int edge_end,
-			  PDFRectangle *selection) override;
+			  const PDFRectangle *selection) override;
   void visitWord (TextWord *word, int begin, int end,
-			  PDFRectangle *selection) override;
+			  const PDFRectangle *selection) override;
   void endPage();
 
 private:
   OutputDev *out;
-  GfxColor *glyph_color;
+  const GfxColor *glyph_color;
   GfxState *state;
   std::vector<TextWordSelection*> *selectionList;
   Matrix ctm, ictm;
@@ -4704,8 +4704,8 @@ TextSelectionPainter::TextSelectionPainter(TextPage *p,
 					   double scale,
 					   int rotation,
 					   OutputDev *outA,
-					   GfxColor *box_color,
-					   GfxColor *glyph_colorA)
+					   const GfxColor *box_color,
+					   const GfxColor *glyph_colorA)
   : TextSelectionVisitor(p),
     out(outA),
     glyph_color(glyph_colorA)
@@ -4740,7 +4740,7 @@ void TextSelectionPainter::visitLine (TextLine *line,
 				      TextWord *end,
 				      int edge_begin,
 				      int edge_end,
-				      PDFRectangle *selection)
+				      const PDFRectangle *selection)
 {
   double x1, y1, x2, y2, margin;
 
@@ -4769,7 +4769,7 @@ void TextSelectionPainter::visitLine (TextLine *line,
 }
 
 void TextSelectionPainter::visitWord (TextWord *word, int begin, int end,
-				      PDFRectangle *selection)
+				      const PDFRectangle *selection)
 {
   selectionList->push_back(new TextWordSelection(word, begin, end));
 }
@@ -4830,7 +4830,7 @@ void TextSelectionPainter::endPage()
 }
 
 void TextWord::visitSelection(TextSelectionVisitor *visitor,
-			      PDFRectangle *selection,
+			      const PDFRectangle *selection,
 			      SelectionStyle style)
 {
   int i, begin, end;
@@ -4855,7 +4855,7 @@ void TextWord::visitSelection(TextSelectionVisitor *visitor,
 }
 
 void TextLine::visitSelection(TextSelectionVisitor *visitor,
-			      PDFRectangle *selection,
+			      const PDFRectangle *selection,
 			      SelectionStyle style) {
   TextWord *p, *begin, *end, *current;
   int i, edge_begin, edge_end;
@@ -4926,7 +4926,7 @@ void TextLine::visitSelection(TextSelectionVisitor *visitor,
 }
 
 void TextBlock::visitSelection(TextSelectionVisitor *visitor,
-			       PDFRectangle *selection,
+			       const PDFRectangle *selection,
 			       SelectionStyle style) {
   PDFRectangle child_selection;
   double x[2], y[2], d, best_d[2];
@@ -5038,7 +5038,7 @@ void TextBlock::visitSelection(TextSelectionVisitor *visitor,
 }
 
 void TextPage::visitSelection(TextSelectionVisitor *visitor,
-			      PDFRectangle *selection,
+			      const PDFRectangle *selection,
 			      SelectionStyle style)
 {
   PDFRectangle child_selection;
@@ -5164,9 +5164,9 @@ void TextPage::visitSelection(TextSelectionVisitor *visitor,
 void TextPage::drawSelection(OutputDev *out,
 			     double scale,
 			     int rotation,
-			     PDFRectangle *selection,
+			     const PDFRectangle *selection,
 			     SelectionStyle style,
-			     GfxColor *glyph_color, GfxColor *box_color)
+			     const GfxColor *glyph_color, const GfxColor *box_color)
 {
   TextSelectionPainter painter(this, scale, rotation, 
 			       out, box_color, glyph_color);
@@ -5175,7 +5175,7 @@ void TextPage::drawSelection(OutputDev *out,
   painter.endPage();
 }
 
-std::vector<PDFRectangle*> *TextPage::getSelectionRegion(PDFRectangle *selection,
+std::vector<PDFRectangle*> *TextPage::getSelectionRegion(const PDFRectangle *selection,
 				      SelectionStyle style,
 				      double scale) {
   TextSelectionSizer sizer(this, scale);
@@ -5185,7 +5185,7 @@ std::vector<PDFRectangle*> *TextPage::getSelectionRegion(PDFRectangle *selection
   return sizer.getRegion();
 }
 
-GooString *TextPage::getSelectionText(PDFRectangle *selection,
+GooString *TextPage::getSelectionText(const PDFRectangle *selection,
 				      SelectionStyle style)
 {
   TextSelectionDumper dumper(this);
@@ -5196,7 +5196,7 @@ GooString *TextPage::getSelectionText(PDFRectangle *selection,
   return dumper.getText();
 }
 
-std::vector<TextWordSelection*> **TextPage::getSelectionWords(PDFRectangle *selection,
+std::vector<TextWordSelection*> **TextPage::getSelectionWords(const PDFRectangle *selection,
                                       SelectionStyle style,
                                       int *nLines)
 {
@@ -5210,7 +5210,7 @@ std::vector<TextWordSelection*> **TextPage::getSelectionWords(PDFRectangle *sele
 
 bool TextPage::findCharRange(int pos, int length,
 			      double *xMin, double *yMin,
-			      double *xMax, double *yMax) {
+			      double *xMax, double *yMax) const {
   TextBlock *blk;
   TextLine *line;
   TextWord *word;
@@ -5477,7 +5477,7 @@ void TextPage::setMergeCombining(bool merge) {
   mergeCombining = merge;
 }
 
-void TextPage::assignColumns(TextLineFrag *frags, int nFrags, bool oneRot) {
+void TextPage::assignColumns(TextLineFrag *frags, int nFrags, bool oneRot) const {
   TextLineFrag *frag0, *frag1;
   int rot, col1, col2, i, j, k;
 
@@ -5573,8 +5573,8 @@ void TextPage::assignColumns(TextLineFrag *frags, int nFrags, bool oneRot) {
   }
 }
 
-int TextPage::dumpFragment(Unicode *text, int len, UnicodeMap *uMap,
-			   GooString *s) {
+int TextPage::dumpFragment(const Unicode *text, int len, const UnicodeMap *uMap,
+			   GooString *s) const {
   if (uMap->isUnicode()) {
     return reorderText(text, len, uMap, primaryLR, s, nullptr);
   } else {
@@ -5615,7 +5615,7 @@ ActualText::~ActualText() {
   text->decRefCnt();
 }
 
-void ActualText::addChar(GfxState *state, double x, double y,
+void ActualText::addChar(const GfxState *state, double x, double y,
 			 double dx, double dy,
 			 CharCode c, int nBytes, const Unicode *u, int uLen) {
   if (!actualText) {
@@ -5633,14 +5633,14 @@ void ActualText::addChar(GfxState *state, double x, double y,
   actualTextNBytes += nBytes;
 }
 
-void ActualText::begin(GfxState *state, const GooString *t) {
+void ActualText::begin(const GfxState *state, const GooString *t) {
   if (actualText)
     delete actualText;
   actualText = new GooString(t);
   actualTextNBytes = 0;
 }
 
-void ActualText::end(GfxState *state) {
+void ActualText::end(const GfxState *state) {
   // ActualText span closed. Output the span text and the
   // extents of all the glyphs inside the span
 
@@ -5925,13 +5925,13 @@ void TextOutputDev::processLink(AnnotLink *link) {
   text->addLink(xMin, yMin, xMax, yMax, link);
 }
 
-bool TextOutputDev::findText(Unicode *s, int len,
+bool TextOutputDev::findText(const Unicode *s, int len,
 			      bool startAtTop, bool stopAtBottom,
 			      bool startAtLast, bool stopAtLast,
 			      bool caseSensitive, bool backward,
 			      bool wholeWord,
 			      double *xMin, double *yMin,
-			      double *xMax, double *yMax) {
+			      double *xMax, double *yMax) const {
   return text->findText(s, len, startAtTop, stopAtBottom,
 			startAtLast, stopAtLast,
 			caseSensitive, backward, wholeWord,
@@ -5939,26 +5939,26 @@ bool TextOutputDev::findText(Unicode *s, int len,
 }
 
 GooString *TextOutputDev::getText(double xMin, double yMin,
-				double xMax, double yMax) {
+				double xMax, double yMax) const {
   return text->getText(xMin, yMin, xMax, yMax);
 }
 
 void TextOutputDev::drawSelection(OutputDev *out,
 				  double scale,
 				  int rotation,
-				  PDFRectangle *selection,
+				  const PDFRectangle *selection,
 				  SelectionStyle style,
-				  GfxColor *glyph_color, GfxColor *box_color) {
+				  const GfxColor *glyph_color, const GfxColor *box_color) {
   text->drawSelection(out, scale, rotation, selection, style, glyph_color, box_color);
 }
 
-std::vector<PDFRectangle*> *TextOutputDev::getSelectionRegion(PDFRectangle *selection,
+std::vector<PDFRectangle*> *TextOutputDev::getSelectionRegion(const PDFRectangle *selection,
 					   SelectionStyle style,
 					   double scale) {
   return text->getSelectionRegion(selection, style, scale);
 }
 
-GooString *TextOutputDev::getSelectionText(PDFRectangle *selection,
+GooString *TextOutputDev::getSelectionText(const PDFRectangle *selection,
 					   SelectionStyle style)
 {
   return text->getSelectionText(selection, style);
@@ -5966,7 +5966,7 @@ GooString *TextOutputDev::getSelectionText(PDFRectangle *selection,
 
 bool TextOutputDev::findCharRange(int pos, int length,
 				   double *xMin, double *yMin,
-				   double *xMax, double *yMax) {
+				   double *xMax, double *yMax) const {
   return text->findCharRange(pos, length, xMin, yMin, xMax, yMax);
 }
 
@@ -5988,6 +5988,6 @@ TextPage *TextOutputDev::takeText() {
   return ret;
 }
 
-TextFlow *TextOutputDev::getFlows() {
+const TextFlow *TextOutputDev::getFlows() const {
   return text->getFlows();
 }
diff --git a/poppler/TextOutputDev.h b/poppler/TextOutputDev.h
index 7e0064ac..f52ace82 100644
--- a/poppler/TextOutputDev.h
+++ b/poppler/TextOutputDev.h
@@ -77,13 +77,13 @@ enum SelectionStyle {
 class TextFontInfo {
 public:
 
-  TextFontInfo(GfxState *state);
+  TextFontInfo(const GfxState *state);
   ~TextFontInfo();
 
   TextFontInfo(const TextFontInfo &) = delete;
   TextFontInfo& operator=(const TextFontInfo &) = delete;
 
-  bool matches(GfxState *state) const;
+  bool matches(const GfxState *state) const;
   bool matches(const TextFontInfo *fontInfo) const;
 
   // Get the font ascent, or a default value if the font is not set
@@ -137,7 +137,7 @@ public:
   TextWord& operator=(const TextWord &) = delete;
 
   // Add a character to the word.
-  void addChar(GfxState *state, TextFontInfo *fontA, double x, double y,
+  void addChar(const GfxState *state, TextFontInfo *fontA, double x, double y,
 	       double dx, double dy, int charPosA, int charLen,
 	       CharCode c, Unicode u, const Matrix &textMatA);
 
@@ -145,7 +145,7 @@ public:
   // Either character u or the last character in the word must be an
   // acute, dieresis, or other combining character.  Returns true if
   // the character was added.
-  bool addCombining(GfxState *state, TextFontInfo *fontA, double fontSizeA, double x, double y,
+  bool addCombining(const GfxState *state, TextFontInfo *fontA, double fontSizeA, double x, double y,
 		     double dx, double dy, int charPosA, int charLen,
 		     CharCode c, Unicode u, const Matrix &textMatA);
 
@@ -154,47 +154,47 @@ public:
 
   // Compares <this> to <word>, returning -1 (<), 0 (=), or +1 (>),
   // based on a primary-axis comparison, e.g., x ordering if rot=0.
-  int primaryCmp(TextWord *word);
+  int primaryCmp(const TextWord *word) const;
 
   // Return the distance along the primary axis between <this> and
   // <word>.
-  double primaryDelta(TextWord *word);
+  double primaryDelta(const TextWord *word) const;
 
   static int cmpYX(const void *p1, const void *p2);
 
   void visitSelection(TextSelectionVisitor *visitor,
-		      PDFRectangle *selection,
+		      const PDFRectangle *selection,
 		      SelectionStyle style);
 
   // Get the TextFontInfo object associated with a character.
-  TextFontInfo *getFontInfo(int idx) { return font[idx]; }
+  const TextFontInfo *getFontInfo(int idx) const { return font[idx]; }
 
   // Get the next TextWord on the linked list.
-  TextWord *getNext() { return next; }
+  const TextWord *getNext() const { return next; }
 
 #ifdef TEXTOUT_WORD_LIST
-  int getLength() { return len; }
-  const Unicode *getChar(int idx) { return &text[idx]; }
-  GooString *getText();
-  GooString *getFontName(int idx) { return font[idx]->fontName; }
-  void getColor(double *r, double *g, double *b)
+  int getLength() const { return len; }
+  const Unicode *getChar(int idx) const { return &text[idx]; }
+  GooString *getText() const;
+  const GooString *getFontName(int idx) const { return font[idx]->fontName; }
+  void getColor(double *r, double *g, double *b) const
     { *r = colorR; *g = colorG; *b = colorB; }
-  void getBBox(double *xMinA, double *yMinA, double *xMaxA, double *yMaxA)
+  void getBBox(double *xMinA, double *yMinA, double *xMaxA, double *yMaxA) const
     { *xMinA = xMin; *yMinA = yMin; *xMaxA = xMax; *yMaxA = yMax; }
   void getCharBBox(int charIdx, double *xMinA, double *yMinA,
-		   double *xMaxA, double *yMaxA);
-  double getFontSize() { return fontSize; }
-  int getRotation() { return rot; }
-  int getCharPos() { return charPos[0]; }
-  int getCharLen() { return charPos[len] - charPos[0]; }
-  bool getSpaceAfter() { return spaceAfter; }
+		   double *xMaxA, double *yMaxA) const;
+  double getFontSize() const { return fontSize; }
+  int getRotation() const { return rot; }
+  int getCharPos() const { return charPos[0]; }
+  int getCharLen() const { return charPos[len] - charPos[0]; }
+  bool getSpaceAfter() const { return spaceAfter; }
 #endif
-  bool isUnderlined() { return underlined; }
-  AnnotLink *getLink() { return link; }
-  double getEdge(int i) { return edge[i]; }
-  double getBaseline () { return base; }
-  bool hasSpaceAfter  () { return spaceAfter; }
-  TextWord* nextWord () { return next; };
+  bool isUnderlined() const { return underlined; }
+  const AnnotLink *getLink() const { return link; }
+  double getEdge(int i) const { return edge[i]; }
+  double getBaseline () const { return base; }
+  bool hasSpaceAfter  () const { return spaceAfter; }
+  const TextWord* nextWord () const { return next; };
 private:
   void ensureCapacity(int capacity);
   void setInitialBounds(TextFontInfo *fontA, double x, double y);
@@ -257,7 +257,7 @@ public:
   TextWord *getPool(int baseIdx) { return pool[baseIdx - minBaseIdx]; }
   void setPool(int baseIdx, TextWord *p) { pool[baseIdx - minBaseIdx] = p; }
 
-  int getBaseIdx(double base);
+  int getBaseIdx(double base) const;
 
   void addWord(TextWord *word);
 
@@ -293,35 +293,35 @@ public:
 
   // Return the distance along the primary axis between <this> and
   // <line>.
-  double primaryDelta(TextLine *line);
+  double primaryDelta(const TextLine *line) const;
 
   // Compares <this> to <line>, returning -1 (<), 0 (=), or +1 (>),
   // based on a primary-axis comparison, e.g., x ordering if rot=0.
-  int primaryCmp(TextLine *line);
+  int primaryCmp(const TextLine *line) const;
 
   // Compares <this> to <line>, returning -1 (<), 0 (=), or +1 (>),
   // based on a secondary-axis comparison of the baselines, e.g., y
   // ordering if rot=0.
-  int secondaryCmp(TextLine *line);
+  int secondaryCmp(const TextLine *line) const;
 
-  int cmpYX(TextLine *line);
+  int cmpYX(const TextLine *line) const;
 
   static int cmpXY(const void *p1, const void *p2);
 
-  void coalesce(UnicodeMap *uMap);
+  void coalesce(const UnicodeMap *uMap);
 
   void visitSelection(TextSelectionVisitor *visitor,
-		      PDFRectangle *selection,
+		      const PDFRectangle *selection,
 		      SelectionStyle style);
 
   // Get the head of the linked list of TextWords.
-  TextWord *getWords() { return words; }
+  const TextWord *getWords() const { return words; }
 
   // Get the next TextLine on the linked list.
-  TextLine *getNext() { return next; }
+  const TextLine *getNext() const { return next; }
 
   // Returns true if the last char of the line is a hyphen.
-  bool isHyphenated() { return hyphenated; }
+  bool isHyphenated() const { return hyphenated; }
 
 private:
 
@@ -374,43 +374,43 @@ public:
 
   void addWord(TextWord *word);
 
-  void coalesce(UnicodeMap *uMap, double fixedPitch);
+  void coalesce(const UnicodeMap *uMap, double fixedPitch);
 
   // Update this block's priMin and priMax values, looking at <blk>.
-  void updatePriMinMax(TextBlock *blk);
+  void updatePriMinMax(const TextBlock *blk);
 
   static int cmpXYPrimaryRot(const void *p1, const void *p2);
 
   static int cmpYXPrimaryRot(const void *p1, const void *p2);
 
-  int primaryCmp(TextBlock *blk);
+  int primaryCmp(const TextBlock *blk) const;
 
-  double secondaryDelta(TextBlock *blk);
+  double secondaryDelta(const TextBlock *blk) const;
 
   // Returns true if <this> is below <blk>, relative to the page's
   // primary rotation.
-  bool isBelow(TextBlock *blk);
+  bool isBelow(const TextBlock *blk) const;
 
   void visitSelection(TextSelectionVisitor *visitor,
-		      PDFRectangle *selection,
+		      const PDFRectangle *selection,
 		      SelectionStyle style);
 
   // Get the head of the linked list of TextLines.
-  TextLine *getLines() { return lines; }
+  const TextLine *getLines() const { return lines; }
 
   // Get the next TextBlock on the linked list.
-  TextBlock *getNext() { return next; }
+  const TextBlock *getNext() const { return next; }
 
-  void getBBox(double *xMinA, double *yMinA, double *xMaxA, double *yMaxA)
+  void getBBox(double *xMinA, double *yMinA, double *xMaxA, double *yMaxA) const
     { *xMinA = xMin; *yMinA = yMin; *xMaxA = xMax; *yMaxA = yMax; }
 
-  int getLineCount() { return nLines; }
+  int getLineCount() const { return nLines; }
 
 private:
 
-  bool isBeforeByRule1(TextBlock *blk1);
-  bool isBeforeByRepeatedRule1(TextBlock *blkList, TextBlock *blk1);
-  bool isBeforeByRule2(TextBlock *blk1);
+  bool isBeforeByRule1(const TextBlock *blk1);
+  bool isBeforeByRepeatedRule1(const TextBlock *blkList, const TextBlock *blk1);
+  bool isBeforeByRule2(const TextBlock *blk1);
 
   int visitDepthFirst(TextBlock *blkList, int pos1,
 		      TextBlock **sorted, int sortPos,
@@ -471,13 +471,13 @@ public:
   // it uses a font no larger than the last block added to the flow,
   // and (2) it fits within the flow's [priMin, priMax] along the
   // primary axis.
-  bool blockFits(TextBlock *blk, TextBlock *prevBlk);
+  bool blockFits(const TextBlock *blk, const TextBlock *prevBlk) const;
 
   // Get the head of the linked list of TextBlocks.
-  TextBlock *getBlocks() { return blocks; }
+  const TextBlock *getBlocks() const { return blocks; }
 
   // Get the next TextFlow on the linked list.
-  TextFlow *getNext() { return next; }
+  const TextFlow *getNext() const { return next; }
 
 private:
 
@@ -506,7 +506,7 @@ public:
   // text->rawOrder is true), physical layout order (if <physLayout>
   // is true and text->rawOrder is false), or reading order (if both
   // flags are false).
-  TextWordList(TextPage *text, bool physLayout);
+  TextWordList(const TextPage *text, bool physLayout);
 
   ~TextWordList();
 
@@ -514,7 +514,7 @@ public:
   TextWordList& operator=(const TextWordList &) = delete;
 
   // Return the number of words on the list.
-  int getLength();
+  int getLength() const;
 
   // Return the <idx>th word from the list.
   TextWord *get(int idx);
@@ -528,17 +528,17 @@ private:
 
 class TextWordSelection {
 public:
-  TextWordSelection(TextWord *wordA, int beginA, int endA)
+  TextWordSelection(const TextWord *wordA, int beginA, int endA)
     : word(wordA), begin(beginA), end(endA)
   {
   }
 
-  TextWord * getWord() const { return word; }
+  const TextWord * getWord() const { return word; }
   int getBegin() const { return begin; }
   int getEnd() const { return end; }
 
 private:
-  TextWord *word;
+  const TextWord *word;
   int begin;
   int end;
 
@@ -563,19 +563,19 @@ public:
   void decRefCnt();
 
   // Start a new page.
-  void startPage(GfxState *state);
+  void startPage(const GfxState *state);
 
   // End the current page.
   void endPage();
 
   // Update the current font.
-  void updateFont(GfxState *state);
+  void updateFont(const GfxState *state);
 
   // Begin a new word.
-  void beginWord(GfxState *state);
+  void beginWord(const GfxState *state);
 
   // Add a character to the current word.
-  void addChar(GfxState *state, double x, double y,
+  void addChar(const GfxState *state, double x, double y,
 	       double dx, double dy,
 	       CharCode c, int nBytes, const Unicode *u, int uLen);
 
@@ -604,7 +604,7 @@ public:
   // bottom of the page; else if <stopAtLast> is true, stops looking
   // just before the last find result; else stops looking at
   // <xMax>,<yMax>.
-  bool findText(Unicode *s, int len,
+  bool findText(const Unicode *s, int len,
 		 bool startAtTop, bool stopAtBottom,
 		 bool startAtLast, bool stopAtLast,
 		 bool caseSensitive, bool backward,
@@ -616,7 +616,7 @@ public:
   // insensitive search, i.e. ignore accents, umlauts, diaeresis,etc.
   // while matching. This option will be ignored if <s> contains characters
   // which are not pure ascii.
-  bool findText(Unicode *s, int len,
+  bool findText(const Unicode *s, int len,
 		 bool startAtTop, bool stopAtBottom,
 		 bool startAtLast, bool stopAtLast,
 		 bool caseSensitive, bool ignoreDiacritics,
@@ -626,27 +626,27 @@ public:
 
   // Get the text which is inside the specified rectangle.
   GooString *getText(double xMin, double yMin,
-		     double xMax, double yMax);
+		     double xMax, double yMax) const;
 
   void visitSelection(TextSelectionVisitor *visitor,
-		      PDFRectangle *selection,
+		      const PDFRectangle *selection,
 		      SelectionStyle style);
 
   void drawSelection(OutputDev *out,
 		     double scale,
 		     int rotation,
-		     PDFRectangle *selection,
+		     const PDFRectangle *selection,
 		     SelectionStyle style,
-		     GfxColor *glyph_color, GfxColor *box_color);
+		     const GfxColor *glyph_color, const GfxColor *box_color);
 
-  std::vector<PDFRectangle*> *getSelectionRegion(PDFRectangle *selection,
+  std::vector<PDFRectangle*> *getSelectionRegion(const PDFRectangle *selection,
 			      SelectionStyle style,
 			      double scale);
 
-  GooString *getSelectionText(PDFRectangle *selection,
+  GooString *getSelectionText(const PDFRectangle *selection,
 			      SelectionStyle style);
 
-  std::vector<TextWordSelection*> **getSelectionWords(PDFRectangle *selection,
+  std::vector<TextWordSelection*> **getSelectionWords(const PDFRectangle *selection,
                               SelectionStyle style,
                               int *nLines);
 
@@ -655,14 +655,14 @@ public:
   // false.
   bool findCharRange(int pos, int length,
 		      double *xMin, double *yMin,
-		      double *xMax, double *yMax);
+		      double *xMax, double *yMax) const;
 
   // Dump contents of page to a file.
   void dump(void *outputStream, TextOutputFunc outputFunc,
 	    bool physLayout);
 
   // Get the head of the linked list of TextFlows.
-  TextFlow *getFlows() { return flows; }
+  const TextFlow *getFlows() const { return flows; }
 
   // If true, will combine characters when a base and combining
   // character are drawn on eachother.
@@ -682,8 +682,8 @@ private:
   ~TextPage();
   
   void clear();
-  void assignColumns(TextLineFrag *frags, int nFrags, bool rot);
-  int dumpFragment(Unicode *text, int len, UnicodeMap *uMap, GooString *s);
+  void assignColumns(TextLineFrag *frags, int nFrags, bool rot) const;
+  int dumpFragment(const Unicode *text, int len, const UnicodeMap *uMap, GooString *s) const;
 
   bool rawOrder;		// keep text in content stream order
   bool discardDiag;		// discard diagonal text
@@ -746,11 +746,11 @@ public:
   ActualText(const ActualText &) = delete;
   ActualText& operator=(const ActualText &) = delete;
 
-  void addChar(GfxState *state, double x, double y,
+  void addChar(const GfxState *state, double x, double y,
 	       double dx, double dy,
 	       CharCode c, int nBytes, const Unicode *u, int uLen);
-  void begin(GfxState *state, const GooString *text);
-  void end(GfxState *state);
+  void begin(const GfxState *state, const GooString *text);
+  void end(const GfxState *state);
 
 private:
   TextPage *text;
@@ -858,35 +858,35 @@ public:
   // bottom of the page; else if <stopAtLast> is true, stops looking
   // just before the last find result; else stops looking at
   // <xMax>,<yMax>.
-  bool findText(Unicode *s, int len,
+  bool findText(const Unicode *s, int len,
 		 bool startAtTop, bool stopAtBottom,
 		 bool startAtLast, bool stopAtLast,
 		 bool caseSensitive, bool backward,
 		 bool wholeWord,
 		 double *xMin, double *yMin,
-		 double *xMax, double *yMax);
+		 double *xMax, double *yMax) const;
 
   // Get the text which is inside the specified rectangle.
   GooString *getText(double xMin, double yMin,
-		   double xMax, double yMax);
+		   double xMax, double yMax) const;
 
   // Find a string by character position and length.  If found, sets
   // the text bounding rectangle and returns true; otherwise returns
   // false.
   bool findCharRange(int pos, int length,
 		      double *xMin, double *yMin,
-		      double *xMax, double *yMax);
+		      double *xMax, double *yMax) const;
 
   void drawSelection(OutputDev *out, double scale, int rotation,
-		     PDFRectangle *selection,
+		     const PDFRectangle *selection,
 		     SelectionStyle style,
-		     GfxColor *glyph_color, GfxColor *box_color);
+		     const GfxColor *glyph_color, const GfxColor *box_color);
 
-  std::vector<PDFRectangle*> *getSelectionRegion(PDFRectangle *selection,
+  std::vector<PDFRectangle*> *getSelectionRegion(const PDFRectangle *selection,
 			      SelectionStyle style,
 			      double scale);
 
-  GooString *getSelectionText(PDFRectangle *selection,
+  GooString *getSelectionText(const PDFRectangle *selection,
 			      SelectionStyle style);
 
   // If true, will combine characters when a base and combining
@@ -910,7 +910,7 @@ public:
 
   // Get the head of the linked list of TextFlows for the
   // last rasterized page.
-  TextFlow *getFlows();
+  const TextFlow *getFlows() const;
 
 private:
 
diff --git a/poppler/UnicodeMap.cc b/poppler/UnicodeMap.cc
index 6e7e467b..e25b8f2e 100644
--- a/poppler/UnicodeMap.cc
+++ b/poppler/UnicodeMap.cc
@@ -261,7 +261,7 @@ bool UnicodeMap::match(const GooString *encodingNameA) const {
   return !encodingName->cmp(encodingNameA);
 }
 
-int UnicodeMap::mapUnicode(Unicode u, char *buf, int bufSize) {
+int UnicodeMap::mapUnicode(Unicode u, char *buf, int bufSize) const {
   int a, b, m, n, i, j;
   unsigned int code;
 
diff --git a/poppler/UnicodeMap.h b/poppler/UnicodeMap.h
index 17f1d59c..641519b4 100644
--- a/poppler/UnicodeMap.h
+++ b/poppler/UnicodeMap.h
@@ -94,7 +94,7 @@ public:
   // output and returns the number of bytes used.  Output will be
   // truncated at <bufSize> bytes.  No string terminator is written.
   // Returns 0 if no mapping is found.
-  int mapUnicode(Unicode u, char *buf, int bufSize);
+  int mapUnicode(Unicode u, char *buf, int bufSize) const;
 
 private:
 
diff --git a/qt5/src/poppler-page.cc b/qt5/src/poppler-page.cc
index 69006754..7341f419 100644
--- a/qt5/src/poppler-page.cc
+++ b/qt5/src/poppler-page.cc
@@ -782,7 +782,7 @@ QList<TextBox*> Page::textList(Rotation rotate, ShouldAbortQueryFunc shouldAbort
     return output_list;
   }
   
-  QHash<TextWord *, TextBox*> wordBoxMap;
+  QHash<const TextWord *, TextBox*> wordBoxMap;
   
   output_list.reserve(word_list->getLength());
   for (int i = 0; i < word_list->getLength(); i++) {
diff --git a/utils/pdftotext.cc b/utils/pdftotext.cc
index 09b988ff..c18b1483 100644
--- a/utils/pdftotext.cc
+++ b/utils/pdftotext.cc
@@ -16,7 +16,7 @@
 // under GPL version 2 or later
 //
 // Copyright (C) 2006 Dominic Lachowicz <cinamod at hotmail.com>
-// Copyright (C) 2007-2008, 2010, 2011, 2017, 2018 Albert Astals Cid <aacid at kde.org>
+// Copyright (C) 2007-2008, 2010, 2011, 2017-2019 Albert Astals Cid <aacid at kde.org>
 // Copyright (C) 2009 Jan Jockusch <jan at jockusch.de>
 // Copyright (C) 2010, 2013 Hib Eris <hib at hiberis.nl>
 // Copyright (C) 2010 Kenneth Berland <ken at hero.com>
@@ -487,10 +487,10 @@ static void printInfoDate(FILE *f, Dict *infoDict, const char *key, const char *
   }
 }
 
-static void printLine(FILE *f, TextLine *line) {
+static void printLine(FILE *f, const TextLine *line) {
   double xMin, yMin, xMax, yMax;
   double lineXMin = 0, lineYMin = 0, lineXMax = 0, lineYMax = 0;
-  TextWord *word;
+  const TextWord *word;
   std::stringstream wordXML;
   wordXML << std::fixed << std::setprecision(6);
 
@@ -516,9 +516,9 @@ static void printLine(FILE *f, TextLine *line) {
 
 void printDocBBox(FILE *f, PDFDoc *doc, TextOutputDev *textOut, int first, int last) {
   double xMin, yMin, xMax, yMax;
-  TextFlow *flow;
-  TextBlock *blk;
-  TextLine *line;
+  const TextFlow *flow;
+  const TextBlock *blk;
+  const TextLine *line;
 
   fprintf(f, "<doc>\n");
   for (int page = first; page <= last; ++page) {


More information about the poppler mailing list