summaryrefslogtreecommitdiff
path: root/core
diff options
context:
space:
mode:
authorHenrique Nakashima <hnakashima@chromium.org>2018-06-22 15:24:05 +0000
committerChromium commit bot <commit-bot@chromium.org>2018-06-22 15:24:05 +0000
commit0a49103801e322656eeacf8764cc0cb557059cea (patch)
tree50782ec65b3619e23789054503f133a4e80e6329 /core
parenta327030ca50bd9e06d4bab3ffc5610bf348be0ee (diff)
downloadpdfium-0a49103801e322656eeacf8764cc0cb557059cea.tar.xz
CPDF_PageObjectHolder::GetDirtyStreams() returns const ref.
This is safer since a ref cannot be deleted. Change-Id: Ib8d76ae2adb7c59e6955881eee0d2bd4db448b68 Reviewed-on: https://pdfium-review.googlesource.com/35950 Reviewed-by: Ryan Harrison <rharrison@chromium.org> Commit-Queue: Henrique Nakashima <hnakashima@chromium.org>
Diffstat (limited to 'core')
-rw-r--r--core/fpdfapi/edit/cpdf_pagecontentgenerator.cpp6
-rw-r--r--core/fpdfapi/edit/cpdf_pagecontentmanager.cpp2
-rw-r--r--core/fpdfapi/page/cpdf_pageobjectholder.h2
3 files changed, 5 insertions, 5 deletions
diff --git a/core/fpdfapi/edit/cpdf_pagecontentgenerator.cpp b/core/fpdfapi/edit/cpdf_pagecontentgenerator.cpp
index da6c74e2c7..ba31516f4a 100644
--- a/core/fpdfapi/edit/cpdf_pagecontentgenerator.cpp
+++ b/core/fpdfapi/edit/cpdf_pagecontentgenerator.cpp
@@ -85,10 +85,10 @@ CPDF_PageContentGenerator::GenerateModifiedStreams() {
if (pPageObj->IsDirty())
all_dirty_streams.insert(pPageObj->GetContentStream());
}
- const std::set<int32_t>* marked_dirty_streams =
+ const std::set<int32_t>& marked_dirty_streams =
m_pObjHolder->GetDirtyStreams();
- all_dirty_streams.insert(marked_dirty_streams->begin(),
- marked_dirty_streams->end());
+ all_dirty_streams.insert(marked_dirty_streams.begin(),
+ marked_dirty_streams.end());
// Start regenerating dirty streams.
std::map<int32_t, std::unique_ptr<std::ostringstream>> streams;
diff --git a/core/fpdfapi/edit/cpdf_pagecontentmanager.cpp b/core/fpdfapi/edit/cpdf_pagecontentmanager.cpp
index 46033bc0d1..3ba23a88fb 100644
--- a/core/fpdfapi/edit/cpdf_pagecontentmanager.cpp
+++ b/core/fpdfapi/edit/cpdf_pagecontentmanager.cpp
@@ -101,7 +101,7 @@ void CPDF_PageContentManager::ExecuteScheduledRemovals() {
// updated.
// Since this is only called by CPDF_PageContentGenerator::GenerateContent(),
// which cleans up the dirty streams first, this should always be true.
- ASSERT(obj_holder_->GetDirtyStreams()->empty());
+ ASSERT(obj_holder_->GetDirtyStreams().empty());
if (contents_stream_) {
// Only stream that can be removed is 0.
diff --git a/core/fpdfapi/page/cpdf_pageobjectholder.h b/core/fpdfapi/page/cpdf_pageobjectholder.h
index d18f400568..b1f7fb9e7f 100644
--- a/core/fpdfapi/page/cpdf_pageobjectholder.h
+++ b/core/fpdfapi/page/cpdf_pageobjectholder.h
@@ -85,7 +85,7 @@ class CPDF_PageObjectHolder {
void AddImageMaskBoundingBox(const CFX_FloatRect& box);
void Transform(const CFX_Matrix& matrix);
CFX_FloatRect CalcBoundingBox() const;
- const std::set<int32_t>* GetDirtyStreams() const { return &m_DirtyStreams; }
+ const std::set<int32_t>& GetDirtyStreams() const { return m_DirtyStreams; }
void ClearDirtyStreams() { m_DirtyStreams.clear(); }
UnownedPtr<CPDF_Dictionary> m_pPageResources;