summaryrefslogtreecommitdiff
path: root/core
diff options
context:
space:
mode:
authorLei Zhang <thestig@chromium.org>2018-10-12 18:31:51 +0000
committerChromium commit bot <commit-bot@chromium.org>2018-10-12 18:31:51 +0000
commitf40380f454042c9783fe30260a0e3df8b32c5c92 (patch)
treed89f89ee2f813e490ec0ccd5c6195c041f81ab44 /core
parent8273b37f032a2d9e8e4a83eeda43641365f311a2 (diff)
downloadpdfium-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')
-rw-r--r--core/fpdfapi/edit/cpdf_pagecontentmanager.cpp4
-rw-r--r--core/fpdfapi/font/cpdf_cidfont.cpp8
-rw-r--r--core/fpdfapi/font/cpdf_simplefont.cpp6
-rw-r--r--core/fpdfapi/font/cpdf_type3font.cpp2
-rw-r--r--core/fpdfapi/page/cpdf_colorspace.cpp10
-rw-r--r--core/fpdfapi/page/cpdf_contentparser.cpp2
-rw-r--r--core/fpdfapi/page/cpdf_docpagedata.cpp2
-rw-r--r--core/fpdfapi/page/cpdf_expintfunc.cpp2
-rw-r--r--core/fpdfapi/page/cpdf_function.cpp4
-rw-r--r--core/fpdfapi/page/cpdf_meshstream.cpp2
-rw-r--r--core/fpdfapi/page/cpdf_shadingpattern.cpp2
-rw-r--r--core/fpdfapi/page/cpdf_stitchfunc.cpp6
-rw-r--r--core/fpdfapi/page/cpdf_streamcontentparser.cpp4
-rw-r--r--core/fpdfapi/parser/cpdf_array.cpp2
-rw-r--r--core/fpdfapi/parser/cpdf_array.h2
-rw-r--r--core/fpdfapi/parser/cpdf_array_unittest.cpp28
-rw-r--r--core/fpdfapi/parser/cpdf_data_avail.cpp6
-rw-r--r--core/fpdfapi/parser/cpdf_dictionary.h2
-rw-r--r--core/fpdfapi/parser/cpdf_document.cpp15
-rw-r--r--core/fpdfapi/parser/cpdf_document_unittest.cpp2
-rw-r--r--core/fpdfapi/parser/cpdf_linearized_header.cpp2
-rw-r--r--core/fpdfapi/parser/cpdf_object_unittest.cpp24
-rw-r--r--core/fpdfapi/parser/cpdf_parser.cpp4
-rw-r--r--core/fpdfapi/parser/fpdf_parser_decode.cpp4
-rw-r--r--core/fpdfapi/parser/fpdf_parser_utility.cpp2
-rw-r--r--core/fpdfapi/render/cpdf_dibbase.cpp6
-rw-r--r--core/fpdfapi/render/cpdf_docrenderdata.cpp2
-rw-r--r--core/fpdfapi/render/cpdf_imagerenderer.cpp2
-rw-r--r--core/fpdfapi/render/cpdf_renderstatus.cpp5
-rw-r--r--core/fpdfdoc/cpdf_action.cpp2
-rw-r--r--core/fpdfdoc/cpdf_actionfields.cpp2
-rw-r--r--core/fpdfdoc/cpdf_annot.cpp12
-rw-r--r--core/fpdfdoc/cpdf_annotlist.cpp2
-rw-r--r--core/fpdfdoc/cpdf_apsettings.cpp4
-rw-r--r--core/fpdfdoc/cpdf_dest.cpp6
-rw-r--r--core/fpdfdoc/cpdf_formfield.cpp14
-rw-r--r--core/fpdfdoc/cpdf_iconfit.cpp2
-rw-r--r--core/fpdfdoc/cpdf_interactiveform.cpp14
-rw-r--r--core/fpdfdoc/cpdf_linklist.cpp2
-rw-r--r--core/fpdfdoc/cpdf_nametree.cpp22
-rw-r--r--core/fpdfdoc/cpdf_nametree_unittest.cpp20
-rw-r--r--core/fpdfdoc/cpdf_numbertree.cpp4
-rw-r--r--core/fpdfdoc/cpdf_occontext.cpp12
-rw-r--r--core/fpdfdoc/cpdf_structelement.cpp4
-rw-r--r--core/fpdfdoc/cpdf_structtree.cpp6
-rw-r--r--core/fpdfdoc/cpvt_generateap.cpp18
-rw-r--r--core/fxge/cfx_color.cpp2
-rw-r--r--core/fxge/cfx_graphstate.cpp4
48 files changed, 156 insertions, 158 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;
}