Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(1160)

Unified Diff: core/fpdfdoc/cpdf_annotlist.cpp

Issue 2510223002: Make CPDF_Dictionary use unique pointers. (Closed)
Patch Set: rebase Created 4 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « core/fpdfdoc/cpdf_annot.cpp ('k') | core/fpdfdoc/cpdf_filespec.cpp » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: core/fpdfdoc/cpdf_annotlist.cpp
diff --git a/core/fpdfdoc/cpdf_annotlist.cpp b/core/fpdfdoc/cpdf_annotlist.cpp
index 91cff454e323bca5203cf33cc0a695f3987543eb..e68e08a1f6c10f03a30dbbcc1d0c7477916fc4f2 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);
« no previous file with comments | « core/fpdfdoc/cpdf_annot.cpp ('k') | core/fpdfdoc/cpdf_filespec.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698