summaryrefslogtreecommitdiff
path: root/core/src/fpdfdoc/doc_formfield.cpp
diff options
context:
space:
mode:
authorTom Sepez <tsepez@chromium.org>2015-12-09 16:26:21 -0800
committerTom Sepez <tsepez@chromium.org>2015-12-09 16:26:21 -0800
commit035359cd8ddb555fa33b6133db4fd405e4660712 (patch)
tree89accecac7da250468166168cd502ed7b92c7ce7 /core/src/fpdfdoc/doc_formfield.cpp
parent0c92bed7ade20fe193dce0a481dad48e1be41622 (diff)
downloadpdfium-035359cd8ddb555fa33b6133db4fd405e4660712.tar.xz
Get rid of most uses of CFX_PtrArray.
I didn't go whole hog and replace these with std::vector, but in the mean time, it is silly to cast a typedef for a template instantiated against void* when we can just instantiate the template against the actual type. The ones that remain are actual heterogeneous arrays with wacky casting. R=thestig@chromium.org Review URL: https://codereview.chromium.org/1518593002 .
Diffstat (limited to 'core/src/fpdfdoc/doc_formfield.cpp')
-rw-r--r--core/src/fpdfdoc/doc_formfield.cpp36
1 files changed, 15 insertions, 21 deletions
diff --git a/core/src/fpdfdoc/doc_formfield.cpp b/core/src/fpdfdoc/doc_formfield.cpp
index 193ed21d45..e840665385 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");