[poppler] 3 commits - poppler/GfxFont.cc poppler/GfxState.cc poppler/GfxState.h poppler/TextOutputDev.cc

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Fri Jun 21 17:21:28 UTC 2019


 poppler/GfxFont.cc       |   12 ++++++------
 poppler/GfxState.cc      |   18 +++++++++---------
 poppler/GfxState.h       |    4 ++--
 poppler/TextOutputDev.cc |   14 ++++++++------
 4 files changed, 25 insertions(+), 23 deletions(-)

New commits:
commit 536ec92bc2ef34b6b137cf73f5e9e15a1010eb55
Author: Albert Astals Cid <aacid at kde.org>
Date:   Fri Jun 21 19:10:35 2019 +0200

    GfXShading: Prepend some variables with bbox_
    
    Makes it clear those variables are only about the bbox, also fixes shadow warnings

diff --git a/poppler/GfxState.cc b/poppler/GfxState.cc
index dc7939b7..a562a6ce 100644
--- a/poppler/GfxState.cc
+++ b/poppler/GfxState.cc
@@ -3516,10 +3516,10 @@ GfxShading::GfxShading(GfxShading *shading) {
     background.c[i] = shading->background.c[i];
   }
   hasBackground = shading->hasBackground;
-  xMin = shading->xMin;
-  yMin = shading->yMin;
-  xMax = shading->xMax;
-  yMax = shading->yMax;
+  bbox_xMin = shading->bbox_xMin;
+  bbox_yMin = shading->bbox_yMin;
+  bbox_xMax = shading->bbox_xMax;
+  bbox_yMax = shading->bbox_yMax;
   hasBBox = shading->hasBBox;
 }
 
@@ -3630,7 +3630,7 @@ bool GfxShading::init(GfxResources *res, Dict *dict, OutputDev *out, GfxState *s
     }
   }
 
