summaryrefslogtreecommitdiff
path: root/core
diff options
context:
space:
mode:
authorLei Zhang <thestig@chromium.org>2018-04-05 19:08:20 +0000
committerChromium commit bot <commit-bot@chromium.org>2018-04-05 19:08:20 +0000
commit4a8478efac2c6b8642298b1e0f2c83247a569cb1 (patch)
treef2190b559a9dc60f363dc6ae35736284eaf76656 /core
parent5a552539e1382443eb18b046ad3ab9c4e673b5b1 (diff)
downloadpdfium-4a8478efac2c6b8642298b1e0f2c83247a569cb1.tar.xz
Remove some const_casts in CPDF_Creator.
Change-Id: I7c639655c003527417255c134a4393d68cda3ef1 Reviewed-on: https://pdfium-review.googlesource.com/29852 Commit-Queue: Ryan Harrison <rharrison@chromium.org> Reviewed-by: Ryan Harrison <rharrison@chromium.org>
Diffstat (limited to 'core')
-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();