diff options
author | tsepez <tsepez@chromium.org> | 2016-10-14 16:59:10 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-10-14 16:59:10 -0700 |
commit | 3ba098595ae56b64eacc0c25ab76b89a4d78d920 (patch) | |
tree | 5c4db47295ea64cdf236c32ef7d5af5b8e7af232 /core/fpdfapi/parser/cpdf_dictionary.cpp | |
parent | 1d023881cd53485303c0fcc0b5878e700dc470fd (diff) | |
download | pdfium-3ba098595ae56b64eacc0c25ab76b89a4d78d920.tar.xz |
Update CPDF_IndirectObjectHolder APIs for unique objects.
Doing so highlights a few places where ownership is dubious.
Add convenience functions to return an unowned reference to
a newly-created indirect object.
Review-Url: https://codereview.chromium.org/2419173002
Diffstat (limited to 'core/fpdfapi/parser/cpdf_dictionary.cpp')
-rw-r--r-- | core/fpdfapi/parser/cpdf_dictionary.cpp | 10 |
1 files changed, 8 insertions, 2 deletions
diff --git a/core/fpdfapi/parser/cpdf_dictionary.cpp b/core/fpdfapi/parser/cpdf_dictionary.cpp index 435eee7248..0f03947ebd 100644 --- a/core/fpdfapi/parser/cpdf_dictionary.cpp +++ b/core/fpdfapi/parser/cpdf_dictionary.cpp @@ -188,8 +188,8 @@ void CPDF_Dictionary::ConvertToIndirectObjectFor( if (it == m_Map.end() || it->second->IsReference()) return; - uint32_t objnum = pHolder->AddIndirectObject(it->second.release()); - it->second = UniqueReference(new CPDF_Reference(pHolder, objnum)); + CPDF_Object* pObj = pHolder->AddIndirectObject(std::move(it->second)); + it->second = UniqueReference(new CPDF_Reference(pHolder, pObj->GetObjNum())); } void CPDF_Dictionary::RemoveFor(const CFX_ByteString& key) { @@ -229,6 +229,12 @@ void CPDF_Dictionary::SetReferenceFor(const CFX_ByteString& key, SetFor(key, new CPDF_Reference(pDoc, objnum)); } +void CPDF_Dictionary::SetReferenceFor(const CFX_ByteString& key, + CPDF_IndirectObjectHolder* pDoc, + const CPDF_Object* pObj) { + SetReferenceFor(key, pDoc, pObj->GetObjNum()); +} + void CPDF_Dictionary::SetNumberFor(const CFX_ByteString& key, FX_FLOAT f) { SetFor(key, new CPDF_Number(f)); } |