summaryrefslogtreecommitdiff
path: root/core/fpdfdoc/doc_formfield.cpp
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/doc_formfield.cpp
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/doc_formfield.cpp')
-rw-r--r--core/fpdfdoc/doc_formfield.cpp19
1 files changed, 12 insertions, 7 deletions
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) {