diff options
author | Lei Zhang <thestig@chromium.org> | 2018-04-05 19:09:10 +0000 |
---|---|---|
committer | Chromium commit bot <commit-bot@chromium.org> | 2018-04-05 19:09:10 +0000 |
commit | 2cc287aec96752d8c36b4178bb75f737842b649b (patch) | |
tree | 84a9dac52899f9d36c798f47ad0b1ee3960aaaba | |
parent | 4a8478efac2c6b8642298b1e0f2c83247a569cb1 (diff) | |
download | pdfium-2cc287aec96752d8c36b4178bb75f737842b649b.tar.xz |
Get rid of a const_cast in CPDF_FlateEncoder.
Change-Id: I3ee8f8e9eb33d251dc00336bcd31e578e7ce5143
Reviewed-on: https://pdfium-review.googlesource.com/29854
Commit-Queue: Ryan Harrison <rharrison@chromium.org>
Reviewed-by: Ryan Harrison <rharrison@chromium.org>
-rw-r--r-- | core/fpdfapi/edit/cpdf_creator.cpp | 3 | ||||
-rw-r--r-- | core/fpdfapi/edit/cpdf_encryptor.cpp | 2 | ||||
-rw-r--r-- | core/fpdfapi/edit/cpdf_encryptor.h | 2 | ||||
-rw-r--r-- | core/fpdfapi/edit/cpdf_flateencoder.cpp | 2 | ||||
-rw-r--r-- | core/fpdfapi/edit/cpdf_flateencoder.h | 2 |
5 files changed, 6 insertions, 5 deletions
diff --git a/core/fpdfapi/edit/cpdf_creator.cpp b/core/fpdfapi/edit/cpdf_creator.cpp index 5868c979f2..adf507f844 100644 --- a/core/fpdfapi/edit/cpdf_creator.cpp +++ b/core/fpdfapi/edit/cpdf_creator.cpp @@ -224,7 +224,8 @@ bool CPDF_Creator::WriteDirectObj(uint32_t objnum, break; } CPDF_Encryptor encryptor(GetCryptoHandler(), objnum, - (uint8_t*)str.c_str(), str.GetLength()); + reinterpret_cast<const uint8_t*>(str.c_str()), + str.GetLength()); ByteString content = PDF_EncodeString( ByteString(encryptor.GetData(), encryptor.GetSize()), bHex); if (!m_Archive->WriteString(content.AsStringView())) diff --git a/core/fpdfapi/edit/cpdf_encryptor.cpp b/core/fpdfapi/edit/cpdf_encryptor.cpp index 858b5b6369..45be9f8447 100644 --- a/core/fpdfapi/edit/cpdf_encryptor.cpp +++ b/core/fpdfapi/edit/cpdf_encryptor.cpp @@ -9,7 +9,7 @@ CPDF_Encryptor::CPDF_Encryptor(CPDF_CryptoHandler* pHandler, int objnum, - uint8_t* src_data, + const uint8_t* src_data, uint32_t src_size) : m_pData(nullptr), m_dwSize(0), m_bNewBuf(false) { if (src_size == 0) diff --git a/core/fpdfapi/edit/cpdf_encryptor.h b/core/fpdfapi/edit/cpdf_encryptor.h index 00c9337eb3..1da601d491 100644 --- a/core/fpdfapi/edit/cpdf_encryptor.h +++ b/core/fpdfapi/edit/cpdf_encryptor.h @@ -15,7 +15,7 @@ class CPDF_Encryptor { public: CPDF_Encryptor(CPDF_CryptoHandler* pHandler, int objnum, - uint8_t* src_data, + const uint8_t* src_data, uint32_t src_size); ~CPDF_Encryptor(); diff --git a/core/fpdfapi/edit/cpdf_flateencoder.cpp b/core/fpdfapi/edit/cpdf_flateencoder.cpp index f68d02c31c..9826932d2a 100644 --- a/core/fpdfapi/edit/cpdf_flateencoder.cpp +++ b/core/fpdfapi/edit/cpdf_flateencoder.cpp @@ -29,7 +29,7 @@ CPDF_FlateEncoder::CPDF_FlateEncoder(const CPDF_Stream* pStream, return; } if (bHasFilter || !bFlateEncode) { - m_pData = const_cast<uint8_t*>(m_pAcc->GetData()); + m_pData = m_pAcc->GetData(); m_dwSize = m_pAcc->GetSize(); m_pDict = pStream->GetDict(); return; diff --git a/core/fpdfapi/edit/cpdf_flateencoder.h b/core/fpdfapi/edit/cpdf_flateencoder.h index acac753e5c..b2213de5f3 100644 --- a/core/fpdfapi/edit/cpdf_flateencoder.h +++ b/core/fpdfapi/edit/cpdf_flateencoder.h @@ -23,7 +23,7 @@ class CPDF_FlateEncoder { void CloneDict(); uint32_t GetSize() const { return m_dwSize; } - uint8_t* GetData() const { return m_pData.Get(); } + const uint8_t* GetData() const { return m_pData.Get(); } CPDF_Dictionary* GetDict() { return m_pDict.Get(); } |