summaryrefslogtreecommitdiff
path: root/core/fpdfapi/fpdf_parser
diff options
context:
space:
mode:
Diffstat (limited to 'core/fpdfapi/fpdf_parser')
-rw-r--r--core/fpdfapi/fpdf_parser/cpdf_dictionary.cpp3
-rw-r--r--core/fpdfapi/fpdf_parser/cpdf_dictionary.h1
-rw-r--r--core/fpdfapi/fpdf_parser/cpdf_object_unittest.cpp22
-rw-r--r--core/fpdfapi/fpdf_parser/cpdf_stream.cpp2
4 files changed, 14 insertions, 14 deletions
diff --git a/core/fpdfapi/fpdf_parser/cpdf_dictionary.cpp b/core/fpdfapi/fpdf_parser/cpdf_dictionary.cpp
index 5b9699d019..5696fc0c8d 100644
--- a/core/fpdfapi/fpdf_parser/cpdf_dictionary.cpp
+++ b/core/fpdfapi/fpdf_parser/cpdf_dictionary.cpp
@@ -19,6 +19,9 @@
#include "third_party/base/logging.h"
#include "third_party/base/stl_util.h"
+CPDF_Dictionary::CPDF_Dictionary()
+ : CPDF_Dictionary(CFX_WeakPtr<CFX_ByteStringPool>()) {}
+
CPDF_Dictionary::CPDF_Dictionary(const CFX_WeakPtr<CFX_ByteStringPool>& pPool)
: m_pPool(pPool) {}
diff --git a/core/fpdfapi/fpdf_parser/cpdf_dictionary.h b/core/fpdfapi/fpdf_parser/cpdf_dictionary.h
index 07903f5bd7..e3fd594575 100644
--- a/core/fpdfapi/fpdf_parser/cpdf_dictionary.h
+++ b/core/fpdfapi/fpdf_parser/cpdf_dictionary.h
@@ -23,6 +23,7 @@ class CPDF_Dictionary : public CPDF_Object {
using iterator = std::map<CFX_ByteString, CPDF_Object*>::iterator;
using const_iterator = std::map<CFX_ByteString, CPDF_Object*>::const_iterator;
+ CPDF_Dictionary();
explicit CPDF_Dictionary(const CFX_WeakPtr<CFX_ByteStringPool>& pPool);
// CPDF_Object.
diff --git a/core/fpdfapi/fpdf_parser/cpdf_object_unittest.cpp b/core/fpdfapi/fpdf_parser/cpdf_object_unittest.cpp
index beeb8f30c9..9b702099bb 100644
--- a/core/fpdfapi/fpdf_parser/cpdf_object_unittest.cpp
+++ b/core/fpdfapi/fpdf_parser/cpdf_object_unittest.cpp
@@ -66,7 +66,7 @@ class PDFObjectsTest : public testing::Test {
m_ArrayObj->InsertAt(0, new CPDF_Number(8902));
m_ArrayObj->InsertAt(1, new CPDF_Name("address"));
// Dictionary object.
- m_DictObj = new CPDF_Dictionary(CFX_WeakPtr<CFX_ByteStringPool>());
+ m_DictObj = new CPDF_Dictionary();
m_DictObj->SetFor("bool", new CPDF_Boolean(false));
m_DictObj->SetFor("num", new CPDF_Number(0.23f));
// Stream object.
@@ -74,7 +74,7 @@ class PDFObjectsTest : public testing::Test {
size_t buf_len = FX_ArraySize(content);
uint8_t* buf = reinterpret_cast<uint8_t*>(malloc(buf_len));
memcpy(buf, content, buf_len);
- m_StreamDictObj = new CPDF_Dictionary(CFX_WeakPtr<CFX_ByteStringPool>());
+ m_StreamDictObj = new CPDF_Dictionary();
m_StreamDictObj->SetFor("key1", new CPDF_String(L" test dict"));
m_StreamDictObj->SetFor("key2", new CPDF_Number(-1));
CPDF_Stream* stream_obj = new CPDF_Stream(buf, buf_len, m_StreamDictObj);
@@ -553,7 +553,7 @@ TEST(PDFArrayTest, GetTypeAt) {
CPDF_Dictionary* vals[3];
ScopedArray arr(new CPDF_Array);
for (size_t i = 0; i < 3; ++i) {
- vals[i] = new CPDF_Dictionary(CFX_WeakPtr<CFX_ByteStringPool>());
+ vals[i] = new CPDF_Dictionary();
for (size_t j = 0; j < 3; ++j) {
std::string key("key");
char buf[33];
@@ -580,7 +580,7 @@ TEST(PDFArrayTest, GetTypeAt) {
CPDF_Stream* stream_vals[3];
ScopedArray arr(new CPDF_Array);
for (size_t i = 0; i < 3; ++i) {
- vals[i] = new CPDF_Dictionary(CFX_WeakPtr<CFX_ByteStringPool>());
+ vals[i] = new CPDF_Dictionary();
for (size_t j = 0; j < 3; ++j) {
std::string key("key");
char buf[33];
@@ -625,13 +625,11 @@ TEST(PDFArrayTest, GetTypeAt) {
arr_val->AddNumber(1);
arr_val->AddNumber(2);
arr->InsertAt(11, arr_val);
- CPDF_Dictionary* dict_val =
- new CPDF_Dictionary(CFX_WeakPtr<CFX_ByteStringPool>());
+ CPDF_Dictionary* dict_val = new CPDF_Dictionary();
dict_val->SetFor("key1", new CPDF_String("Linda", false));
dict_val->SetFor("key2", new CPDF_String("Zoe", false));
arr->InsertAt(12, dict_val);
- CPDF_Dictionary* stream_dict =
- new CPDF_Dictionary(CFX_WeakPtr<CFX_ByteStringPool>());
+ CPDF_Dictionary* stream_dict = new CPDF_Dictionary();
stream_dict->SetFor("key1", new CPDF_String("John", false));
stream_dict->SetFor("key2", new CPDF_String("King", false));
uint8_t data[] = "A stream for test";
@@ -770,7 +768,7 @@ TEST(PDFArrayTest, CloneDirectObject) {
TEST(PDFDictionaryTest, CloneDirectObject) {
CPDF_IndirectObjectHolder objects_holder;
- ScopedDict dict(new CPDF_Dictionary(CFX_WeakPtr<CFX_ByteStringPool>()));
+ ScopedDict dict(new CPDF_Dictionary());
dict->SetReferenceFor("foo", &objects_holder, 1234);
ASSERT_EQ(1U, dict->GetCount());
CPDF_Object* obj = dict->GetObjectFor("foo");
@@ -792,8 +790,7 @@ TEST(PDFObjectTest, CloneCheckLoop) {
// Create an object with a reference loop.
ScopedArray arr_obj(new CPDF_Array);
// Dictionary object.
- CPDF_Dictionary* dict_obj =
- new CPDF_Dictionary(CFX_WeakPtr<CFX_ByteStringPool>());
+ CPDF_Dictionary* dict_obj = new CPDF_Dictionary();
dict_obj->SetFor("arr", arr_obj.get());
arr_obj->InsertAt(0, dict_obj);
@@ -811,8 +808,7 @@ TEST(PDFObjectTest, CloneCheckLoop) {
{
CPDF_IndirectObjectHolder objects_holder;
// Create an object with a reference loop.
- CPDF_Dictionary* dict_obj =
- new CPDF_Dictionary(CFX_WeakPtr<CFX_ByteStringPool>());
+ CPDF_Dictionary* dict_obj = new CPDF_Dictionary();
CPDF_Array* arr_obj = new CPDF_Array;
objects_holder.AddIndirectObject(dict_obj);
EXPECT_EQ(1u, dict_obj->GetObjNum());
diff --git a/core/fpdfapi/fpdf_parser/cpdf_stream.cpp b/core/fpdfapi/fpdf_parser/cpdf_stream.cpp
index 88d04203a1..4f6d046397 100644
--- a/core/fpdfapi/fpdf_parser/cpdf_stream.cpp
+++ b/core/fpdfapi/fpdf_parser/cpdf_stream.cpp
@@ -93,7 +93,7 @@ void CPDF_Stream::SetData(const uint8_t* pData, uint32_t size) {
FXSYS_memcpy(m_pDataBuf.get(), pData, size);
m_dwSize = size;
if (!m_pDict)
- m_pDict.reset(new CPDF_Dictionary(CFX_WeakPtr<CFX_ByteStringPool>()));
+ m_pDict.reset(new CPDF_Dictionary());
m_pDict->SetIntegerFor("Length", size);
m_pDict->RemoveFor("Filter");
m_pDict->RemoveFor("DecodeParms");