summaryrefslogtreecommitdiff
path: root/core/fpdfdoc/cpdf_formfield.cpp
diff options
context:
space:
mode:
authortsepez <tsepez@chromium.org>2017-01-10 10:19:04 -0800
committerCommit bot <commit-bot@chromium.org>2017-01-10 10:19:04 -0800
commitd18b8674378b104a9b5bb1f015e3f92fc174673e (patch)
tree6216931229e3b311e6c64008846a33e5135366b7 /core/fpdfdoc/cpdf_formfield.cpp
parent3128d1c45d8bc313abb8aae151f86bbe62c52e56 (diff)
downloadpdfium-d18b8674378b104a9b5bb1f015e3f92fc174673e.tar.xz
Remove some CFX_ArrayTemplate in fpdfapi and fpdfdoc
Also use unique_ptr in one spot while we're at it. Review-Url: https://codereview.chromium.org/2625483002
Diffstat (limited to 'core/fpdfdoc/cpdf_formfield.cpp')
-rw-r--r--core/fpdfdoc/cpdf_formfield.cpp11
1 files changed, 3 insertions, 8 deletions
diff --git a/core/fpdfdoc/cpdf_formfield.cpp b/core/fpdfdoc/cpdf_formfield.cpp
index cc7054dfaf..b344327adc 100644
--- a/core/fpdfdoc/cpdf_formfield.cpp
+++ b/core/fpdfdoc/cpdf_formfield.cpp
@@ -245,11 +245,8 @@ int CPDF_FormField::GetControlIndex(const CPDF_FormControl* pControl) const {
if (!pControl)
return -1;
- for (int i = 0; i < m_ControlList.GetSize(); i++) {
- if (m_ControlList.GetAt(i) == pControl)
- return i;
- }
- return -1;
+ auto it = std::find(m_ControlList.begin(), m_ControlList.end(), pControl);
+ return it != m_ControlList.end() ? it - m_ControlList.begin() : -1;
}
int CPDF_FormField::GetFieldType() const {
@@ -414,11 +411,9 @@ int CPDF_FormField::GetMaxLen() const {
if (CPDF_Object* pObj = FPDF_GetFieldAttr(m_pDict, "MaxLen"))
return pObj->GetInteger();
- for (int i = 0; i < m_ControlList.GetSize(); i++) {
- CPDF_FormControl* pControl = m_ControlList.GetAt(i);
+ for (const auto& pControl : m_ControlList) {
if (!pControl)
continue;
-
CPDF_Dictionary* pWidgetDict = pControl->m_pWidgetDict;
if (pWidgetDict->KeyExist("MaxLen"))
return pWidgetDict->GetIntegerFor("MaxLen");