Make CPDF_Dictionary use unique pointers.
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
diff --git a/fpdfsdk/cpdfsdk_annothandlermgr.cpp b/fpdfsdk/cpdfsdk_annothandlermgr.cpp
index 51ce88e..898b9cc 100644
--- a/fpdfsdk/cpdfsdk_annothandlermgr.cpp
+++ b/fpdfsdk/cpdfsdk_annothandlermgr.cpp
@@ -6,6 +6,8 @@
#include "fpdfsdk/cpdfsdk_annothandlermgr.h"
+#include "core/fpdfapi/parser/cpdf_number.h"
+#include "core/fpdfapi/parser/cpdf_string.h"
#include "core/fpdfdoc/cpdf_annot.h"
#include "fpdfsdk/cba_annotiterator.h"
#include "fpdfsdk/cpdfsdk_annot.h"
@@ -62,8 +64,9 @@
CPDF_Annot* pPDFAnnot = pAnnot->GetPDFAnnot();
CPDFSDK_DateTime curTime;
- pPDFAnnot->GetAnnotDict()->SetStringFor("M", curTime.ToPDFDateTimeString());
- pPDFAnnot->GetAnnotDict()->SetNumberFor("F", 0);
+ pPDFAnnot->GetAnnotDict()->SetNewFor<CPDF_String>(
+ "M", curTime.ToPDFDateTimeString(), false);
+ pPDFAnnot->GetAnnotDict()->SetNewFor<CPDF_Number>("F", 0);
}
void CPDFSDK_AnnotHandlerMgr::Annot_OnLoad(CPDFSDK_Annot* pAnnot) {