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_filespec.cpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'core/fpdfdoc/cpdf_filespec.cpp') diff --git a/core/fpdfdoc/cpdf_filespec.cpp b/core/fpdfdoc/cpdf_filespec.cpp index 46b7f8a446..d6a66f7b73 100644 --- a/core/fpdfdoc/cpdf_filespec.cpp +++ b/core/fpdfdoc/cpdf_filespec.cpp @@ -7,7 +7,9 @@ #include "core/fpdfdoc/cpdf_filespec.h" #include "core/fpdfapi/parser/cpdf_dictionary.h" +#include "core/fpdfapi/parser/cpdf_name.h" #include "core/fpdfapi/parser/cpdf_object.h" +#include "core/fpdfapi/parser/cpdf_string.h" #include "core/fpdfapi/parser/fpdf_parser_decode.h" #include "core/fxcrt/fx_system.h" @@ -112,7 +114,7 @@ bool CPDF_FileSpec::GetFileName(CFX_WideString* csFileName) const { CPDF_FileSpec::CPDF_FileSpec(const CFX_WeakPtr& pPool) { m_pObj = new CPDF_Dictionary(pPool); - m_pObj->AsDictionary()->SetNameFor("Type", "Filespec"); + m_pObj->AsDictionary()->SetNewFor("Type", "Filespec"); } CFX_WideString CPDF_FileSpec::EncodeFileName(const CFX_WideStringC& filepath) { @@ -161,7 +163,8 @@ void CPDF_FileSpec::SetFileName(const CFX_WideStringC& wsFileName) { if (m_pObj->IsString()) { m_pObj->SetString(CFX_ByteString::FromUnicode(wsStr)); } else if (CPDF_Dictionary* pDict = m_pObj->AsDictionary()) { - pDict->SetStringFor("F", CFX_ByteString::FromUnicode(wsStr)); - pDict->SetStringFor("UF", PDF_EncodeText(wsStr)); + pDict->SetNewFor("F", CFX_ByteString::FromUnicode(wsStr), + false); + pDict->SetNewFor("UF", PDF_EncodeText(wsStr), false); } } -- cgit v1.2.3