[poppler] poppler/Parser.cc poppler/Parser.h poppler/SecurityHandler.cc poppler/SecurityHandler.h

GitLab Mirror gitlab-mirror at kemper.freedesktop.org
Thu Jan 9 13:58:24 UTC 2020


 poppler/Parser.cc          |    6 +++---
 poppler/Parser.h           |    6 +++---
 poppler/SecurityHandler.cc |    2 +-
 poppler/SecurityHandler.h  |   34 +++++++++++++++++-----------------
 4 files changed, 24 insertions(+), 24 deletions(-)

New commits:
commit ff404bdfcb5763ae5e219e075ca08b41c220f8ec
Author: Albert Astals Cid <aacid at kde.org>
Date:   Thu Jan 9 14:39:14 2020 +0100

    SecurityHandler: add const

diff --git a/poppler/Parser.cc b/poppler/Parser.cc
index afb54dfb..04721005 100644
--- a/poppler/Parser.cc
+++ b/poppler/Parser.cc
@@ -13,7 +13,7 @@
 // All changes made under the Poppler project to this file are licensed
 // under GPL version 2 or later
 //
-// Copyright (C) 2006, 2009, 201, 2010, 2013, 2014, 2017-2019 Albert Astals Cid <aacid at kde.org>
+// Copyright (C) 2006, 2009, 201, 2010, 2013, 2014, 2017-2020 Albert Astals Cid <aacid at kde.org>
 // Copyright (C) 2006 Krzysztof Kowalczyk <kkowalczyk at gmail.com>
 // Copyright (C) 2009 Ilya Gorenbein <igorenbein at finjan.com>
 // Copyright (C) 2012 Hib Eris <hib at hiberis.nl>
@@ -66,7 +66,7 @@ Object Parser::getObj(int recursion)
 }
 
 Object Parser::getObj(bool simpleOnly,
-           unsigned char *fileKey,
+           const unsigned char *fileKey,
 		       CryptAlgorithm encAlgorithm, int keyLength,
 		       int objNum, int objGen, int recursion,
 		       bool strict) {
@@ -196,7 +196,7 @@ err:
   return Object(objError);
 }
 
