[poppler] 5 commits - poppler/Annot.cc poppler/Dict.cc poppler/GfxState.cc poppler/GlobalParams.cc poppler/StructElement.cc

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


 poppler/Annot.cc         |    4 ++--
 poppler/Dict.cc          |    7 +++----
 poppler/GfxState.cc      |    3 +--
 poppler/GlobalParams.cc  |   27 ++++++++++++++-------------
 poppler/StructElement.cc |    8 ++++----
 5 files changed, 24 insertions(+), 25 deletions(-)

New commits:
commit 32eed048980ae480e6671fe272c6b9037d1cd0e7
Author: Albert Astals Cid <aacid at kde.org>
Date:   Fri Apr 5 17:04:42 2019 +0200

    Annot::initialize: Rename ref to pRef to not collide with Annot::ref

diff --git a/poppler/Annot.cc b/poppler/Annot.cc
index a061a1b7..e703b5b9 100644
--- a/poppler/Annot.cc
+++ b/poppler/Annot.cc
@@ -1229,9 +1229,9 @@ void Annot::initialize(PDFDoc *docA, Dict *dict) {
   // Note: This value is overwritten by Annots ctor
   const Object &pObj = dict->lookupNF("P");
   if (pObj.isRef()) {
-    const Ref ref = pObj.getRef();
+    const Ref pRef = pObj.getRef();
 
-    page = doc->getCatalog()->findPage (ref);
+    page = doc->getCatalog()->findPage (pRef);
   } else {
     page = 0;
   }
commit 40e999471ecfcb42804c00a3c9ff31677d8838df
Author: Albert Astals Cid <aacid at kde.org>
Date:   Fri Mar 29 17:51:02 2019 +0100

    GfxDeviceNColorSpace::copy: Move i inside loop

diff --git a/poppler/GfxState.cc b/poppler/GfxState.cc
index 557ce46d..dc7939b7 100644
--- a/poppler/GfxState.cc
+++ b/poppler/GfxState.cc
@@ -2976,7 +2976,6 @@ GfxDeviceNColorSpace::~GfxDeviceNColorSpace() {
 }
 
 GfxColorSpace *GfxDeviceNColorSpace::copy() {
-  int i;
   int *mappingA = nullptr;
 
   auto sepsCSA = new std::vector<GfxSeparationColorSpace*>();
@@ -2989,7 +2988,7 @@ GfxColorSpace *GfxDeviceNColorSpace::copy() {
   }
   if (mapping != nullptr) {
     mappingA = (int *)gmalloc(sizeof(int) * nComps);
-    for (i = 0; i < nComps; i++)
+    for (int i = 0; i < nComps; i++)
       mappingA[i] = mapping[i];
   }
   return new GfxDeviceNColorSpace(nComps, names, alt->copy(), func->copy(),
commit 2e824cd8aa6c743219d6d22f266e33cc7c2d98f8
Author: Albert Astals Cid <aacid at kde.org>
Date:   Fri Mar 29 17:44:31 2019 +0100

    GlobalParams: Fix shadow warnings

diff --git a/poppler/GlobalParams.cc b/poppler/GlobalParams.cc
index c76ab1f5..d737003f 100644
--- a/poppler/GlobalParams.cc
+++ b/poppler/GlobalParams.cc
@@ -15,7 +15,7 @@
 //
 // Copyright (C) 2005 Martin Kretzschmar <martink at gnome.org>
 // Copyright (C) 2005, 2006 Kristian Høgsberg <krh at redhat.com>
-// Copyright (C) 2005, 2007-2010, 2012, 2015, 2017, 2018 Albert Astals Cid <aacid at kde.org>
+// Copyright (C) 2005, 2007-2010, 2012, 2015, 2017-2019 Albert Astals Cid <aacid at kde.org>
 // Copyright (C) 2005 Jonathan Blandford <jrb at redhat.com>
 // Copyright (C) 2006, 2007 Jeff Muizelaar <jeff at infidigm.net>
 // Copyright (C) 2006 Takashi Iwai <tiwai at suse.de>
@@ -264,22 +264,23 @@ SysFontInfo *SysFontList::find(const GooString *name, bool fixedWidth, bool exac
   GooString *name2;
   bool bold, italic, oblique;
   SysFontInfo *fi;
-  char c;
-  int n, i;
+  int n;
 
   name2 = name->copy();
 
   // remove space, comma, dash chars
-  i = 0;
-  while (i < name2->getLength()) {
-    c = name2->getChar(i);
-    if (c == ' ' || c == ',' || c == '-') {
-      name2->del(i);
-    } else {
-      ++i;
+  {
+    int i = 0;
+    while (i < name2->getLength()) {
+        const char c = name2->getChar(i);
+        if (c == ' ' || c == ',' || c == '-') {
+        name2->del(i);
+        } else {
+        ++i;
+        }
     }
+    n = name2->getLength();
   }
-  n = name2->getLength();
 
   // remove trailing "MT" (Foo-MT, Foo-BoldMT, etc.)
   if (n > 2 && !strcmp(name2->c_str() + n - 2, "MT")) {
@@ -620,8 +621,8 @@ FILE *GlobalParams::findCMapFile(const GooString *collection, const GooString *c
   FILE *file = nullptr;
 
   globalParamsLocker();
-  const auto cMapDirs = this->cMapDirs.equal_range(collection->toStr());
-  for (auto cMapDir = cMapDirs.first; cMapDir != cMapDirs.second; ++cMapDir) {
+  const auto collectionCMapDirs = cMapDirs.equal_range(collection->toStr());
+  for (auto cMapDir = collectionCMapDirs.first; cMapDir != collectionCMapDirs.second; ++cMapDir) {
     auto* const path = new GooString(cMapDir->second);
     appendToPath(path, cMapName->c_str());
     file = openFile(path->c_str(), "r");
commit 6c16dacc28d975cf3f78ac6b34612f1900c43e74
Author: Albert Astals Cid <aacid at kde.org>
Date:   Fri Mar 29 17:44:12 2019 +0100

    StructElement::parseAttributes: Fix shadow warning

diff --git a/poppler/StructElement.cc b/poppler/StructElement.cc
index ccfa4686..19bac494 100644
--- a/poppler/StructElement.cc
+++ b/poppler/StructElement.cc
@@ -1297,13 +1297,13 @@ void StructElement::parseAttributes(Dict *attributes, bool keepExisting)
       for (int i = 0; i < attributes->getLength(); i++) {
         const char *key = attributes->getKey(i);
         if (strcmp(key, "O") != 0) {
-          Attribute::Type type = Attribute::getTypeForName(key, this);
+          Attribute::Type t = Attribute::getTypeForName(key, this);
 
           // Check if the attribute is already defined.
           if (keepExisting) {
             bool exists = false;
             for (unsigned j = 0; j < getNumAttributes(); j++) {
-              if (getAttribute(j)->getType() == type) {
+              if (getAttribute(j)->getType() == t) {
                 exists = true;
                 break;
               }
@@ -1312,10 +1312,10 @@ void StructElement::parseAttributes(Dict *attributes, bool keepExisting)
               continue;
           }
 
-          if (type != Attribute::Unknown) {
+          if (t != Attribute::Unknown) {
             Object value = attributes->getVal(i);
             bool typeCheckOk = true;
-            Attribute *attribute = new Attribute(type, &value);
+            Attribute *attribute = new Attribute(t, &value);
 
             if (attribute->isOk() && (typeCheckOk = attribute->checkType(this))) {
               appendAttribute(attribute);
commit 42b417547e963d150e1e786e2fa503130ff72184
Author: Albert Astals Cid <aacid at kde.org>
Date:   Fri Mar 29 17:38:21 2019 +0100

    Dict: Use the that pattern for a non-const this

diff --git a/poppler/Dict.cc b/poppler/Dict.cc
index 524a8622..77b8ee18 100644
--- a/poppler/Dict.cc
+++ b/poppler/Dict.cc
@@ -98,11 +98,10 @@ inline const Dict::DictEntry *Dict::find(const char *key) const {
     if (!sorted) {
       dictLocker();
       if (!sorted) {
-	auto& entries = const_cast<std::vector<DictEntry>&>(this->entries);
-	auto& sorted = const_cast<std::atomic_bool&>(this->sorted);
+	Dict *that = const_cast<Dict*>(this);
 
-	std::sort(entries.begin(), entries.end(), CmpDictEntry{});
-	sorted = true;
+	std::sort(that->entries.begin(), that->entries.end(), CmpDictEntry{});
+	that->sorted = true;
       }
     }
   }


More information about the poppler mailing list