-  xMin = yMin = xMax = yMax = 0;
+  bbox_xMin = bbox_yMin = bbox_xMax = bbox_yMax = 0;
   hasBBox = false;
   obj1 = dict->lookup("BBox");
   if (obj1.isArray()) {
@@ -3642,10 +3642,10 @@ bool GfxShading::init(GfxResources *res, Dict *dict, OutputDev *out, GfxState *s
       if (obj2.isNum() && obj3.isNum() && obj4.isNum() && obj5.isNum())
       {
         hasBBox = true;
-        xMin = obj2.getNum();
-        yMin = obj3.getNum();
-        xMax = obj4.getNum();
-        yMax = obj5.getNum();
+        bbox_xMin = obj2.getNum();
+        bbox_yMin = obj3.getNum();
+        bbox_xMax = obj4.getNum();
+        bbox_yMax = obj5.getNum();
       } else {
         error(errSyntaxWarning, -1, "Bad BBox in shading dictionary (Values not numbers)");
       }
diff --git a/poppler/GfxState.h b/poppler/GfxState.h
index 57bb26fa..88463d1d 100644
--- a/poppler/GfxState.h
+++ b/poppler/GfxState.h
@@ -866,7 +866,7 @@ public:
   const GfxColor *getBackground() const { return &background; }
   bool getHasBackground() const { return hasBackground; }
   void getBBox(double *xMinA, double *yMinA, double *xMaxA, double *yMaxA) const
-    { *xMinA = xMin; *yMinA = yMin; *xMaxA = xMax; *yMaxA = yMax; }
+    { *xMinA = bbox_xMin; *yMinA = bbox_yMin; *xMaxA = bbox_xMax; *yMaxA = bbox_yMax; }
   bool getHasBBox() const { return hasBBox; }
 
 protected:
@@ -885,7 +885,7 @@ protected:
   bool hasBBox;
   GfxColorSpace *colorSpace;
   GfxColor background;
-  double xMin, yMin, xMax, yMax;
+  double bbox_xMin, bbox_yMin, bbox_xMax, bbox_yMax;
 };
 
 //------------------------------------------------------------------------
commit 8ec3c11697a4ed735b2a9d0ee1d759e42d7c6246
Author: Albert Astals Cid <aacid at kde.org>
Date:   Fri Jun 21 18:57:00 2019 +0200

    GfxFont: Rename local variable cmap to cnameCmap
    
    Fixes shadow warning

diff --git a/poppler/GfxFont.cc b/poppler/GfxFont.cc
index c74b4b0d..cdf8975b 100644
--- a/poppler/GfxFont.cc
+++ b/poppler/GfxFont.cc
@@ -2188,7 +2188,6 @@ int *GfxCIDFont::getCodeToGIDMap(FoFiTrueType *ff, int *mapsizep) {
   unsigned long code;
   int wmode;
   const char **cmapName;
-  CMap *cMap;
   CMapListEntry *lp;
   int cmap;
   int cmapPlatform, cmapEncoding;
@@ -2261,14 +2260,15 @@ int *GfxCIDFont::getCodeToGIDMap(FoFiTrueType *ff, int *mapsizep) {
     for (cmapName = lp->CMaps;*cmapName != nullptr;cmapName++) {
       GooString cname(*cmapName);
 
-      if ((cMap = globalParams->getCMap(getCollection(),&cname))
+      CMap *cnameCMap;
+      if ((cnameCMap = globalParams->getCMap(getCollection(),&cname))
 	   != nullptr) {
-	    if (cMap->getWMode()) {
-		cMap->setReverseMap(vumap,n,1);
+	    if (cnameCMap->getWMode()) {
+		cnameCMap->setReverseMap(vumap,n,1);
 	    } else {
-		cMap->setReverseMap(humap,n,N_UCS_CANDIDATES);
+		cnameCMap->setReverseMap(humap,n,N_UCS_CANDIDATES);
 	    }
-	cMap->decRefCnt();
+	cnameCMap->decRefCnt();
       }
     }
     ff->setupGSUB(lp->scriptTag, lp->languageTag);
commit 7b088899d97981a9cd62f68fd632d7394f10c9d7
Author: Albert Astals Cid <aacid at kde.org>
Date:   Fri Jun 21 18:46:34 2019 +0200

    TextOutputDev: break i definition into multiple ones
    
    Fixes shadow warning

diff --git a/poppler/TextOutputDev.cc b/poppler/TextOutputDev.cc
index a6a80c26..6cb1d9aa 100644
--- a/poppler/TextOutputDev.cc
+++ b/poppler/TextOutputDev.cc
@@ -2803,7 +2803,7 @@ void TextPage::coalesce(bool physLayout, double fixedPitch, bool doHTML) {
   int count[4];
   int lrCount;
   int col1, col2;
-  int i, j, n;
+  int j, n;
 
   if (rawOrder) {
     primaryRot = 0;
@@ -3331,7 +3331,7 @@ void TextPage::coalesce(bool physLayout, double fixedPitch, bool doHTML) {
   for (blk = blkList; blk; blk = blk->next) {
     for (line = blk->lines; line; line = line->next) {
       for (word0 = line->words; word0; word0 = word0->next) {
-	for (i = 0; i < word0->len; ++i) {
+	for (int i = 0; i < word0->len; ++i) {
 	  if (unicodeTypeL(word0->text[i])) {
 	    ++lrCount;
 	  } else if (unicodeTypeR(word0->text[i])) {
@@ -3357,6 +3357,7 @@ void TextPage::coalesce(bool physLayout, double fixedPitch, bool doHTML) {
   if (physLayout && fixedPitch) {
 
     blocks = (TextBlock **)gmallocn(nBlocks, sizeof(TextBlock *));
+    int i;
     for (blk = blkList, i = 0; blk; blk = blk->next, ++i) {
       blocks[i] = blk;
       col1 = 0; // make gcc happy
@@ -3386,6 +3387,7 @@ void TextPage::coalesce(bool physLayout, double fixedPitch, bool doHTML) {
 
     // sort blocks into xy order for column assignment
     blocks = (TextBlock **)gmallocn(nBlocks, sizeof(TextBlock *));
+    int i;
     for (blk = blkList, i = 0; blk; blk = blk->next, ++i) {
       blocks[i] = blk;
     }
@@ -3485,7 +3487,7 @@ void TextPage::coalesce(bool physLayout, double fixedPitch, bool doHTML) {
   //----- reading order sort
 
   // compute space on left and right sides of each block
-  for (i = 0; i < nBlocks; ++i) {
+  for (int i = 0; i < nBlocks; ++i) {
     blk0 = blocks[i];
     for (j = 0; j < nBlocks; ++j) {
       blk1 = blocks[j];
@@ -3501,7 +3503,7 @@ void TextPage::coalesce(bool physLayout, double fixedPitch, bool doHTML) {
 
   int sortPos = 0;
   bool *visited = (bool *)gmallocn(nBlocks, sizeof(bool));
-  for (i = 0; i < nBlocks; i++) {
+  for (int i = 0; i < nBlocks; i++) {
     visited[i] = false;
   }
 
@@ -3677,7 +3679,7 @@ void TextPage::coalesce(bool physLayout, double fixedPitch, bool doHTML) {
   PDFRectangle *envelopes = new PDFRectangle [numTables];
   TextBlock **ending_blocks = new TextBlock* [numTables];
 
-  for (i = 0; i < numTables; i++) {
+  for (int i = 0; i < numTables; i++) {
     envelopes[i].x1 = DBL_MAX;
     envelopes[i].x2 = DBL_MIN;
     envelopes[i].y1 = DBL_MAX;
@@ -3764,7 +3766,7 @@ void TextPage::coalesce(bool physLayout, double fixedPitch, bool doHTML) {
     }
   }
 
-  i = -1;
+  int i = -1;
   for (blk1 = blkList; blk1; blk1 = blk1->next) {
     i++;
     sortPos = blk1->visitDepthFirst(blkList, i, blocks, sortPos, visited);


More information about the poppler mailing list