-Stream *Parser::makeStream(Object &&dict, unsigned char *fileKey,
+Stream *Parser::makeStream(Object &&dict, const unsigned char *fileKey,
 			   CryptAlgorithm encAlgorithm, int keyLength,
 			   int objNum, int objGen, int recursion,
                            bool strict) {
diff --git a/poppler/Parser.h b/poppler/Parser.h
index 9a6812e4..b6e68432 100644
--- a/poppler/Parser.h
+++ b/poppler/Parser.h
@@ -13,7 +13,7 @@
 // All changes made under the Poppler project to this file are licensed
 // under GPL version 2 or later
 //
-// Copyright (C) 2006, 2010, 2013, 2017, 2018 Albert Astals Cid <aacid at kde.org>
+// Copyright (C) 2006, 2010, 2013, 2017, 2018, 2020 Albert Astals Cid <aacid at kde.org>
 // Copyright (C) 2012 Hib Eris <hib at hiberis.nl>
 // Copyright (C) 2013 Adrian Johnson <ajohnson at redneon.com>
 // Copyright (C) 2013 Thomas Freitag <Thomas.Freitag at alfa.de>
@@ -50,7 +50,7 @@ public:
   // true, do not parse compound objects (arrays, dictionaries, or
   // streams).
   Object getObj(bool simpleOnly = false,
-     unsigned char *fileKey = nullptr,
+		 const unsigned char *fileKey = nullptr,
 		 CryptAlgorithm encAlgorithm = cryptRC4, int keyLength = 0,
 		 int objNum = 0, int objGen = 0, int recursion = 0,
 		 bool strict = false);
@@ -71,7 +71,7 @@ private:
   Object buf1, buf2;		// next two tokens
   int inlineImg;		// set when inline image data is encountered
 
-  Stream *makeStream(Object &&dict, unsigned char *fileKey,
+  Stream *makeStream(Object &&dict, const unsigned char *fileKey,
 		     CryptAlgorithm encAlgorithm, int keyLength,
 		     int objNum, int objGen, int recursion,
 		     bool strict);
diff --git a/poppler/SecurityHandler.cc b/poppler/SecurityHandler.cc
index 9e289a9d..575e5912 100644
--- a/poppler/SecurityHandler.cc
+++ b/poppler/SecurityHandler.cc
@@ -295,7 +295,7 @@ StandardSecurityHandler::~StandardSecurityHandler() {
   }
 }
 
-bool StandardSecurityHandler::isUnencrypted() {
+bool StandardSecurityHandler::isUnencrypted() const {
   if (!ok) {
     return true;
   }
diff --git a/poppler/SecurityHandler.h b/poppler/SecurityHandler.h
index 39c70b48..0c9147e6 100644
--- a/poppler/SecurityHandler.h
+++ b/poppler/SecurityHandler.h
@@ -13,7 +13,7 @@
 // All changes made under the Poppler project to this file are licensed
 // under GPL version 2 or later
 //
-// Copyright (C) 2012, 2018 Albert Astals Cid <aacid at kde.org>
+// Copyright (C) 2012, 2018, 2020 Albert Astals Cid <aacid at kde.org>
 //
 // To see a description of the changes please see the Changelog file that
 // came with your tarball or type make ChangeLog if you are building from git
@@ -46,7 +46,7 @@ public:
   SecurityHandler& operator=(const SecurityHandler &) = delete;
 
   // Returns true if the file is actually unencrypted.
-  virtual bool isUnencrypted() { return false; }
+  virtual bool isUnencrypted() const { return false; }
 
   // Check the document's encryption.  If the document is encrypted,
   // this will first try <ownerPassword> and <userPassword> (in
@@ -83,13 +83,13 @@ public:
 
   // Return the various authorization parameters.  These are only
   // valid after authorize has returned true.
-  virtual int getPermissionFlags() = 0;
-  virtual bool getOwnerPasswordOk() = 0;
-  virtual unsigned char *getFileKey() = 0;
-  virtual int getFileKeyLength() = 0;
-  virtual int getEncVersion() = 0;
-  virtual int getEncRevision() = 0;
-  virtual CryptAlgorithm getEncAlgorithm() = 0;
+  virtual int getPermissionFlags() const = 0;
+  virtual bool getOwnerPasswordOk() const = 0;
+  virtual const unsigned char *getFileKey() const = 0;
+  virtual int getFileKeyLength() const = 0;
+  virtual int getEncVersion() const = 0;
+  virtual int getEncRevision() const = 0;
+  virtual CryptAlgorithm getEncAlgorithm() const = 0;
 
 protected:
 
@@ -106,19 +106,19 @@ public:
   StandardSecurityHandler(PDFDoc *docA, Object *encryptDictA);
   ~StandardSecurityHandler() override;
 
-  bool isUnencrypted() override;
+  bool isUnencrypted() const override;
   void *makeAuthData(const GooString *ownerPassword,
 			     const GooString *userPassword) override;
   void *getAuthData() override;
   void freeAuthData(void *authData) override;
   bool authorize(void *authData) override;
-  int getPermissionFlags() override { return permFlags; }
-  bool getOwnerPasswordOk() override { return ownerPasswordOk; }
-  unsigned char *getFileKey() override { return fileKey; }
-  int getFileKeyLength() override { return fileKeyLength; }
-  int getEncVersion() override { return encVersion; }
-  int getEncRevision() override { return encRevision; }
-  CryptAlgorithm getEncAlgorithm() override { return encAlgorithm; }
+  int getPermissionFlags() const override { return permFlags; }
+  bool getOwnerPasswordOk() const override { return ownerPasswordOk; }
+  const unsigned char *getFileKey() const override { return fileKey; }
+  int getFileKeyLength() const override { return fileKeyLength; }
+  int getEncVersion() const override { return encVersion; }
+  int getEncRevision() const override { return encRevision; }
+  CryptAlgorithm getEncAlgorithm() const override { return encAlgorithm; }
 
 private:
 


More information about the poppler mailing list