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/fpdfdoc | |
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/fpdfdoc')
-rw-r--r-- | core/fpdfdoc/cpdf_action.cpp | 2 | ||||
-rw-r--r-- | core/fpdfdoc/cpdf_actionfields.cpp | 2 | ||||
-rw-r--r-- | core/fpdfdoc/cpdf_annot.cpp | 12 | ||||
-rw-r--r-- | core/fpdfdoc/cpdf_annotlist.cpp | 2 | ||||
-rw-r--r-- | core/fpdfdoc/cpdf_apsettings.cpp | 4 | ||||
-rw-r--r-- | core/fpdfdoc/cpdf_dest.cpp | 6 | ||||
-rw-r--r-- | core/fpdfdoc/cpdf_formfield.cpp | 14 | ||||
-rw-r--r-- | core/fpdfdoc/cpdf_iconfit.cpp | 2 | ||||
-rw-r--r-- | core/fpdfdoc/cpdf_interactiveform.cpp | 14 | ||||
-rw-r--r-- | core/fpdfdoc/cpdf_linklist.cpp | 2 | ||||
-rw-r--r-- | core/fpdfdoc/cpdf_nametree.cpp | 22 | ||||
-rw-r--r-- | core/fpdfdoc/cpdf_nametree_unittest.cpp | 20 | ||||
-rw-r--r-- | core/fpdfdoc/cpdf_numbertree.cpp | 4 | ||||
-rw-r--r-- | core/fpdfdoc/cpdf_occontext.cpp | 12 | ||||
-rw-r--r-- | core/fpdfdoc/cpdf_structelement.cpp | 4 | ||||
-rw-r--r-- | core/fpdfdoc/cpdf_structtree.cpp | 6 | ||||
-rw-r--r-- | core/fpdfdoc/cpvt_generateap.cpp | 18 |
17 files changed, 73 insertions, 73 deletions
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; |