summaryrefslogtreecommitdiff
path: root/core
diff options
context:
space:
mode:
Diffstat (limited to 'core')
-rw-r--r--core/fpdfapi/edit/cpdf_creator.cpp11
-rw-r--r--core/fpdfapi/edit/cpdf_creator.h4
2 files changed, 6 insertions, 9 deletions
diff --git a/core/fpdfapi/edit/cpdf_creator.cpp b/core/fpdfapi/edit/cpdf_creator.cpp
index 60872c2059..ff8d4bb82f 100644
--- a/core/fpdfapi/edit/cpdf_creator.cpp
+++ b/core/fpdfapi/edit/cpdf_creator.cpp
@@ -151,9 +151,10 @@ CPDF_Creator::CPDF_Creator(CPDF_Document* pDoc,
CPDF_Creator::~CPDF_Creator() {}
-bool CPDF_Creator::WriteStream(const CPDF_Object* pStream,
- uint32_t objnum,
- CPDF_CryptoHandler* pCrypto) {
+bool CPDF_Creator::WriteStream(const CPDF_Object* pStream, uint32_t objnum) {
+ CPDF_CryptoHandler* pCrypto =
+ pStream != m_pMetadata ? GetCryptoHandler() : nullptr;
+
CPDF_FlateEncoder encoder(pStream->AsStream(), pStream != m_pMetadata);
CPDF_Encryptor encryptor(pCrypto, objnum, encoder.GetSpan());
if (static_cast<uint32_t>(encoder.GetDict()->GetIntegerFor("Length")) !=
@@ -183,9 +184,7 @@ bool CPDF_Creator::WriteIndirectObj(uint32_t objnum, const CPDF_Object* pObj) {
return false;
if (pObj->IsStream()) {
- CPDF_CryptoHandler* pHandler =
- pObj != m_pMetadata ? GetCryptoHandler() : nullptr;
- if (!WriteStream(pObj, objnum, pHandler))
+ if (!WriteStream(pObj, objnum))
return false;
} else if (!WriteDirectObj(objnum, pObj, true)) {
return false;
diff --git a/core/fpdfapi/edit/cpdf_creator.h b/core/fpdfapi/edit/cpdf_creator.h
index af1a486d44..9c760edeae 100644
--- a/core/fpdfapi/edit/cpdf_creator.h
+++ b/core/fpdfapi/edit/cpdf_creator.h
@@ -55,9 +55,7 @@ class CPDF_Creator {
bool WriteDirectObj(uint32_t objnum, const CPDF_Object* pObj, bool bEncrypt);
bool WriteIndirectObj(uint32_t objnum, const CPDF_Object* pObj);
- bool WriteStream(const CPDF_Object* pStream,
- uint32_t objnum,
- CPDF_CryptoHandler* pCrypto);
+ bool WriteStream(const CPDF_Object* pStream, uint32_t objnum);
CPDF_CryptoHandler* GetCryptoHandler();