[poppler] 2 commits - poppler/Gfx.cc poppler/Gfx.h poppler/Object.h

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Sat Feb 20 21:30:17 UTC 2021


 poppler/Gfx.cc   |    6 ++----
 poppler/Gfx.h    |    4 ++--
 poppler/Object.h |   10 +++++-----
 3 files changed, 9 insertions(+), 11 deletions(-)

New commits:
commit 3746704a810fc9a67a91444da300e0683d452e6d
Author: Albert Astals Cid <aacid at kde.org>
Date:   Sat Feb 20 22:25:06 2021 +0100

    Gfx: Make clear neither printCommands nor profileCommands change

diff --git a/poppler/Gfx.cc b/poppler/Gfx.cc
index cbdd5feb..0cd7875d 100644
--- a/poppler/Gfx.cc
+++ b/poppler/Gfx.cc
@@ -453,6 +453,7 @@ Object GfxResources::lookupGStateNF(const char *name)
 //------------------------------------------------------------------------
 
 Gfx::Gfx(PDFDoc *docA, OutputDev *outA, int pageNum, Dict *resDict, double hDPI, double vDPI, const PDFRectangle *box, const PDFRectangle *cropBox, int rotate, bool (*abortCheckCbkA)(void *data), void *abortCheckCbkDataA, XRef *xrefA)
+    : printCommands(globalParams->getPrintCommands()), profileCommands(globalParams->getProfileCommands())
 {
     int i;
 
@@ -460,8 +461,6 @@ Gfx::Gfx(PDFDoc *docA, OutputDev *outA, int pageNum, Dict *resDict, double hDPI,
     xref = (xrefA == nullptr) ? doc->getXRef() : xrefA;
     catalog = doc->getCatalog();
     subPage = false;
-    printCommands = globalParams->getPrintCommands();
-    profileCommands = globalParams->getProfileCommands();
     mcStack = nullptr;
     parser = nullptr;
 
@@ -506,6 +505,7 @@ Gfx::Gfx(PDFDoc *docA, OutputDev *outA, int pageNum, Dict *resDict, double hDPI,
 }
 
 Gfx::Gfx(PDFDoc *docA, OutputDev *outA, Dict *resDict, const PDFRectangle *box, const PDFRectangle *cropBox, bool (*abortCheckCbkA)(void *data), void *abortCheckCbkDataA, Gfx *gfxA)
+    : printCommands(globalParams->getPrintCommands()), profileCommands(globalParams->getProfileCommands())
 {
     int i;
 
@@ -519,8 +519,6 @@ Gfx::Gfx(PDFDoc *docA, OutputDev *outA, Dict *resDict, const PDFRectangle *box,
     }
     catalog = doc->getCatalog();
     subPage = true;
-    printCommands = globalParams->getPrintCommands();
-    profileCommands = globalParams->getProfileCommands();
     mcStack = nullptr;
     parser = nullptr;
 
diff --git a/poppler/Gfx.h b/poppler/Gfx.h
index 3539bd69..1e5955f5 100644
--- a/poppler/Gfx.h
+++ b/poppler/Gfx.h
@@ -203,8 +203,8 @@ private:
     Catalog *catalog; // the Catalog for this PDF file
     OutputDev *out; // output device
     bool subPage; // is this a sub-page object?
-    bool printCommands; // print the drawing commands (for debugging)
-    bool profileCommands; // profile the drawing commands (for debugging)
+    const bool printCommands; // print the drawing commands (for debugging)
+    const bool profileCommands; // profile the drawing commands (for debugging)
     bool commandAborted; // did the previous command abort the drawing?
     GfxResources *res; // resource stack
     int updateLevel;
commit a622a5a88242fc99c3ce37879337b980458fc4e6
Author: Albert Astals Cid <aacid at kde.org>
Date:   Sat Feb 20 22:22:03 2021 +0100

    Mark Object::streamGetChar[s] as non const
    
    Calling them twice in a row will potentially return different things, so
    I would say probably don't qualify as const

diff --git a/poppler/Object.h b/poppler/Object.h
index 25dbe35d..104a95b1 100644
--- a/poppler/Object.h
+++ b/poppler/Object.h
@@ -15,7 +15,7 @@
 //
 // Copyright (C) 2007 Julien Rebetez <julienr at svn.gnome.org>
 // Copyright (C) 2008 Kees Cook <kees at outflux.net>
-// Copyright (C) 2008, 2010, 2017-2020 Albert Astals Cid <aacid at kde.org>
+// Copyright (C) 2008, 2010, 2017-2021 Albert Astals Cid <aacid at kde.org>
 // Copyright (C) 2009 Jakub Wilk <jwilk at jwilk.net>
 // Copyright (C) 2012 Fabio D'Urso <fabiodurso at hotmail.it>
 // Copyright (C) 2013 Thomas Freitag <Thomas.Freitag at alfa.de>
@@ -500,8 +500,8 @@ public:
     // Stream accessors.
     void streamReset();
     void streamClose();
-    int streamGetChar() const;
-    int streamGetChars(int nChars, unsigned char *buffer) const;
+    int streamGetChar();
+    int streamGetChars(int nChars, unsigned char *buffer);
     void streamSetPos(Goffset pos, int dir = 0);
     Dict *streamGetDict() const;
 
@@ -663,13 +663,13 @@ inline void Object::streamClose()
     stream->close();
 }
 
-inline int Object::streamGetChar() const
+inline int Object::streamGetChar()
 {
     OBJECT_TYPE_CHECK(objStream);
     return stream->getChar();
 }
 
-inline int Object::streamGetChars(int nChars, unsigned char *buffer) const
+inline int Object::streamGetChars(int nChars, unsigned char *buffer)
 {
     OBJECT_TYPE_CHECK(objStream);
     return stream->doGetChars(nChars, buffer);


More information about the poppler mailing list