diff options
author | tsepez <tsepez@chromium.org> | 2016-11-18 16:22:41 -0800 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-11-18 16:22:41 -0800 |
commit | 0e606b5ecd6e45f74391f110cc1fe0cce0e80c64 (patch) | |
tree | 07c55fac710b191cf5d1d6595c63b90ca52e3cbb /core/fpdfdoc/cpdf_annotlist.cpp | |
parent | 430ab8363e77c48b2c2435af4d289f85e2be1b96 (diff) | |
download | pdfium-0e606b5ecd6e45f74391f110cc1fe0cce0e80c64.tar.xz |
Make CPDF_Dictionary use unique pointers.chromium/2926
Some changes were required to match underlying ctors
as invoked by the templated methods.
Many release() calls go away, a few WrapUniques() are
introduced to avoid going deeper into other code.
Review-Url: https://codereview.chromium.org/2510223002
Diffstat (limited to 'core/fpdfdoc/cpdf_annotlist.cpp')
-rw-r--r-- | core/fpdfdoc/cpdf_annotlist.cpp | 14 |
1 files changed, 9 insertions, 5 deletions
diff --git a/core/fpdfdoc/cpdf_annotlist.cpp b/core/fpdfdoc/cpdf_annotlist.cpp index 91cff454e3..e68e08a1f6 100644 --- a/core/fpdfdoc/cpdf_annotlist.cpp +++ b/core/fpdfdoc/cpdf_annotlist.cpp @@ -11,7 +11,10 @@ #include "core/fpdfapi/page/cpdf_page.h" #include "core/fpdfapi/parser/cpdf_document.h" +#include "core/fpdfapi/parser/cpdf_name.h" +#include "core/fpdfapi/parser/cpdf_number.h" #include "core/fpdfapi/parser/cpdf_reference.h" +#include "core/fpdfapi/parser/cpdf_string.h" #include "core/fpdfapi/render/cpdf_renderoptions.h" #include "core/fpdfdoc/cpdf_annot.h" #include "core/fpdfdoc/cpdf_interform.h" @@ -36,10 +39,11 @@ std::unique_ptr<CPDF_Annot> CreatePopupAnnot(CPDF_Annot* pAnnot, auto pAnnotDict = pdfium::MakeUnique<CPDF_Dictionary>(pDocument->GetByteStringPool()); - pAnnotDict->SetNameFor("Type", "Annot"); - pAnnotDict->SetNameFor("Subtype", "Popup"); - pAnnotDict->SetStringFor("T", pParentDict->GetStringFor("T")); - pAnnotDict->SetStringFor("Contents", sContents.UTF8Encode()); + pAnnotDict->SetNewFor<CPDF_Name>("Type", "Annot"); + pAnnotDict->SetNewFor<CPDF_Name>("Subtype", "Popup"); + pAnnotDict->SetNewFor<CPDF_String>("T", pParentDict->GetStringFor("T"), + false); + pAnnotDict->SetNewFor<CPDF_String>("Contents", sContents.UTF8Encode(), false); CFX_FloatRect rect = pParentDict->GetRectFor("Rect"); rect.Normalize(); @@ -47,7 +51,7 @@ std::unique_ptr<CPDF_Annot> CreatePopupAnnot(CPDF_Annot* pAnnot, popupRect.Translate(rect.left, rect.bottom - popupRect.Height()); pAnnotDict->SetRectFor("Rect", popupRect); - pAnnotDict->SetIntegerFor("F", 0); + pAnnotDict->SetNewFor<CPDF_Number>("F", 0); auto pPopupAnnot = pdfium::MakeUnique<CPDF_Annot>(std::move(pAnnotDict), pDocument); |