summaryrefslogtreecommitdiff
path: root/core/fpdfapi/edit/cpdf_creator.cpp
diff options
context:
space:
mode:
authorLei Zhang <thestig@chromium.org>2018-05-09 21:28:32 +0000
committerChromium commit bot <commit-bot@chromium.org>2018-05-09 21:28:32 +0000
commit81981300c2892598784f8b7096d5143ac04293a7 (patch)
tree3ed5b42c0aaec60d63f90dab8f1d7f93c3366f15 /core/fpdfapi/edit/cpdf_creator.cpp
parent607f3cd63a314cd3a6c219b19cce31805b66cd6d (diff)
downloadpdfium-81981300c2892598784f8b7096d5143ac04293a7.tar.xz
Split the MaybeOwned CPDF_Dictionary in CPDF_FlateEncoder.
The owned copy needs to be modified, so it should be non-const. Whereas the unowned copy can be const. Add a GetClonedDict() method for accessing the modifiable dictionary. Change-Id: Ia7f6bcc5f917864cd1bbc7b5000a86f6e433ae9a Reviewed-on: https://pdfium-review.googlesource.com/32181 Reviewed-by: Henrique Nakashima <hnakashima@chromium.org> Commit-Queue: Lei Zhang <thestig@chromium.org>
Diffstat (limited to 'core/fpdfapi/edit/cpdf_creator.cpp')
-rw-r--r--core/fpdfapi/edit/cpdf_creator.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/core/fpdfapi/edit/cpdf_creator.cpp b/core/fpdfapi/edit/cpdf_creator.cpp
index 9176c21e45..872860b0ed 100644
--- a/core/fpdfapi/edit/cpdf_creator.cpp
+++ b/core/fpdfapi/edit/cpdf_creator.cpp
@@ -169,7 +169,7 @@ bool CPDF_Creator::WriteStream(const CPDF_Object* pStream,
if (static_cast<uint32_t>(encoder.GetDict()->GetIntegerFor("Length")) !=
encryptor.GetSize()) {
encoder.CloneDict();
- encoder.GetDict()->SetNewFor<CPDF_Number>(
+ encoder.GetClonedDict()->SetNewFor<CPDF_Number>(
"Length", static_cast<int>(encryptor.GetSize()));
}
@@ -240,7 +240,7 @@ bool CPDF_Creator::WriteDirectObj(uint32_t objnum,
if (static_cast<uint32_t>(encoder.GetDict()->GetIntegerFor("Length")) !=
encryptor.GetSize()) {
encoder.CloneDict();
- encoder.GetDict()->SetNewFor<CPDF_Number>(
+ encoder.GetClonedDict()->SetNewFor<CPDF_Number>(
"Length", static_cast<int>(encryptor.GetSize()));
}
if (!WriteDirectObj(objnum, encoder.GetDict(), true) ||