[poppler] 5 commits - poppler/Annot.cc test/perf-test.cc utils/HtmlOutputDev.cc utils/HtmlOutputDev.h

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


 poppler/Annot.cc       |   16 ++++++++--------
 test/perf-test.cc      |    6 +++---
 utils/HtmlOutputDev.cc |   42 +++++++++++++++++++++---------------------
 utils/HtmlOutputDev.h  |    6 +++---
 4 files changed, 35 insertions(+), 35 deletions(-)

New commits:
commit 55ac94ac16a6b1750059ac606a12fc549239229d
Author: Albert Astals Cid <aacid at kde.org>
Date:   Wed Jun 5 20:08:04 2019 +0200

    HtmlOutputDev: rename variables to not collide with existing ones
    
    makes reading the code easier

diff --git a/utils/HtmlOutputDev.cc b/utils/HtmlOutputDev.cc
index 114a14bd..954a4779 100644
--- a/utils/HtmlOutputDev.cc
+++ b/utils/HtmlOutputDev.cc
@@ -271,8 +271,8 @@ void HtmlString::endString()
 // HtmlPage
 //------------------------------------------------------------------------
 
-HtmlPage::HtmlPage(bool rawOrder) {
-  this->rawOrder = rawOrder;
+HtmlPage::HtmlPage(bool rawOrderA) {
+  rawOrder = rawOrderA;
   curStr = nullptr;
   yxStrings = nullptr;
   xyStrings = nullptr;
@@ -1085,7 +1085,7 @@ void HtmlOutputDev::doFrame(int firstPage){
 
 HtmlOutputDev::HtmlOutputDev(Catalog *catalogA, const char *fileName, const char *title,
 	const char *author, const char *keywords, const char *subject, const char *date,
-	bool rawOrder, int firstPage, bool outline) 
+	bool rawOrderA, int firstPage, bool outline)
 {
   catalog = catalogA;
   fContentsFrame = nullptr;
@@ -1094,7 +1094,7 @@ HtmlOutputDev::HtmlOutputDev(Catalog *catalogA, const char *fileName, const char
   pages = nullptr;
   dumpJPEG=true;
   //write = true;
-  this->rawOrder = rawOrder;
+  rawOrder = rawOrderA;
   this->doOutline = outline;
   ok = false;
   //this->firstPage = firstPage;
@@ -1227,7 +1227,7 @@ HtmlOutputDev::~HtmlOutputDev() {
       delete pages;
 }
 
-void HtmlOutputDev::startPage(int pageNum, GfxState *state, XRef *xref) {
+void HtmlOutputDev::startPage(int pageNumA, GfxState *state, XRef *xref) {
 #if 0
   if (mode&&!xml){
     if (write){
@@ -1247,7 +1247,7 @@ void HtmlOutputDev::startPage(int pageNum, GfxState *state, XRef *xref) {
   }
 #endif
 
-  this->pageNum = pageNum;
+  pageNum = pageNumA;
   const std::string str = gbasename(Docname->c_str());
   pages->clear(); 
   if(!noframes)
@@ -1558,7 +1558,7 @@ GooString* HtmlOutputDev::getLinkDest(AnnotLink *link){
       case actionGoTo:
 	  {
 	  GooString* file = new GooString(gbasename(Docname->c_str()));
-	  int page=1;
+	  int destPage=1;
 	  LinkGoTo *ha=(LinkGoTo *)link->getAction();
 	  LinkDest *dest=nullptr;
 	  if (ha->getDest()!=nullptr)
@@ -1569,15 +1569,15 @@ GooString* HtmlOutputDev::getLinkDest(AnnotLink *link){
 	  if (dest){ 
 	      if (dest->isPageRef()){
 		  const Ref pageref=dest->getPageRef();
-		  page=catalog->findPage(pageref);
+		  destPage=catalog->findPage(pageref);
 	      }
 	      else {
-		  page=dest->getPageNum();
+		  destPage=dest->getPageNum();
 	      }
 
 	      delete dest;
 
-	      GooString *str=GooString::fromInt(page);
+	      GooString *str=GooString::fromInt(destPage);
 	      /* 		complex 	simple
 	       	frames		file-4.html	files.html#4
 		noframes	file.html#4	file.html#4
@@ -1602,7 +1602,7 @@ GooString* HtmlOutputDev::getLinkDest(AnnotLink *link){
 		}
 	      }
 
-	      if (printCommands) printf(" link to page %d ",page);
+	      if (printCommands) printf(" link to page %d ",destPage);
 	      delete str;
 	      return file;
 	  }
@@ -1615,7 +1615,7 @@ GooString* HtmlOutputDev::getLinkDest(AnnotLink *link){
 	  {
 	  LinkGoToR *ha=(LinkGoToR *) link->getAction();
 	  LinkDest *dest=nullptr;
-	  int page=1;
+	  int destPage=1;
 	  GooString *file=new GooString();
 	  if (ha->getFileName()){
 	      delete file;
@@ -1623,10 +1623,10 @@ GooString* HtmlOutputDev::getLinkDest(AnnotLink *link){
 	  }
 	  if (ha->getDest()!=nullptr)  dest=ha->getDest()->copy();
 	  if (dest&&file){
-	      if (!(dest->isPageRef()))  page=dest->getPageNum();
+	      if (!(dest->isPageRef()))  destPage=dest->getPageNum();
 	      delete dest;
 
-	      if (printCommands) printf(" link to page %d ",page);
+	      if (printCommands) printf(" link to page %d ",destPage);
 	      if (printHtml){
 		  const char *p=file->c_str()+file->getLength()-4;
 		  if (!strcmp(p, ".pdf") || !strcmp(p, ".PDF")){
@@ -1634,7 +1634,7 @@ GooString* HtmlOutputDev::getLinkDest(AnnotLink *link){
 		      file->append(".html");
 		  }
 		  file->append('#');
-		  GooString *pgNum = GooString::fromInt(page);
+		  GooString *pgNum = GooString::fromInt(destPage);
 		  file->append(pgNum);
 		  delete pgNum;
 	      }
@@ -1769,15 +1769,15 @@ bool HtmlOutputDev::newHtmlOutlineLevel(FILE *output, const std::vector<OutlineI
 							   item->getTitleLength());
 
 		GooString *linkName = nullptr;;
-        int page = getOutlinePageNum(item);
-        if (page > 0)
+        const int itemPage = getOutlinePageNum(item);
+        if (itemPage > 0)
         {
 				/*		complex		simple
 				frames		file-4.html	files.html#4
 				noframes	file.html#4	file.html#4
 				*/
 				linkName = new GooString(gbasename(Docname->c_str()));
-				GooString *str=GooString::fromInt(page);
+				GooString *str=GooString::fromInt(itemPage);
 				if (noframes) {
 					linkName->append(".html#");
 					linkName->append(str);
@@ -1828,11 +1828,11 @@ void HtmlOutputDev::newXmlOutlineLevel(FILE *output, const std::vector<OutlineIt
         OutlineItem *item     = (*outlines)[i];
         GooString   *titleStr = HtmlFont::HtmlFilter(item->getTitle(),
                                                      item->getTitleLength());
-        int page = getOutlinePageNum(item);
-        if (page > 0)
+        const int itemPage = getOutlinePageNum(item);
+        if (itemPage > 0)
         {
             fprintf(output, "<item page=\"%d\">%s</item>\n",
-                    page, titleStr->c_str());
+                    itemPage, titleStr->c_str());
         }
         else
         {
commit 0c78e1efb6752161b8ed97b03e8d4f44827fca17
Author: Albert Astals Cid <aacid at kde.org>
Date:   Thu May 16 15:13:12 2019 +0200

    -Wshadow renaming in perf-test

diff --git a/test/perf-test.cc b/test/perf-test.cc
index a727144e..83c8c5f8 100644
--- a/test/perf-test.cc
+++ b/test/perf-test.cc
@@ -934,10 +934,10 @@ static void RenderPdf(const char *fileName)
 
         SplashBitmap *bmpSplash = nullptr;
 
-        GooTimer msTimer;
+        GooTimer msRenderTimer;
         bmpSplash = engineSplash->renderBitmap(curPage, 100.0, 0);
-        msTimer.stop();
-        double timeInMs = msTimer.getElapsed();
+        msRenderTimer.stop();
+        timeInMs = msRenderTimer.getElapsed();
         if (gfTimings) {
             if (!bmpSplash)
                 LogInfo("page splash %d: failed to render\n", curPage);
commit 89bd3f1f1d60a99a8a3bb7ccd384a5e6e731e0d4
Author: Albert Astals Cid <aacid at kde.org>
Date:   Thu May 16 15:12:05 2019 +0200

    HtmlOutputDev::checkPageSlice: rename Page *page to p
    
    To not collide with FILE *page

diff --git a/utils/HtmlOutputDev.h b/utils/HtmlOutputDev.h
index cd81581c..e35c2c9c 100644
--- a/utils/HtmlOutputDev.h
+++ b/utils/HtmlOutputDev.h
@@ -14,7 +14,7 @@
 // All changes made under the Poppler project to this file are licensed
 // under GPL version 2 or later
 //
-// Copyright (C) 2006, 2007, 2009, 2012, 2018 Albert Astals Cid <aacid at kde.org>
+// Copyright (C) 2006, 2007, 2009, 2012, 2018, 2019 Albert Astals Cid <aacid at kde.org>
 // Copyright (C) 2008, 2009 Warren Toomey <wkt at tuhs.org>
 // Copyright (C) 2009, 2011 Carlos Garcia Campos <carlosgc at gnome.org>
 // Copyright (C) 2009 Kovid Goyal <kovid at kovidgoyal.net>
@@ -262,7 +262,7 @@ public:
 
   //----- initialization and control
 
-  bool checkPageSlice(Page *page, double hDPI, double vDPI,
+  bool checkPageSlice(Page *p, double hDPI, double vDPI,
                        int rotate, bool useMediaBox, bool crop,
                        int sliceX, int sliceY, int sliceW, int sliceH,
                        bool printing,
@@ -271,7 +271,7 @@ public:
                        bool (*annotDisplayDecideCbk)(Annot *annot, void *user_data) = nullptr,
                        void *annotDisplayDecideCbkData = nullptr) override
   {
-   docPage = page;
+   docPage = p;
    return true;
   }
 
commit e56461bb8208ad028c2c1673e80a2a23e3eef795
Author: Albert Astals Cid <aacid at kde.org>
Date:   Fri Apr 5 17:07:52 2019 +0200

    AnnotInk(): Rename inkList to inkListArray
    
    to not collide with AnnotInk::inkList

diff --git a/poppler/Annot.cc b/poppler/Annot.cc
index faac7eff..8ff40d6a 100644
--- a/poppler/Annot.cc
+++ b/poppler/Annot.cc
@@ -5769,12 +5769,12 @@ AnnotInk::AnnotInk(PDFDoc *docA, PDFRectangle *rect) :
   annotObj.dictSet ("Subtype", Object(objName, "Ink"));
 
   // Store dummy path with one null vertex only
-  Array *inkList = new Array(doc->getXRef());
+  Array *inkListArray = new Array(doc->getXRef());
   Array *vList = new Array(doc->getXRef());
   vList->add(Object(0.));
   vList->add(Object(0.));
-  inkList->add(Object(vList));
-  annotObj.dictSet("InkList", Object(inkList));
+  inkListArray->add(Object(vList));
+  annotObj.dictSet("InkList", Object(inkListArray));
 
   initialize(docA, annotObj.getDict());
 }
commit 20cb86345288063294532c03b123c1f08921ff93
Author: Albert Astals Cid <aacid at kde.org>
Date:   Fri Apr 5 17:06:06 2019 +0200

    Configuration(): Rename name to subtypeName
    
    to not collide with Configuration::name

diff --git a/poppler/Annot.cc b/poppler/Annot.cc
index e703b5b9..faac7eff 100644
--- a/poppler/Annot.cc
+++ b/poppler/Annot.cc
@@ -6599,15 +6599,15 @@ AnnotRichMedia::Configuration::Configuration(Dict *dict)
 
   obj1 = dict->lookup("Subtype");
   if (obj1.isName()) {
-    const char *name = obj1.getName();
+    const char *subtypeName = obj1.getName();
 
-    if (!strcmp(name, "3D")) {
+    if (!strcmp(subtypeName, "3D")) {
       type = type3D;
-    } else if (!strcmp(name, "Flash")) {
+    } else if (!strcmp(subtypeName, "Flash")) {
       type = typeFlash;
-    } else if (!strcmp(name, "Sound")) {
+    } else if (!strcmp(subtypeName, "Sound")) {
       type = typeSound;
-    } else if (!strcmp(name, "Video")) {
+    } else if (!strcmp(subtypeName, "Video")) {
       type = typeVideo;
     } else {
       // determine from first non null instance


More information about the poppler mailing list