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 | |
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>
65 files changed, 211 insertions, 213 deletions
diff --git a/core/fpdfapi/edit/cpdf_pagecontentmanager.cpp b/core/fpdfapi/edit/cpdf_pagecontentmanager.cpp index b3fe4ae39a..f9057dbe32 100644 --- a/core/fpdfapi/edit/cpdf_pagecontentmanager.cpp +++ b/core/fpdfapi/edit/cpdf_pagecontentmanager.cpp @@ -80,7 +80,7 @@ size_t CPDF_PageContentManager::AddStream(std::ostringstream* buf) { // If there is an array, just add the new stream to it, at the last position. if (contents_array_) { contents_array_->Add(new_stream->MakeReference(doc_.Get())); - return contents_array_->GetCount() - 1; + return contents_array_->size() - 1; } // There were no Contents, so add the new stream as the single Content stream. @@ -113,7 +113,7 @@ void CPDF_PageContentManager::ExecuteScheduledRemovals() { } else if (contents_array_) { // Initialize a vector with the old stream indexes. This will be used to // build a map from the old to the new indexes. - std::vector<size_t> streams_left(contents_array_->GetCount()); + std::vector<size_t> streams_left(contents_array_->size()); std::iota(streams_left.begin(), streams_left.end(), 0); // In reverse order so as to not change the indexes in the middle of the diff --git a/core/fpdfapi/font/cpdf_cidfont.cpp b/core/fpdfapi/font/cpdf_cidfont.cpp index 03442b5897..41627c069f 100644 --- a/core/fpdfapi/font/cpdf_cidfont.cpp +++ b/core/fpdfapi/font/cpdf_cidfont.cpp @@ -333,7 +333,7 @@ bool CPDF_CIDFont::Load() { } const CPDF_Array* pFonts = m_pFontDict->GetArrayFor("DescendantFonts"); - if (!pFonts || pFonts->GetCount() != 1) + if (!pFonts || pFonts->size() != 1) return false; const CPDF_Dictionary* pCIDFontDict = pFonts->GetDictAt(0); @@ -771,7 +771,7 @@ void CPDF_CIDFont::LoadMetricsArray(const CPDF_Array* pArray, int iCurElement = 0; uint32_t first_code = 0; uint32_t last_code = 0; - for (size_t i = 0; i < pArray->GetCount(); i++) { + for (size_t i = 0; i < pArray->size(); i++) { const CPDF_Object* pObj = pArray->GetDirectObjectAt(i); if (!pObj) continue; @@ -780,12 +780,12 @@ void CPDF_CIDFont::LoadMetricsArray(const CPDF_Array* pArray, if (width_status != 1) return; if (first_code > - std::numeric_limits<uint32_t>::max() - pObjArray->GetCount()) { + std::numeric_limits<uint32_t>::max() - pObjArray->size()) { width_status = 0; continue; } - for (size_t j = 0; j < pObjArray->GetCount(); j += nElements) { + for (size_t j = 0; j < pObjArray->size(); j += nElements) { result->push_back(first_code); result->push_back(first_code); for (int k = 0; k < nElements; k++) diff --git a/core/fpdfapi/font/cpdf_simplefont.cpp b/core/fpdfapi/font/cpdf_simplefont.cpp index dd1a1f33f3..38deef7cc8 100644 --- a/core/fpdfapi/font/cpdf_simplefont.cpp +++ b/core/fpdfapi/font/cpdf_simplefont.cpp @@ -146,7 +146,7 @@ void CPDF_SimpleFont::LoadPDFEncoding(bool bEmbedded, bool bTrueType) { m_CharNames.resize(256); uint32_t cur_code = 0; - for (uint32_t i = 0; i < pDiffs->GetCount(); i++) { + for (uint32_t i = 0; i < pDiffs->size(); i++) { const CPDF_Object* pElement = pDiffs->GetDirectObjectAt(i); if (!pElement) continue; @@ -202,8 +202,8 @@ bool CPDF_SimpleFont::LoadCommon() { size_t width_start = m_pFontDict->GetIntegerFor("FirstChar", 0); size_t width_end = m_pFontDict->GetIntegerFor("LastChar", 0); if (width_start <= 255) { - if (width_end == 0 || width_end >= width_start + pWidthArray->GetCount()) - width_end = width_start + pWidthArray->GetCount() - 1; + if (width_end == 0 || width_end >= width_start + pWidthArray->size()) + width_end = width_start + pWidthArray->size() - 1; if (width_end > 255) width_end = 255; for (size_t i = width_start; i <= width_end; i++) diff --git a/core/fpdfapi/font/cpdf_type3font.cpp b/core/fpdfapi/font/cpdf_type3font.cpp index 5993c1c7cb..1d70c8bb48 100644 --- a/core/fpdfapi/font/cpdf_type3font.cpp +++ b/core/fpdfapi/font/cpdf_type3font.cpp @@ -69,7 +69,7 @@ bool CPDF_Type3Font::Load() { if (StartChar >= 0 && static_cast<size_t>(StartChar) < kCharLimit) { const CPDF_Array* pWidthArray = m_pFontDict->GetArrayFor("Widths"); if (pWidthArray) { - size_t count = std::min(pWidthArray->GetCount(), kCharLimit); + size_t count = std::min(pWidthArray->size(), kCharLimit); count = std::min(count, kCharLimit - StartChar); for (size_t i = 0; i < count; i++) { m_CharWidthL[StartChar + i] = diff --git a/core/fpdfapi/page/cpdf_colorspace.cpp b/core/fpdfapi/page/cpdf_colorspace.cpp index 882b5657d8..2266dec9e8 100644 --- a/core/fpdfapi/page/cpdf_colorspace.cpp +++ b/core/fpdfapi/page/cpdf_colorspace.cpp @@ -80,7 +80,7 @@ void GetDefaultBlackPoint(float* pPoints) { void GetBlackPoint(const CPDF_Dictionary* pDict, float* pPoints) { const CPDF_Array* pParam = pDict->GetArrayFor("BlackPoint"); - if (!pParam || pParam->GetCount() != kBlackWhitePointCount) { + if (!pParam || pParam->size() != kBlackWhitePointCount) { GetDefaultBlackPoint(pPoints); return; } @@ -97,7 +97,7 @@ void GetBlackPoint(const CPDF_Dictionary* pDict, float* pPoints) { bool GetWhitePoint(const CPDF_Dictionary* pDict, float* pPoints) { const CPDF_Array* pParam = pDict->GetArrayFor("WhitePoint"); - if (!pParam || pParam->GetCount() != kBlackWhitePointCount) + if (!pParam || pParam->size() != kBlackWhitePointCount) return false; for (size_t i = 0; i < kBlackWhitePointCount; ++i) @@ -481,7 +481,7 @@ std::unique_ptr<CPDF_ColorSpace> CPDF_ColorSpace::Load( return nullptr; ByteString familyname = pFamilyObj->GetString(); - if (pArray->GetCount() == 1) + if (pArray->size() == 1) return pdfium::WrapUnique(ColorspaceFromName(familyname)); std::unique_ptr<CPDF_ColorSpace> pCS; @@ -1101,7 +1101,7 @@ CPDF_IndexedCS::~CPDF_IndexedCS() { uint32_t CPDF_IndexedCS::v_Load(CPDF_Document* pDoc, const CPDF_Array* pArray, std::set<const CPDF_Object*>* pVisited) { - if (pArray->GetCount() < 4) + if (pArray->size() < 4) return 0; const CPDF_Object* pBaseObj = pArray->GetDirectObjectAt(1); @@ -1299,7 +1299,7 @@ uint32_t CPDF_DeviceNCS::v_Load(CPDF_Document* pDoc, if (m_pFunc->CountOutputs() < m_pAltCS->CountComponents()) return 0; - return pObj->GetCount(); + return pObj->size(); } bool CPDF_DeviceNCS::GetRGB(const float* pBuf, diff --git a/core/fpdfapi/page/cpdf_contentparser.cpp b/core/fpdfapi/page/cpdf_contentparser.cpp index 3427fe5230..cf31447697 100644 --- a/core/fpdfapi/page/cpdf_contentparser.cpp +++ b/core/fpdfapi/page/cpdf_contentparser.cpp @@ -52,7 +52,7 @@ CPDF_ContentParser::CPDF_ContentParser(CPDF_Page* pPage) return; } - m_nStreams = pArray->GetCount(); + m_nStreams = pArray->size(); if (m_nStreams == 0) { m_CurrentStage = Stage::kComplete; return; diff --git a/core/fpdfapi/page/cpdf_docpagedata.cpp b/core/fpdfapi/page/cpdf_docpagedata.cpp index bc1c1c5a60..b41a8466b1 100644 --- a/core/fpdfapi/page/cpdf_docpagedata.cpp +++ b/core/fpdfapi/page/cpdf_docpagedata.cpp @@ -278,7 +278,7 @@ CPDF_ColorSpace* CPDF_DocPageData::GetColorSpaceInternal( if (!pArray || pArray->IsEmpty()) return nullptr; - if (pArray->GetCount() == 1) { + if (pArray->size() == 1) { return GetColorSpaceInternal(pArray->GetDirectObjectAt(0), pResources, pVisited, pVisitedInternal); } diff --git a/core/fpdfapi/page/cpdf_expintfunc.cpp b/core/fpdfapi/page/cpdf_expintfunc.cpp index cb83ac2d0b..e04ce1282c 100644 --- a/core/fpdfapi/page/cpdf_expintfunc.cpp +++ b/core/fpdfapi/page/cpdf_expintfunc.cpp @@ -30,7 +30,7 @@ bool CPDF_ExpIntFunc::v_Init(const CPDF_Object* pObj, const CPDF_Array* pArray0 = pDict->GetArrayFor("C0"); if (pArray0 && m_nOutputs == 0) - m_nOutputs = pArray0->GetCount(); + m_nOutputs = pArray0->size(); if (m_nOutputs == 0) m_nOutputs = 1; diff --git a/core/fpdfapi/page/cpdf_function.cpp b/core/fpdfapi/page/cpdf_function.cpp index def72992cd..fc8eb46d73 100644 --- a/core/fpdfapi/page/cpdf_function.cpp +++ b/core/fpdfapi/page/cpdf_function.cpp @@ -85,7 +85,7 @@ bool CPDF_Function::Init(const CPDF_Object* pObj, if (!pDomains) return false; - m_nInputs = pDomains->GetCount() / 2; + m_nInputs = pDomains->size() / 2; if (m_nInputs == 0) return false; @@ -95,7 +95,7 @@ bool CPDF_Function::Init(const CPDF_Object* pObj, m_Domains[i] = pDomains->GetFloatAt(i); const CPDF_Array* pRanges = pDict->GetArrayFor("Range"); - m_nOutputs = pRanges ? pRanges->GetCount() / 2 : 0; + m_nOutputs = pRanges ? pRanges->size() / 2 : 0; // Ranges are required for type 0 and type 4 functions. A non-zero // |m_nOutputs| here implied Ranges meets the requirements. diff --git a/core/fpdfapi/page/cpdf_meshstream.cpp b/core/fpdfapi/page/cpdf_meshstream.cpp index 5d8e1f2342..dce4c8a7c8 100644 --- a/core/fpdfapi/page/cpdf_meshstream.cpp +++ b/core/fpdfapi/page/cpdf_meshstream.cpp @@ -142,7 +142,7 @@ bool CPDF_MeshStream::Load() { m_nComponents = m_funcs.empty() ? nComponents : 1; const CPDF_Array* pDecode = pDict->GetArrayFor("Decode"); - if (!pDecode || pDecode->GetCount() != 4 + m_nComponents * 2) + if (!pDecode || pDecode->size() != 4 + m_nComponents * 2) return false; m_xmin = pDecode->GetNumberAt(0); diff --git a/core/fpdfapi/page/cpdf_shadingpattern.cpp b/core/fpdfapi/page/cpdf_shadingpattern.cpp index 52f4e1e10a..79ea6f84ec 100644 --- a/core/fpdfapi/page/cpdf_shadingpattern.cpp +++ b/core/fpdfapi/page/cpdf_shadingpattern.cpp @@ -72,7 +72,7 @@ bool CPDF_ShadingPattern::Load() { const CPDF_Object* pFunc = pShadingDict->GetDirectObjectFor("Function"); if (pFunc) { if (const CPDF_Array* pArray = pFunc->AsArray()) { - m_pFunctions.resize(std::min<size_t>(pArray->GetCount(), 4)); + m_pFunctions.resize(std::min<size_t>(pArray->size(), 4)); for (size_t i = 0; i < m_pFunctions.size(); ++i) m_pFunctions[i] = CPDF_Function::Load(pArray->GetDirectObjectAt(i)); } else { diff --git a/core/fpdfapi/page/cpdf_stitchfunc.cpp b/core/fpdfapi/page/cpdf_stitchfunc.cpp index b400a987c0..40f7c44d72 100644 --- a/core/fpdfapi/page/cpdf_stitchfunc.cpp +++ b/core/fpdfapi/page/cpdf_stitchfunc.cpp @@ -43,14 +43,14 @@ bool CPDF_StitchFunc::v_Init(const CPDF_Object* pObj, if (!pEncodeArray) return false; - const uint32_t nSubs = pFunctionsArray->GetCount(); + const uint32_t nSubs = pFunctionsArray->size(); if (nSubs == 0) return false; // Check array sizes. The checks are slightly relaxed to allow the "Bounds" // and "Encode" arrays to have more than the required number of elements. { - if (pBoundsArray->GetCount() < nSubs - 1) + if (pBoundsArray->size() < nSubs - 1) return false; FX_SAFE_UINT32 nExpectedEncodeSize = nSubs; @@ -58,7 +58,7 @@ bool CPDF_StitchFunc::v_Init(const CPDF_Object* pObj, if (!nExpectedEncodeSize.IsValid()) return false; - if (pEncodeArray->GetCount() < nExpectedEncodeSize.ValueOrDie()) + if (pEncodeArray->size() < nExpectedEncodeSize.ValueOrDie()) return false; } diff --git a/core/fpdfapi/page/cpdf_streamcontentparser.cpp b/core/fpdfapi/page/cpdf_streamcontentparser.cpp index d84d4d62ec..79fa3d2890 100644 --- a/core/fpdfapi/page/cpdf_streamcontentparser.cpp +++ b/core/fpdfapi/page/cpdf_streamcontentparser.cpp @@ -216,7 +216,7 @@ void ReplaceAbbr(CPDF_Object* pObj) { } case CPDF_Object::ARRAY: { CPDF_Array* pArray = pObj->AsArray(); - for (size_t i = 0; i < pArray->GetCount(); i++) { + for (size_t i = 0; i < pArray->size(); i++) { CPDF_Object* pElement = pArray->GetObjectAt(i); if (pElement->IsName()) { ByteString name = pElement->GetString(); @@ -1286,7 +1286,7 @@ void CPDF_StreamContentParser::Handle_ShowText_Positioning() { if (!pArray) return; - size_t n = pArray->GetCount(); + size_t n = pArray->size(); size_t nsegs = 0; for (size_t i = 0; i < n; i++) { if (pArray->GetDirectObjectAt(i)->IsString()) 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"; diff --git a/core/fpdfapi/render/cpdf_dibbase.cpp b/core/fpdfapi/render/cpdf_dibbase.cpp index 3557672e81..b95c14b59f 100644 --- a/core/fpdfapi/render/cpdf_dibbase.cpp +++ b/core/fpdfapi/render/cpdf_dibbase.cpp @@ -357,7 +357,7 @@ bool CPDF_DIBBase::LoadColorInfo(const CPDF_Dictionary* pFormResources, if (pFilter->IsName()) { filter = pFilter->GetString(); } else if (const CPDF_Array* pArray = pFilter->AsArray()) { - filter = pArray->GetStringAt(pArray->GetCount() - 1); + filter = pArray->GetStringAt(pArray->size() - 1); } if (filter == "JPXDecode") { @@ -441,7 +441,7 @@ bool CPDF_DIBBase::GetDecodeAndMaskArray(bool* bDefaultDecode, return true; if (const CPDF_Array* pArray = pMask->AsArray()) { - if (pArray->GetCount() >= m_nComponents * 2) { + if (pArray->size() >= m_nComponents * 2) { for (uint32_t i = 0; i < m_nComponents; i++) { int min_num = pArray->GetIntegerAt(i * 2); int max_num = pArray->GetIntegerAt(i * 2 + 1); @@ -825,7 +825,7 @@ void CPDF_DIBBase::ValidateDictParam() { m_bpc = 8; } } else if (const CPDF_Array* pArray = pFilter->AsArray()) { - ByteString filter = pArray->GetStringAt(pArray->GetCount() - 1); + ByteString filter = pArray->GetStringAt(pArray->size() - 1); if (filter == "CCITTFaxDecode" || filter == "JBIG2Decode") { m_bpc = 1; m_nComponents = 1; diff --git a/core/fpdfapi/render/cpdf_docrenderdata.cpp b/core/fpdfapi/render/cpdf_docrenderdata.cpp index c86eb9b147..fb54e147fa 100644 --- a/core/fpdfapi/render/cpdf_docrenderdata.cpp +++ b/core/fpdfapi/render/cpdf_docrenderdata.cpp @@ -75,7 +75,7 @@ RetainPtr<CPDF_TransferFunc> CPDF_DocRenderData::GetTransferFunc( bool bIdentity = true; if (const CPDF_Array* pArray = pObj->AsArray()) { bUniTransfer = false; - if (pArray->GetCount() < 3) + if (pArray->size() < 3) return nullptr; for (uint32_t i = 0; i < 3; ++i) { diff --git a/core/fpdfapi/render/cpdf_imagerenderer.cpp b/core/fpdfapi/render/cpdf_imagerenderer.cpp index affe12d6aa..da63f556a7 100644 --- a/core/fpdfapi/render/cpdf_imagerenderer.cpp +++ b/core/fpdfapi/render/cpdf_imagerenderer.cpp @@ -565,7 +565,7 @@ void CPDF_ImageRenderer::HandleFilters() { if (!pArray) return; - for (size_t i = 0; i < pArray->GetCount(); i++) { + for (size_t i = 0; i < pArray->size(); i++) { ByteString bsDecodeType = pArray->GetStringAt(i); if (bsDecodeType == "DCTDecode" || bsDecodeType == "JPXDecode") { m_Flags |= FXRENDER_IMAGE_LOSSY; diff --git a/core/fpdfapi/render/cpdf_renderstatus.cpp b/core/fpdfapi/render/cpdf_renderstatus.cpp index f77b6c654f..842272bc02 100644 --- a/core/fpdfapi/render/cpdf_renderstatus.cpp +++ b/core/fpdfapi/render/cpdf_renderstatus.cpp @@ -2028,8 +2028,7 @@ void CPDF_RenderStatus::DrawShading(const CPDF_ShadingPattern* pPattern, FX_ARGB background = 0; if (!pPattern->IsShadingObject() && pDict->KeyExist("Background")) { const CPDF_Array* pBackColor = pDict->GetArrayFor("Background"); - if (pBackColor && - pBackColor->GetCount() >= pColorSpace->CountComponents()) { + if (pBackColor && pBackColor->size() >= pColorSpace->CountComponents()) { std::vector<float> comps(pColorSpace->CountComponents()); for (uint32_t i = 0; i < pColorSpace->CountComponents(); i++) comps[i] = pBackColor->GetNumberAt(i); @@ -2638,7 +2637,7 @@ FX_ARGB CPDF_RenderStatus::GetBackColor(const CPDF_Dictionary* pSMaskDict, uint32_t comps = std::max(8u, pCS->CountComponents()); std::vector<float> floats(comps); - size_t count = std::min<size_t>(8, pBC->GetCount()); + size_t count = std::min<size_t>(8, pBC->size()); for (size_t i = 0; i < count; i++) floats[i] = pBC->GetNumberAt(i); diff --git a/core/fpdfdoc/cpdf_action.cpp b/core/fpdfdoc/cpdf_action.cpp index 6e9e9f7b68..ed5f46b7b0 100644 --- a/core/fpdfdoc/cpdf_action.cpp +++ b/core/fpdfdoc/cpdf_action.cpp @@ -131,7 +131,7 @@ size_t CPDF_Action::GetSubActionsCount() const { if (pNext->IsDictionary()) return 1; const CPDF_Array* pArray = pNext->AsArray(); - return pArray ? pArray->GetCount() : 0; + return pArray ? pArray->size() : 0; } CPDF_Action CPDF_Action::GetSubAction(size_t iIndex) const { diff --git a/core/fpdfdoc/cpdf_actionfields.cpp b/core/fpdfdoc/cpdf_actionfields.cpp index 4db5bc543b..f6a73fd045 100644 --- a/core/fpdfdoc/cpdf_actionfields.cpp +++ b/core/fpdfdoc/cpdf_actionfields.cpp @@ -36,7 +36,7 @@ std::vector<const CPDF_Object*> CPDF_ActionFields::GetAllFields() const { if (pFields->IsDictionary() || pFields->IsString()) { fields.push_back(pFields); } else if (const CPDF_Array* pArray = pFields->AsArray()) { - for (size_t i = 0; i < pArray->GetCount(); ++i) { + for (size_t i = 0; i < pArray->size(); ++i) { const CPDF_Object* pObj = pArray->GetDirectObjectAt(i); if (pObj) fields.push_back(pObj); diff --git a/core/fpdfdoc/cpdf_annot.cpp b/core/fpdfdoc/cpdf_annot.cpp index 89268d493a..8e703d5d5c 100644 --- a/core/fpdfdoc/cpdf_annot.cpp +++ b/core/fpdfdoc/cpdf_annot.cpp @@ -211,7 +211,7 @@ CPDF_Form* CPDF_Annot::GetAPForm(const CPDF_Page* pPage, AppearanceMode mode) { CFX_FloatRect CPDF_Annot::RectFromQuadPointsArray(const CPDF_Array* pArray, size_t nIndex) { ASSERT(pArray); - ASSERT(nIndex < pArray->GetCount() / 8); + ASSERT(nIndex < pArray->size() / 8); // QuadPoints are defined with 4 pairs of numbers // ([ pair0, pair1, pair2, pair3 ]), where @@ -381,7 +381,7 @@ ByteString CPDF_Annot::AnnotSubtypeToString(CPDF_Annot::Subtype nSubtype) { // static size_t CPDF_Annot::QuadPointCount(const CPDF_Array* pArray) { - return pArray->GetCount() / 8; + return pArray->size() / 8; } bool CPDF_Annot::DrawAppearance(CPDF_Page* pPage, @@ -460,12 +460,12 @@ void CPDF_Annot::DrawBorder(CFX_RenderDevice* pDevice, style_char = 'S'; if (pBorderArray) { width = pBorderArray->GetNumberAt(2); - if (pBorderArray->GetCount() == 4) { + if (pBorderArray->size() == 4) { pDashArray = pBorderArray->GetArrayAt(3); if (!pDashArray) { return; } - size_t nLen = pDashArray->GetCount(); + size_t nLen = pDashArray->size(); size_t i = 0; for (; i < nLen; ++i) { CPDF_Object* pObj = pDashArray->GetDirectObjectAt(i); @@ -502,13 +502,13 @@ void CPDF_Annot::DrawBorder(CFX_RenderDevice* pDevice, graph_state.m_LineWidth = width; if (style_char == 'D') { if (pDashArray) { - size_t dash_count = pDashArray->GetCount(); + size_t dash_count = pDashArray->size(); if (dash_count % 2) { dash_count++; } graph_state.m_DashArray.resize(dash_count); size_t i; - for (i = 0; i < pDashArray->GetCount(); ++i) { + for (i = 0; i < pDashArray->size(); ++i) { graph_state.m_DashArray[i] = pDashArray->GetNumberAt(i); } if (i < dash_count) { diff --git a/core/fpdfdoc/cpdf_annotlist.cpp b/core/fpdfdoc/cpdf_annotlist.cpp index 909431caf3..61ba6e944e 100644 --- a/core/fpdfdoc/cpdf_annotlist.cpp +++ b/core/fpdfdoc/cpdf_annotlist.cpp @@ -172,7 +172,7 @@ CPDF_AnnotList::CPDF_AnnotList(CPDF_Page* pPage) const CPDF_Dictionary* pAcroForm = pRoot->GetDictFor("AcroForm"); bool bRegenerateAP = pAcroForm && pAcroForm->GetBooleanFor("NeedAppearances", false); - for (size_t i = 0; i < pAnnots->GetCount(); ++i) { + for (size_t i = 0; i < pAnnots->size(); ++i) { CPDF_Dictionary* pDict = ToDictionary(pAnnots->GetDirectObjectAt(i)); if (!pDict) continue; diff --git a/core/fpdfdoc/cpdf_apsettings.cpp b/core/fpdfdoc/cpdf_apsettings.cpp index 0f0989252e..341764ffa0 100644 --- a/core/fpdfdoc/cpdf_apsettings.cpp +++ b/core/fpdfdoc/cpdf_apsettings.cpp @@ -38,7 +38,7 @@ FX_ARGB CPDF_ApSettings::GetColor(int& iColorType, return 0; FX_ARGB color = 0; - size_t dwCount = pEntry->GetCount(); + size_t dwCount = pEntry->size(); if (dwCount == 1) { iColorType = CFX_Color::kGray; float g = pEntry->GetNumberAt(0) * 255; @@ -88,7 +88,7 @@ void CPDF_ApSettings::GetOriginalColor(int& iColorType, if (!pEntry) return; - size_t dwCount = pEntry->GetCount(); + size_t dwCount = pEntry->size(); if (dwCount == 1) { iColorType = CFX_Color::kGray; fc[0] = pEntry->GetNumberAt(0); diff --git a/core/fpdfdoc/cpdf_dest.cpp b/core/fpdfdoc/cpdf_dest.cpp index f7aa98f1ef..1a373b6b9b 100644 --- a/core/fpdfdoc/cpdf_dest.cpp +++ b/core/fpdfdoc/cpdf_dest.cpp @@ -85,7 +85,7 @@ bool CPDF_Dest::GetXYZ(bool* pHasX, if (!m_pArray) return false; - if (m_pArray->GetCount() < 5) + if (m_pArray->size() < 5) return false; const CPDF_Name* xyz = ToName(m_pArray->GetDirectObjectAt(1)); @@ -119,11 +119,11 @@ bool CPDF_Dest::GetXYZ(bool* pHasX, } unsigned long CPDF_Dest::GetNumParams() const { - if (!m_pArray || m_pArray->GetCount() < 2) + if (!m_pArray || m_pArray->size() < 2) return 0; unsigned long maxParamsForFitType = g_sZoomModeMaxParamCount[GetZoomMode()]; - unsigned long numParamsInArray = m_pArray->GetCount() - 2; + unsigned long numParamsInArray = m_pArray->size() - 2; return std::min(maxParamsForFitType, numParamsInArray); } diff --git a/core/fpdfdoc/cpdf_formfield.cpp b/core/fpdfdoc/cpdf_formfield.cpp index 8399e79a13..a96e49b0cb 100644 --- a/core/fpdfdoc/cpdf_formfield.cpp +++ b/core/fpdfdoc/cpdf_formfield.cpp @@ -443,7 +443,7 @@ int CPDF_FormField::CountSelectedItems() const { if (pValue->IsString() || pValue->IsNumber()) return pValue->GetString().IsEmpty() ? 0 : 1; const CPDF_Array* pArray = pValue->AsArray(); - return pArray ? pArray->GetCount() : 0; + return pArray ? pArray->size() : 0; } int CPDF_FormField::GetSelectedIndex(int index) const { @@ -533,7 +533,7 @@ bool CPDF_FormField::IsItemSelected(int index) const { break; } } - for (int i = 0; i < static_cast<int>(pArray->GetCount()); i++) + for (int i = 0; i < static_cast<int>(pArray->size()); i++) if (pArray->GetDirectObjectAt(i)->GetUnicodeText() == opt_value && i == iPos) { return true; @@ -588,7 +588,7 @@ bool CPDF_FormField::SetItemSelection(int index, pArray->AddNew<CPDF_String>(PDF_EncodeText(opt_value), false); } } - if (pArray->GetCount() > 0) + if (pArray->size() > 0) m_pDict->SetFor("V", std::move(pArray)); } } else { @@ -627,7 +627,7 @@ int CPDF_FormField::GetDefaultSelectedItem() const { int CPDF_FormField::CountOptions() const { const CPDF_Array* pArray = ToArray(FPDF_GetFieldAttr(m_pDict.Get(), "Opt")); - return pArray ? pArray->GetCount() : 0; + return pArray ? pArray->size() : 0; } WideString CPDF_FormField::GetOptionText(int index, int sub_index) const { @@ -767,7 +767,7 @@ int CPDF_FormField::GetTopVisibleIndex() const { int CPDF_FormField::CountSelectedOptions() const { const CPDF_Array* pArray = ToArray(FPDF_GetFieldAttr(m_pDict.Get(), "I")); - return pArray ? pArray->GetCount() : 0; + return pArray ? pArray->size() : 0; } int CPDF_FormField::GetSelectedOptionIndex(int index) const { @@ -775,7 +775,7 @@ int CPDF_FormField::GetSelectedOptionIndex(int index) const { if (!pArray) return -1; - int iCount = pArray->GetCount(); + int iCount = pArray->size(); if (iCount < 0 || index >= iCount) return -1; return pArray->GetIntegerAt(index); @@ -805,7 +805,7 @@ bool CPDF_FormField::SelectOption(int iOptIndex, } bool bReturn = false; - for (size_t i = 0; i < pArray->GetCount(); i++) { + for (size_t i = 0; i < pArray->size(); i++) { int iFind = pArray->GetIntegerAt(i); if (iFind == iOptIndex) { if (bSelected) diff --git a/core/fpdfdoc/cpdf_iconfit.cpp b/core/fpdfdoc/cpdf_iconfit.cpp index 8b8fa4ed5b..801e908974 100644 --- a/core/fpdfdoc/cpdf_iconfit.cpp +++ b/core/fpdfdoc/cpdf_iconfit.cpp @@ -50,7 +50,7 @@ CFX_PointF CPDF_IconFit::GetIconBottomLeftPosition() const { if (!pA) return {fLeft, fBottom}; - size_t dwCount = pA->GetCount(); + size_t dwCount = pA->size(); if (dwCount > 0) fLeft = pA->GetNumberAt(0); if (dwCount > 1) diff --git a/core/fpdfdoc/cpdf_interactiveform.cpp b/core/fpdfdoc/cpdf_interactiveform.cpp index 58b1a61cfc..347fd559e0 100644 --- a/core/fpdfdoc/cpdf_interactiveform.cpp +++ b/core/fpdfdoc/cpdf_interactiveform.cpp @@ -591,7 +591,7 @@ CPDF_InteractiveForm::CPDF_InteractiveForm(CPDF_Document* pDocument) if (!pFields) return; - for (size_t i = 0; i < pFields->GetCount(); ++i) + for (size_t i = 0; i < pFields->size(); ++i) LoadField(pFields->GetDictAt(i), 0); } @@ -715,7 +715,7 @@ CPDF_FormControl* CPDF_InteractiveForm::GetControlAtPoint( if (!pAnnotList) return nullptr; - for (size_t i = pAnnotList->GetCount(); i > 0; --i) { + for (size_t i = pAnnotList->size(); i > 0; --i) { size_t annot_index = i - 1; CPDF_Dictionary* pAnnot = pAnnotList->GetDictAt(annot_index); if (!pAnnot) @@ -751,7 +751,7 @@ int CPDF_InteractiveForm::CountFieldsInCalculationOrder() { return 0; CPDF_Array* pArray = m_pFormDict->GetArrayFor("CO"); - return pArray ? pArray->GetCount() : 0; + return pArray ? pArray->size() : 0; } CPDF_FormField* CPDF_InteractiveForm::GetFieldInCalculationOrder(int index) { @@ -775,7 +775,7 @@ int CPDF_InteractiveForm::FindFieldInCalculationOrder( if (!pArray) return -1; - for (size_t i = 0; i < pArray->GetCount(); i++) { + for (size_t i = 0; i < pArray->size(); i++) { CPDF_Object* pElement = pArray->GetDirectObjectAt(i); if (pElement == pField->GetDict()) return i; @@ -844,7 +844,7 @@ void CPDF_InteractiveForm::LoadField(CPDF_Dictionary* pFieldDict, int nLevel) { return; if (pFirstKid->KeyExist("T") || pFirstKid->KeyExist("Kids")) { - for (size_t i = 0; i < pKids->GetCount(); i++) { + for (size_t i = 0; i < pKids->size(); i++) { CPDF_Dictionary* pChildDict = pKids->GetDictAt(i); if (pChildDict) { if (pChildDict->GetObjNum() != dwParentObjNum) @@ -869,7 +869,7 @@ void CPDF_InteractiveForm::FixPageFields(CPDF_Page* pPage) { if (!pAnnots) return; - for (size_t i = 0; i < pAnnots->GetCount(); i++) { + for (size_t i = 0; i < pAnnots->size(); i++) { CPDF_Dictionary* pAnnot = pAnnots->GetDictAt(i); if (pAnnot && pAnnot->GetStringFor("Subtype") == "Widget") LoadField(pAnnot, 0); @@ -930,7 +930,7 @@ void CPDF_InteractiveForm::AddTerminalField(CPDF_Dictionary* pFieldDict) { CPDF_Array* pKids = pFieldDict->GetArrayFor("Kids"); if (pKids) { - for (size_t i = 0; i < pKids->GetCount(); i++) { + for (size_t i = 0; i < pKids->size(); i++) { CPDF_Dictionary* pKid = pKids->GetDictAt(i); if (!pKid) continue; diff --git a/core/fpdfdoc/cpdf_linklist.cpp b/core/fpdfdoc/cpdf_linklist.cpp index 43b4d45510..746bbab304 100644 --- a/core/fpdfdoc/cpdf_linklist.cpp +++ b/core/fpdfdoc/cpdf_linklist.cpp @@ -60,7 +60,7 @@ void CPDF_LinkList::LoadPageLinks(CPDF_Page* pPage, if (!pAnnotList) return; - for (size_t i = 0; i < pAnnotList->GetCount(); ++i) { + for (size_t i = 0; i < pAnnotList->size(); ++i) { CPDF_Dictionary* pAnnot = pAnnotList->GetDictAt(i); bool add_link = (pAnnot && pAnnot->GetStringFor("Subtype") == "Link"); // Add non-links as nullptrs to preserve z-order. diff --git a/core/fpdfdoc/cpdf_nametree.cpp b/core/fpdfdoc/cpdf_nametree.cpp index 92b37f12b3..3e13c85846 100644 --- a/core/fpdfdoc/cpdf_nametree.cpp +++ b/core/fpdfdoc/cpdf_nametree.cpp @@ -52,7 +52,7 @@ bool GetNodeAncestorsLimits(CPDF_Dictionary* pNode, if (!pKids) return false; - for (size_t i = 0; i < pKids->GetCount(); ++i) { + for (size_t i = 0; i < pKids->size(); ++i) { CPDF_Dictionary* pKid = pKids->GetDictAt(i); if (!pKid) continue; @@ -94,7 +94,7 @@ bool UpdateNodesAndLimitsUponDeletion(CPDF_Dictionary* pNode, // names to find the new lower and upper limits. WideString csNewLeft = csRight; WideString csNewRight = csLeft; - for (size_t i = 0; i < pNames->GetCount() / 2; ++i) { + for (size_t i = 0; i < pNames->size() / 2; ++i) { WideString wsName = pNames->GetUnicodeTextAt(i * 2); if (wsName.Compare(csNewLeft) < 0) csNewLeft = wsName; @@ -111,7 +111,7 @@ bool UpdateNodesAndLimitsUponDeletion(CPDF_Dictionary* pNode, return false; // Loop through the kids to find the leaf array |pFind|. - for (size_t i = 0; i < pKids->GetCount(); ++i) { + for (size_t i = 0; i < pKids->size(); ++i) { CPDF_Dictionary* pKid = pKids->GetDictAt(i); if (!pKid) continue; @@ -132,7 +132,7 @@ bool UpdateNodesAndLimitsUponDeletion(CPDF_Dictionary* pNode, // kids to find the new lower and upper limits. WideString csNewLeft = csRight; WideString csNewRight = csLeft; - for (size_t j = 0; j < pKids->GetCount(); ++j) { + for (size_t j = 0; j < pKids->size(); ++j) { CPDF_Array* pKidLimits = pKids->GetDictAt(j)->GetArrayFor("Limits"); ASSERT(pKidLimits); if (pKidLimits->GetUnicodeTextAt(0).Compare(csNewLeft) < 0) @@ -178,7 +178,7 @@ CPDF_Object* SearchNameNodeByName(CPDF_Dictionary* pNode, if (ppFind) *ppFind = pNames; if (pFindIndex) - *pFindIndex = pNames->GetCount() / 2 - 1; + *pFindIndex = pNames->size() / 2 - 1; return nullptr; } @@ -186,7 +186,7 @@ CPDF_Object* SearchNameNodeByName(CPDF_Dictionary* pNode, // If the node is a leaf node, look for the name in its names array. if (pNames) { - size_t dwCount = pNames->GetCount() / 2; + size_t dwCount = pNames->size() / 2; for (size_t i = 0; i < dwCount; i++) { WideString csValue = pNames->GetUnicodeTextAt(i * 2); int32_t iCompare = csValue.Compare(csName); @@ -211,7 +211,7 @@ CPDF_Object* SearchNameNodeByName(CPDF_Dictionary* pNode, if (!pKids) return nullptr; - for (size_t i = 0; i < pKids->GetCount(); i++) { + for (size_t i = 0; i < pKids->size(); i++) { CPDF_Dictionary* pKid = pKids->GetDictAt(i); if (!pKid) continue; @@ -240,7 +240,7 @@ CPDF_Object* SearchNameNodeByIndex(CPDF_Dictionary* pNode, CPDF_Array* pNames = pNode->GetArrayFor("Names"); if (pNames) { - size_t nCount = pNames->GetCount() / 2; + size_t nCount = pNames->size() / 2; if (nIndex >= *nCurIndex + nCount) { *nCurIndex += nCount; return nullptr; @@ -258,7 +258,7 @@ CPDF_Object* SearchNameNodeByIndex(CPDF_Dictionary* pNode, if (!pKids) return nullptr; - for (size_t i = 0; i < pKids->GetCount(); i++) { + for (size_t i = 0; i < pKids->size(); i++) { CPDF_Dictionary* pKid = pKids->GetDictAt(i); if (!pKid) continue; @@ -277,14 +277,14 @@ size_t CountNamesInternal(CPDF_Dictionary* pNode, int nLevel) { CPDF_Array* pNames = pNode->GetArrayFor("Names"); if (pNames) - return pNames->GetCount() / 2; + return pNames->size() / 2; CPDF_Array* pKids = pNode->GetArrayFor("Kids"); if (!pKids) return 0; size_t nCount = 0; - for (size_t i = 0; i < pKids->GetCount(); i++) { + for (size_t i = 0; i < pKids->size(); i++) { CPDF_Dictionary* pKid = pKids->GetDictAt(i); if (!pKid) continue; diff --git a/core/fpdfdoc/cpdf_nametree_unittest.cpp b/core/fpdfdoc/cpdf_nametree_unittest.cpp index 0ceab24e48..39e9dea956 100644 --- a/core/fpdfdoc/cpdf_nametree_unittest.cpp +++ b/core/fpdfdoc/cpdf_nametree_unittest.cpp @@ -238,9 +238,9 @@ TEST(cpdf_nametree, DeleteFromKids) { EXPECT_EQ(999, nameTree.LookupValue(L"9.txt")->GetInteger()); EXPECT_TRUE(nameTree.LookupValueAndName(4, &csName)); EXPECT_STREQ(L"9.txt", csName.c_str()); - EXPECT_EQ(2u, pKid1->GetArrayFor("Kids")->GetCount()); + EXPECT_EQ(2u, pKid1->GetArrayFor("Kids")->size()); EXPECT_TRUE(nameTree.DeleteValueAndName(4)); - EXPECT_EQ(1u, pKid1->GetArrayFor("Kids")->GetCount()); + EXPECT_EQ(1u, pKid1->GetArrayFor("Kids")->size()); CheckLimitsArray(pKid1, "1.txt", "5.txt"); // Delete the name "2.txt", and check that its node does not get deleted, its @@ -249,9 +249,9 @@ TEST(cpdf_nametree, DeleteFromKids) { EXPECT_EQ(222, nameTree.LookupValue(L"2.txt")->GetInteger()); EXPECT_TRUE(nameTree.LookupValueAndName(1, &csName)); EXPECT_STREQ(L"2.txt", csName.c_str()); - EXPECT_EQ(4u, pKid4->GetArrayFor("Names")->GetCount()); + EXPECT_EQ(4u, pKid4->GetArrayFor("Names")->size()); EXPECT_TRUE(nameTree.DeleteValueAndName(1)); - EXPECT_EQ(2u, pKid4->GetArrayFor("Names")->GetCount()); + EXPECT_EQ(2u, pKid4->GetArrayFor("Names")->size()); CheckLimitsArray(pKid4, "1.txt", "1.txt"); CheckLimitsArray(pKid2, "1.txt", "5.txt"); CheckLimitsArray(pKid1, "1.txt", "5.txt"); @@ -262,9 +262,9 @@ TEST(cpdf_nametree, DeleteFromKids) { EXPECT_EQ(111, nameTree.LookupValue(L"1.txt")->GetInteger()); EXPECT_TRUE(nameTree.LookupValueAndName(0, &csName)); EXPECT_STREQ(L"1.txt", csName.c_str()); - EXPECT_EQ(2u, pKid2->GetArrayFor("Kids")->GetCount()); + EXPECT_EQ(2u, pKid2->GetArrayFor("Kids")->size()); EXPECT_TRUE(nameTree.DeleteValueAndName(0)); - EXPECT_EQ(1u, pKid2->GetArrayFor("Kids")->GetCount()); + EXPECT_EQ(1u, pKid2->GetArrayFor("Kids")->size()); CheckLimitsArray(pKid2, "3.txt", "5.txt"); CheckLimitsArray(pKid1, "3.txt", "5.txt"); @@ -274,9 +274,9 @@ TEST(cpdf_nametree, DeleteFromKids) { EXPECT_EQ(333, nameTree.LookupValue(L"3.txt")->GetInteger()); EXPECT_TRUE(nameTree.LookupValueAndName(0, &csName)); EXPECT_STREQ(L"3.txt", csName.c_str()); - EXPECT_EQ(4u, pKid5->GetArrayFor("Names")->GetCount()); + EXPECT_EQ(4u, pKid5->GetArrayFor("Names")->size()); EXPECT_TRUE(nameTree.DeleteValueAndName(0)); - EXPECT_EQ(2u, pKid5->GetArrayFor("Names")->GetCount()); + EXPECT_EQ(2u, pKid5->GetArrayFor("Names")->size()); CheckLimitsArray(pKid5, "5.txt", "5.txt"); CheckLimitsArray(pKid2, "5.txt", "5.txt"); CheckLimitsArray(pKid1, "5.txt", "5.txt"); @@ -287,9 +287,9 @@ TEST(cpdf_nametree, DeleteFromKids) { EXPECT_EQ(555, nameTree.LookupValue(L"5.txt")->GetInteger()); EXPECT_TRUE(nameTree.LookupValueAndName(0, &csName)); EXPECT_STREQ(L"5.txt", csName.c_str()); - EXPECT_EQ(1u, nameTree.GetRoot()->GetArrayFor("Kids")->GetCount()); + EXPECT_EQ(1u, nameTree.GetRoot()->GetArrayFor("Kids")->size()); EXPECT_TRUE(nameTree.DeleteValueAndName(0)); - EXPECT_EQ(0u, nameTree.GetRoot()->GetArrayFor("Kids")->GetCount()); + EXPECT_EQ(0u, nameTree.GetRoot()->GetArrayFor("Kids")->size()); // Check that the tree is now empty. EXPECT_EQ(0u, nameTree.GetCount()); diff --git a/core/fpdfdoc/cpdf_numbertree.cpp b/core/fpdfdoc/cpdf_numbertree.cpp index 74aeb67e85..46257c872a 100644 --- a/core/fpdfdoc/cpdf_numbertree.cpp +++ b/core/fpdfdoc/cpdf_numbertree.cpp @@ -19,7 +19,7 @@ const CPDF_Object* SearchNumberNode(const CPDF_Dictionary* pNode, int num) { } const CPDF_Array* pNumbers = pNode->GetArrayFor("Nums"); if (pNumbers) { - for (size_t i = 0; i < pNumbers->GetCount() / 2; i++) { + for (size_t i = 0; i < pNumbers->size() / 2; i++) { int index = pNumbers->GetIntegerAt(i * 2); if (num == index) return pNumbers->GetDirectObjectAt(i * 2 + 1); @@ -33,7 +33,7 @@ const CPDF_Object* SearchNumberNode(const CPDF_Dictionary* pNode, int num) { if (!pKids) return nullptr; - for (size_t i = 0; i < pKids->GetCount(); i++) { + for (size_t i = 0; i < pKids->size(); i++) { const CPDF_Dictionary* pKid = pKids->GetDictAt(i); if (!pKid) continue; diff --git a/core/fpdfdoc/cpdf_occontext.cpp b/core/fpdfdoc/cpdf_occontext.cpp index 4116fdb256..1cfa29cd3a 100644 --- a/core/fpdfdoc/cpdf_occontext.cpp +++ b/core/fpdfdoc/cpdf_occontext.cpp @@ -17,7 +17,7 @@ int32_t FindGroup(const CPDF_Array* pArray, const CPDF_Dictionary* pGroupDict) { if (!pArray || !pGroupDict) return -1; - for (size_t i = 0; i < pArray->GetCount(); i++) { + for (size_t i = 0; i < pArray->size(); i++) { if (pArray->GetDictAt(i) == pGroupDict) return i; } @@ -33,7 +33,7 @@ bool HasIntent(const CPDF_Dictionary* pDict, ByteString bsIntent; if (const CPDF_Array* pArray = pIntent->AsArray()) { - for (size_t i = 0; i < pArray->GetCount(); i++) { + for (size_t i = 0; i < pArray->size(); i++) { bsIntent = pArray->GetStringAt(i); if (bsIntent == "All" || bsIntent == csElement) return true; @@ -63,7 +63,7 @@ CPDF_Dictionary* GetConfig(CPDF_Document* pDoc, if (!pConfigs) return pConfig; - for (size_t i = 0; i < pConfigs->GetCount(); i++) { + for (size_t i = 0; i < pConfigs->size(); i++) { CPDF_Dictionary* pFind = pConfigs->GetDictAt(i); if (pFind && HasIntent(pFind, "View", "View")) return pFind; @@ -122,7 +122,7 @@ bool CPDF_OCContext::LoadOCGStateFromConfig( return bState; ByteString csFind = csConfig + "State"; - for (size_t i = 0; i < pArray->GetCount(); i++) { + for (size_t i = 0; i < pArray->size(); i++) { CPDF_Dictionary* pUsage = pArray->GetDictAt(i); if (!pUsage) continue; @@ -213,7 +213,7 @@ bool CPDF_OCContext::GetOCGVE(const CPDF_Array* pExpression, int nLevel) { return false; bool bValue = false; - for (size_t i = 1; i < pExpression->GetCount(); i++) { + for (size_t i = 1; i < pExpression->size(); i++) { const CPDF_Object* pOCGObj = pExpression->GetDirectObjectAt(1); if (!pOCGObj) continue; @@ -258,7 +258,7 @@ bool CPDF_OCContext::LoadOCMDState(const CPDF_Dictionary* pOCMDDict) { // At least one entry of OCGs needs to be a valid dictionary for it to be // considered present. See "OCGs" in table 4.49 in the PDF 1.7 spec. bool bValidEntrySeen = false; - for (size_t i = 0; i < pArray->GetCount(); i++) { + for (size_t i = 0; i < pArray->size(); i++) { bool bItem = true; const CPDF_Dictionary* pItemDict = pArray->GetDictAt(i); if (!pItemDict) diff --git a/core/fpdfdoc/cpdf_structelement.cpp b/core/fpdfdoc/cpdf_structelement.cpp index d8fc0d88ba..c42faa3b69 100644 --- a/core/fpdfdoc/cpdf_structelement.cpp +++ b/core/fpdfdoc/cpdf_structelement.cpp @@ -67,8 +67,8 @@ void CPDF_StructElement::LoadKids(const CPDF_Dictionary* pDict) { m_Kids.clear(); if (const CPDF_Array* pArray = pKids->AsArray()) { - m_Kids.resize(pArray->GetCount()); - for (uint32_t i = 0; i < pArray->GetCount(); i++) { + m_Kids.resize(pArray->size()); + for (uint32_t i = 0; i < pArray->size(); i++) { const CPDF_Object* pKid = pArray->GetDirectObjectAt(i); LoadKid(PageObjNum, pKid, &m_Kids[i]); } diff --git a/core/fpdfdoc/cpdf_structtree.cpp b/core/fpdfdoc/cpdf_structtree.cpp index 04b074f39f..1b72a5387c 100644 --- a/core/fpdfdoc/cpdf_structtree.cpp +++ b/core/fpdfdoc/cpdf_structtree.cpp @@ -56,7 +56,7 @@ void CPDF_StructTree::LoadPageTree(const CPDF_Dictionary* pPageDict) { if (pKids->IsDictionary()) dwKids = 1; else if (const CPDF_Array* pArray = pKids->AsArray()) - dwKids = pArray->GetCount(); + dwKids = pArray->size(); else return; @@ -76,7 +76,7 @@ void CPDF_StructTree::LoadPageTree(const CPDF_Dictionary* pPageDict) { return; StructElementMap element_map; - for (size_t i = 0; i < pParentArray->GetCount(); i++) { + for (size_t i = 0; i < pParentArray->size(); i++) { if (const CPDF_Dictionary* pParent = pParentArray->GetDictAt(i)) AddPageNode(pParent, &element_map, 0); } @@ -135,7 +135,7 @@ bool CPDF_StructTree::AddTopLevelNode( return true; bool bSave = false; - for (size_t i = 0; i < pTopKids->GetCount(); i++) { + for (size_t i = 0; i < pTopKids->size(); i++) { const CPDF_Reference* pKidRef = ToReference(pTopKids->GetObjectAt(i)); if (pKidRef && pKidRef->GetRefObjNum() == pDict->GetObjNum()) { m_Kids[i] = pElement; diff --git a/core/fpdfdoc/cpvt_generateap.cpp b/core/fpdfdoc/cpvt_generateap.cpp index dc2f22d0e6..734173ffb4 100644 --- a/core/fpdfdoc/cpvt_generateap.cpp +++ b/core/fpdfdoc/cpvt_generateap.cpp @@ -319,7 +319,7 @@ float GetBorderWidth(const CPDF_Dictionary& pAnnotDict) { } if (const CPDF_Array* pBorderArray = pAnnotDict.GetArrayFor("Border")) { - if (pBorderArray->GetCount() > 2) + if (pBorderArray->size() > 2) return pBorderArray->GetNumberAt(2); } @@ -333,7 +333,7 @@ const CPDF_Array* GetDashArray(const CPDF_Dictionary& pAnnotDict) { } if (const CPDF_Array* pBorderArray = pAnnotDict.GetArrayFor("Border")) { - if (pBorderArray->GetCount() == 4) + if (pBorderArray->size() == 4) return pBorderArray->GetArrayAt(3); } @@ -346,7 +346,7 @@ ByteString GetDashPatternString(const CPDF_Dictionary& pAnnotDict) { return ByteString(); // Support maximum of ten elements in the dash array. - size_t pDashArrayCount = std::min<size_t>(pDashArray->GetCount(), 10); + size_t pDashArrayCount = std::min<size_t>(pDashArray->size(), 10); std::ostringstream sDashStream; sDashStream << "["; @@ -657,15 +657,15 @@ bool GenerateInkAP(CPDF_Document* pDoc, CPDF_Dictionary* pAnnotDict) { rect.Inflate(fBorderWidth / 2, fBorderWidth / 2); pAnnotDict->SetRectFor("Rect", rect); - for (size_t i = 0; i < pInkList->GetCount(); i++) { + for (size_t i = 0; i < pInkList->size(); i++) { CPDF_Array* pInkCoordList = pInkList->GetArrayAt(i); - if (!pInkCoordList || pInkCoordList->GetCount() < 2) + if (!pInkCoordList || pInkCoordList->size() < 2) continue; sAppStream << pInkCoordList->GetNumberAt(0) << " " << pInkCoordList->GetNumberAt(1) << " m "; - for (size_t j = 0; j < pInkCoordList->GetCount() - 1; j += 2) { + for (size_t j = 0; j < pInkCoordList->size() - 1; j += 2) { sAppStream << pInkCoordList->GetNumberAt(j) << " " << pInkCoordList->GetNumberAt(j + 1) << " l "; } @@ -803,7 +803,7 @@ bool GenerateSquareAP(CPDF_Document* pDoc, CPDF_Dictionary* pAnnotDict) { rect.Deflate(fBorderWidth / 2, fBorderWidth / 2); } - bool bIsFillRect = pInteriorColor && (pInteriorColor->GetCount() > 0); + bool bIsFillRect = pInteriorColor && (pInteriorColor->size() > 0); sAppStream << rect.left << " " << rect.bottom << " " << rect.Width() << " " << rect.Height() << " re " @@ -1230,7 +1230,7 @@ void CPVT_GenerateAP::GenerateFormAP(Type type, std::ostringstream sBody; if (pOpts) { float fy = rcBody.top; - for (size_t i = nTop, sz = pOpts->GetCount(); i < sz; i++) { + for (size_t i = nTop, sz = pOpts->size(); i < sz; i++) { if (IsFloatSmaller(fy, rcBody.bottom)) break; @@ -1243,7 +1243,7 @@ void CPVT_GenerateAP::GenerateFormAP(Type type, bool bSelected = false; if (pSels) { - for (size_t s = 0, ssz = pSels->GetCount(); s < ssz; s++) { + for (size_t s = 0, ssz = pSels->size(); s < ssz; s++) { int value = pSels->GetIntegerAt(s); if (value >= 0 && i == static_cast<size_t>(value)) { bSelected = true; diff --git a/core/fxge/cfx_color.cpp b/core/fxge/cfx_color.cpp index 19d1d4fd24..e4d89dc2ff 100644 --- a/core/fxge/cfx_color.cpp +++ b/core/fxge/cfx_color.cpp @@ -66,7 +66,7 @@ CFX_Color ConvertRGB2CMYK(float dR, float dG, float dB) { // Static. CFX_Color CFX_Color::ParseColor(const CPDF_Array& array) { CFX_Color rt; - switch (array.GetCount()) { + switch (array.size()) { case 1: rt = CFX_Color(CFX_Color::kGray, array.GetFloatAt(0)); break; diff --git a/core/fxge/cfx_graphstate.cpp b/core/fxge/cfx_graphstate.cpp index 919faa39c6..929abe1af6 100644 --- a/core/fxge/cfx_graphstate.cpp +++ b/core/fxge/cfx_graphstate.cpp @@ -22,8 +22,8 @@ void CFX_GraphState::Emplace() { void CFX_GraphState::SetLineDash(CPDF_Array* pArray, float phase, float scale) { CFX_GraphStateData* pData = m_Ref.GetPrivateCopy(); pData->m_DashPhase = phase * scale; - pData->m_DashArray.resize(pArray->GetCount()); - for (size_t i = 0; i < pArray->GetCount(); i++) + pData->m_DashArray.resize(pArray->size()); + for (size_t i = 0; i < pArray->size(); i++) pData->m_DashArray[i] = pArray->GetNumberAt(i) * scale; } diff --git a/fpdfsdk/cpdfsdk_actionhandler.cpp b/fpdfsdk/cpdfsdk_actionhandler.cpp index 6d7fb9f2f9..c9ef6bcdfb 100644 --- a/fpdfsdk/cpdfsdk_actionhandler.cpp +++ b/fpdfsdk/cpdfsdk_actionhandler.cpp @@ -374,7 +374,7 @@ void CPDFSDK_ActionHandler::DoAction_GoTo( const CPDF_Array* pMyArray = MyDest.GetArray(); std::vector<float> posArray; if (pMyArray) { - for (size_t i = 2; i < pMyArray->GetCount(); i++) + for (size_t i = 2; i < pMyArray->size(); i++) posArray.push_back(pMyArray->GetFloatAt(i)); } pFormFillEnv->DoGoToAction(nPageIndex, nFitType, posArray.data(), diff --git a/fpdfsdk/cpdfsdk_baannot.cpp b/fpdfsdk/cpdfsdk_baannot.cpp index 5fe3411d78..dc4f3f96b2 100644 --- a/fpdfsdk/cpdfsdk_baannot.cpp +++ b/fpdfsdk/cpdfsdk_baannot.cpp @@ -192,9 +192,9 @@ BorderStyle CPDFSDK_BAAnnot::GetBorderStyle() const { CPDF_Array* pBorder = GetAnnotDict()->GetArrayFor("Border"); if (pBorder) { - if (pBorder->GetCount() >= 4) { + if (pBorder->size() >= 4) { CPDF_Array* pDP = pBorder->GetArrayAt(3); - if (pDP && pDP->GetCount() > 0) + if (pDP && pDP->size() > 0) return BorderStyle::DASH; } } diff --git a/fpdfsdk/cpdfsdk_helpers.cpp b/fpdfsdk/cpdfsdk_helpers.cpp index cc16cf431c..b2ef675809 100644 --- a/fpdfsdk/cpdfsdk_helpers.cpp +++ b/fpdfsdk/cpdfsdk_helpers.cpp @@ -218,7 +218,7 @@ void ReportUnsupportedFeatures(CPDF_Document* pDoc) { const CPDF_Array* pArray = pJSDict ? pJSDict->GetArrayFor("Names") : nullptr; if (pArray) { - for (size_t i = 0; i < pArray->GetCount(); i++) { + for (size_t i = 0; i < pArray->size(); i++) { ByteString cbStr = pArray->GetStringAt(i); if (cbStr.Compare("com.adobe.acrobat.SharedReview.Register") == 0) { RaiseUnSupportError(FPDF_UNSP_DOC_SHAREDREVIEW); @@ -353,7 +353,7 @@ CPDF_Array* AddQuadPointsArrayToDictionary(CPDF_Dictionary* dict) { } bool IsValidQuadPointsIndex(const CPDF_Array* array, size_t index) { - return array && index < array->GetCount() / 8; + return array && index < array->size() / 8; } bool GetQuadPointsAtIndex(const CPDF_Array* array, @@ -383,7 +383,7 @@ bool GetQuadPointsFromDictionary(CPDF_Dictionary* dict, ASSERT(quad_points); const CPDF_Array* pArray = GetQuadPointsArrayFromDictionary(dict); - if (!pArray || quad_index >= pArray->GetCount() / 8) + if (!pArray || quad_index >= pArray->size() / 8) return false; quad_index *= 8; diff --git a/fpdfsdk/cpdfsdk_interactiveform.cpp b/fpdfsdk/cpdfsdk_interactiveform.cpp index b224b0ec88..31be320acf 100644 --- a/fpdfsdk/cpdfsdk_interactiveform.cpp +++ b/fpdfsdk/cpdfsdk_interactiveform.cpp @@ -94,7 +94,7 @@ bool FDFToURLEncodedData(std::vector<uint8_t>* pBuffer) { return false; std::ostringstream fdfEncodedData; - for (uint32_t i = 0; i < pFields->GetCount(); i++) { + for (uint32_t i = 0; i < pFields->size(); i++) { CPDF_Dictionary* pField = pFields->GetDictAt(i); if (!pField) continue; @@ -105,7 +105,7 @@ bool FDFToURLEncodedData(std::vector<uint8_t>* pBuffer) { WideString csWValue = PDF_DecodeText(csBValue); ByteString csValue_b = csWValue.ToDefANSI(); fdfEncodedData << name_b << "=" << csValue_b; - if (i != pFields->GetCount() - 1) + if (i != pFields->size() - 1) fdfEncodedData << "&"; } @@ -208,7 +208,7 @@ int CPDFSDK_InteractiveForm::GetPageIndexByAnnotDict( for (int i = 0, sz = pDocument->GetPageCount(); i < sz; i++) { if (CPDF_Dictionary* pPageDict = pDocument->GetPageDictionary(i)) { if (CPDF_Array* pAnnots = pPageDict->GetArrayFor("Annots")) { - for (int j = 0, jsz = pAnnots->GetCount(); j < jsz; j++) { + for (int j = 0, jsz = pAnnots->size(); j < jsz; j++) { CPDF_Object* pDict = pAnnots->GetDirectObjectAt(j); if (pAnnotDict == pDict) return i; diff --git a/fpdfsdk/fpdf_annot.cpp b/fpdfsdk/fpdf_annot.cpp index 757bb96b2e..c4623bb726 100644 --- a/fpdfsdk/fpdf_annot.cpp +++ b/fpdfsdk/fpdf_annot.cpp @@ -245,7 +245,7 @@ FPDF_EXPORT int FPDF_CALLCONV FPDFPage_GetAnnotCount(FPDF_PAGE page) { return 0; CPDF_Array* pAnnots = pPage->GetDict()->GetArrayFor("Annots"); - return pAnnots ? pAnnots->GetCount() : 0; + return pAnnots ? pAnnots->size() : 0; } FPDF_EXPORT FPDF_ANNOTATION FPDF_CALLCONV FPDFPage_GetAnnot(FPDF_PAGE page, @@ -255,7 +255,7 @@ FPDF_EXPORT FPDF_ANNOTATION FPDF_CALLCONV FPDFPage_GetAnnot(FPDF_PAGE page, return nullptr; CPDF_Array* pAnnots = pPage->GetDict()->GetArrayFor("Annots"); - if (!pAnnots || static_cast<size_t>(index) >= pAnnots->GetCount()) + if (!pAnnots || static_cast<size_t>(index) >= pAnnots->size()) return nullptr; CPDF_Dictionary* pDict = ToDictionary(pAnnots->GetDirectObjectAt(index)); @@ -300,7 +300,7 @@ FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV FPDFPage_RemoveAnnot(FPDF_PAGE page, return false; CPDF_Array* pAnnots = pPage->GetDict()->GetArrayFor("Annots"); - if (!pAnnots || static_cast<size_t>(index) >= pAnnots->GetCount()) + if (!pAnnots || static_cast<size_t>(index) >= pAnnots->size()) return false; pAnnots->RemoveAt(index); @@ -630,7 +630,7 @@ FPDFAnnot_CountAttachmentPoints(FPDF_ANNOTATION annot) { CPDF_Dictionary* pAnnotDict = CPDFAnnotContextFromFPDFAnnotation(annot)->GetAnnotDict(); const CPDF_Array* pArray = GetQuadPointsArrayFromDictionary(pAnnotDict); - return pArray ? pArray->GetCount() / 8 : 0; + return pArray ? pArray->size() / 8 : 0; } FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV diff --git a/fpdfsdk/fpdf_doc.cpp b/fpdfsdk/fpdf_doc.cpp index 28c670c5dd..0a2f589ecc 100644 --- a/fpdfsdk/fpdf_doc.cpp +++ b/fpdfsdk/fpdf_doc.cpp @@ -340,7 +340,7 @@ FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV FPDFLink_Enumerate(FPDF_PAGE page, CPDF_Array* pAnnots = pPage->GetDict()->GetArrayFor("Annots"); if (!pAnnots) return false; - for (size_t i = *start_pos; i < pAnnots->GetCount(); i++) { + for (size_t i = *start_pos; i < pAnnots->size(); i++) { CPDF_Dictionary* pDict = ToDictionary(pAnnots->GetDirectObjectAt(i)); if (!pDict) continue; @@ -365,7 +365,7 @@ FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV FPDFLink_GetAnnotRect(FPDF_LINK link_annot, FPDF_EXPORT int FPDF_CALLCONV FPDFLink_CountQuadPoints(FPDF_LINK link_annot) { const CPDF_Array* pArray = GetQuadPointsArrayFromDictionary(CPDFDictionaryFromFPDFLink(link_annot)); - return pArray ? static_cast<int>(pArray->GetCount() / 8) : 0; + return pArray ? static_cast<int>(pArray->size() / 8) : 0; } FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV diff --git a/fpdfsdk/fpdf_edit_embeddertest.cpp b/fpdfsdk/fpdf_edit_embeddertest.cpp index 4250091fce..9cd7dbf86b 100644 --- a/fpdfsdk/fpdf_edit_embeddertest.cpp +++ b/fpdfsdk/fpdf_edit_embeddertest.cpp @@ -58,7 +58,7 @@ class FPDFEditEmbeddertest : public EmbedderTest { const CPDF_Array* fontBBox = font_desc->GetArrayFor("FontBBox"); ASSERT_TRUE(fontBBox); - EXPECT_EQ(4u, fontBBox->GetCount()); + EXPECT_EQ(4u, fontBBox->size()); // Check that the coordinates are in the preferred order according to spec // 1.7 Section 3.8.4 EXPECT_TRUE(fontBBox->GetIntegerAt(0) < fontBBox->GetIntegerAt(2)); @@ -97,18 +97,18 @@ class FPDFEditEmbeddertest : public EmbedderTest { // Check that W array is in a format that conforms to PDF spec 1.7 section // "Glyph Metrics in CIDFonts" (these checks are not // implementation-specific). - EXPECT_GT(widths_array->GetCount(), 1u); + EXPECT_GT(widths_array->size(), 1u); int num_cids_checked = 0; int cur_cid = 0; - for (size_t idx = 0; idx < widths_array->GetCount(); idx++) { + for (size_t idx = 0; idx < widths_array->size(); idx++) { int cid = widths_array->GetNumberAt(idx); EXPECT_GE(cid, cur_cid); - ASSERT_FALSE(++idx == widths_array->GetCount()); + ASSERT_FALSE(++idx == widths_array->size()); const CPDF_Object* next = widths_array->GetObjectAt(idx); if (next->IsArray()) { // We are in the c [w1 w2 ...] case const CPDF_Array* arr = next->AsArray(); - int cnt = static_cast<int>(arr->GetCount()); + int cnt = static_cast<int>(arr->size()); size_t inner_idx = 0; for (cur_cid = cid; cur_cid < cid + cnt; cur_cid++) { uint32_t width = arr->GetNumberAt(inner_idx++); @@ -121,7 +121,7 @@ class FPDFEditEmbeddertest : public EmbedderTest { // Otherwise, are in the c_first c_last w case. ASSERT_TRUE(next->IsNumber()); int last_cid = next->AsNumber()->GetInteger(); - ASSERT_FALSE(++idx == widths_array->GetCount()); + ASSERT_FALSE(++idx == widths_array->size()); uint32_t width = widths_array->GetNumberAt(idx); for (cur_cid = cid; cur_cid <= last_cid; cur_cid++) { EXPECT_EQ(width, typed_font->GetCharWidthF(cur_cid)) @@ -2053,7 +2053,7 @@ TEST_F(FPDFEditEmbeddertest, GraphicsData) { CPDF_Page* cpage = CPDFPageFromFPDFPage(page.get()); CPDF_Dictionary* graphics_dict = cpage->m_pResources->GetDictFor("ExtGState"); ASSERT_TRUE(graphics_dict); - EXPECT_EQ(2u, graphics_dict->GetCount()); + EXPECT_EQ(2u, graphics_dict->size()); // Add a text object causing no change to the graphics dictionary FPDF_PAGEOBJECT text1 = FPDFPageObj_NewTextObj(document(), "Arial", 12.0f); @@ -2062,7 +2062,7 @@ TEST_F(FPDFEditEmbeddertest, GraphicsData) { EXPECT_TRUE(FPDFText_SetFillColor(text1, 100, 100, 100, 255)); FPDFPage_InsertObject(page.get(), text1); EXPECT_TRUE(FPDFPage_GenerateContent(page.get())); - EXPECT_EQ(2u, graphics_dict->GetCount()); + EXPECT_EQ(2u, graphics_dict->size()); // Add a text object increasing the size of the graphics dictionary FPDF_PAGEOBJECT text2 = @@ -2071,7 +2071,7 @@ TEST_F(FPDFEditEmbeddertest, GraphicsData) { FPDFPageObj_SetBlendMode(text2, "Darken"); EXPECT_TRUE(FPDFText_SetFillColor(text2, 0, 0, 255, 150)); EXPECT_TRUE(FPDFPage_GenerateContent(page.get())); - EXPECT_EQ(3u, graphics_dict->GetCount()); + EXPECT_EQ(3u, graphics_dict->size()); // Add a path that should reuse graphics FPDF_PAGEOBJECT path = FPDFPageObj_CreateNewPath(400, 100); @@ -2079,7 +2079,7 @@ TEST_F(FPDFEditEmbeddertest, GraphicsData) { EXPECT_TRUE(FPDFPath_SetFillColor(path, 200, 200, 100, 150)); FPDFPage_InsertObject(page.get(), path); EXPECT_TRUE(FPDFPage_GenerateContent(page.get())); - EXPECT_EQ(3u, graphics_dict->GetCount()); + EXPECT_EQ(3u, graphics_dict->size()); // Add a rect increasing the size of the graphics dictionary FPDF_PAGEOBJECT rect2 = FPDFPageObj_CreateNewRect(10, 10, 100, 100); @@ -2088,7 +2088,7 @@ TEST_F(FPDFEditEmbeddertest, GraphicsData) { EXPECT_TRUE(FPDFPath_SetStrokeColor(rect2, 0, 0, 0, 200)); FPDFPage_InsertObject(page.get(), rect2); EXPECT_TRUE(FPDFPage_GenerateContent(page.get())); - EXPECT_EQ(4u, graphics_dict->GetCount()); + EXPECT_EQ(4u, graphics_dict->size()); } TEST_F(FPDFEditEmbeddertest, DoubleGenerating) { @@ -2106,7 +2106,7 @@ TEST_F(FPDFEditEmbeddertest, DoubleGenerating) { CPDF_Page* cpage = CPDFPageFromFPDFPage(page); CPDF_Dictionary* graphics_dict = cpage->m_pResources->GetDictFor("ExtGState"); ASSERT_TRUE(graphics_dict); - EXPECT_EQ(2u, graphics_dict->GetCount()); + EXPECT_EQ(2u, graphics_dict->size()); // Check the bitmap { @@ -2118,7 +2118,7 @@ TEST_F(FPDFEditEmbeddertest, DoubleGenerating) { // Never mind, my new favorite color is blue, increase alpha EXPECT_TRUE(FPDFPath_SetFillColor(rect, 0, 0, 255, 180)); EXPECT_TRUE(FPDFPage_GenerateContent(page)); - EXPECT_EQ(3u, graphics_dict->GetCount()); + EXPECT_EQ(3u, graphics_dict->size()); // Check that bitmap displays changed content { @@ -2129,7 +2129,7 @@ TEST_F(FPDFEditEmbeddertest, DoubleGenerating) { // And now generate, without changes EXPECT_TRUE(FPDFPage_GenerateContent(page)); - EXPECT_EQ(3u, graphics_dict->GetCount()); + EXPECT_EQ(3u, graphics_dict->size()); { ScopedFPDFBitmap page_bitmap = RenderPageWithFlags(page, nullptr, 0); CompareBitmap(page_bitmap.get(), 612, 792, @@ -2147,12 +2147,12 @@ TEST_F(FPDFEditEmbeddertest, DoubleGenerating) { EXPECT_TRUE(FPDFPage_GenerateContent(page)); CPDF_Dictionary* font_dict = cpage->m_pResources->GetDictFor("Font"); ASSERT_TRUE(font_dict); - EXPECT_EQ(1u, font_dict->GetCount()); + EXPECT_EQ(1u, font_dict->size()); // Generate yet again, check dicts are reasonably sized EXPECT_TRUE(FPDFPage_GenerateContent(page)); - EXPECT_EQ(3u, graphics_dict->GetCount()); - EXPECT_EQ(1u, font_dict->GetCount()); + EXPECT_EQ(3u, graphics_dict->size()); + EXPECT_EQ(1u, font_dict->size()); FPDF_ClosePage(page); } @@ -2179,7 +2179,7 @@ TEST_F(FPDFEditEmbeddertest, LoadSimpleType1Font) { const CPDF_Array* widths_array = font_dict->GetArrayFor("Widths"); ASSERT_TRUE(widths_array); - ASSERT_EQ(224u, widths_array->GetCount()); + ASSERT_EQ(224u, widths_array->size()); EXPECT_EQ(250, widths_array->GetNumberAt(0)); EXPECT_EQ(569, widths_array->GetNumberAt(11)); EXPECT_EQ(500, widths_array->GetNumberAt(223)); @@ -2207,7 +2207,7 @@ TEST_F(FPDFEditEmbeddertest, LoadSimpleTrueTypeFont) { const CPDF_Array* widths_array = font_dict->GetArrayFor("Widths"); ASSERT_TRUE(widths_array); - ASSERT_EQ(224u, widths_array->GetCount()); + ASSERT_EQ(224u, widths_array->size()); EXPECT_EQ(600, widths_array->GetNumberAt(33)); EXPECT_EQ(600, widths_array->GetNumberAt(74)); EXPECT_EQ(600, widths_array->GetNumberAt(223)); @@ -2234,7 +2234,7 @@ TEST_F(FPDFEditEmbeddertest, LoadCIDType0Font) { const CPDF_Array* descendant_array = font_dict->GetArrayFor("DescendantFonts"); ASSERT_TRUE(descendant_array); - EXPECT_EQ(1u, descendant_array->GetCount()); + EXPECT_EQ(1u, descendant_array->size()); // Check the CIDFontDict const CPDF_Dictionary* cidfont_dict = descendant_array->GetDictAt(0); @@ -2252,7 +2252,7 @@ TEST_F(FPDFEditEmbeddertest, LoadCIDType0Font) { // Check widths const CPDF_Array* widths_array = cidfont_dict->GetArrayFor("W"); ASSERT_TRUE(widths_array); - EXPECT_GT(widths_array->GetCount(), 1u); + EXPECT_GT(widths_array->size(), 1u); CheckCompositeFontWidths(widths_array, typed_font); } @@ -2276,7 +2276,7 @@ TEST_F(FPDFEditEmbeddertest, LoadCIDType2Font) { const CPDF_Array* descendant_array = font_dict->GetArrayFor("DescendantFonts"); ASSERT_TRUE(descendant_array); - EXPECT_EQ(1u, descendant_array->GetCount()); + EXPECT_EQ(1u, descendant_array->size()); // Check the CIDFontDict const CPDF_Dictionary* cidfont_dict = descendant_array->GetDictAt(0); diff --git a/fpdfsdk/fpdf_editimg.cpp b/fpdfsdk/fpdf_editimg.cpp index aaa1c46c76..be7e571afe 100644 --- a/fpdfsdk/fpdf_editimg.cpp +++ b/fpdfsdk/fpdf_editimg.cpp @@ -250,7 +250,7 @@ FPDFImageObj_GetImageFilterCount(FPDF_PAGEOBJECT image_object) { return 0; if (pFilter->IsArray()) - return pFilter->AsArray()->GetCount(); + return pFilter->AsArray()->size(); if (pFilter->IsName()) return 1; diff --git a/fpdfsdk/fpdf_editpage.cpp b/fpdfsdk/fpdf_editpage.cpp index 77d03051b2..8c9a33d816 100644 --- a/fpdfsdk/fpdf_editpage.cpp +++ b/fpdfsdk/fpdf_editpage.cpp @@ -373,7 +373,7 @@ FPDFPageObjMark_CountParams(FPDF_PAGEOBJECTMARK mark) { CPDFContentMarkItemFromFPDFPageObjectMark(mark); const CPDF_Dictionary* pParams = pMarkItem->GetParam(); - return pParams ? pParams->GetCount() : 0; + return pParams ? pParams->size() : 0; } FPDF_EXPORT FPDF_BOOL FPDF_CALLCONV diff --git a/fpdfsdk/fpdf_flatten.cpp b/fpdfsdk/fpdf_flatten.cpp index 29d81c2c66..93490ad859 100644 --- a/fpdfsdk/fpdf_flatten.cpp +++ b/fpdfsdk/fpdf_flatten.cpp @@ -341,7 +341,7 @@ FPDF_EXPORT int FPDF_CALLCONV FPDFPage_Flatten(FPDF_PAGE page, int nFlag) { if (!sAnnotState.IsEmpty()) { pAPStream = pAPDic->GetStreamFor(sAnnotState); } else { - if (pAPDic->GetCount() > 0) { + if (pAPDic->size() > 0) { CPDF_Object* pFirstObj = pAPDic->begin()->second.get(); if (pFirstObj) { if (pFirstObj->IsReference()) diff --git a/fpdfsdk/fpdf_ppo.cpp b/fpdfsdk/fpdf_ppo.cpp index 1d093a1f3d..b3d4ff53cb 100644 --- a/fpdfsdk/fpdf_ppo.cpp +++ b/fpdfsdk/fpdf_ppo.cpp @@ -383,7 +383,7 @@ bool CPDF_PageOrganizer::UpdateReference(CPDF_Object* pObj, } case CPDF_Object::ARRAY: { CPDF_Array* pArray = pObj->AsArray(); - for (size_t i = 0; i < pArray->GetCount(); ++i) { + for (size_t i = 0; i < pArray->size(); ++i) { CPDF_Object* pNextObj = pArray->GetObjectAt(i); if (!pNextObj) return false; @@ -708,7 +708,7 @@ uint32_t CPDF_NPageToOneExporter::MakeXObject( if (const CPDF_Array* pSrcContentArray = ToArray(pSrcContentObj)) { ByteString bsSrcContentStream; - for (size_t i = 0; i < pSrcContentArray->GetCount(); ++i) { + for (size_t i = 0; i < pSrcContentArray->size(); ++i) { const CPDF_Stream* pStream = pSrcContentArray->GetStreamAt(i); auto pAcc = pdfium::MakeRetain<CPDF_StreamAcc>(pStream); pAcc->LoadAllDataFiltered(); diff --git a/fpdfsdk/fpdf_save.cpp b/fpdfsdk/fpdf_save.cpp index 16d7da2101..237c262c79 100644 --- a/fpdfsdk/fpdf_save.cpp +++ b/fpdfsdk/fpdf_save.cpp @@ -78,7 +78,7 @@ bool SaveXFADocumentData(CPDFXFA_Context* pContext, if (!pArray) return false; - int size = pArray->GetCount(); + int size = pArray->size(); int iFormIndex = -1; int iDataSetsIndex = -1; int iLast = size - 2; @@ -139,7 +139,7 @@ bool SaveXFADocumentData(CPDFXFA_Context* pContext, } else { CPDF_Stream* pData = pPDFDocument->NewIndirect<CPDF_Stream>(); pData->InitStreamFromFile(pDsfileWrite, std::move(pDataDict)); - iLast = pArray->GetCount() - 2; + iLast = pArray->size() - 2; pArray->InsertNewAt<CPDF_String>(iLast, "datasets", false); pArray->InsertAt(iLast + 1, pData->MakeReference(pPDFDocument)); } @@ -164,7 +164,7 @@ bool SaveXFADocumentData(CPDFXFA_Context* pContext, } else { CPDF_Stream* pData = pPDFDocument->NewIndirect<CPDF_Stream>(); pData->InitStreamFromFile(pfileWrite, std::move(pDataDict)); - iLast = pArray->GetCount() - 2; + iLast = pArray->size() - 2; pArray->InsertNewAt<CPDF_String>(iLast, "form", false); pArray->InsertAt(iLast + 1, pData->MakeReference(pPDFDocument)); } diff --git a/fpdfsdk/fpdf_view.cpp b/fpdfsdk/fpdf_view.cpp index 247a90240b..83d7e4a6cb 100644 --- a/fpdfsdk/fpdf_view.cpp +++ b/fpdfsdk/fpdf_view.cpp @@ -985,14 +985,14 @@ FPDF_VIEWERREF_GetPrintPageRange(FPDF_DOCUMENT document) { FPDF_EXPORT size_t FPDF_CALLCONV FPDF_VIEWERREF_GetPrintPageRangeCount(FPDF_PAGERANGE pagerange) { const CPDF_Array* pArray = CPDFArrayFromFPDFPageRange(pagerange); - return pArray ? pArray->GetCount() : 0; + return pArray ? pArray->size() : 0; } FPDF_EXPORT int FPDF_CALLCONV FPDF_VIEWERREF_GetPrintPageRangeElement(FPDF_PAGERANGE pagerange, size_t index) { const CPDF_Array* pArray = CPDFArrayFromFPDFPageRange(pagerange); - if (!pArray || index >= pArray->GetCount()) + if (!pArray || index >= pArray->size()) return -1; return pArray->GetIntegerAt(index); } @@ -1047,7 +1047,7 @@ FPDF_CountNamedDests(FPDF_DOCUMENT document) { pdfium::base::CheckedNumeric<FPDF_DWORD> count = nameTree.GetCount(); const CPDF_Dictionary* pDest = pRoot->GetDictFor("Dests"); if (pDest) - count += pDest->GetCount(); + count += pDest->size(); if (!count.IsValid()) return 0; @@ -1145,7 +1145,7 @@ FPDF_EXPORT FPDF_DEST FPDF_CALLCONV FPDF_GetNamedDest(FPDF_DOCUMENT document, return nullptr; pdfium::base::CheckedNumeric<int> checked_count = count; - checked_count += pDest->GetCount(); + checked_count += pDest->size(); if (!checked_count.IsValid() || index >= checked_count.ValueOrDie()) return nullptr; diff --git a/fpdfsdk/fpdfxfa/cpdfxfa_docenvironment.cpp b/fpdfsdk/fpdfxfa/cpdfxfa_docenvironment.cpp index 6cf4bff833..e9cd2f6f99 100644 --- a/fpdfsdk/fpdfxfa/cpdfxfa_docenvironment.cpp +++ b/fpdfsdk/fpdfxfa/cpdfxfa_docenvironment.cpp @@ -467,7 +467,7 @@ void CPDFXFA_DocEnvironment::ExportData(CXFA_FFDoc* hDoc, if (!pArray) return; - for (size_t i = 1; i < pArray->GetCount(); i += 2) { + for (size_t i = 1; i < pArray->size(); i += 2) { const CPDF_Object* pPDFObj = pArray->GetObjectAt(i); const CPDF_Object* pPrePDFObj = pArray->GetObjectAt(i - 1); if (!pPrePDFObj->IsString()) @@ -492,7 +492,7 @@ void CPDFXFA_DocEnvironment::ExportData(CXFA_FFDoc* hDoc, fileWrite); continue; } - if (i == pArray->GetCount() - 1) { + if (i == pArray->size() - 1) { WideString wPath = WideString::FromUTF16LE( reinterpret_cast<const unsigned short*>(bs.c_str()), bs.GetLength() / sizeof(unsigned short)); @@ -763,7 +763,7 @@ bool CPDFXFA_DocEnvironment::ExportSubmitFile(FPDF_FILEHANDLER* pFileHandler, return false; } - for (size_t i = 1; i < pArray->GetCount(); i += 2) { + for (size_t i = 1; i < pArray->size(); i += 2) { const CPDF_Object* pPDFObj = pArray->GetObjectAt(i); const CPDF_Object* pPrePDFObj = pArray->GetObjectAt(i - 1); if (!pPrePDFObj->IsString()) diff --git a/fpdfsdk/pwl/cpwl_icon.cpp b/fpdfsdk/pwl/cpwl_icon.cpp index f0232c4ae4..407e866766 100644 --- a/fpdfsdk/pwl/cpwl_icon.cpp +++ b/fpdfsdk/pwl/cpwl_icon.cpp @@ -55,7 +55,7 @@ std::pair<float, float> CPWL_Icon::GetIconPosition() { if (!pA) return {0.0f, 0.0f}; - size_t dwCount = pA->GetCount(); + size_t dwCount = pA->size(); return {dwCount > 0 ? pA->GetNumberAt(0) : 0.0f, dwCount > 1 ? pA->GetNumberAt(1) : 0.0f}; } diff --git a/fxjs/cjs_document.cpp b/fxjs/cjs_document.cpp index 7f81a37f72..9899deb593 100644 --- a/fxjs/cjs_document.cpp +++ b/fxjs/cjs_document.cpp @@ -1443,7 +1443,7 @@ CJS_Result CJS_Document::gotoNamedDest( const CPDF_Array* arrayObject = dest.GetArray(); std::vector<float> scrollPositionArray; if (arrayObject) { - for (size_t i = 2; i < arrayObject->GetCount(); i++) + for (size_t i = 2; i < arrayObject->size(); i++) scrollPositionArray.push_back(arrayObject->GetFloatAt(i)); } pRuntime->BeginBlock(); diff --git a/xfa/fxfa/cxfa_ffdoc.cpp b/xfa/fxfa/cxfa_ffdoc.cpp index 47c82151fe..030883b5cc 100644 --- a/xfa/fxfa/cxfa_ffdoc.cpp +++ b/xfa/fxfa/cxfa_ffdoc.cpp @@ -50,7 +50,7 @@ bool CXFA_FFDoc::ParseDoc(const CPDF_Object* pElementXFA) { std::vector<const CPDF_Stream*> xfaStreams; if (pElementXFA->IsArray()) { const CPDF_Array* pXFAArray = pElementXFA->AsArray(); - for (size_t i = 0; i < pXFAArray->GetCount() / 2; i++) { + for (size_t i = 0; i < pXFAArray->size() / 2; i++) { if (const CPDF_Stream* pStream = pXFAArray->GetStreamAt(i * 2 + 1)) xfaStreams.push_back(pStream); } |