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_unittest.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'core/fpdfdoc/cpdf_filespec_unittest.cpp') diff --git a/core/fpdfdoc/cpdf_filespec_unittest.cpp b/core/fpdfdoc/cpdf_filespec_unittest.cpp index 4da5019314..d164165f00 100644 --- a/core/fpdfdoc/cpdf_filespec_unittest.cpp +++ b/core/fpdfdoc/cpdf_filespec_unittest.cpp @@ -67,7 +67,8 @@ TEST(cpdf_filespec, GetFileName) { L"/docs/test.pdf" #endif }; - std::unique_ptr str_obj(new CPDF_String(test_data.input)); + std::unique_ptr str_obj( + new CPDF_String(nullptr, test_data.input)); CPDF_FileSpec file_spec(str_obj.get()); CFX_WideString file_name; EXPECT_TRUE(file_spec.GetFileName(&file_name)); @@ -102,13 +103,13 @@ TEST(cpdf_filespec, GetFileName) { CPDF_FileSpec file_spec(dict_obj.get()); CFX_WideString file_name; for (int i = 0; i < 5; ++i) { - dict_obj->SetFor(keywords[i], new CPDF_String(test_data[i].input)); + dict_obj->SetNewFor(keywords[i], test_data[i].input); EXPECT_TRUE(file_spec.GetFileName(&file_name)); EXPECT_TRUE(file_name == test_data[i].expected); } // With all the former fields and 'FS' field suggests 'URL' type. - dict_obj->SetStringFor("FS", "URL"); + dict_obj->SetNewFor("FS", "URL", false); EXPECT_TRUE(file_spec.GetFileName(&file_name)); // Url string is not decoded. EXPECT_TRUE(file_name == test_data[4].input); @@ -136,7 +137,7 @@ TEST(cpdf_filespec, SetFileName) { #endif }; // String object. - std::unique_ptr str_obj(new CPDF_String(L"babababa")); + std::unique_ptr str_obj(new CPDF_String(nullptr, L"babababa")); CPDF_FileSpec file_spec1(str_obj.get()); file_spec1.SetFileName(test_data.input); // Check internal object value. -- cgit v1.2.3