[poppler] 8 commits - poppler/Form.cc poppler/PSOutputDev.cc poppler/PSOutputDev.h poppler/TextOutputDev.cc

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Sat Jun 8 08:54:05 UTC 2019


 poppler/Form.cc          |   64 +++++++++++++++++++++++------------------------
 poppler/PSOutputDev.cc   |   10 +++----
 poppler/PSOutputDev.h    |    2 -
 poppler/TextOutputDev.cc |   20 +++++++-------
 4 files changed, 48 insertions(+), 48 deletions(-)

New commits:
commit a9bf48780660b855135d2435c7dd29dddb3d45c0
Author: Albert Astals Cid <aacid at kde.org>
Date:   Fri Jun 7 17:08:10 2019 +0200

    FormField::getFullyQualifiedName: Rename variable
    
    fixes shadow warning

diff --git a/poppler/Form.cc b/poppler/Form.cc
index b3aed725..3efa6b4f 100644
--- a/poppler/Form.cc
+++ b/poppler/Form.cc
@@ -842,7 +842,7 @@ FormWidget* FormField::findWidgetByRef (Ref aref)
 
 GooString* FormField::getFullyQualifiedName() {
   Object obj1;
-  Object parent;
+  Object parentObj;
   const GooString *parent_name;
   GooString *full_name;
   bool unicode_encoded = false;
@@ -853,8 +853,8 @@ GooString* FormField::getFullyQualifiedName() {
   full_name = new GooString();
 
   obj1 = obj.copy();
-  while (parent = obj1.dictLookup("Parent"), parent.isDict()) {
-    Object obj2 = parent.dictLookup("T");
+  while (parentObj = obj1.dictLookup("Parent"), parentObj.isDict()) {
+    Object obj2 = parentObj.dictLookup("T");
     if (obj2.isString()) {
       parent_name = obj2.getString();
 
@@ -879,7 +879,7 @@ GooString* FormField::getFullyQualifiedName() {
         }
       }
     }
-    obj1 = parent.copy();
+    obj1 = parentObj.copy();
   }
 
   if (partialName) {
commit 5d9eebbf4b31ef3124015d7ac4e5d9723b91a042
Author: Albert Astals Cid <aacid at kde.org>
Date:   Fri Jun 7 17:07:06 2019 +0200

    FormField::_createWidget: Rename parameter to fix shadow warning

diff --git a/poppler/Form.cc b/poppler/Form.cc
index c9ba3a70..b3aed725 100644
--- a/poppler/Form.cc
+++ b/poppler/Form.cc
@@ -799,7 +799,7 @@ void FormField::createWidgetAnnotations() {
   }
 }
 
-void FormField::_createWidget (Object *obj, Ref aref)
+void FormField::_createWidget (Object *objA, Ref aref)
 {
   terminal = true;
   numChildren++;
@@ -807,16 +807,16 @@ void FormField::_createWidget (Object *obj, Ref aref)
   //ID = index in "widgets" table
   switch (type) {
   case formButton:
-    widgets[numChildren-1] = new FormWidgetButton(doc, obj, numChildren-1, aref, this);
+    widgets[numChildren-1] = new FormWidgetButton(doc, objA, numChildren-1, aref, this);
     break;
   case formText:
-    widgets[numChildren-1] = new FormWidgetText(doc, obj, numChildren-1, aref, this);
+    widgets[numChildren-1] = new FormWidgetText(doc, objA, numChildren-1, aref, this);
     break;
   case formChoice:
-    widgets[numChildren-1] = new FormWidgetChoice(doc, obj, numChildren-1, aref, this);
+    widgets[numChildren-1] = new FormWidgetChoice(doc, objA, numChildren-1, aref, this);
     break;
   case formSignature:
-    widgets[numChildren-1] = new FormWidgetSignature(doc, obj, numChildren-1, aref, this);
+    widgets[numChildren-1] = new FormWidgetSignature(doc, objA, numChildren-1, aref, this);
     break;
   default:
     error(errSyntaxWarning, -1, "SubType on non-terminal field, invalid document?");
commit fb8093dd3ac116d382b9cea9b940d59be89bd304
Author: Albert Astals Cid <aacid at kde.org>
Date:   Fri Jun 7 17:06:10 2019 +0200

    FormWidgetSignature::getSignedRangeBounds: obj -> byteRangeObj

diff --git a/poppler/Form.cc b/poppler/Form.cc
index a5454c80..c9ba3a70 100644
--- a/poppler/Form.cc
+++ b/poppler/Form.cc
@@ -463,16 +463,16 @@ SignatureInfo *FormWidgetSignature::validateSignature(bool doVerifyCert, bool fo
 
 std::vector<Goffset> FormWidgetSignature::getSignedRangeBounds()
 {
-  Object* obj = static_cast<FormFieldSignature*>(field)->getByteRange();
+  Object* byteRangeObj = static_cast<FormFieldSignature*>(field)->getByteRange();
   std::vector<Goffset> range_vec;
-  if (obj->isArray())
+  if (byteRangeObj->isArray())
   {
-    if (obj->arrayGetLength() == 4)
+    if (byteRangeObj->arrayGetLength() == 4)
     {
       for (int i = 0; i < 2; ++i)
       {
-        Object offsetObj(obj->arrayGet(2*i));
-        Object lenObj(obj->arrayGet(2*i+1));
+        Object offsetObj(byteRangeObj->arrayGet(2*i));
+        Object lenObj(byteRangeObj->arrayGet(2*i+1));
         if (offsetObj.isIntOrInt64() && lenObj.isIntOrInt64())
         {
           Goffset offset = offsetObj.getIntOrInt64();
commit 126c9883cf62d59a2cb4818e699f7d0ab19f4519
Author: Albert Astals Cid <aacid at kde.org>
Date:   Fri Jun 7 16:56:01 2019 +0200

    Form: add A to some constructor parameters to avoid shadow warnings

diff --git a/poppler/Form.cc b/poppler/Form.cc
index 66f31a18..a5454c80 100644
--- a/poppler/Form.cc
+++ b/poppler/Form.cc
@@ -177,8 +177,8 @@ LinkAction *FormWidget::getAdditionalAction(Annot::FormAdditionalActionsType t)
   return widget ? widget->getFormAdditionalAction(t) : nullptr;
 }
 
-FormWidgetButton::FormWidgetButton (PDFDoc *docA, Object *aobj, unsigned num, Ref ref, FormField *p) :
-	FormWidget(docA, aobj, num, ref, p)
+FormWidgetButton::FormWidgetButton (PDFDoc *docA, Object *aobj, unsigned num, Ref refA, FormField *p) :
+	FormWidget(docA, aobj, num, refA, p)
 {
   type = formButton;
   onStr = nullptr;
@@ -256,8 +256,8 @@ FormFieldButton *FormWidgetButton::parent() const
 }
 
 
-FormWidgetText::FormWidgetText (PDFDoc *docA, Object *aobj, unsigned num, Ref ref, FormField *p) :
-	FormWidget(docA, aobj, num, ref, p)
+FormWidgetText::FormWidgetText (PDFDoc *docA, Object *aobj, unsigned num, Ref refA, FormField *p) :
+	FormWidget(docA, aobj, num, refA, p)
 {
   type = formText;
 }
@@ -333,8 +333,8 @@ FormFieldText *FormWidgetText::parent() const
   return static_cast<FormFieldText*>(field);
 }
 
-FormWidgetChoice::FormWidgetChoice(PDFDoc *docA, Object *aobj, unsigned num, Ref ref, FormField *p) :
-	FormWidget(docA, aobj, num, ref, p)
+FormWidgetChoice::FormWidgetChoice(PDFDoc *docA, Object *aobj, unsigned num, Ref refA, FormField *p) :
+	FormWidget(docA, aobj, num, refA, p)
 {
   type = formChoice;
 }
@@ -445,8 +445,8 @@ FormFieldChoice *FormWidgetChoice::parent() const
   return static_cast<FormFieldChoice*>(field);
 }
 
-FormWidgetSignature::FormWidgetSignature(PDFDoc *docA, Object *aobj, unsigned num, Ref ref, FormField *p) :
-	FormWidget(docA, aobj, num, ref, p)
+FormWidgetSignature::FormWidgetSignature(PDFDoc *docA, Object *aobj, unsigned num, Ref refA, FormField *p) :
+	FormWidget(docA, aobj, num, refA, p)
 {
   type = formSignature;
 }
@@ -964,8 +964,8 @@ void FormField::setReadOnly (bool value)
 //------------------------------------------------------------------------
 // FormFieldButton
 //------------------------------------------------------------------------
-FormFieldButton::FormFieldButton(PDFDoc *docA, Object &&aobj, const Ref ref, FormField *parent, std::set<int> *usedParents)
-  : FormField(docA, std::move(aobj), ref, parent, usedParents, formButton)
+FormFieldButton::FormFieldButton(PDFDoc *docA, Object &&aobj, const Ref refA, FormField *parentA, std::set<int> *usedParents)
+  : FormField(docA, std::move(aobj), refA, parentA, usedParents, formButton)
 {
   Dict* dict = obj.getDict();
   active_child = -1;
@@ -1134,8 +1134,8 @@ FormFieldButton::~FormFieldButton()
 //------------------------------------------------------------------------
 // FormFieldText
 //------------------------------------------------------------------------
-FormFieldText::FormFieldText(PDFDoc *docA, Object &&aobj, const Ref ref, FormField *parent, std::set<int> *usedParents)
-  : FormField(docA, std::move(aobj), ref, parent, usedParents, formText)
+FormFieldText::FormFieldText(PDFDoc *docA, Object &&aobj, const Ref refA, FormField *parentA, std::set<int> *usedParents)
+  : FormField(docA, std::move(aobj), refA, parentA, usedParents, formText)
 {
   Dict* dict = obj.getDict();
   Object obj1;
@@ -1306,8 +1306,8 @@ int FormFieldText::parseDA(std::vector<GooString*>* daToks)
 //------------------------------------------------------------------------
 // FormFieldChoice
 //------------------------------------------------------------------------
-FormFieldChoice::FormFieldChoice(PDFDoc *docA, Object &&aobj, const Ref ref, FormField *parent, std::set<int> *usedParents)
-  : FormField(docA, std::move(aobj), ref, parent, usedParents, formChoice)
+FormFieldChoice::FormFieldChoice(PDFDoc *docA, Object &&aobj, const Ref refA, FormField *parentA, std::set<int> *usedParents)
+  : FormField(docA, std::move(aobj), refA, parentA, usedParents, formChoice)
 {
   numChoices = 0;
   choices = nullptr;
@@ -1598,8 +1598,8 @@ const GooString *FormFieldChoice::getSelectedChoice() const {
 //------------------------------------------------------------------------
 // FormFieldSignature
 //------------------------------------------------------------------------
-FormFieldSignature::FormFieldSignature(PDFDoc *docA, Object &&dict, const Ref ref, FormField *parent, std::set<int> *usedParents)
-  : FormField(docA, std::move(dict), ref, parent, usedParents, formSignature),
+FormFieldSignature::FormFieldSignature(PDFDoc *docA, Object &&dict, const Ref refA, FormField *parentA, std::set<int> *usedParents)
+  : FormField(docA, std::move(dict), refA, parentA, usedParents, formSignature),
     signature_type(adbe_pkcs7_detached),
     signature(nullptr), signature_info(nullptr)
 {
commit c148085564edf90760cab47a9363b1c868a5322c
Author: Albert Astals Cid <aacid at kde.org>
Date:   Fri Jun 7 16:48:54 2019 +0200

    FormWidget::getAdditionalAction: Rename parameter to fix shadow warning

diff --git a/poppler/Form.cc b/poppler/Form.cc
index c13eda8f..66f31a18 100644
--- a/poppler/Form.cc
+++ b/poppler/Form.cc
@@ -173,8 +173,8 @@ LinkAction *FormWidget::getActivationAction() {
   return widget ? widget->getAction() : nullptr;
 }
 
-LinkAction *FormWidget::getAdditionalAction(Annot::FormAdditionalActionsType type) {
-  return widget ? widget->getFormAdditionalAction(type) : nullptr;
+LinkAction *FormWidget::getAdditionalAction(Annot::FormAdditionalActionsType t) {
+  return widget ? widget->getFormAdditionalAction(t) : nullptr;
 }
 
 FormWidgetButton::FormWidgetButton (PDFDoc *docA, Object *aobj, unsigned num, Ref ref, FormField *p) :
commit 7f87a3a309f30d67e04d365105a479e53ebe814b
Author: Albert Astals Cid <aacid at kde.org>
Date:   Fri Jun 7 16:46:49 2019 +0200

    Fix last two shadow warnings in PSOutputDev
    
    Don't pass doc to writeDocSetup, we already have it
    Rename writeDocSetup pages to pageList

diff --git a/poppler/PSOutputDev.cc b/poppler/PSOutputDev.cc
index 5de181d0..0fdc92c9 100644
--- a/poppler/PSOutputDev.cc
+++ b/poppler/PSOutputDev.cc
@@ -1443,7 +1443,7 @@ void PSOutputDev::postInit()
       writePS("%%EndProlog\n");
       writePS("%%BeginSetup\n");
     }
-    writeDocSetup(doc, catalog, pageList, duplex);
+    writeDocSetup(catalog, pageList, duplex);
     if (mode != psModeForm) {
       writePS("%%EndSetup\n");
     }
@@ -1658,8 +1658,8 @@ void PSOutputDev::writeXpdfProcset() {
   }
 }
 
-void PSOutputDev::writeDocSetup(PDFDoc *doc, Catalog *catalog,
-				const std::vector<int> &pages,
+void PSOutputDev::writeDocSetup(Catalog *catalog,
+				const std::vector<int> &pageList,
                                 bool duplexA) {
   Page *page;
   Dict *resDict;
@@ -1673,8 +1673,8 @@ void PSOutputDev::writeDocSetup(PDFDoc *doc, Catalog *catalog,
   } else {
     writePS("xpdf begin\n");
   }
-  for (size_t pgi = 0; pgi < pages.size(); ++pgi) {
-    const int pg = pages[pgi];
+  for (size_t pgi = 0; pgi < pageList.size(); ++pgi) {
+    const int pg = pageList[pgi];
     page = doc->getPage(pg);
     if (!page) {
       error(errSyntaxError, -1, "Failed writing resources for page {0:d}", pg);
diff --git a/poppler/PSOutputDev.h b/poppler/PSOutputDev.h
index e7949388..51f14017 100644
--- a/poppler/PSOutputDev.h
+++ b/poppler/PSOutputDev.h
@@ -429,7 +429,7 @@ private:
   GooString *filterPSName(const GooString *name);
 
   // Write the document-level setup.
-  void writeDocSetup(PDFDoc *doc, Catalog *catalog, const std::vector<int> &pages, bool duplexA);
+  void writeDocSetup(Catalog *catalog, const std::vector<int> &pageList, bool duplexA);
 
   void writePSChar(char c);
   void writePS(const char *s);
commit e3a09f02fa1b4ac9197b704fee10233b6386cd99
Author: Albert Astals Cid <aacid at kde.org>
Date:   Thu Jun 6 14:21:15 2019 +0200

    scale -> s
    
    to not collide with the scale member variable

diff --git a/poppler/TextOutputDev.cc b/poppler/TextOutputDev.cc
index 7923f460..391904b5 100644
--- a/poppler/TextOutputDev.cc
+++ b/poppler/TextOutputDev.cc
@@ -4605,9 +4605,9 @@ private:
   double scale;
 };
 
-TextSelectionSizer::TextSelectionSizer(TextPage *p, double scale)
+TextSelectionSizer::TextSelectionSizer(TextPage *p, double s)
   : TextSelectionVisitor(p),
-    scale(scale)
+    scale(s)
 {
   list = new std::vector<PDFRectangle*>();
 }
commit 366685602e953354c3818cff185fa7e00f1afb64
Author: Albert Astals Cid <aacid at kde.org>
Date:   Wed Jun 5 21:19:58 2019 +0200

    page -> p
    
    fixes shadow warnings, doesn't make code harder to read, it's in trivial
    functions

diff --git a/poppler/TextOutputDev.cc b/poppler/TextOutputDev.cc
index 77624013..7923f460 100644
--- a/poppler/TextOutputDev.cc
+++ b/poppler/TextOutputDev.cc
@@ -4401,8 +4401,8 @@ protected:
   TextPage *page;
 };
 
-TextSelectionVisitor::TextSelectionVisitor (TextPage *page)
-  : page(page)
+TextSelectionVisitor::TextSelectionVisitor (TextPage *p)
+  : page(p)
 {
 }
 
@@ -4441,8 +4441,8 @@ private:
   TextBlock *currentBlock;
 };
 
-TextSelectionDumper::TextSelectionDumper(TextPage *page)
-    : TextSelectionVisitor(page)
+TextSelectionDumper::TextSelectionDumper(TextPage *p)
+    : TextSelectionVisitor(p)
 {
   linesSize = 256;
   lines = (std::vector<TextWordSelection*> **)gmallocn(linesSize, sizeof(std::vector<TextWordSelection*> *));
@@ -4605,8 +4605,8 @@ private:
   double scale;
 };
 
-TextSelectionSizer::TextSelectionSizer(TextPage *page, double scale)
-  : TextSelectionVisitor(page),
+TextSelectionSizer::TextSelectionSizer(TextPage *p, double scale)
+  : TextSelectionVisitor(p),
     scale(scale)
 {
   list = new std::vector<PDFRectangle*>();
@@ -4668,17 +4668,17 @@ private:
   Matrix ctm, ictm;
 };
 
-TextSelectionPainter::TextSelectionPainter(TextPage *page,
+TextSelectionPainter::TextSelectionPainter(TextPage *p,
 					   double scale,
 					   int rotation,
 					   OutputDev *out,
 					   GfxColor *box_color,
 					   GfxColor *glyph_color)
-  : TextSelectionVisitor(page),
+  : TextSelectionVisitor(p),
     out(out),
     glyph_color(glyph_color)
 {
-  PDFRectangle box(0, 0, page->pageWidth, page->pageHeight);
+  PDFRectangle box(0, 0, p->pageWidth, p->pageHeight);
 
   selectionList = new std::vector<TextWordSelection*>();
   state = new GfxState(72 * scale, 72 * scale, &box, rotation, false);


More information about the poppler mailing list