diff options
Diffstat (limited to 'core')
-rw-r--r-- | core/fpdfapi/page/cpdf_streamcontentparser.cpp | 4 | ||||
-rw-r--r-- | core/fpdfapi/parser/cpdf_array.cpp | 2 | ||||
-rw-r--r-- | core/fpdfapi/parser/cpdf_boolean.cpp | 2 | ||||
-rw-r--r-- | core/fpdfapi/parser/cpdf_data_avail.cpp | 8 | ||||
-rw-r--r-- | core/fpdfapi/parser/cpdf_dictionary.cpp | 2 | ||||
-rw-r--r-- | core/fpdfapi/parser/cpdf_name.cpp | 2 | ||||
-rw-r--r-- | core/fpdfapi/parser/cpdf_null.cpp | 2 | ||||
-rw-r--r-- | core/fpdfapi/parser/cpdf_number.cpp | 2 | ||||
-rw-r--r-- | core/fpdfapi/parser/cpdf_object.h | 18 | ||||
-rw-r--r-- | core/fpdfapi/parser/cpdf_object_unittest.cpp | 54 | ||||
-rw-r--r-- | core/fpdfapi/parser/cpdf_reference.cpp | 2 | ||||
-rw-r--r-- | core/fpdfapi/parser/cpdf_stream.cpp | 2 | ||||
-rw-r--r-- | core/fpdfapi/parser/cpdf_string.cpp | 2 | ||||
-rw-r--r-- | core/fpdfapi/parser/fpdf_parser_utility.cpp | 18 | ||||
-rw-r--r-- | core/fpdfdoc/cpdf_formfield.cpp | 6 |
15 files changed, 63 insertions, 63 deletions
diff --git a/core/fpdfapi/page/cpdf_streamcontentparser.cpp b/core/fpdfapi/page/cpdf_streamcontentparser.cpp index beba208739..6e930f62bb 100644 --- a/core/fpdfapi/page/cpdf_streamcontentparser.cpp +++ b/core/fpdfapi/page/cpdf_streamcontentparser.cpp @@ -173,7 +173,7 @@ ByteStringView FindFullName(const AbbrPair* table, void ReplaceAbbr(CPDF_Object* pObj) { switch (pObj->GetType()) { - case CPDF_Object::DICTIONARY: { + case CPDF_Object::kDictionary: { std::vector<AbbrReplacementOp> replacements; CPDF_Dictionary* pDict = pObj->AsDictionary(); { @@ -217,7 +217,7 @@ void ReplaceAbbr(CPDF_Object* pObj) { } break; } - case CPDF_Object::ARRAY: { + case CPDF_Object::kArray: { CPDF_Array* pArray = pObj->AsArray(); for (size_t i = 0; i < pArray->size(); i++) { CPDF_Object* pElement = pArray->GetObjectAt(i); diff --git a/core/fpdfapi/parser/cpdf_array.cpp b/core/fpdfapi/parser/cpdf_array.cpp index e0ac34169f..78a52f9694 100644 --- a/core/fpdfapi/parser/cpdf_array.cpp +++ b/core/fpdfapi/parser/cpdf_array.cpp @@ -33,7 +33,7 @@ CPDF_Array::~CPDF_Array() { } CPDF_Object::Type CPDF_Array::GetType() const { - return ARRAY; + return kArray; } bool CPDF_Array::IsArray() const { diff --git a/core/fpdfapi/parser/cpdf_boolean.cpp b/core/fpdfapi/parser/cpdf_boolean.cpp index 6066c80809..fdf5b5784d 100644 --- a/core/fpdfapi/parser/cpdf_boolean.cpp +++ b/core/fpdfapi/parser/cpdf_boolean.cpp @@ -16,7 +16,7 @@ CPDF_Boolean::CPDF_Boolean(bool value) : m_bValue(value) {} CPDF_Boolean::~CPDF_Boolean() {} CPDF_Object::Type CPDF_Boolean::GetType() const { - return BOOLEAN; + return kBoolean; } std::unique_ptr<CPDF_Object> CPDF_Boolean::Clone() const { diff --git a/core/fpdfapi/parser/cpdf_data_avail.cpp b/core/fpdfapi/parser/cpdf_data_avail.cpp index b685214f6f..43c0cb799c 100644 --- a/core/fpdfapi/parser/cpdf_data_avail.cpp +++ b/core/fpdfapi/parser/cpdf_data_avail.cpp @@ -353,10 +353,10 @@ bool CPDF_DataAvail::GetPageKids(CPDF_Object* pPages) { return true; switch (pKids->GetType()) { - case CPDF_Object::REFERENCE: + case CPDF_Object::kReference: m_PageObjList.push_back(pKids->AsReference()->GetRefObjNum()); break; - case CPDF_Object::ARRAY: { + case CPDF_Object::kArray: { CPDF_Array* pKidsArray = pKids->AsArray(); for (size_t i = 0; i < pKidsArray->size(); ++i) { if (CPDF_Reference* pRef = ToReference(pKidsArray->GetObjectAt(i))) @@ -602,14 +602,14 @@ bool CPDF_DataAvail::CheckUnknownPageNode(uint32_t dwPageNo, } switch (pKids->GetType()) { - case CPDF_Object::REFERENCE: { + case CPDF_Object::kReference: { CPDF_Reference* pKid = pKids->AsReference(); auto pNode = pdfium::MakeUnique<PageNode>(); pNode->m_dwPageNo = pKid->GetRefObjNum(); pPageNode->m_ChildNodes.push_back(std::move(pNode)); break; } - case CPDF_Object::ARRAY: { + case CPDF_Object::kArray: { CPDF_Array* pKidsArray = pKids->AsArray(); for (size_t i = 0; i < pKidsArray->size(); ++i) { CPDF_Reference* pKid = ToReference(pKidsArray->GetObjectAt(i)); diff --git a/core/fpdfapi/parser/cpdf_dictionary.cpp b/core/fpdfapi/parser/cpdf_dictionary.cpp index 6c005c8db2..c514e797e3 100644 --- a/core/fpdfapi/parser/cpdf_dictionary.cpp +++ b/core/fpdfapi/parser/cpdf_dictionary.cpp @@ -40,7 +40,7 @@ CPDF_Dictionary::~CPDF_Dictionary() { } CPDF_Object::Type CPDF_Dictionary::GetType() const { - return DICTIONARY; + return kDictionary; } CPDF_Dictionary* CPDF_Dictionary::GetDict() { diff --git a/core/fpdfapi/parser/cpdf_name.cpp b/core/fpdfapi/parser/cpdf_name.cpp index d35a76c8a0..721c58a3c7 100644 --- a/core/fpdfapi/parser/cpdf_name.cpp +++ b/core/fpdfapi/parser/cpdf_name.cpp @@ -20,7 +20,7 @@ CPDF_Name::CPDF_Name(WeakPtr<ByteStringPool> pPool, const ByteString& str) CPDF_Name::~CPDF_Name() {} CPDF_Object::Type CPDF_Name::GetType() const { - return NAME; + return kName; } std::unique_ptr<CPDF_Object> CPDF_Name::Clone() const { diff --git a/core/fpdfapi/parser/cpdf_null.cpp b/core/fpdfapi/parser/cpdf_null.cpp index 18c135c3ab..2a0a89095d 100644 --- a/core/fpdfapi/parser/cpdf_null.cpp +++ b/core/fpdfapi/parser/cpdf_null.cpp @@ -12,7 +12,7 @@ CPDF_Null::CPDF_Null() {} CPDF_Object::Type CPDF_Null::GetType() const { - return NULLOBJ; + return kNullobj; } std::unique_ptr<CPDF_Object> CPDF_Null::Clone() const { diff --git a/core/fpdfapi/parser/cpdf_number.cpp b/core/fpdfapi/parser/cpdf_number.cpp index 221a1ce760..5b618a79b0 100644 --- a/core/fpdfapi/parser/cpdf_number.cpp +++ b/core/fpdfapi/parser/cpdf_number.cpp @@ -20,7 +20,7 @@ CPDF_Number::CPDF_Number(const ByteStringView& str) : m_Number(str) {} CPDF_Number::~CPDF_Number() {} CPDF_Object::Type CPDF_Number::GetType() const { - return NUMBER; + return kNumber; } std::unique_ptr<CPDF_Object> CPDF_Number::Clone() const { diff --git a/core/fpdfapi/parser/cpdf_object.h b/core/fpdfapi/parser/cpdf_object.h index 4f64aec265..9404ad248f 100644 --- a/core/fpdfapi/parser/cpdf_object.h +++ b/core/fpdfapi/parser/cpdf_object.h @@ -31,15 +31,15 @@ class CPDF_Object { public: static const uint32_t kInvalidObjNum = static_cast<uint32_t>(-1); enum Type { - BOOLEAN = 1, - NUMBER, - STRING, - NAME, - ARRAY, - DICTIONARY, - STREAM, - NULLOBJ, - REFERENCE + kBoolean = 1, + kNumber, + kString, + kName, + kArray, + kDictionary, + kStream, + kNullobj, + kReference }; virtual ~CPDF_Object(); diff --git a/core/fpdfapi/parser/cpdf_object_unittest.cpp b/core/fpdfapi/parser/cpdf_object_unittest.cpp index c3ec3aeddb..0b6909660b 100644 --- a/core/fpdfapi/parser/cpdf_object_unittest.cpp +++ b/core/fpdfapi/parser/cpdf_object_unittest.cpp @@ -86,10 +86,10 @@ class PDFObjectsTest : public testing::Test { name_obj, m_ArrayObj.Get(), m_DictObj.Get(), stream_obj, null_obj}; m_DirectObjTypes = { - CPDF_Object::BOOLEAN, CPDF_Object::BOOLEAN, CPDF_Object::NUMBER, - CPDF_Object::NUMBER, CPDF_Object::STRING, CPDF_Object::STRING, - CPDF_Object::NAME, CPDF_Object::ARRAY, CPDF_Object::DICTIONARY, - CPDF_Object::STREAM, CPDF_Object::NULLOBJ}; + CPDF_Object::kBoolean, CPDF_Object::kBoolean, CPDF_Object::kNumber, + CPDF_Object::kNumber, CPDF_Object::kString, CPDF_Object::kString, + CPDF_Object::kName, CPDF_Object::kArray, CPDF_Object::kDictionary, + CPDF_Object::kStream, CPDF_Object::kNullobj}; for (size_t i = 0; i < FX_ArraySize(objs); ++i) m_DirectObjs.emplace_back(objs[i]); @@ -114,15 +114,15 @@ class PDFObjectsTest : public testing::Test { if (!obj1 || !obj2 || obj1->GetType() != obj2->GetType()) return false; switch (obj1->GetType()) { - case CPDF_Object::BOOLEAN: + case CPDF_Object::kBoolean: return obj1->GetInteger() == obj2->GetInteger(); - case CPDF_Object::NUMBER: + case CPDF_Object::kNumber: return obj1->AsNumber()->IsInteger() == obj2->AsNumber()->IsInteger() && obj1->GetInteger() == obj2->GetInteger(); - case CPDF_Object::STRING: - case CPDF_Object::NAME: + case CPDF_Object::kString: + case CPDF_Object::kName: return obj1->GetString() == obj2->GetString(); - case CPDF_Object::ARRAY: { + case CPDF_Object::kArray: { const CPDF_Array* array1 = obj1->AsArray(); const CPDF_Array* array2 = obj2->AsArray(); if (array1->size() != array2->size()) @@ -133,7 +133,7 @@ class PDFObjectsTest : public testing::Test { } return true; } - case CPDF_Object::DICTIONARY: { + case CPDF_Object::kDictionary: { const CPDF_Dictionary* dict1 = obj1->AsDictionary(); const CPDF_Dictionary* dict2 = obj2->AsDictionary(); if (dict1->size() != dict2->size()) @@ -145,9 +145,9 @@ class PDFObjectsTest : public testing::Test { } return true; } - case CPDF_Object::NULLOBJ: + case CPDF_Object::kNullobj: return true; - case CPDF_Object::STREAM: { + case CPDF_Object::kStream: { const CPDF_Stream* stream1 = obj1->AsStream(); const CPDF_Stream* stream2 = obj2->AsStream(); if (!stream1->GetDict() && !stream2->GetDict()) @@ -168,7 +168,7 @@ class PDFObjectsTest : public testing::Test { return memcmp(streamAcc1->GetData(), streamAcc2->GetData(), streamAcc2->GetSize()) == 0; } - case CPDF_Object::REFERENCE: + case CPDF_Object::kReference: return obj1->AsReference()->GetRefObjNum() == obj2->AsReference()->GetRefObjNum(); } @@ -300,7 +300,7 @@ TEST_F(PDFObjectsTest, GetType) { // Check indirect references. for (const auto& it : m_RefObjs) - EXPECT_EQ(CPDF_Object::REFERENCE, it->GetType()); + EXPECT_EQ(CPDF_Object::kReference, it->GetType()); } TEST_F(PDFObjectsTest, GetDirect) { @@ -328,7 +328,7 @@ TEST_F(PDFObjectsTest, SetString) { TEST_F(PDFObjectsTest, IsTypeAndAsType) { // Check for direct objects. for (size_t i = 0; i < m_DirectObjs.size(); ++i) { - if (m_DirectObjTypes[i] == CPDF_Object::ARRAY) { + if (m_DirectObjTypes[i] == CPDF_Object::kArray) { EXPECT_TRUE(m_DirectObjs[i]->IsArray()); EXPECT_EQ(m_DirectObjs[i].get(), m_DirectObjs[i]->AsArray()); } else { @@ -336,7 +336,7 @@ TEST_F(PDFObjectsTest, IsTypeAndAsType) { EXPECT_EQ(nullptr, m_DirectObjs[i]->AsArray()); } - if (m_DirectObjTypes[i] == CPDF_Object::BOOLEAN) { + if (m_DirectObjTypes[i] == CPDF_Object::kBoolean) { EXPECT_TRUE(m_DirectObjs[i]->IsBoolean()); EXPECT_EQ(m_DirectObjs[i].get(), m_DirectObjs[i]->AsBoolean()); } else { @@ -344,7 +344,7 @@ TEST_F(PDFObjectsTest, IsTypeAndAsType) { EXPECT_EQ(nullptr, m_DirectObjs[i]->AsBoolean()); } - if (m_DirectObjTypes[i] == CPDF_Object::NAME) { + if (m_DirectObjTypes[i] == CPDF_Object::kName) { EXPECT_TRUE(m_DirectObjs[i]->IsName()); EXPECT_EQ(m_DirectObjs[i].get(), m_DirectObjs[i]->AsName()); } else { @@ -352,7 +352,7 @@ TEST_F(PDFObjectsTest, IsTypeAndAsType) { EXPECT_EQ(nullptr, m_DirectObjs[i]->AsName()); } - if (m_DirectObjTypes[i] == CPDF_Object::NUMBER) { + if (m_DirectObjTypes[i] == CPDF_Object::kNumber) { EXPECT_TRUE(m_DirectObjs[i]->IsNumber()); EXPECT_EQ(m_DirectObjs[i].get(), m_DirectObjs[i]->AsNumber()); } else { @@ -360,7 +360,7 @@ TEST_F(PDFObjectsTest, IsTypeAndAsType) { EXPECT_EQ(nullptr, m_DirectObjs[i]->AsNumber()); } - if (m_DirectObjTypes[i] == CPDF_Object::STRING) { + if (m_DirectObjTypes[i] == CPDF_Object::kString) { EXPECT_TRUE(m_DirectObjs[i]->IsString()); EXPECT_EQ(m_DirectObjs[i].get(), m_DirectObjs[i]->AsString()); } else { @@ -368,7 +368,7 @@ TEST_F(PDFObjectsTest, IsTypeAndAsType) { EXPECT_EQ(nullptr, m_DirectObjs[i]->AsString()); } - if (m_DirectObjTypes[i] == CPDF_Object::DICTIONARY) { + if (m_DirectObjTypes[i] == CPDF_Object::kDictionary) { EXPECT_TRUE(m_DirectObjs[i]->IsDictionary()); EXPECT_EQ(m_DirectObjs[i].get(), m_DirectObjs[i]->AsDictionary()); } else { @@ -376,7 +376,7 @@ TEST_F(PDFObjectsTest, IsTypeAndAsType) { EXPECT_EQ(nullptr, m_DirectObjs[i]->AsDictionary()); } - if (m_DirectObjTypes[i] == CPDF_Object::STREAM) { + if (m_DirectObjTypes[i] == CPDF_Object::kStream) { EXPECT_TRUE(m_DirectObjs[i]->IsStream()); EXPECT_EQ(m_DirectObjs[i].get(), m_DirectObjs[i]->AsStream()); } else { @@ -697,7 +697,7 @@ TEST(PDFArrayTest, AddNumber) { for (size_t i = 0; i < FX_ArraySize(vals); ++i) arr->AddNew<CPDF_Number>(vals[i]); for (size_t i = 0; i < FX_ArraySize(vals); ++i) { - EXPECT_EQ(CPDF_Object::NUMBER, arr->GetObjectAt(i)->GetType()); + EXPECT_EQ(CPDF_Object::kNumber, arr->GetObjectAt(i)->GetType()); EXPECT_EQ(vals[i], arr->GetObjectAt(i)->GetNumber()); } } @@ -708,7 +708,7 @@ TEST(PDFArrayTest, AddInteger) { for (size_t i = 0; i < FX_ArraySize(vals); ++i) arr->AddNew<CPDF_Number>(vals[i]); for (size_t i = 0; i < FX_ArraySize(vals); ++i) { - EXPECT_EQ(CPDF_Object::NUMBER, arr->GetObjectAt(i)->GetType()); + EXPECT_EQ(CPDF_Object::kNumber, arr->GetObjectAt(i)->GetType()); EXPECT_EQ(vals[i], arr->GetObjectAt(i)->GetNumber()); } } @@ -724,9 +724,9 @@ TEST(PDFArrayTest, AddStringAndName) { name_array->AddNew<CPDF_Name>(vals[i]); } for (size_t i = 0; i < FX_ArraySize(vals); ++i) { - EXPECT_EQ(CPDF_Object::STRING, string_array->GetObjectAt(i)->GetType()); + EXPECT_EQ(CPDF_Object::kString, string_array->GetObjectAt(i)->GetType()); EXPECT_STREQ(vals[i], string_array->GetObjectAt(i)->GetString().c_str()); - EXPECT_EQ(CPDF_Object::NAME, name_array->GetObjectAt(i)->GetType()); + EXPECT_EQ(CPDF_Object::kName, name_array->GetObjectAt(i)->GetType()); EXPECT_STREQ(vals[i], name_array->GetObjectAt(i)->GetString().c_str()); } } @@ -758,10 +758,10 @@ TEST(PDFArrayTest, AddReferenceAndGetObjectAt) { // Check arrays. EXPECT_EQ(arr->size(), arr1->size()); for (size_t i = 0; i < arr->size(); ++i) { - EXPECT_EQ(CPDF_Object::REFERENCE, arr->GetObjectAt(i)->GetType()); + EXPECT_EQ(CPDF_Object::kReference, arr->GetObjectAt(i)->GetType()); EXPECT_EQ(indirect_objs[i], arr->GetObjectAt(i)->GetDirect()); EXPECT_EQ(indirect_objs[i], arr->GetDirectObjectAt(i)); - EXPECT_EQ(CPDF_Object::REFERENCE, arr1->GetObjectAt(i)->GetType()); + EXPECT_EQ(CPDF_Object::kReference, arr1->GetObjectAt(i)->GetType()); EXPECT_EQ(indirect_objs[i], arr1->GetObjectAt(i)->GetDirect()); EXPECT_EQ(indirect_objs[i], arr1->GetDirectObjectAt(i)); } diff --git a/core/fpdfapi/parser/cpdf_reference.cpp b/core/fpdfapi/parser/cpdf_reference.cpp index 5a4d58a0e2..6885d2c6c7 100644 --- a/core/fpdfapi/parser/cpdf_reference.cpp +++ b/core/fpdfapi/parser/cpdf_reference.cpp @@ -17,7 +17,7 @@ CPDF_Reference::CPDF_Reference(CPDF_IndirectObjectHolder* pDoc, uint32_t objnum) CPDF_Reference::~CPDF_Reference() {} CPDF_Object::Type CPDF_Reference::GetType() const { - return REFERENCE; + return kReference; } ByteString CPDF_Reference::GetString() const { diff --git a/core/fpdfapi/parser/cpdf_stream.cpp b/core/fpdfapi/parser/cpdf_stream.cpp index 81d0e840c0..38374626ac 100644 --- a/core/fpdfapi/parser/cpdf_stream.cpp +++ b/core/fpdfapi/parser/cpdf_stream.cpp @@ -46,7 +46,7 @@ CPDF_Stream::~CPDF_Stream() { } CPDF_Object::Type CPDF_Stream::GetType() const { - return STREAM; + return kStream; } CPDF_Dictionary* CPDF_Stream::GetDict() { diff --git a/core/fpdfapi/parser/cpdf_string.cpp b/core/fpdfapi/parser/cpdf_string.cpp index e7f2a9dcd6..08f3db30d8 100644 --- a/core/fpdfapi/parser/cpdf_string.cpp +++ b/core/fpdfapi/parser/cpdf_string.cpp @@ -33,7 +33,7 @@ CPDF_String::CPDF_String(WeakPtr<ByteStringPool> pPool, const WideString& str) CPDF_String::~CPDF_String() {} CPDF_Object::Type CPDF_String::GetType() const { - return STRING; + return kString; } std::unique_ptr<CPDF_Object> CPDF_String::Clone() const { diff --git a/core/fpdfapi/parser/fpdf_parser_utility.cpp b/core/fpdfapi/parser/fpdf_parser_utility.cpp index e6972984ea..f25d68bb5e 100644 --- a/core/fpdfapi/parser/fpdf_parser_utility.cpp +++ b/core/fpdfapi/parser/fpdf_parser_utility.cpp @@ -158,26 +158,26 @@ std::ostream& operator<<(std::ostream& buf, const CPDF_Object* pObj) { return buf; } switch (pObj->GetType()) { - case CPDF_Object::NULLOBJ: + case CPDF_Object::kNullobj: buf << " null"; break; - case CPDF_Object::BOOLEAN: - case CPDF_Object::NUMBER: + case CPDF_Object::kBoolean: + case CPDF_Object::kNumber: buf << " " << pObj->GetString(); break; - case CPDF_Object::STRING: + case CPDF_Object::kString: buf << PDF_EncodeString(pObj->GetString(), pObj->AsString()->IsHex()); break; - case CPDF_Object::NAME: { + case CPDF_Object::kName: { ByteString str = pObj->GetString(); buf << "/" << PDF_NameEncode(str); break; } - case CPDF_Object::REFERENCE: { + case CPDF_Object::kReference: { buf << " " << pObj->AsReference()->GetRefObjNum() << " 0 R "; break; } - case CPDF_Object::ARRAY: { + case CPDF_Object::kArray: { const CPDF_Array* p = pObj->AsArray(); buf << "["; for (size_t i = 0; i < p->size(); i++) { @@ -191,7 +191,7 @@ std::ostream& operator<<(std::ostream& buf, const CPDF_Object* pObj) { buf << "]"; break; } - case CPDF_Object::DICTIONARY: { + case CPDF_Object::kDictionary: { CPDF_DictionaryLocker locker(pObj->AsDictionary()); buf << "<<"; for (const auto& it : locker) { @@ -207,7 +207,7 @@ std::ostream& operator<<(std::ostream& buf, const CPDF_Object* pObj) { buf << ">>"; break; } - case CPDF_Object::STREAM: { + case CPDF_Object::kStream: { const CPDF_Stream* p = pObj->AsStream(); buf << p->GetDict() << "stream\r\n"; auto pAcc = pdfium::MakeRetain<CPDF_StreamAcc>(p); diff --git a/core/fpdfdoc/cpdf_formfield.cpp b/core/fpdfdoc/cpdf_formfield.cpp index 89030b4132..61cdf4c4a1 100644 --- a/core/fpdfdoc/cpdf_formfield.cpp +++ b/core/fpdfdoc/cpdf_formfield.cpp @@ -337,10 +337,10 @@ WideString CPDF_FormField::GetValue(bool bDefault) const { } switch (pValue->GetType()) { - case CPDF_Object::STRING: - case CPDF_Object::STREAM: + case CPDF_Object::kString: + case CPDF_Object::kStream: return pValue->GetUnicodeText(); - case CPDF_Object::ARRAY: + case CPDF_Object::kArray: pValue = pValue->AsArray()->GetDirectObjectAt(0); if (pValue) return pValue->GetUnicodeText(); |