[poppler] 5 commits - poppler/TextOutputDev.cc poppler/TextOutputDev.h splash/SplashBitmap.cc splash/SplashBitmap.h utils/HtmlOutputDev.cc utils/HtmlOutputDev.h utils/pdftohtml.cc utils/pdftops.cc utils/pdftotext.cc

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Sun Sep 23 00:54:27 UTC 2018


 poppler/TextOutputDev.cc |    2 +-
 poppler/TextOutputDev.h  |    2 +-
 splash/SplashBitmap.cc   |    4 ++--
 splash/SplashBitmap.h    |    2 +-
 utils/HtmlOutputDev.cc   |   17 ++++++++---------
 utils/HtmlOutputDev.h    |   16 ++++++++--------
 utils/pdftohtml.cc       |    7 +++----
 utils/pdftops.cc         |    3 +--
 utils/pdftotext.cc       |    3 +--
 9 files changed, 26 insertions(+), 30 deletions(-)

New commits:
commit f1b91cac94f1309452604447e9a5ace4e14336fc
Author: Albert Astals Cid <aacid at kde.org>
Date:   Sun Sep 23 02:37:10 2018 +0200

    pdftohtml & friends: some const

diff --git a/utils/HtmlOutputDev.cc b/utils/HtmlOutputDev.cc
index 8a088c22..30d8ddd8 100644
--- a/utils/HtmlOutputDev.cc
+++ b/utils/HtmlOutputDev.cc
@@ -121,7 +121,7 @@ static GooString *gstr_buff0 = nullptr; // a workspace in which I format strings
 
 static GooString* basename(GooString* str){
   
-  char *p=str->getCString();
+  const char *p=str->getCString();
   int len=str->getLength();
   for (int i=len-1;i>=0;i--)
     if (*(p+i)==SLASH) 
@@ -279,7 +279,7 @@ void HtmlString::endString()
 // HtmlPage
 //------------------------------------------------------------------------
 
-HtmlPage::HtmlPage(GBool rawOrder, char *imgExtVal) {
+HtmlPage::HtmlPage(GBool rawOrder, const char *imgExtVal) {
   this->rawOrder = rawOrder;
   curStr = nullptr;
   yxStrings = nullptr;
@@ -1014,7 +1014,7 @@ void HtmlPage::clear() {
 
 }
 
-void HtmlPage::setDocName(char *fname){
+void HtmlPage::setDocName(const char *fname){
   DocName=new GooString(fname);
 }
 
@@ -1109,9 +1109,9 @@ void HtmlOutputDev::doFrame(int firstPage){
   fclose(fContentsFrame);  
 }
 
-HtmlOutputDev::HtmlOutputDev(Catalog *catalogA, char *fileName, char *title, 
-	char *author, char *keywords, char *subject, char *date,
-	char *extension,
+HtmlOutputDev::HtmlOutputDev(Catalog *catalogA, const char *fileName, const char *title,
+	const char *author, const char *keywords, const char *subject, const char *date,
+	const char *extension,
 	GBool rawOrder, int firstPage, GBool outline) 
 {
   catalog = catalogA;
@@ -1573,7 +1573,6 @@ void HtmlOutputDev::doProcessLink(AnnotLink* link){
 }
 
 GooString* HtmlOutputDev::getLinkDest(AnnotLink *link){
-  char *p;
   if (!link->getAction())
     return new GooString();
   switch(link->getAction()->getKind()) 
@@ -1651,7 +1650,7 @@ GooString* HtmlOutputDev::getLinkDest(AnnotLink *link){
 
 	      if (printCommands) printf(" link to page %d ",page);
 	      if (printHtml){
-		  p=file->getCString()+file->getLength()-4;
+		  const char *p=file->getCString()+file->getLength()-4;
 		  if (!strcmp(p, ".pdf") || !strcmp(p, ".PDF")){
 		      file->del(file->getLength()-4,4);
 		      file->append(".html");
@@ -1676,7 +1675,7 @@ GooString* HtmlOutputDev::getLinkDest(AnnotLink *link){
 	  if (printHtml) {
 	      LinkLaunch *ha=(LinkLaunch *) link->getAction();
 	      GooString* file=new GooString(ha->getFileName()->getCString());
-	      p=file->getCString()+file->getLength()-4;
+	      const char *p=file->getCString()+file->getLength()-4;
 	      if (!strcmp(p, ".pdf") || !strcmp(p, ".PDF")){
 		  file->del(file->getLength()-4,4);
 		  file->append(".html");
diff --git a/utils/HtmlOutputDev.h b/utils/HtmlOutputDev.h
index ec552012..0c6b1c55 100644
--- a/utils/HtmlOutputDev.h
+++ b/utils/HtmlOutputDev.h
@@ -128,7 +128,7 @@ class HtmlPage {
 public:
 
   // Constructor.
-  HtmlPage(GBool rawOrder, char *imgExtVal);
+  HtmlPage(GBool rawOrder, const char *imgExtVal);
 
   // Destructor.
   ~HtmlPage();
@@ -189,7 +189,7 @@ private:
   HtmlString *xyStrings;	// strings in x-major order
   HtmlString *yxCur1, *yxCur2;	// cursors for yxStrings list
   
-  void setDocName(char* fname);
+  void setDocName(const char* fname);
   void dumpAsXML(FILE* f,int page);
   void dumpComplex(FILE* f, int page);
   int dumpComplexHeaders(FILE * const file, FILE *& pageFile, int page);
@@ -241,12 +241,12 @@ public:
   // 8-bit ISO Latin-1.  <useASCII7> should also be set for Japanese
   // (EUC-JP) text.  If <rawOrder> is true, the text is kept in content
   // stream order.
-  HtmlOutputDev(Catalog *catalogA, char *fileName, char *title, 
-	  char *author,
-	  char *keywords,
-	  char *subject,
-	  char *date,
-	  char *extension,
+  HtmlOutputDev(Catalog *catalogA, const char *fileName, const char *title,
+	  const char *author,
+	  const char *keywords,
+	  const char *subject,
+	  const char *date,
+	  const char *extension,
 	  GBool rawOrder,
 	  int firstPage = 1,
 	  GBool outline = 0);
diff --git a/utils/pdftohtml.cc b/utils/pdftohtml.cc
index 06c3a03e..1881e2be 100644
--- a/utils/pdftohtml.cc
+++ b/utils/pdftohtml.cc
@@ -193,7 +193,6 @@ int main(int argc, char *argv[]) {
 #endif
   GBool doOutline;
   GBool ok;
-  char *p;
   GooString *ownerPW, *userPW;
   Object info;
   int exit_status = EXIT_FAILURE;
@@ -278,14 +277,14 @@ int main(int argc, char *argv[]) {
     GooString* tmp = new GooString(argv[2]);
     if (!xml) {
       if (tmp->getLength() >= 5) {
-        p = tmp->getCString() + tmp->getLength() - 5;
+        const char *p = tmp->getCString() + tmp->getLength() - 5;
         if (!strcmp(p, ".html") || !strcmp(p, ".HTML")) {
           htmlFileName = new GooString(tmp->getCString(), tmp->getLength() - 5);
         }
       }
     } else {
       if (tmp->getLength() >= 4) {
-        p = tmp->getCString() + tmp->getLength() - 4;
+        const char *p = tmp->getCString() + tmp->getLength() - 4;
         if (!strcmp(p, ".xml") || !strcmp(p, ".XML")) {
           htmlFileName = new GooString(tmp->getCString(), tmp->getLength() - 4);
         }
@@ -299,7 +298,7 @@ int main(int argc, char *argv[]) {
       error(errCommandLine, -1, "You have to provide an output filename when reading form stdin.");
       goto error;
   } else {
-    p = fileName->getCString() + fileName->getLength() - 4;
+    const char *p = fileName->getCString() + fileName->getLength() - 4;
     if (!strcmp(p, ".pdf") || !strcmp(p, ".PDF"))
       htmlFileName = new GooString(fileName->getCString(),
 				 fileName->getLength() - 4);
commit 3096a561afe4c001b08e54ffee396d6efa071fca
Author: Albert Astals Cid <aacid at kde.org>
Date:   Sun Sep 23 02:35:12 2018 +0200

    SplashBitmap: const filename

diff --git a/splash/SplashBitmap.cc b/splash/SplashBitmap.cc
index cc4b6155..bab5123b 100644
--- a/splash/SplashBitmap.cc
+++ b/splash/SplashBitmap.cc
@@ -11,7 +11,7 @@
 // All changes made under the Poppler project to this file are licensed
 // under GPL version 2 or later
 //
-// Copyright (C) 2006, 2009, 2010, 2012, 2015 Albert Astals Cid <aacid at kde.org>
+// Copyright (C) 2006, 2009, 2010, 2012, 2015, 2018 Albert Astals Cid <aacid at kde.org>
 // Copyright (C) 2007 Ilmari Heikkinen <ilmari.heikkinen at gmail.com>
 // Copyright (C) 2009 Shen Liang <shenzhuxi at gmail.com>
 // Copyright (C) 2009 Stefan Thomas <thomas at eload24.com>
@@ -338,7 +338,7 @@ SplashColorPtr SplashBitmap::takeData() {
   return data2;
 }
 
-SplashError SplashBitmap::writeImgFile(SplashImageFileFormat format, char *fileName, int hDPI, int vDPI, WriteImgParams* params) {
+SplashError SplashBitmap::writeImgFile(SplashImageFileFormat format, const char *fileName, int hDPI, int vDPI, WriteImgParams* params) {
   FILE *f;
   SplashError e;
 
diff --git a/splash/SplashBitmap.h b/splash/SplashBitmap.h
index 01c972c3..ff4b5a4e 100644
--- a/splash/SplashBitmap.h
+++ b/splash/SplashBitmap.h
@@ -85,7 +85,7 @@ public:
     GBool jpegOptimize = gFalse;
   };
 
-  SplashError writeImgFile(SplashImageFileFormat format, char *fileName, int hDPI, int vDPI, WriteImgParams* params = nullptr);
+  SplashError writeImgFile(SplashImageFileFormat format, const char *fileName, int hDPI, int vDPI, WriteImgParams* params = nullptr);
   SplashError writeImgFile(SplashImageFileFormat format, FILE *f, int hDPI, int vDPI, WriteImgParams* params = nullptr);
   SplashError writeImgFile(ImgWriter *writer, FILE *f, int hDPI, int vDPI, SplashColorMode imageWriterFormat);
 
commit f557542147c59acaf9bc34082f433f74d38e5a58
Author: Albert Astals Cid <aacid at kde.org>
Date:   Sun Sep 23 02:32:23 2018 +0200

    pdftops: const char *

diff --git a/utils/pdftops.cc b/utils/pdftops.cc
index b6af5941..3e12c384 100644
--- a/utils/pdftops.cc
+++ b/utils/pdftops.cc
@@ -215,7 +215,6 @@ int main(int argc, char *argv[]) {
   GooString *ownerPW, *userPW;
   PSOutputDev *psOut;
   GBool ok;
-  char *p;
   int exitCode;
   GBool rasterAntialias = gFalse;
   std::vector<int> pages;
@@ -352,7 +351,7 @@ int main(int argc, char *argv[]) {
     error(errCommandLine, -1, "You have to provide an output filename when reading form stdin.");
     goto err1;
   } else {
-    p = fileName->getCString() + fileName->getLength() - 4;
+    const char *p = fileName->getCString() + fileName->getLength() - 4;
     if (!strcmp(p, ".pdf") || !strcmp(p, ".PDF")) {
       psFileName = new GooString(fileName->getCString(),
 			       fileName->getLength() - 4);
commit f974a592cfce3ef6f06e12b7621b39c1906db5c0
Author: Albert Astals Cid <aacid at kde.org>
Date:   Sun Sep 23 02:31:39 2018 +0200

    pdftotext: const char *

diff --git a/utils/pdftotext.cc b/utils/pdftotext.cc
index 8fb42195..10153acb 100644
--- a/utils/pdftotext.cc
+++ b/utils/pdftotext.cc
@@ -182,7 +182,6 @@ int main(int argc, char *argv[]) {
   UnicodeMap *uMap;
   Object info;
   GBool ok;
-  char *p;
   int exitCode;
 
   Win32Console win32Console(&argc, &argv);
@@ -291,7 +290,7 @@ int main(int argc, char *argv[]) {
      error(errCommandLine, -1, "You have to provide an output filename when reading form stdin.");
      goto err2;
   } else {
-    p = fileName->getCString() + fileName->getLength() - 4;
+    const char *p = fileName->getCString() + fileName->getLength() - 4;
     if (!strcmp(p, ".pdf") || !strcmp(p, ".PDF")) {
       textFileName = new GooString(fileName->getCString(),
 				 fileName->getLength() - 4);
commit 2add4fd2a1d26a00659c9441feafd51a10b671c1
Author: Albert Astals Cid <aacid at kde.org>
Date:   Sun Sep 23 02:31:19 2018 +0200

    TextOutputDev: const filename

diff --git a/poppler/TextOutputDev.cc b/poppler/TextOutputDev.cc
index 66e0d047..68542db3 100644
--- a/poppler/TextOutputDev.cc
+++ b/poppler/TextOutputDev.cc
@@ -5558,7 +5558,7 @@ static void TextOutputDev_outputToFile(void *stream, const char *text, int len)
   fwrite(text, 1, len, (FILE *)stream);
 }
 
-TextOutputDev::TextOutputDev(char *fileName, GBool physLayoutA,
+TextOutputDev::TextOutputDev(const char *fileName, GBool physLayoutA,
 			     double fixedPitchA, GBool rawOrderA,
 			     GBool append) {
   text = nullptr;
diff --git a/poppler/TextOutputDev.h b/poppler/TextOutputDev.h
index f2435545..e793401f 100644
--- a/poppler/TextOutputDev.h
+++ b/poppler/TextOutputDev.h
@@ -761,7 +761,7 @@ public:
   // <physLayoutA> is true, the original physical layout of the text
   // is maintained.  If <rawOrder> is true, the text is kept in
   // content stream order.
-  TextOutputDev(char *fileName, GBool physLayoutA,
+  TextOutputDev(const char *fileName, GBool physLayoutA,
 		double fixedPitchA, GBool rawOrderA,
 		GBool append);
 


More information about the poppler mailing list