[poppler] 6 commits - poppler/PSOutputDev.cc poppler/PSOutputDev.h poppler/TextOutputDev.cc splash/Splash.cc

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Wed Jun 5 19:20:32 UTC 2019


 poppler/PSOutputDev.cc   |   29 ++++++++++++++---------------
 poppler/PSOutputDev.h    |    8 ++++----
 poppler/TextOutputDev.cc |    8 ++++----
 splash/Splash.cc         |    6 +++---
 4 files changed, 25 insertions(+), 26 deletions(-)

New commits:
commit c7981a19fab9abf8df31e67c87aa7710fdf60bc7
Author: Albert Astals Cid <aacid at kde.org>
Date:   Wed Jun 5 21:13:46 2019 +0200

    text -> t
    
    Fixes some shadow warnings

diff --git a/poppler/TextOutputDev.cc b/poppler/TextOutputDev.cc
index 32d7968c..77624013 100644
--- a/poppler/TextOutputDev.cc
+++ b/poppler/TextOutputDev.cc
@@ -5601,10 +5601,10 @@ void ActualText::addChar(GfxState *state, double x, double y,
   actualTextNBytes += nBytes;
 }
 
-void ActualText::begin(GfxState *state, const GooString *text) {
+void ActualText::begin(GfxState *state, const GooString *t) {
   if (actualText)
     delete actualText;
-  actualText = new GooString(text);
+  actualText = new GooString(t);
   actualTextNBytes = 0;
 }
 
@@ -5738,9 +5738,9 @@ void TextOutputDev::incCharCount(int nChars) {
   text->incCharCount(nChars);
 }
 
-void TextOutputDev::beginActualText(GfxState *state, const GooString *text)
+void TextOutputDev::beginActualText(GfxState *state, const GooString *t)
 {
-  actualText->begin(state, text);
+  actualText->begin(state, t);
 }
 
 void TextOutputDev::endActualText(GfxState *state)
commit 024dd8d2bd58ded2457581fc2e6eea5ecc664c45
Author: Albert Astals Cid <aacid at kde.org>
Date:   Wed Jun 5 21:10:26 2019 +0200

    adjustLine -> doAdjustLine
    
    fixes shadow warning

diff --git a/splash/Splash.cc b/splash/Splash.cc
index 24bdce7b..dea728dd 100644
--- a/splash/Splash.cc
+++ b/splash/Splash.cc
@@ -2590,16 +2590,16 @@ SplashError Splash::fillWithPattern(SplashPath *path, bool eo,
 	  state->clip->clipAALine(aaBuf, &x0, &x1, y, thinLineMode != splashThinLineDefault && xMinI == xMaxI);
 	}
 	unsigned char lineShape = 255;
-	bool adjustLine = false;
+	bool doAdjustLine = false;
 	if (thinLineMode == splashThinLineShape && (xMinI == xMaxI || yMinI == yMaxI)) {
 	  // compute line shape for thin lines:
 	  SplashCoord mx, my, delta;
 	  transform(state->matrix, 0, 0, &mx, &my);
 	  transform(state->matrix, state->lineWidth, 0, &delta, &my);
-	  adjustLine = true;
+	  doAdjustLine = true;
 	  lineShape = clip255((delta - mx) * 255);
 	}
-	drawAALine(&pipe, x0, x1, y, adjustLine, lineShape);
+	drawAALine(&pipe, x0, x1, y, doAdjustLine, lineShape);
       }
     } else {
       for (y = yMinI; y <= yMaxI; ++y) {
commit f9ab3afbb4c1129813eec68c5914ad1796484daf
Author: Albert Astals Cid <aacid at kde.org>
Date:   Wed Jun 5 20:55:54 2019 +0200

    Fix shadow warning in PSOutputDev::tilingPatternFill

diff --git a/poppler/PSOutputDev.cc b/poppler/PSOutputDev.cc
index ba143988..5de181d0 100644
--- a/poppler/PSOutputDev.cc
+++ b/poppler/PSOutputDev.cc
@@ -4501,18 +4501,17 @@ bool PSOutputDev::tilingPatternFill(GfxState *state, Gfx *gfxA, Catalog *cat, Ob
     // Don't need to use patterns if only one instance of the pattern is used
     PDFRectangle box;
     Gfx *gfx;
-    double x, y, tx, ty;
 
-    x = x0 * xStep;
-    y = y0 * yStep;
-    tx = x * mat[0] + y * mat[2] + mat[4];
-    ty = x * mat[1] + y * mat[3] + mat[5];
+    const double singleStep_x = x0 * xStep;
+    const double singleStep_y = y0 * yStep;
+    const double singleStep_tx = singleStep_x * mat[0] + singleStep_y * mat[2] + mat[4];
+    const double singleStep_ty = singleStep_x * mat[1] + singleStep_y * mat[3] + mat[5];
     box.x1 = bbox[0];
     box.y1 = bbox[1];
     box.x2 = bbox[2];
     box.y2 = bbox[3];
     gfx = new Gfx(doc, this, resDict, &box, nullptr, nullptr, nullptr, gfxA);
-    writePSFmt("[{0:.6g} {1:.6g} {2:.6g} {3:.6g} {4:.6g} {5:.6g}] cm\n", mat[0], mat[1], mat[2], mat[3], tx, ty);
+    writePSFmt("[{0:.6g} {1:.6g} {2:.6g} {3:.6g} {4:.6g} {5:.6g}] cm\n", mat[0], mat[1], mat[2], mat[3], singleStep_tx, singleStep_ty);
     inType3Char = true;
     gfx->display(str);
     inType3Char = false;
commit 6b39c1e8c4f13219e0ed5a7545e930136ccbfec5
Author: Albert Astals Cid <aacid at kde.org>
Date:   Wed Jun 5 20:45:28 2019 +0200

    Rename fontMaxValidGlyph map to perFontMaxValidGlyph

diff --git a/poppler/PSOutputDev.cc b/poppler/PSOutputDev.cc
index 620a322c..ba143988 100644
--- a/poppler/PSOutputDev.cc
+++ b/poppler/PSOutputDev.cc
@@ -2529,7 +2529,7 @@ void PSOutputDev::setupExternalTrueTypeFont(GfxFont *font, GooString *fileName,
 
 void PSOutputDev::updateFontMaxValidGlyph(GfxFont *font, int maxValidGlyph) {
   if (maxValidGlyph >= 0 && font->getName()) {
-    auto& fontMaxValidGlyph = this->fontMaxValidGlyph[font->getName()->toStr()];
+    auto& fontMaxValidGlyph = perFontMaxValidGlyph[font->getName()->toStr()];
     if (fontMaxValidGlyph < maxValidGlyph) {
       fontMaxValidGlyph = maxValidGlyph;
     }
@@ -5071,7 +5071,7 @@ void PSOutputDev::drawString(GfxState *state, const GooString *s) {
   if (!(font = state->getFont())) {
     return;
   }
-  maxGlyphInt = (font->getName() ? fontMaxValidGlyph[font->getName()->toStr()] : 0);
+  maxGlyphInt = (font->getName() ? perFontMaxValidGlyph[font->getName()->toStr()] : 0);
   if (maxGlyphInt < 0) maxGlyphInt = 0;
   maxGlyph = (CharCode) maxGlyphInt;
   wMode = font->getWMode();
diff --git a/poppler/PSOutputDev.h b/poppler/PSOutputDev.h
index 2822bfdb..e7949388 100644
--- a/poppler/PSOutputDev.h
+++ b/poppler/PSOutputDev.h
@@ -479,7 +479,7 @@ private:
   int fontIDSize;		// size of fontIDs array
   std::set<int> resourceIDs;	// list of object IDs of objects containing Resources we've already set up
   std::unordered_set<std::string> fontNames; // all used font names
-  std::unordered_map<std::string, int> fontMaxValidGlyph; // max valid glyph of each font
+  std::unordered_map<std::string, int> perFontMaxValidGlyph; // max valid glyph of each font
   PST1FontName *t1FontNames;	// font names for Type 1/1C fonts
   int t1FontNameLen;		// number of entries in t1FontNames array
   int t1FontNameSize;		// size of t1FontNames array
commit 277ce8b4455842d3ddc812a10636603a2d92cf90
Author: Albert Astals Cid <aacid at kde.org>
Date:   Wed Jun 5 20:34:02 2019 +0200

    PSOutputDev::writeHeader: pass int instead of vector
    
    it's what we really need and fixes shadow warning

diff --git a/poppler/PSOutputDev.cc b/poppler/PSOutputDev.cc
index f52e4542..620a322c 100644
--- a/poppler/PSOutputDev.cc
+++ b/poppler/PSOutputDev.cc
@@ -1424,7 +1424,7 @@ void PSOutputDev::postInit()
     Page *page;
     // this check is needed in case the document has zero pages
     if ((page = doc->getPage(pageList[0]))) {
-      writeHeader(pageList,
+      writeHeader(pageList.size(),
 		  page->getMediaBox(),
 		  page->getCropBox(),
 		  page->getRotate(),
@@ -1432,7 +1432,7 @@ void PSOutputDev::postInit()
     } else {
       error(errSyntaxError, -1, "Invalid page {0:d}", pageList[0]);
       box = new PDFRectangle(0, 0, 1, 1);
-      writeHeader(pageList, box, box, 0, psTitle);
+      writeHeader(pageList.size(), box, box, 0, psTitle);
       delete box;
     }
     if (mode != psModeForm) {
@@ -1519,7 +1519,7 @@ PSOutputDev::~PSOutputDev() {
   gfree(psTitle);
 }
 
-void PSOutputDev::writeHeader(const std::vector<int> &pages,
+void PSOutputDev::writeHeader(int nPages,
 			      const PDFRectangle *mediaBox, const PDFRectangle *cropBox,
 			      int pageRotate, const char *title) {
   PSOutPaperSize *size;
@@ -1575,7 +1575,7 @@ void PSOutputDev::writeHeader(const std::vector<int> &pages,
                  i==0 ? "DocumentMedia:" : "+", size->name, size->w, size->h);
     }
     writePSFmt("%%BoundingBox: 0 0 {0:d} {1:d}\n", paperWidth, paperHeight);
-    writePSFmt("%%Pages: {0:d}\n", static_cast<int>(pages.size()));
+    writePSFmt("%%Pages: {0:d}\n", nPages);
     writePS("%%EndComments\n");
     if (!paperMatch) {
       size = (*paperSizes)[0];
diff --git a/poppler/PSOutputDev.h b/poppler/PSOutputDev.h
index 9e31578f..2822bfdb 100644
--- a/poppler/PSOutputDev.h
+++ b/poppler/PSOutputDev.h
@@ -166,7 +166,7 @@ public:
   //----- header/trailer (used only if manualCtrl is true)
 
   // Write the document-level header.
-  void writeHeader(const std::vector<int> &pages,
+  void writeHeader(int nPages,
 		   const PDFRectangle *mediaBox, const PDFRectangle *cropBox,
 		   int pageRotate, const char *title);
 
commit bd6a0c584ce48accc1351fd651e7bafa6003140b
Author: Albert Astals Cid <aacid at kde.org>
Date:   Wed Jun 5 20:29:29 2019 +0200

    PSOutputDev: psTitle -> title as a function parameter
    
    fixes shadow warning

diff --git a/poppler/PSOutputDev.cc b/poppler/PSOutputDev.cc
index 73f2fb18..f52e4542 100644
--- a/poppler/PSOutputDev.cc
+++ b/poppler/PSOutputDev.cc
@@ -1521,7 +1521,7 @@ PSOutputDev::~PSOutputDev() {
 
 void PSOutputDev::writeHeader(const std::vector<int> &pages,
 			      const PDFRectangle *mediaBox, const PDFRectangle *cropBox,
-			      int pageRotate, char *psTitle) {
+			      int pageRotate, const char *title) {
   PSOutPaperSize *size;
   double x1, y1, x2, y2;
 
@@ -1545,8 +1545,8 @@ void PSOutputDev::writeHeader(const std::vector<int> &pages,
         writePSTextLine(obj1.getString());
     }
   }
-  if(psTitle) {
-    char *sanitizedTitle = strdup(psTitle);
+  if(title) {
+    char *sanitizedTitle = strdup(title);
     for (unsigned int i = 0; i < strlen(sanitizedTitle); ++i) {
       if (sanitizedTitle[i] == '\n' || sanitizedTitle[i] == '\r') {
         sanitizedTitle[i] = ' ';
diff --git a/poppler/PSOutputDev.h b/poppler/PSOutputDev.h
index ecdf19f7..9e31578f 100644
--- a/poppler/PSOutputDev.h
+++ b/poppler/PSOutputDev.h
@@ -15,7 +15,7 @@
 //
 // Copyright (C) 2005 Martin Kretzschmar <martink at gnome.org>
 // Copyright (C) 2005 Kristian Høgsberg <krh at redhat.com>
-// Copyright (C) 2006-2008, 2012, 2013, 2015, 2017, 2018 Albert Astals Cid <aacid at kde.org>
+// Copyright (C) 2006-2008, 2012, 2013, 2015, 2017-2019 Albert Astals Cid <aacid at kde.org>
 // Copyright (C) 2007 Brad Hards <bradh at kde.org>
 // Copyright (C) 2009-2013 Thomas Freitag <Thomas.Freitag at alfa.de>
 // Copyright (C) 2009 Till Kamppeter <till.kamppeter at gmail.com>
@@ -168,7 +168,7 @@ public:
   // Write the document-level header.
   void writeHeader(const std::vector<int> &pages,
 		   const PDFRectangle *mediaBox, const PDFRectangle *cropBox,
-		   int pageRotate, char *pstitle);
+		   int pageRotate, const char *title);
 
   // Write the Xpdf procset.
   void writeXpdfProcset();


More information about the poppler mailing list