summaryrefslogtreecommitdiff
path: root/core/fpdfdoc/cpdf_formcontrol.cpp
diff options
context:
space:
mode:
authortsepez <tsepez@chromium.org>2016-11-18 16:22:41 -0800
committerCommit bot <commit-bot@chromium.org>2016-11-18 16:22:41 -0800
commit0e606b5ecd6e45f74391f110cc1fe0cce0e80c64 (patch)
tree07c55fac710b191cf5d1d6595c63b90ca52e3cbb /core/fpdfdoc/cpdf_formcontrol.cpp
parent430ab8363e77c48b2c2435af4d289f85e2be1b96 (diff)
downloadpdfium-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_formcontrol.cpp')
-rw-r--r--core/fpdfdoc/cpdf_formcontrol.cpp9
1 files changed, 5 insertions, 4 deletions
diff --git a/core/fpdfdoc/cpdf_formcontrol.cpp b/core/fpdfdoc/cpdf_formcontrol.cpp
index b01784b8dd..54edb4910c 100644
--- a/core/fpdfdoc/cpdf_formcontrol.cpp
+++ b/core/fpdfdoc/cpdf_formcontrol.cpp
@@ -11,6 +11,7 @@
#include "core/fpdfapi/page/cpdf_form.h"
#include "core/fpdfapi/parser/cpdf_array.h"
#include "core/fpdfapi/parser/cpdf_document.h"
+#include "core/fpdfapi/parser/cpdf_name.h"
#include "core/fpdfapi/parser/cpdf_stream.h"
#include "core/fpdfapi/parser/fpdf_parser_decode.h"
#include "core/fpdfapi/render/cpdf_rendercontext.h"
@@ -61,14 +62,14 @@ void CPDF_FormControl::SetOnStateName(const CFX_ByteString& csOn) {
CFX_ByteString csAS = m_pWidgetDict->GetStringFor("AS", "Off");
if (csAS != "Off")
- m_pWidgetDict->SetNameFor("AS", csValue);
+ m_pWidgetDict->SetNewFor<CPDF_Name>("AS", csValue);
CPDF_Dictionary* pAP = m_pWidgetDict->GetDictFor("AP");
if (!pAP)
return;
for (const auto& it : *pAP) {
- CPDF_Object* pObj1 = it.second;
+ CPDF_Object* pObj1 = it.second.get();
if (!pObj1)
continue;
@@ -80,7 +81,7 @@ void CPDF_FormControl::SetOnStateName(const CFX_ByteString& csOn) {
auto subdict_it = pSubDict->begin();
while (subdict_it != pSubDict->end()) {
const CFX_ByteString& csKey2 = subdict_it->first;
- CPDF_Object* pObj2 = subdict_it->second;
+ CPDF_Object* pObj2 = subdict_it->second.get();
++subdict_it;
if (!pObj2)
continue;
@@ -155,7 +156,7 @@ void CPDF_FormControl::CheckControl(bool bChecked) {
csAS = csOn;
if (csOldAS == csAS)
return;
- m_pWidgetDict->SetNameFor("AS", csAS);
+ m_pWidgetDict->SetNewFor<CPDF_Name>("AS", csAS);
}
void CPDF_FormControl::DrawControl(CFX_RenderDevice* pDevice,