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

Unified Diff: core/src/fpdfdoc/doc_formfield.cpp

Issue 1518593002: Get rid of most uses of CFX_PtrArray. (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Fix botch. Created 5 years 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/src/fpdfdoc/doc_form.cpp ('k') | core/src/fpdfdoc/tagged_int.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: core/src/fpdfdoc/doc_formfield.cpp
diff --git a/core/src/fpdfdoc/doc_formfield.cpp b/core/src/fpdfdoc/doc_formfield.cpp
index 193ed21d450f32d34e9420a7c471bec543d6208c..e8406653855a6d059c88a7f0e7503f147d8f1929 100644
--- a/core/src/fpdfdoc/doc_formfield.cpp
+++ b/core/src/fpdfdoc/doc_formfield.cpp
@@ -207,15 +207,12 @@ FX_BOOL CPDF_FormField::ResetField(FX_BOOL bNotify) {
return TRUE;
}
int CPDF_FormField::GetControlIndex(const CPDF_FormControl* pControl) {
- if (pControl == NULL) {
+ if (!pControl) {
return -1;
}
- int iCount = m_ControlList.GetSize();
- for (int i = 0; i < iCount; i++) {
- CPDF_FormControl* pFind = (CPDF_FormControl*)m_ControlList.GetAt(i);
- if (pFind == pControl) {
+ for (int i = 0; i < m_ControlList.GetSize(); i++) {
+ if (m_ControlList.GetAt(i) == pControl)
return i;
- }
}
return -1;
}
@@ -399,22 +396,19 @@ FX_BOOL CPDF_FormField::SetValue(const CFX_WideString& value, FX_BOOL bNotify) {
return SetValue(value, FALSE, bNotify);
}
int CPDF_FormField::GetMaxLen() {
- CPDF_Object* pObj = FPDF_GetFieldAttr(m_pDict, "MaxLen");
- if (pObj == NULL) {
- int iCount = m_ControlList.GetSize();
- for (int i = 0; i < iCount; i++) {
- CPDF_FormControl* pControl = (CPDF_FormControl*)m_ControlList.GetAt(i);
- if (pControl == NULL) {
- continue;
- }
- CPDF_Dictionary* pWidgetDict = pControl->m_pWidgetDict;
- if (pWidgetDict->KeyExist("MaxLen")) {
- return pWidgetDict->GetInteger("MaxLen");
- }
- }
- return 0;
+ 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);
+ if (!pControl)
+ continue;
+
+ CPDF_Dictionary* pWidgetDict = pControl->m_pWidgetDict;
+ if (pWidgetDict->KeyExist("MaxLen"))
+ return pWidgetDict->GetInteger("MaxLen");
}
- return pObj->GetInteger();
+ return 0;
}
int CPDF_FormField::CountSelectedItems() {
CPDF_Object* pValue = FPDF_GetFieldAttr(m_pDict, "V");
« no previous file with comments | « core/src/fpdfdoc/doc_form.cpp ('k') | core/src/fpdfdoc/tagged_int.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698