summaryrefslogtreecommitdiff
path: root/core
diff options
context:
space:
mode:
authorArtem Strygin <art-snake@yandex-team.ru>2017-10-03 21:47:34 +0300
committerChromium commit bot <commit-bot@chromium.org>2017-10-03 19:17:25 +0000
commit609d1fd4a4360e2592c5c59d60758ac67a1cb4ee (patch)
tree7b9502134165d50d486d925ed472226aabd4abb0 /core
parentdf3d229b592d1ebc7019797e0015dd2219fa3d0c (diff)
downloadpdfium-609d1fd4a4360e2592c5c59d60758ac67a1cb4ee.tar.xz
Improve CPDF_SecurityHandler code style.
Make m_pEncryptDict as constant value. Change-Id: I4f65578e936eae5bd6afe9bfed20da3ab8e20de3 Reviewed-on: https://pdfium-review.googlesource.com/15350 Reviewed-by: dsinclair <dsinclair@chromium.org> Commit-Queue: Art Snake <art-snake@yandex-team.ru>
Diffstat (limited to 'core')
-rw-r--r--core/fpdfapi/parser/cpdf_security_handler.cpp10
-rw-r--r--core/fpdfapi/parser/cpdf_security_handler.h8
2 files changed, 9 insertions, 9 deletions
diff --git a/core/fpdfapi/parser/cpdf_security_handler.cpp b/core/fpdfapi/parser/cpdf_security_handler.cpp
index 4a33de116f..26202ec3ee 100644
--- a/core/fpdfapi/parser/cpdf_security_handler.cpp
+++ b/core/fpdfapi/parser/cpdf_security_handler.cpp
@@ -26,7 +26,7 @@ const uint8_t defpasscode[32] = {
0x56, 0xff, 0xfa, 0x01, 0x08, 0x2e, 0x2e, 0x00, 0xb6, 0xd0, 0x68,
0x3e, 0x80, 0x2f, 0x0c, 0xa9, 0xfe, 0x64, 0x53, 0x69, 0x7a};
-void CalcEncryptKey(CPDF_Dictionary* pEncrypt,
+void CalcEncryptKey(const CPDF_Dictionary* pEncrypt,
const ByteString& password,
uint8_t* key,
int keylen,
@@ -99,7 +99,7 @@ CPDF_SecurityHandler::CPDF_SecurityHandler()
CPDF_SecurityHandler::~CPDF_SecurityHandler() {}
-bool CPDF_SecurityHandler::OnInit(CPDF_Dictionary* pEncryptDict,
+bool CPDF_SecurityHandler::OnInit(const CPDF_Dictionary* pEncryptDict,
const CPDF_Array* pIdArray,
const ByteString& password) {
m_pIdArray = pIdArray;
@@ -129,7 +129,7 @@ uint32_t CPDF_SecurityHandler::GetPermissions() {
return m_bOwnerUnlocked ? 0xFFFFFFFF : m_Permissions;
}
-static bool LoadCryptInfo(CPDF_Dictionary* pEncryptDict,
+static bool LoadCryptInfo(const CPDF_Dictionary* pEncryptDict,
const ByteString& name,
int& cipher,
int& keylen) {
@@ -175,7 +175,7 @@ static bool LoadCryptInfo(CPDF_Dictionary* pEncryptDict,
return IsValidKeyLengthForCipher(cipher, keylen);
}
-bool CPDF_SecurityHandler::LoadDict(CPDF_Dictionary* pEncryptDict) {
+bool CPDF_SecurityHandler::LoadDict(const CPDF_Dictionary* pEncryptDict) {
m_pEncryptDict = pEncryptDict;
m_Version = pEncryptDict->GetIntegerFor("V");
m_Revision = pEncryptDict->GetIntegerFor("R");
@@ -191,7 +191,7 @@ bool CPDF_SecurityHandler::LoadDict(CPDF_Dictionary* pEncryptDict) {
return LoadCryptInfo(pEncryptDict, strf_name, m_Cipher, m_KeyLen);
}
-bool CPDF_SecurityHandler::LoadDict(CPDF_Dictionary* pEncryptDict,
+bool CPDF_SecurityHandler::LoadDict(const CPDF_Dictionary* pEncryptDict,
uint32_t type,
int& cipher,
int& key_len) {
diff --git a/core/fpdfapi/parser/cpdf_security_handler.h b/core/fpdfapi/parser/cpdf_security_handler.h
index c92dc46862..15be505705 100644
--- a/core/fpdfapi/parser/cpdf_security_handler.h
+++ b/core/fpdfapi/parser/cpdf_security_handler.h
@@ -29,7 +29,7 @@ class CPDF_SecurityHandler {
CPDF_SecurityHandler();
~CPDF_SecurityHandler();
- bool OnInit(CPDF_Dictionary* pEncryptDict,
+ bool OnInit(const CPDF_Dictionary* pEncryptDict,
const CPDF_Array* pIdArray,
const ByteString& password);
uint32_t GetPermissions();
@@ -57,8 +57,8 @@ class CPDF_SecurityHandler {
}
private:
- bool LoadDict(CPDF_Dictionary* pEncryptDict);
- bool LoadDict(CPDF_Dictionary* pEncryptDict,
+ bool LoadDict(const CPDF_Dictionary* pEncryptDict);
+ bool LoadDict(const CPDF_Dictionary* pEncryptDict,
uint32_t type,
int& cipher,
int& key_len);
@@ -94,7 +94,7 @@ class CPDF_SecurityHandler {
int m_Version;
int m_Revision;
- UnownedPtr<CPDF_Dictionary> m_pEncryptDict;
+ UnownedPtr<const CPDF_Dictionary> m_pEncryptDict;
UnownedPtr<const CPDF_Array> m_pIdArray;
uint32_t m_Permissions;
int m_Cipher;