From 0e606b5ecd6e45f74391f110cc1fe0cce0e80c64 Mon Sep 17 00:00:00 2001 From: tsepez Date: Fri, 18 Nov 2016 16:22:41 -0800 Subject: 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 --- core/fpdfdoc/cpdf_formcontrol.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'core/fpdfdoc/cpdf_formcontrol.cpp') 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("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("AS", csAS); } void CPDF_FormControl::DrawControl(CFX_RenderDevice* pDevice, -- cgit v1.2.3