Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(2029)

Unified Diff: core/fpdfdoc/cpdf_formfield.cpp

Issue 2625483002: Remove some CFX_ArrayTemplate in fpdfapi and fpdfdoc (Closed)
Patch Set: coments Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « core/fpdfdoc/cpdf_formfield.h ('k') | core/fpdfdoc/cpdf_interform.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: core/fpdfdoc/cpdf_formfield.cpp
diff --git a/core/fpdfdoc/cpdf_formfield.cpp b/core/fpdfdoc/cpdf_formfield.cpp
index cc7054dfaf7365ea0bf8442dbf146c89cf980e51..b344327adc329a9e01ada4301caef90814c191ed 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");
« no previous file with comments | « core/fpdfdoc/cpdf_formfield.h ('k') | core/fpdfdoc/cpdf_interform.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698