summaryrefslogtreecommitdiff
path: root/core/fpdfapi
diff options
context:
space:
mode:
Diffstat (limited to 'core/fpdfapi')
-rw-r--r--core/fpdfapi/edit/cpdf_creator.cpp6
-rw-r--r--core/fpdfapi/edit/cpdf_flateencoder.cpp3
-rw-r--r--core/fpdfapi/edit/cpdf_flateencoder.h2
3 files changed, 5 insertions, 6 deletions
diff --git a/core/fpdfapi/edit/cpdf_creator.cpp b/core/fpdfapi/edit/cpdf_creator.cpp
index e31da13a4d..5868c979f2 100644
--- a/core/fpdfapi/edit/cpdf_creator.cpp
+++ b/core/fpdfapi/edit/cpdf_creator.cpp
@@ -162,8 +162,7 @@ CPDF_Creator::~CPDF_Creator() {}
bool CPDF_Creator::WriteStream(const CPDF_Object* pStream,
uint32_t objnum,
CPDF_CryptoHandler* pCrypto) {
- CPDF_FlateEncoder encoder(const_cast<CPDF_Stream*>(pStream->AsStream()),
- pStream != m_pMetadata);
+ CPDF_FlateEncoder encoder(pStream->AsStream(), pStream != m_pMetadata);
CPDF_Encryptor encryptor(pCrypto, objnum, encoder.GetData(),
encoder.GetSize());
if (static_cast<uint32_t>(encoder.GetDict()->GetIntegerFor("Length")) !=
@@ -233,8 +232,7 @@ bool CPDF_Creator::WriteDirectObj(uint32_t objnum,
break;
}
case CPDF_Object::STREAM: {
- CPDF_FlateEncoder encoder(const_cast<CPDF_Stream*>(pObj->AsStream()),
- true);
+ CPDF_FlateEncoder encoder(pObj->AsStream(), true);
CPDF_Encryptor encryptor(GetCryptoHandler(), objnum, encoder.GetData(),
encoder.GetSize());
if (static_cast<uint32_t>(encoder.GetDict()->GetIntegerFor("Length")) !=
diff --git a/core/fpdfapi/edit/cpdf_flateencoder.cpp b/core/fpdfapi/edit/cpdf_flateencoder.cpp
index 555da84244..f68d02c31c 100644
--- a/core/fpdfapi/edit/cpdf_flateencoder.cpp
+++ b/core/fpdfapi/edit/cpdf_flateencoder.cpp
@@ -12,7 +12,8 @@
#include "core/fpdfapi/parser/cpdf_number.h"
#include "core/fpdfapi/parser/fpdf_parser_decode.h"
-CPDF_FlateEncoder::CPDF_FlateEncoder(CPDF_Stream* pStream, bool bFlateEncode)
+CPDF_FlateEncoder::CPDF_FlateEncoder(const CPDF_Stream* pStream,
+ bool bFlateEncode)
: m_dwSize(0), m_pAcc(pdfium::MakeRetain<CPDF_StreamAcc>(pStream)) {
m_pAcc->LoadAllDataRaw();
diff --git a/core/fpdfapi/edit/cpdf_flateencoder.h b/core/fpdfapi/edit/cpdf_flateencoder.h
index 887816c1a1..acac753e5c 100644
--- a/core/fpdfapi/edit/cpdf_flateencoder.h
+++ b/core/fpdfapi/edit/cpdf_flateencoder.h
@@ -17,7 +17,7 @@ class CPDF_Stream;
class CPDF_FlateEncoder {
public:
- CPDF_FlateEncoder(CPDF_Stream* pStream, bool bFlateEncode);
+ CPDF_FlateEncoder(const CPDF_Stream* pStream, bool bFlateEncode);
~CPDF_FlateEncoder();
void CloneDict();