summaryrefslogtreecommitdiff
path: root/core/fpdfdoc
diff options
context:
space:
mode:
authorWei Li <weili@chromium.org>2016-04-11 10:02:09 -0700
committerWei Li <weili@chromium.org>2016-04-11 10:02:09 -0700
commite1aebd43b0c75133f94f8b141b33d12e2e715524 (patch)
tree863aded8c706db162eb3f69d6482100f9d61b842 /core/fpdfdoc
parent2d4a4fc372159ac7562abea48498b6ab72c2f321 (diff)
downloadpdfium-e1aebd43b0c75133f94f8b141b33d12e2e715524.tar.xz
Use std::vector as internal storage for CPDF_Array
Replace the usage of CFX_ArrayTemplate inside CPDF_Array, which has non-standard APIs such as GetSize() returns int. R=tsepez@chromium.org Review URL: https://codereview.chromium.org/1867183002 .
Diffstat (limited to 'core/fpdfdoc')
-rw-r--r--core/fpdfdoc/cpvt_generateap.cpp4
-rw-r--r--core/fpdfdoc/doc_action.cpp11
-rw-r--r--core/fpdfdoc/doc_annot.cpp10
-rw-r--r--core/fpdfdoc/doc_basic.cpp51
-rw-r--r--core/fpdfdoc/doc_form.cpp25
-rw-r--r--core/fpdfdoc/doc_formcontrol.cpp4
-rw-r--r--core/fpdfdoc/doc_formfield.cpp19
-rw-r--r--core/fpdfdoc/doc_link.cpp2
-rw-r--r--core/fpdfdoc/doc_ocg.cpp18
-rw-r--r--core/fpdfdoc/doc_tagged.cpp2
-rw-r--r--core/fpdfdoc/doc_utils.cpp5
-rw-r--r--core/fpdfdoc/include/fpdf_doc.h10
12 files changed, 79 insertions, 82 deletions
diff --git a/core/fpdfdoc/cpvt_generateap.cpp b/core/fpdfdoc/cpvt_generateap.cpp
index 19b171a896..a837c35801 100644
--- a/core/fpdfdoc/cpvt_generateap.cpp
+++ b/core/fpdfdoc/cpvt_generateap.cpp
@@ -356,7 +356,7 @@ FX_BOOL GenerateWidgetAP(CPDF_Document* pDoc,
CFX_ByteTextBuf sBody;
if (pOpts) {
FX_FLOAT fy = rcBody.top;
- for (int32_t i = nTop, sz = pOpts->GetCount(); i < sz; i++) {
+ for (size_t i = nTop, sz = pOpts->GetCount(); i < sz; i++) {
if (IsFloatSmaller(fy, rcBody.bottom))
break;
@@ -369,7 +369,7 @@ FX_BOOL GenerateWidgetAP(CPDF_Document* pDoc,
FX_BOOL bSelected = FALSE;
if (pSels) {
- for (uint32_t s = 0, ssz = pSels->GetCount(); s < ssz; s++) {
+ for (size_t s = 0, ssz = pSels->GetCount(); s < ssz; s++) {
if (i == pSels->GetIntegerAt(s)) {
bSelected = TRUE;
break;
diff --git a/core/fpdfdoc/doc_action.cpp b/core/fpdfdoc/doc_action.cpp
index 3036d61ab0..c478bbe1f4 100644
--- a/core/fpdfdoc/doc_action.cpp
+++ b/core/fpdfdoc/doc_action.cpp
@@ -101,7 +101,7 @@ CFX_ByteString CPDF_Action::GetURI(CPDF_Document* pDoc) const {
}
return csURI;
}
-uint32_t CPDF_ActionFields::GetFieldsCount() const {
+size_t CPDF_ActionFields::GetFieldsCount() const {
if (!m_pAction) {
return 0;
}
@@ -148,8 +148,7 @@ std::vector<CPDF_Object*> CPDF_ActionFields::GetAllFields() const {
if (pFields->IsDictionary() || pFields->IsString()) {
fields.push_back(pFields);
} else if (CPDF_Array* pArray = pFields->AsArray()) {
- uint32_t iCount = pArray->GetCount();
- for (uint32_t i = 0; i < iCount; ++i) {
+ for (size_t i = 0; i < pArray->GetCount(); ++i) {
CPDF_Object* pObj = pArray->GetDirectObjectAt(i);
if (pObj) {
fields.push_back(pObj);
@@ -159,7 +158,7 @@ std::vector<CPDF_Object*> CPDF_ActionFields::GetAllFields() const {
return fields;
}
-CPDF_Object* CPDF_ActionFields::GetField(uint32_t iIndex) const {
+CPDF_Object* CPDF_ActionFields::GetField(size_t iIndex) const {
if (!m_pAction) {
return NULL;
}
@@ -233,7 +232,7 @@ int32_t CPDF_Action::GetOperationType() const {
}
return 0;
}
-uint32_t CPDF_Action::GetSubActionsCount() const {
+size_t CPDF_Action::GetSubActionsCount() const {
if (!m_pDict || !m_pDict->KeyExist("Next"))
return 0;
@@ -246,7 +245,7 @@ uint32_t CPDF_Action::GetSubActionsCount() const {
return pArray->GetCount();
return 0;
}
-CPDF_Action CPDF_Action::GetSubAction(uint32_t iIndex) const {
+CPDF_Action CPDF_Action::GetSubAction(size_t iIndex) const {
if (!m_pDict || !m_pDict->KeyExist("Next")) {
return CPDF_Action();
}
diff --git a/core/fpdfdoc/doc_annot.cpp b/core/fpdfdoc/doc_annot.cpp
index 1db37ccdb3..8650fbd23d 100644
--- a/core/fpdfdoc/doc_annot.cpp
+++ b/core/fpdfdoc/doc_annot.cpp
@@ -29,7 +29,7 @@ CPDF_AnnotList::CPDF_AnnotList(CPDF_Page* pPage)
CPDF_Dictionary* pAcroForm = pRoot->GetDictBy("AcroForm");
FX_BOOL bRegenerateAP =
pAcroForm && pAcroForm->GetBooleanBy("NeedAppearances");
- for (uint32_t i = 0; i < pAnnots->GetCount(); ++i) {
+ for (size_t i = 0; i < pAnnots->GetCount(); ++i) {
CPDF_Dictionary* pDict = ToDictionary(pAnnots->GetDirectObjectAt(i));
if (!pDict)
continue;
@@ -286,8 +286,8 @@ void CPDF_Annot::DrawBorder(CFX_RenderDevice* pDevice,
if (!pDashArray) {
return;
}
- int nLen = pDashArray->GetCount();
- int i = 0;
+ size_t nLen = pDashArray->GetCount();
+ size_t i = 0;
for (; i < nLen; ++i) {
CPDF_Object* pObj = pDashArray->GetDirectObjectAt(i);
if (pObj && pObj->GetInteger()) {
@@ -323,13 +323,13 @@ void CPDF_Annot::DrawBorder(CFX_RenderDevice* pDevice,
graph_state.m_LineWidth = width;
if (style_char == 'D') {
if (pDashArray) {
- uint32_t dash_count = pDashArray->GetCount();
+ size_t dash_count = pDashArray->GetCount();
if (dash_count % 2) {
dash_count++;
}
graph_state.m_DashArray = FX_Alloc(FX_FLOAT, dash_count);
graph_state.m_DashCount = dash_count;
- uint32_t i;
+ size_t i;
for (i = 0; i < pDashArray->GetCount(); ++i) {
graph_state.m_DashArray[i] = pDashArray->GetNumberAt(i);
}
diff --git a/core/fpdfdoc/doc_basic.cpp b/core/fpdfdoc/doc_basic.cpp
index bdb3f8cb0a..1cfca7e8ee 100644
--- a/core/fpdfdoc/doc_basic.cpp
+++ b/core/fpdfdoc/doc_basic.cpp
@@ -78,9 +78,10 @@ CPDF_NameTree::CPDF_NameTree(CPDF_Document* pDoc,
else
m_pRoot = NULL;
}
+
static CPDF_Object* SearchNameNode(CPDF_Dictionary* pNode,
const CFX_ByteString& csName,
- int& nIndex,
+ size_t& nIndex,
CPDF_Array** ppFind,
int nLevel = 0) {
if (nLevel > nMaxRecursion) {
@@ -102,8 +103,8 @@ static CPDF_Object* SearchNameNode(CPDF_Dictionary* pNode,
}
CPDF_Array* pNames = pNode->GetArrayBy("Names");
if (pNames) {
- uint32_t dwCount = pNames->GetCount() / 2;
- for (uint32_t i = 0; i < dwCount; i++) {
+ size_t dwCount = pNames->GetCount() / 2;
+ for (size_t i = 0; i < dwCount; i++) {
CFX_ByteString csValue = pNames->GetStringAt(i * 2);
int32_t iCompare = csValue.Compare(csName.AsStringC());
if (iCompare <= 0) {
@@ -126,7 +127,7 @@ static CPDF_Object* SearchNameNode(CPDF_Dictionary* pNode,
if (!pKids) {
return NULL;
}
- for (uint32_t i = 0; i < pKids->GetCount(); i++) {
+ for (size_t i = 0; i < pKids->GetCount(); i++) {
CPDF_Dictionary* pKid = pKids->GetDictAt(i);
if (!pKid) {
continue;
@@ -139,46 +140,44 @@ static CPDF_Object* SearchNameNode(CPDF_Dictionary* pNode,
}
return NULL;
}
+
static CPDF_Object* SearchNameNode(CPDF_Dictionary* pNode,
- int nIndex,
- int& nCurIndex,
+ size_t nIndex,
+ size_t& nCurIndex,
CFX_ByteString& csName,
CPDF_Array** ppFind,
int nLevel = 0) {
- if (nLevel > nMaxRecursion) {
+ if (nLevel > nMaxRecursion)
return NULL;
- }
+
CPDF_Array* pNames = pNode->GetArrayBy("Names");
if (pNames) {
- int nCount = pNames->GetCount() / 2;
+ size_t nCount = pNames->GetCount() / 2;
if (nIndex >= nCurIndex + nCount) {
nCurIndex += nCount;
return NULL;
}
- if (ppFind) {
+ if (ppFind)
*ppFind = pNames;
- }
csName = pNames->GetStringAt((nIndex - nCurIndex) * 2);
return pNames->GetDirectObjectAt((nIndex - nCurIndex) * 2 + 1);
}
CPDF_Array* pKids = pNode->GetArrayBy("Kids");
- if (!pKids) {
+ if (!pKids)
return NULL;
- }
- for (uint32_t i = 0; i < pKids->GetCount(); i++) {
+ for (size_t i = 0; i < pKids->GetCount(); i++) {
CPDF_Dictionary* pKid = pKids->GetDictAt(i);
- if (!pKid) {
+ if (!pKid)
continue;
- }
CPDF_Object* pFound =
SearchNameNode(pKid, nIndex, nCurIndex, csName, ppFind, nLevel + 1);
- if (pFound) {
+ if (pFound)
return pFound;
- }
}
return NULL;
}
-static int CountNames(CPDF_Dictionary* pNode, int nLevel = 0) {
+
+static size_t CountNames(CPDF_Dictionary* pNode, int nLevel = 0) {
if (nLevel > nMaxRecursion) {
return 0;
}
@@ -190,8 +189,8 @@ static int CountNames(CPDF_Dictionary* pNode, int nLevel = 0) {
if (!pKids) {
return 0;
}
- int nCount = 0;
- for (uint32_t i = 0; i < pKids->GetCount(); i++) {
+ size_t nCount = 0;
+ for (size_t i = 0; i < pKids->GetCount(); i++) {
CPDF_Dictionary* pKid = pKids->GetDictAt(i);
if (!pKid) {
continue;
@@ -200,17 +199,19 @@ static int CountNames(CPDF_Dictionary* pNode, int nLevel = 0) {
}
return nCount;
}
-int CPDF_NameTree::GetCount() const {
+
+size_t CPDF_NameTree::GetCount() const {
if (!m_pRoot) {
return 0;
}
return ::CountNames(m_pRoot);
}
+
int CPDF_NameTree::GetIndex(const CFX_ByteString& csName) const {
if (!m_pRoot) {
return -1;
}
- int nIndex = 0;
+ size_t nIndex = 0;
if (!SearchNameNode(m_pRoot, csName, nIndex, NULL)) {
return -1;
}
@@ -221,14 +222,14 @@ CPDF_Object* CPDF_NameTree::LookupValue(int nIndex,
if (!m_pRoot) {
return NULL;
}
- int nCurIndex = 0;
+ size_t nCurIndex = 0;
return SearchNameNode(m_pRoot, nIndex, nCurIndex, csName, NULL);
}
CPDF_Object* CPDF_NameTree::LookupValue(const CFX_ByteString& csName) const {
if (!m_pRoot) {
return NULL;
}
- int nIndex = 0;
+ size_t nIndex = 0;
return SearchNameNode(m_pRoot, csName, nIndex, NULL);
}
CPDF_Array* CPDF_NameTree::LookupNamedDest(CPDF_Document* pDoc,
diff --git a/core/fpdfdoc/doc_form.cpp b/core/fpdfdoc/doc_form.cpp
index e1f5f30856..207b824545 100644
--- a/core/fpdfdoc/doc_form.cpp
+++ b/core/fpdfdoc/doc_form.cpp
@@ -278,10 +278,8 @@ CPDF_InterForm::CPDF_InterForm(CPDF_Document* pDocument, FX_BOOL bGenerateAP)
if (!pFields)
return;
- int count = pFields->GetCount();
- for (int i = 0; i < count; i++) {
+ for (size_t i = 0; i < pFields->GetCount(); i++)
LoadField(pFields->GetDictAt(i));
- }
}
CPDF_InterForm::~CPDF_InterForm() {
@@ -704,8 +702,8 @@ CPDF_FormControl* CPDF_InterForm::GetControlAtPoint(CPDF_Page* pPage,
if (!pAnnotList)
return nullptr;
- for (uint32_t i = pAnnotList->GetCount(); i > 0; --i) {
- uint32_t annot_index = i - 1;
+ for (size_t i = pAnnotList->GetCount(); i > 0; --i) {
+ size_t annot_index = i - 1;
CPDF_Dictionary* pAnnot = pAnnotList->GetDictAt(annot_index);
if (!pAnnot)
continue;
@@ -720,7 +718,7 @@ CPDF_FormControl* CPDF_InterForm::GetControlAtPoint(CPDF_Page* pPage,
continue;
if (z_order)
- *z_order = annot_index;
+ *z_order = static_cast<int>(annot_index);
return pControl;
}
return nullptr;
@@ -742,6 +740,7 @@ void CPDF_InterForm::NeedConstructAP(FX_BOOL bNeedAP) {
m_pFormDict->SetAtBoolean("NeedAppearances", bNeedAP);
m_bGenerateAP = bNeedAP;
}
+
int CPDF_InterForm::CountFieldsInCalculationOrder() {
if (!m_pFormDict) {
return 0;
@@ -749,6 +748,7 @@ int CPDF_InterForm::CountFieldsInCalculationOrder() {
CPDF_Array* pArray = m_pFormDict->GetArrayBy("CO");
return pArray ? pArray->GetCount() : 0;
}
+
CPDF_FormField* CPDF_InterForm::GetFieldInCalculationOrder(int index) {
if (!m_pFormDict || index < 0) {
return NULL;
@@ -771,7 +771,7 @@ int CPDF_InterForm::FindFieldInCalculationOrder(const CPDF_FormField* pField) {
if (!pArray) {
return -1;
}
- for (uint32_t i = 0; i < pArray->GetCount(); i++) {
+ for (size_t i = 0; i < pArray->GetCount(); i++) {
CPDF_Object* pElement = pArray->GetDirectObjectAt(i);
if (pElement == pField->m_pDict) {
return i;
@@ -901,7 +901,7 @@ void CPDF_InterForm::LoadField(CPDF_Dictionary* pFieldDict, int nLevel) {
return;
}
if (pFirstKid->KeyExist("T") || pFirstKid->KeyExist("Kids")) {
- for (uint32_t i = 0; i < pKids->GetCount(); i++) {
+ for (size_t i = 0; i < pKids->GetCount(); i++) {
CPDF_Dictionary* pChildDict = pKids->GetDictAt(i);
if (pChildDict) {
if (pChildDict->GetObjNum() != dwParentObjNum) {
@@ -925,8 +925,7 @@ void CPDF_InterForm::FixPageFields(const CPDF_Page* pPage) {
if (!pAnnots) {
return;
}
- int iAnnotCount = pAnnots->GetCount();
- for (int i = 0; i < iAnnotCount; i++) {
+ for (size_t i = 0; i < pAnnots->GetCount(); i++) {
CPDF_Dictionary* pAnnot = pAnnots->GetDictAt(i);
if (pAnnot && pAnnot->GetStringBy("Subtype") == "Widget") {
LoadField(pAnnot);
@@ -984,7 +983,7 @@ CPDF_FormField* CPDF_InterForm::AddTerminalField(CPDF_Dictionary* pFieldDict) {
AddControl(pField, pFieldDict);
}
} else {
- for (uint32_t i = 0; i < pKids->GetCount(); i++) {
+ for (size_t i = 0; i < pKids->GetCount(); i++) {
CPDF_Dictionary* pKid = pKids->GetDictAt(i);
if (!pKid) {
continue;
@@ -1122,7 +1121,7 @@ void CPDF_InterForm::FDF_ImportField(CPDF_Dictionary* pFieldDict,
name += pFieldDict->GetUnicodeTextBy("T");
CPDF_Array* pKids = pFieldDict->GetArrayBy("Kids");
if (pKids) {
- for (uint32_t i = 0; i < pKids->GetCount(); i++) {
+ for (size_t i = 0; i < pKids->GetCount(); i++) {
CPDF_Dictionary* pKid = pKids->GetDictAt(i);
if (!pKid) {
continue;
@@ -1194,7 +1193,7 @@ FX_BOOL CPDF_InterForm::ImportFromFDF(const CFDF_Document* pFDF,
return FALSE;
}
}
- for (uint32_t i = 0; i < pFields->GetCount(); i++) {
+ for (size_t i = 0; i < pFields->GetCount(); i++) {
CPDF_Dictionary* pField = pFields->GetDictAt(i);
if (!pField) {
continue;
diff --git a/core/fpdfdoc/doc_formcontrol.cpp b/core/fpdfdoc/doc_formcontrol.cpp
index 1fef183d80..b187ea7999 100644
--- a/core/fpdfdoc/doc_formcontrol.cpp
+++ b/core/fpdfdoc/doc_formcontrol.cpp
@@ -349,7 +349,7 @@ FX_ARGB CPDF_ApSettings::GetColor(int& iColorType,
return 0;
FX_ARGB color = 0;
- uint32_t dwCount = pEntry->GetCount();
+ size_t dwCount = pEntry->GetCount();
if (dwCount == 1) {
iColorType = COLORTYPE_GRAY;
FX_FLOAT g = pEntry->GetNumberAt(0) * 255;
@@ -398,7 +398,7 @@ void CPDF_ApSettings::GetOriginalColor(int& iColorType,
if (!pEntry) {
return;
}
- uint32_t dwCount = pEntry->GetCount();
+ size_t dwCount = pEntry->GetCount();
if (dwCount == 1) {
iColorType = COLORTYPE_GRAY;
fc[0] = pEntry->GetNumberAt(0);
diff --git a/core/fpdfdoc/doc_formfield.cpp b/core/fpdfdoc/doc_formfield.cpp
index 103465a8e5..957352ecef 100644
--- a/core/fpdfdoc/doc_formfield.cpp
+++ b/core/fpdfdoc/doc_formfield.cpp
@@ -414,6 +414,7 @@ int CPDF_FormField::GetMaxLen() {
}
return 0;
}
+
int CPDF_FormField::CountSelectedItems() {
CPDF_Object* pValue = FPDF_GetFieldAttr(m_pDict, "V");
if (!pValue) {
@@ -428,6 +429,7 @@ int CPDF_FormField::CountSelectedItems() {
return pArray->GetCount();
return 0;
}
+
int CPDF_FormField::GetSelectedIndex(int index) {
CPDF_Object* pValue = FPDF_GetFieldAttr(m_pDict, "V");
if (!pValue) {
@@ -537,9 +539,9 @@ FX_BOOL CPDF_FormField::IsItemSelected(int index) {
break;
}
}
- for (uint32_t i = 0; i < pArray->GetCount(); i++)
+ for (int i = 0; i < static_cast<int>(pArray->GetCount()); i++)
if (pArray->GetDirectObjectAt(i)->GetUnicodeText() == opt_value &&
- (int)i == iPos) {
+ i == iPos) {
return TRUE;
}
return FALSE;
@@ -887,6 +889,7 @@ FX_BOOL CPDF_FormField::SetCheckValue(const CFX_WideString& value,
m_pForm->m_bUpdated = TRUE;
return TRUE;
}
+
int CPDF_FormField::GetTopVisibleIndex() {
CPDF_Object* pObj = FPDF_GetFieldAttr(m_pDict, "TI");
if (!pObj) {
@@ -894,6 +897,7 @@ int CPDF_FormField::GetTopVisibleIndex() {
}
return pObj->GetInteger();
}
+
int CPDF_FormField::CountSelectedOptions() {
CPDF_Object* pObj = FPDF_GetFieldAttr(m_pDict, "I");
if (!pObj) {
@@ -903,8 +907,9 @@ int CPDF_FormField::CountSelectedOptions() {
if (!pArray) {
return 0;
}
- return (int)pArray->GetCount();
+ return static_cast<int>(pArray->GetCount());
}
+
int CPDF_FormField::GetSelectedOptionIndex(int index) {
CPDF_Object* pObj = FPDF_GetFieldAttr(m_pDict, "I");
if (!pObj) {
@@ -914,7 +919,7 @@ int CPDF_FormField::GetSelectedOptionIndex(int index) {
if (!pArray) {
return -1;
}
- int iCount = (int)pArray->GetCount();
+ int iCount = static_cast<int>(pArray->GetCount());
if (iCount > 0 && index < iCount) {
return pArray->GetIntegerAt(index);
}
@@ -929,8 +934,8 @@ FX_BOOL CPDF_FormField::IsOptionSelected(int iOptIndex) {
if (!pArray) {
return FALSE;
}
- int iCount = (int)pArray->GetCount();
- for (int i = 0; i < iCount; i++) {
+ size_t iCount = pArray->GetCount();
+ for (size_t i = 0; i < iCount; i++) {
if (pArray->GetIntegerAt(i) == iOptIndex) {
return TRUE;
}
@@ -949,7 +954,7 @@ FX_BOOL CPDF_FormField::SelectOption(int iOptIndex,
m_pDict->SetAt("I", pArray);
}
FX_BOOL bReturn = FALSE;
- for (int i = 0; i < (int)pArray->GetCount(); i++) {
+ for (size_t i = 0; i < pArray->GetCount(); i++) {
int iFind = pArray->GetIntegerAt(i);
if (iFind == iOptIndex) {
if (bSelected) {
diff --git a/core/fpdfdoc/doc_link.cpp b/core/fpdfdoc/doc_link.cpp
index 07cc9f26ff..995290b9fb 100644
--- a/core/fpdfdoc/doc_link.cpp
+++ b/core/fpdfdoc/doc_link.cpp
@@ -63,7 +63,7 @@ void CPDF_LinkList::LoadPageLinks(CPDF_Page* pPage,
if (!pAnnotList)
return;
- for (uint32_t i = 0; i < pAnnotList->GetCount(); ++i) {
+ for (size_t i = 0; i < pAnnotList->GetCount(); ++i) {
CPDF_Dictionary* pAnnot = pAnnotList->GetDictAt(i);
bool add_link = (pAnnot && pAnnot->GetStringBy("Subtype") == "Link");
// Add non-links as nullptrs to preserve z-order.
diff --git a/core/fpdfdoc/doc_ocg.cpp b/core/fpdfdoc/doc_ocg.cpp
index 9b57509e56..b4fb3e1c01 100644
--- a/core/fpdfdoc/doc_ocg.cpp
+++ b/core/fpdfdoc/doc_ocg.cpp
@@ -14,8 +14,7 @@ static int32_t FPDFDOC_OCG_FindGroup(const CPDF_Object* pObject,
return -1;
if (const CPDF_Array* pArray = pObject->AsArray()) {
- uint32_t dwCount = pArray->GetCount();
- for (uint32_t i = 0; i < dwCount; i++) {
+ for (size_t i = 0; i < pArray->GetCount(); i++) {
if (pArray->GetDictAt(i) == pGroupDict)
return i;
}
@@ -32,8 +31,7 @@ static FX_BOOL FPDFDOC_OCG_HasIntent(const CPDF_Dictionary* pDict,
}
CFX_ByteString bsIntent;
if (CPDF_Array* pArray = pIntent->AsArray()) {
- uint32_t dwCount = pArray->GetCount();
- for (uint32_t i = 0; i < dwCount; i++) {
+ for (size_t i = 0; i < pArray->GetCount(); i++) {
bsIntent = pArray->GetStringAt(i);
if (bsIntent == "All" || bsIntent == csElement)
return TRUE;
@@ -62,8 +60,7 @@ static CPDF_Dictionary* FPDFDOC_OCG_GetConfig(CPDF_Document* pDoc,
CPDF_Array* pConfigs = pOCProperties->GetArrayBy("Configs");
if (pConfigs) {
CPDF_Dictionary* pFind;
- int32_t iCount = pConfigs->GetCount();
- for (int32_t i = 0; i < iCount; i++) {
+ for (size_t i = 0; i < pConfigs->GetCount(); i++) {
pFind = pConfigs->GetDictAt(i);
if (!pFind) {
continue;
@@ -122,8 +119,7 @@ FX_BOOL CPDF_OCContext::LoadOCGStateFromConfig(const CFX_ByteStringC& csConfig,
pArray = pConfig->GetArrayBy("AS");
if (pArray) {
CFX_ByteString csFind = csConfig + "State";
- int32_t iCount = pArray->GetCount();
- for (int32_t i = 0; i < iCount; i++) {
+ for (size_t i = 0; i < pArray->GetCount(); i++) {
CPDF_Dictionary* pUsage = pArray->GetDictAt(i);
if (!pUsage) {
continue;
@@ -194,7 +190,6 @@ FX_BOOL CPDF_OCContext::GetOCGVE(CPDF_Array* pExpression,
if (!pExpression) {
return FALSE;
}
- int32_t iCount = pExpression->GetCount();
CPDF_Object* pOCGObj;
CFX_ByteString csOperator = pExpression->GetStringAt(0);
if (csOperator == "Not") {
@@ -209,7 +204,7 @@ FX_BOOL CPDF_OCContext::GetOCGVE(CPDF_Array* pExpression,
}
if (csOperator == "Or" || csOperator == "And") {
FX_BOOL bValue = FALSE;
- for (int32_t i = 1; i < iCount; i++) {
+ for (size_t i = 1; i < pExpression->GetCount(); i++) {
pOCGObj = pExpression->GetDirectObjectAt(1);
if (!pOCGObj) {
continue;
@@ -255,8 +250,7 @@ FX_BOOL CPDF_OCContext::LoadOCMDState(const CPDF_Dictionary* pOCMDDict,
if (csP == "AllOn" || csP == "AllOff") {
bState = TRUE;
}
- int32_t iCount = pArray->GetCount();
- for (int32_t i = 0; i < iCount; i++) {
+ for (size_t i = 0; i < pArray->GetCount(); i++) {
FX_BOOL bItem = TRUE;
CPDF_Dictionary* pItemDict = pArray->GetDictAt(i);
if (pItemDict)
diff --git a/core/fpdfdoc/doc_tagged.cpp b/core/fpdfdoc/doc_tagged.cpp
index a86514059c..b60c83932e 100644
--- a/core/fpdfdoc/doc_tagged.cpp
+++ b/core/fpdfdoc/doc_tagged.cpp
@@ -70,7 +70,7 @@ void CPDF_StructTreeImpl::LoadDocTree() {
if (!pArray)
return;
- for (uint32_t i = 0; i < pArray->GetCount(); i++) {
+ for (size_t i = 0; i < pArray->GetCount(); i++) {
CPDF_Dictionary* pKid = pArray->GetDictAt(i);
CPDF_StructElementImpl* pStructElementImpl =
new CPDF_StructElementImpl(this, nullptr, pKid);
diff --git a/core/fpdfdoc/doc_utils.cpp b/core/fpdfdoc/doc_utils.cpp
index 7c66b879cb..404353847f 100644
--- a/core/fpdfdoc/doc_utils.cpp
+++ b/core/fpdfdoc/doc_utils.cpp
@@ -27,8 +27,7 @@ CPDF_Object* SearchNumberNode(const CPDF_Dictionary* pNode, int num) {
}
CPDF_Array* pNumbers = pNode->GetArrayBy("Nums");
if (pNumbers) {
- uint32_t dwCount = pNumbers->GetCount() / 2;
- for (uint32_t i = 0; i < dwCount; i++) {
+ for (size_t i = 0; i < pNumbers->GetCount() / 2; i++) {
int index = pNumbers->GetIntegerAt(i * 2);
if (num == index) {
return pNumbers->GetDirectObjectAt(i * 2 + 1);
@@ -43,7 +42,7 @@ CPDF_Object* SearchNumberNode(const CPDF_Dictionary* pNode, int num) {
if (!pKids) {
return NULL;
}
- for (uint32_t i = 0; i < pKids->GetCount(); i++) {
+ for (size_t i = 0; i < pKids->GetCount(); i++) {
CPDF_Dictionary* pKid = pKids->GetDictAt(i);
if (!pKid) {
continue;
diff --git a/core/fpdfdoc/include/fpdf_doc.h b/core/fpdfdoc/include/fpdf_doc.h
index e33b60165b..bcbfcf33ba 100644
--- a/core/fpdfdoc/include/fpdf_doc.h
+++ b/core/fpdfdoc/include/fpdf_doc.h
@@ -58,7 +58,7 @@ class CPDF_NameTree {
CPDF_Array* LookupNamedDest(CPDF_Document* pDoc,
const CFX_ByteStringC& sName);
int GetIndex(const CFX_ByteString& csName) const;
- int GetCount() const;
+ size_t GetCount() const;
CPDF_Dictionary* GetRoot() const { return m_pRoot; }
protected:
@@ -154,9 +154,9 @@ class CPDF_ActionFields {
public:
explicit CPDF_ActionFields(const CPDF_Action* pAction) : m_pAction(pAction) {}
- uint32_t GetFieldsCount() const;
+ size_t GetFieldsCount() const;
std::vector<CPDF_Object*> GetAllFields() const;
- CPDF_Object* GetField(uint32_t iIndex) const;
+ CPDF_Object* GetField(size_t iIndex) const;
protected:
const CPDF_Action* const m_pAction;
@@ -213,8 +213,8 @@ class CPDF_Action {
FX_BOOL IsSynchronous() const { return m_pDict->GetBooleanBy("Synchronous"); }
FX_BOOL IsRepeat() const { return m_pDict->GetBooleanBy("Repeat"); }
FX_BOOL IsMixPlay() const { return m_pDict->GetBooleanBy("Mix"); }
- uint32_t GetSubActionsCount() const;
- CPDF_Action GetSubAction(uint32_t iIndex) const;
+ size_t GetSubActionsCount() const;
+ CPDF_Action GetSubAction(size_t iIndex) const;
protected:
CPDF_Dictionary* const m_pDict;