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 --- fpdfsdk/javascript/Document.cpp | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) (limited to 'fpdfsdk/javascript') diff --git a/fpdfsdk/javascript/Document.cpp b/fpdfsdk/javascript/Document.cpp index 54761a2647..29f9764806 100644 --- a/fpdfsdk/javascript/Document.cpp +++ b/fpdfsdk/javascript/Document.cpp @@ -13,6 +13,7 @@ #include "core/fpdfapi/page/cpdf_page.h" #include "core/fpdfapi/parser/cpdf_array.h" #include "core/fpdfapi/parser/cpdf_document.h" +#include "core/fpdfapi/parser/cpdf_string.h" #include "core/fpdfapi/parser/fpdf_parser_decode.h" #include "core/fpdfdoc/cpdf_interform.h" #include "core/fpdfdoc/cpdf_nametree.h" @@ -809,7 +810,7 @@ bool Document::info(IJS_Context* cc, // It's to be compatible to non-standard info dictionary. for (const auto& it : *pDictionary) { const CFX_ByteString& bsKey = it.first; - CPDF_Object* pValueObj = it.second; + CPDF_Object* pValueObj = it.second.get(); CFX_WideString wsKey = CFX_WideString::FromUTF8(bsKey.AsStringC()); if (pValueObj->IsString() || pValueObj->IsName()) { pRuntime->PutObjectString(pObj, wsKey, pValueObj->GetUnicodeText()); @@ -844,7 +845,8 @@ bool Document::getPropertyInternal(IJS_Context* cc, } CFX_WideString csProperty; vp >> csProperty; - pDictionary->SetStringFor(propName, PDF_EncodeText(csProperty)); + pDictionary->SetNewFor(propName, PDF_EncodeText(csProperty), + false); m_pFormFillEnv->SetChangeMark(); } return true; -- cgit v1.2.3