diff options
author | Lei Zhang <thestig@chromium.org> | 2018-10-12 18:31:51 +0000 |
---|---|---|
committer | Chromium commit bot <commit-bot@chromium.org> | 2018-10-12 18:31:51 +0000 |
commit | f40380f454042c9783fe30260a0e3df8b32c5c92 (patch) | |
tree | d89f89ee2f813e490ec0ccd5c6195c041f81ab44 /core/fpdfapi/parser | |
parent | 8273b37f032a2d9e8e4a83eeda43641365f311a2 (diff) | |
download | pdfium-f40380f454042c9783fe30260a0e3df8b32c5c92.tar.xz |
Rename CPDF_{Array,Dictionary}::GetCount() to size().
Make them compatible with pdfium::CollectionSize().
Change-Id: Ibef3b182e35a7eca7c656cf590462782de0cc157
Reviewed-on: https://pdfium-review.googlesource.com/c/43937
Reviewed-by: Tom Sepez <tsepez@chromium.org>
Commit-Queue: Lei Zhang <thestig@chromium.org>
Diffstat (limited to 'core/fpdfapi/parser')
-rw-r--r-- | core/fpdfapi/parser/cpdf_array.cpp | 2 | ||||
-rw-r--r-- | core/fpdfapi/parser/cpdf_array.h | 2 | ||||
-rw-r--r-- | core/fpdfapi/parser/cpdf_array_unittest.cpp | 28 | ||||
-rw-r--r-- | core/fpdfapi/parser/cpdf_data_avail.cpp | 6 | ||||
-rw-r--r-- | core/fpdfapi/parser/cpdf_dictionary.h | 2 | ||||
-rw-r--r-- | core/fpdfapi/parser/cpdf_document.cpp | 15 | ||||
-rw-r--r-- | core/fpdfapi/parser/cpdf_document_unittest.cpp | 2 | ||||
-rw-r--r-- | core/fpdfapi/parser/cpdf_linearized_header.cpp | 2 | ||||
-rw-r--r-- | core/fpdfapi/parser/cpdf_object_unittest.cpp | 24 | ||||
-rw-r--r-- | core/fpdfapi/parser/cpdf_parser.cpp | 4 | ||||
-rw-r--r-- | core/fpdfapi/parser/fpdf_parser_decode.cpp | 4 | ||||
-rw-r--r-- | core/fpdfapi/parser/fpdf_parser_utility.cpp | 2 |
12 files changed, 46 insertions, 47 deletions
diff --git a/core/fpdfapi/parser/cpdf_array.cpp b/core/fpdfapi/parser/cpdf_array.cpp index 79be0c8bae..f2eca1be70 100644 --- a/core/fpdfapi/parser/cpdf_array.cpp +++ b/core/fpdfapi/parser/cpdf_array.cpp @@ -236,7 +236,7 @@ bool CPDF_Array::WriteTo(IFX_ArchiveStream* archive, if (!archive->WriteString("[")) return false; - for (size_t i = 0; i < GetCount(); ++i) { + for (size_t i = 0; i < size(); ++i) { if (!GetObjectAt(i)->WriteTo(archive, encryptor)) return false; } diff --git a/core/fpdfapi/parser/cpdf_array.h b/core/fpdfapi/parser/cpdf_array.h index c4686c08e1..0905251382 100644 --- a/core/fpdfapi/parser/cpdf_array.h +++ b/core/fpdfapi/parser/cpdf_array.h @@ -37,7 +37,7 @@ class CPDF_Array final : public CPDF_Object { const CPDF_Encryptor* encryptor) const override; bool IsEmpty() const { return m_Objects.empty(); } - size_t GetCount() const { return m_Objects.size(); } + size_t size() const { return m_Objects.size(); } CPDF_Object* GetObjectAt(size_t index); const CPDF_Object* GetObjectAt(size_t index) const; CPDF_Object* GetDirectObjectAt(size_t index); diff --git a/core/fpdfapi/parser/cpdf_array_unittest.cpp b/core/fpdfapi/parser/cpdf_array_unittest.cpp index 4ce66dcadb..a70f9910ed 100644 --- a/core/fpdfapi/parser/cpdf_array_unittest.cpp +++ b/core/fpdfapi/parser/cpdf_array_unittest.cpp @@ -21,13 +21,13 @@ TEST(cpdf_array, RemoveAt) { for (size_t i = 0; i < 3; ++i) arr->RemoveAt(3); const int expected[] = {1, 2, 3, 7, 8, 9, 10}; - ASSERT_EQ(FX_ArraySize(expected), arr->GetCount()); + ASSERT_EQ(FX_ArraySize(expected), arr->size()); for (size_t i = 0; i < FX_ArraySize(expected); ++i) EXPECT_EQ(expected[i], arr->GetIntegerAt(i)); arr->RemoveAt(4); arr->RemoveAt(4); const int expected2[] = {1, 2, 3, 7, 10}; - ASSERT_EQ(FX_ArraySize(expected2), arr->GetCount()); + ASSERT_EQ(FX_ArraySize(expected2), arr->size()); for (size_t i = 0; i < FX_ArraySize(expected2); ++i) EXPECT_EQ(expected2[i], arr->GetIntegerAt(i)); } @@ -38,19 +38,19 @@ TEST(cpdf_array, RemoveAt) { for (size_t i = 0; i < FX_ArraySize(elems); ++i) arr->AddNew<CPDF_Number>(elems[i]); arr->RemoveAt(11); - EXPECT_EQ(FX_ArraySize(elems), arr->GetCount()); + EXPECT_EQ(FX_ArraySize(elems), arr->size()); } } TEST(cpdf_array, Clear) { const int elems[] = {1, 2, 3, 4, 5, 6, 7, 8, 9, 10}; auto arr = pdfium::MakeUnique<CPDF_Array>(); - EXPECT_EQ(0U, arr->GetCount()); + EXPECT_EQ(0U, arr->size()); for (size_t i = 0; i < FX_ArraySize(elems); ++i) arr->AddNew<CPDF_Number>(elems[i]); - EXPECT_EQ(FX_ArraySize(elems), arr->GetCount()); + EXPECT_EQ(FX_ArraySize(elems), arr->size()); arr->Clear(); - EXPECT_EQ(0U, arr->GetCount()); + EXPECT_EQ(0U, arr->size()); } TEST(cpdf_array, InsertAt) { @@ -59,14 +59,14 @@ TEST(cpdf_array, InsertAt) { auto arr = pdfium::MakeUnique<CPDF_Array>(); for (size_t i = 0; i < FX_ArraySize(elems); ++i) arr->InsertNewAt<CPDF_Number>(i, elems[i]); - ASSERT_EQ(FX_ArraySize(elems), arr->GetCount()); + ASSERT_EQ(FX_ArraySize(elems), arr->size()); for (size_t i = 0; i < FX_ArraySize(elems); ++i) EXPECT_EQ(elems[i], arr->GetIntegerAt(i)); arr->InsertNewAt<CPDF_Number>(3, 33); arr->InsertNewAt<CPDF_Number>(6, 55); arr->InsertNewAt<CPDF_Number>(12, 12); const int expected[] = {1, 2, 3, 33, 4, 5, 55, 6, 7, 8, 9, 10, 12}; - ASSERT_EQ(FX_ArraySize(expected), arr->GetCount()); + ASSERT_EQ(FX_ArraySize(expected), arr->size()); for (size_t i = 0; i < FX_ArraySize(expected); ++i) EXPECT_EQ(expected[i], arr->GetIntegerAt(i)); } @@ -79,7 +79,7 @@ TEST(cpdf_array, InsertAt) { for (size_t i = 0; i < FX_ArraySize(elems); ++i) arr->InsertNewAt<CPDF_Number>(i, elems[i]); arr->InsertNewAt<CPDF_Number>(10, 10); - ASSERT_EQ(11u, arr->GetCount()); + ASSERT_EQ(11u, arr->size()); for (size_t i = 0; i < FX_ArraySize(elems); ++i) EXPECT_EQ(elems[i], arr->GetIntegerAt(i)); for (size_t i = FX_ArraySize(elems); i < 10; ++i) @@ -96,7 +96,7 @@ TEST(cpdf_array, Clone) { for (size_t i = 0; i < FX_ArraySize(elems); ++i) arr->InsertNewAt<CPDF_Number>(i, elems[i]); std::unique_ptr<CPDF_Array> arr2 = ToArray(arr->Clone()); - ASSERT_EQ(arr->GetCount(), arr2->GetCount()); + ASSERT_EQ(arr->size(), arr2->size()); for (size_t i = 0; i < FX_ArraySize(elems); ++i) { // Clone() always create new objects. EXPECT_NE(arr->GetObjectAt(i), arr2->GetObjectAt(i)); @@ -124,14 +124,14 @@ TEST(cpdf_array, Clone) { } arr->InsertAt(i, std::move(arr_elem)); } - ASSERT_EQ(kNumOfRows, arr->GetCount()); + ASSERT_EQ(kNumOfRows, arr->size()); // Not dereferencing reference objects means just creating new references // instead of new copies of direct objects. std::unique_ptr<CPDF_Array> arr1 = ToArray(arr->Clone()); - ASSERT_EQ(arr->GetCount(), arr1->GetCount()); + ASSERT_EQ(arr->size(), arr1->size()); // Dereferencing reference objects creates new copies of direct objects. std::unique_ptr<CPDF_Array> arr2 = ToArray(arr->CloneDirectObject()); - ASSERT_EQ(arr->GetCount(), arr2->GetCount()); + ASSERT_EQ(arr->size(), arr2->size()); for (size_t i = 0; i < kNumOfRows; ++i) { CPDF_Array* arr_elem = arr->GetObjectAt(i)->AsArray(); CPDF_Array* arr1_elem = arr1->GetObjectAt(i)->AsArray(); @@ -156,7 +156,7 @@ TEST(cpdf_array, Clone) { } } arr.reset(); - ASSERT_EQ(kNumOfRows, arr1->GetCount()); + ASSERT_EQ(kNumOfRows, arr1->size()); for (size_t i = 0; i < kNumOfRows; ++i) { for (size_t j = 0; j < kNumOfRowElems; ++j) { // Results from not deferencing reference objects. diff --git a/core/fpdfapi/parser/cpdf_data_avail.cpp b/core/fpdfapi/parser/cpdf_data_avail.cpp index 904b0ad9fc..c046996498 100644 --- a/core/fpdfapi/parser/cpdf_data_avail.cpp +++ b/core/fpdfapi/parser/cpdf_data_avail.cpp @@ -357,7 +357,7 @@ bool CPDF_DataAvail::GetPageKids(CPDF_Object* pPages) { break; case CPDF_Object::ARRAY: { CPDF_Array* pKidsArray = pKids->AsArray(); - for (size_t i = 0; i < pKidsArray->GetCount(); ++i) { + for (size_t i = 0; i < pKidsArray->size(); ++i) { if (CPDF_Reference* pRef = ToReference(pKidsArray->GetObjectAt(i))) m_PageObjList.push_back(pRef->GetRefObjNum()); } @@ -545,7 +545,7 @@ bool CPDF_DataAvail::CheckArrayPageNode(uint32_t dwPageNo, } pPageNode->m_type = PDF_PAGENODE_PAGES; - for (size_t i = 0; i < pArray->GetCount(); ++i) { + for (size_t i = 0; i < pArray->size(); ++i) { CPDF_Reference* pKid = ToReference(pArray->GetObjectAt(i)); if (!pKid) continue; @@ -610,7 +610,7 @@ bool CPDF_DataAvail::CheckUnknownPageNode(uint32_t dwPageNo, } case CPDF_Object::ARRAY: { CPDF_Array* pKidsArray = pKids->AsArray(); - for (size_t i = 0; i < pKidsArray->GetCount(); ++i) { + for (size_t i = 0; i < pKidsArray->size(); ++i) { CPDF_Reference* pKid = ToReference(pKidsArray->GetObjectAt(i)); if (!pKid) continue; diff --git a/core/fpdfapi/parser/cpdf_dictionary.h b/core/fpdfapi/parser/cpdf_dictionary.h index a0e678c6fd..2e972d0577 100644 --- a/core/fpdfapi/parser/cpdf_dictionary.h +++ b/core/fpdfapi/parser/cpdf_dictionary.h @@ -41,7 +41,7 @@ class CPDF_Dictionary final : public CPDF_Object { bool WriteTo(IFX_ArchiveStream* archive, const CPDF_Encryptor* encryptor) const override; - size_t GetCount() const { return m_Map.size(); } + size_t size() const { return m_Map.size(); } const CPDF_Object* GetObjectFor(const ByteString& key) const; CPDF_Object* GetObjectFor(const ByteString& key); const CPDF_Object* GetDirectObjectFor(const ByteString& key) const; diff --git a/core/fpdfapi/parser/cpdf_document.cpp b/core/fpdfapi/parser/cpdf_document.cpp index c82112e044..c2ad8b7553 100644 --- a/core/fpdfapi/parser/cpdf_document.cpp +++ b/core/fpdfapi/parser/cpdf_document.cpp @@ -46,7 +46,7 @@ void InsertWidthArrayImpl(std::vector<int> widths, CPDF_Array* pWidthArray) { break; } if (i == widths.size()) { - int first = pWidthArray->GetIntegerAt(pWidthArray->GetCount() - 1); + int first = pWidthArray->GetIntegerAt(pWidthArray->size() - 1); pWidthArray->AddNew<CPDF_Number>(first + static_cast<int>(widths.size()) - 1); pWidthArray->AddNew<CPDF_Number>(widths[0]); @@ -99,7 +99,7 @@ int CountPages(CPDF_Dictionary* pPages, if (!pKidList) return 0; count = 0; - for (size_t i = 0; i < pKidList->GetCount(); i++) { + for (size_t i = 0; i < pKidList->size(); i++) { CPDF_Dictionary* pKid = pKidList->GetDictAt(i); if (!pKid || pdfium::ContainsKey(*visited_pages, pKid)) continue; @@ -259,8 +259,7 @@ CPDF_Dictionary* CPDF_Document::TraversePDFPages(int iPage, return nullptr; } CPDF_Dictionary* page = nullptr; - for (size_t i = m_pTreeTraversal[level].second; i < pKidList->GetCount(); - i++) { + for (size_t i = m_pTreeTraversal[level].second; i < pKidList->size(); i++) { if (*nPagesToGo == 0) break; pKidList->ConvertToIndirectObjectAt(i, this); @@ -299,7 +298,7 @@ CPDF_Dictionary* CPDF_Document::TraversePDFPages(int iPage, } } } - if (m_pTreeTraversal[level].second == pKidList->GetCount()) + if (m_pTreeTraversal[level].second == pKidList->size()) m_pTreeTraversal.pop_back(); return page; } @@ -388,7 +387,7 @@ int CPDF_Document::FindPageIndex(const CPDF_Dictionary* pNode, return -1; } - if (count && count == pKidList->GetCount()) { + if (count && count == pKidList->size()) { for (size_t i = 0; i < count; i++) { const CPDF_Reference* pKid = ToReference(pKidList->GetObjectAt(i)); if (pKid && pKid->GetRefObjNum() == objnum) @@ -396,7 +395,7 @@ int CPDF_Document::FindPageIndex(const CPDF_Dictionary* pNode, } } - for (size_t i = 0; i < pKidList->GetCount(); i++) { + for (size_t i = 0; i < pKidList->size(); i++) { const CPDF_Dictionary* pKid = pKidList->GetDictAt(i); if (!pKid || pKid == pNode) continue; @@ -527,7 +526,7 @@ bool CPDF_Document::InsertDeletePDFPage(CPDF_Dictionary* pPages, if (!pKidList) return false; - for (size_t i = 0; i < pKidList->GetCount(); i++) { + for (size_t i = 0; i < pKidList->size(); i++) { CPDF_Dictionary* pKid = pKidList->GetDictAt(i); if (pKid->GetStringFor("Type") == "Page") { if (nPagesToGo != 0) { diff --git a/core/fpdfapi/parser/cpdf_document_unittest.cpp b/core/fpdfapi/parser/cpdf_document_unittest.cpp index daaab5de32..fd726f03bf 100644 --- a/core/fpdfapi/parser/cpdf_document_unittest.cpp +++ b/core/fpdfapi/parser/cpdf_document_unittest.cpp @@ -33,7 +33,7 @@ CPDF_Dictionary* CreatePageTreeNode(std::unique_ptr<CPDF_Array> kids, pageNode->SetNewFor<CPDF_String>("Type", "Pages", false); pageNode->SetNewFor<CPDF_Reference>("Kids", pDoc, pUnowned->GetObjNum()); pageNode->SetNewFor<CPDF_Number>("Count", count); - for (size_t i = 0; i < pUnowned->GetCount(); i++) { + for (size_t i = 0; i < pUnowned->size(); i++) { pUnowned->GetDictAt(i)->SetNewFor<CPDF_Reference>("Parent", pDoc, pageNode->GetObjNum()); } diff --git a/core/fpdfapi/parser/cpdf_linearized_header.cpp b/core/fpdfapi/parser/cpdf_linearized_header.cpp index da7a7ad384..467d7c64dd 100644 --- a/core/fpdfapi/parser/cpdf_linearized_header.cpp +++ b/core/fpdfapi/parser/cpdf_linearized_header.cpp @@ -93,7 +93,7 @@ CPDF_LinearizedHeader::CPDF_LinearizedHeader(const CPDF_Dictionary* pDict, m_szLastXRefOffset(szLastXRefOffset) { const CPDF_Array* pHintStreamRange = pDict->GetArrayFor("H"); const size_t nHintStreamSize = - pHintStreamRange ? pHintStreamRange->GetCount() : 0; + pHintStreamRange ? pHintStreamRange->size() : 0; if (nHintStreamSize == 2 || nHintStreamSize == 4) { m_szHintStart = std::max(pHintStreamRange->GetIntegerAt(0), 0); const FX_SAFE_UINT32 safe_hint_length = pHintStreamRange->GetIntegerAt(1); diff --git a/core/fpdfapi/parser/cpdf_object_unittest.cpp b/core/fpdfapi/parser/cpdf_object_unittest.cpp index ca01949c65..e5b322ff42 100644 --- a/core/fpdfapi/parser/cpdf_object_unittest.cpp +++ b/core/fpdfapi/parser/cpdf_object_unittest.cpp @@ -125,9 +125,9 @@ class PDFObjectsTest : public testing::Test { case CPDF_Object::ARRAY: { const CPDF_Array* array1 = obj1->AsArray(); const CPDF_Array* array2 = obj2->AsArray(); - if (array1->GetCount() != array2->GetCount()) + if (array1->size() != array2->size()) return false; - for (size_t i = 0; i < array1->GetCount(); ++i) { + for (size_t i = 0; i < array1->size(); ++i) { if (!Equal(array1->GetObjectAt(i), array2->GetObjectAt(i))) return false; } @@ -136,7 +136,7 @@ class PDFObjectsTest : public testing::Test { case CPDF_Object::DICTIONARY: { const CPDF_Dictionary* dict1 = obj1->AsDictionary(); const CPDF_Dictionary* dict2 = obj2->AsDictionary(); - if (dict1->GetCount() != dict2->GetCount()) + if (dict1->size() != dict2->size()) return false; for (CPDF_Dictionary::const_iterator it = dict1->begin(); it != dict1->end(); ++it) { @@ -667,7 +667,7 @@ TEST(PDFArrayTest, GetTypeAt) { 0, 0, 0, 0, 0, 0, 0}; const float expected_float[] = {0, 0, 0, -1234, 2345, 0.05f, 0, 0, 0, 0, 0, 0, 0, 0}; - for (size_t i = 0; i < arr->GetCount(); ++i) { + for (size_t i = 0; i < arr->size(); ++i) { EXPECT_STREQ(expected_str[i], arr->GetStringAt(i).c_str()); EXPECT_EQ(expected_int[i], arr->GetIntegerAt(i)); EXPECT_EQ(expected_float[i], arr->GetNumberAt(i)); @@ -756,8 +756,8 @@ TEST(PDFArrayTest, AddReferenceAndGetObjectAt) { for (size_t i = 0; i < FX_ArraySize(obj_nums); ++i) EXPECT_EQ(indirect_objs[i], holder->GetOrParseIndirectObject(obj_nums[i])); // Check arrays. - EXPECT_EQ(arr->GetCount(), arr1->GetCount()); - for (size_t i = 0; i < arr->GetCount(); ++i) { + 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(indirect_objs[i], arr->GetObjectAt(i)->GetDirect()); EXPECT_EQ(indirect_objs[i], arr->GetDirectObjectAt(i)); @@ -771,7 +771,7 @@ TEST(PDFArrayTest, CloneDirectObject) { CPDF_IndirectObjectHolder objects_holder; auto array = pdfium::MakeUnique<CPDF_Array>(); array->AddNew<CPDF_Reference>(&objects_holder, 1234); - ASSERT_EQ(1U, array->GetCount()); + ASSERT_EQ(1U, array->size()); CPDF_Object* obj = array->GetObjectAt(0); ASSERT_TRUE(obj); EXPECT_TRUE(obj->IsReference()); @@ -782,7 +782,7 @@ TEST(PDFArrayTest, CloneDirectObject) { std::unique_ptr<CPDF_Array> cloned_array = ToArray(std::move(cloned_array_object)); - ASSERT_EQ(0U, cloned_array->GetCount()); + ASSERT_EQ(0U, cloned_array->size()); CPDF_Object* cloned_obj = cloned_array->GetObjectAt(0); EXPECT_FALSE(cloned_obj); } @@ -878,7 +878,7 @@ TEST(PDFDictionaryTest, CloneDirectObject) { CPDF_IndirectObjectHolder objects_holder; auto dict = pdfium::MakeUnique<CPDF_Dictionary>(); dict->SetNewFor<CPDF_Reference>("foo", &objects_holder, 1234); - ASSERT_EQ(1U, dict->GetCount()); + ASSERT_EQ(1U, dict->size()); CPDF_Object* obj = dict->GetObjectFor("foo"); ASSERT_TRUE(obj); EXPECT_TRUE(obj->IsReference()); @@ -889,7 +889,7 @@ TEST(PDFDictionaryTest, CloneDirectObject) { std::unique_ptr<CPDF_Dictionary> cloned_dict = ToDictionary(std::move(cloned_dict_object)); - ASSERT_EQ(0U, cloned_dict->GetCount()); + ASSERT_EQ(0U, cloned_dict->size()); CPDF_Object* cloned_obj = cloned_dict->GetObjectFor("foo"); EXPECT_FALSE(cloned_obj); } @@ -906,7 +906,7 @@ TEST(PDFObjectTest, CloneCheckLoop) { std::unique_ptr<CPDF_Array> cloned_array = ToArray(arr_obj->Clone()); // Cloned object should be the same as the original. ASSERT_TRUE(cloned_array); - EXPECT_EQ(1u, cloned_array->GetCount()); + EXPECT_EQ(1u, cloned_array->size()); CPDF_Object* cloned_dict = cloned_array->GetObjectAt(0); ASSERT_TRUE(cloned_dict); ASSERT_TRUE(cloned_dict->IsDictionary()); @@ -953,7 +953,7 @@ TEST(PDFObjectTest, CloneCheckLoop) { CPDF_Object* cloned_arr = cloned_dict->GetObjectFor("arr"); ASSERT_TRUE(cloned_arr); ASSERT_TRUE(cloned_arr->IsArray()); - EXPECT_EQ(0U, cloned_arr->AsArray()->GetCount()); + EXPECT_EQ(0U, cloned_arr->AsArray()->size()); // Recursively referenced object is not cloned. EXPECT_EQ(nullptr, cloned_arr->AsArray()->GetObjectAt(0)); } diff --git a/core/fpdfapi/parser/cpdf_parser.cpp b/core/fpdfapi/parser/cpdf_parser.cpp index 32629bc873..08d5a3358d 100644 --- a/core/fpdfapi/parser/cpdf_parser.cpp +++ b/core/fpdfapi/parser/cpdf_parser.cpp @@ -688,7 +688,7 @@ bool CPDF_Parser::LoadCrossRefV5(FX_FILESIZE* pos, bool bMainXRef) { std::vector<std::pair<int32_t, int32_t>> arrIndex; CPDF_Array* pArray = pDict->GetArrayFor("Index"); if (pArray) { - for (size_t i = 0; i < pArray->GetCount() / 2; i++) { + for (size_t i = 0; i < pArray->size() / 2; i++) { CPDF_Object* pStartNumObj = pArray->GetObjectAt(i * 2); CPDF_Object* pCountObj = pArray->GetObjectAt(i * 2 + 1); @@ -710,7 +710,7 @@ bool CPDF_Parser::LoadCrossRefV5(FX_FILESIZE* pos, bool bMainXRef) { std::vector<uint32_t> WidthArray; FX_SAFE_UINT32 dwAccWidth = 0; - for (size_t i = 0; i < pArray->GetCount(); ++i) { + for (size_t i = 0; i < pArray->size(); ++i) { WidthArray.push_back(pArray->GetIntegerAt(i)); dwAccWidth += WidthArray[i]; } diff --git a/core/fpdfapi/parser/fpdf_parser_decode.cpp b/core/fpdfapi/parser/fpdf_parser_decode.cpp index a581dcc44f..99b6154e8d 100644 --- a/core/fpdfapi/parser/fpdf_parser_decode.cpp +++ b/core/fpdfapi/parser/fpdf_parser_decode.cpp @@ -89,7 +89,7 @@ const uint16_t PDFDocEncoding[256] = { 0x00fc, 0x00fd, 0x00fe, 0x00ff}; bool ValidateDecoderPipeline(const CPDF_Array* pDecoders) { - size_t count = pDecoders->GetCount(); + size_t count = pDecoders->size(); if (count <= 1) return true; @@ -379,7 +379,7 @@ bool PDF_DataDecode(pdfium::span<const uint8_t> src_span, return false; const CPDF_Array* pParamsArray = ToArray(pParams); - for (size_t i = 0; i < pDecoders->GetCount(); ++i) { + for (size_t i = 0; i < pDecoders->size(); ++i) { DecoderArray.push_back( {pDecoders->GetStringAt(i), pParamsArray ? pParamsArray->GetDictAt(i) : nullptr}); diff --git a/core/fpdfapi/parser/fpdf_parser_utility.cpp b/core/fpdfapi/parser/fpdf_parser_utility.cpp index 83c967d8c2..4cd02f009e 100644 --- a/core/fpdfapi/parser/fpdf_parser_utility.cpp +++ b/core/fpdfapi/parser/fpdf_parser_utility.cpp @@ -180,7 +180,7 @@ std::ostream& operator<<(std::ostream& buf, const CPDF_Object* pObj) { case CPDF_Object::ARRAY: { const CPDF_Array* p = pObj->AsArray(); buf << "["; - for (size_t i = 0; i < p->GetCount(); i++) { + for (size_t i = 0; i < p->size(); i++) { const CPDF_Object* pElement = p->GetObjectAt(i); if (pElement && !pElement->IsInline()) { buf << " " << pElement->GetObjNum() << " 0 R"; |