summaryrefslogtreecommitdiff
path: root/core/src/fpdfdoc/doc_formfield.cpp
diff options
context:
space:
mode:
authorLei Zhang <thestig@chromium.org>2015-12-18 16:26:45 -0800
committerLei Zhang <thestig@chromium.org>2015-12-18 16:26:45 -0800
commitd866ab0b44a571c884fdd8ba5a5319adaf607559 (patch)
treece18ed89550cf563dbdf2e421f8ff08bc6526f27 /core/src/fpdfdoc/doc_formfield.cpp
parent20c8a9a66ea710b96493c9048fb65753e68b48fc (diff)
downloadpdfium-d866ab0b44a571c884fdd8ba5a5319adaf607559.tar.xz
Get rid of a few CPDF_Object Create() methods and just use new instead.
R=ochang@chromium.org Review URL: https://codereview.chromium.org/1540693002 .
Diffstat (limited to 'core/src/fpdfdoc/doc_formfield.cpp')
-rw-r--r--core/src/fpdfdoc/doc_formfield.cpp24
1 files changed, 6 insertions, 18 deletions
diff --git a/core/src/fpdfdoc/doc_formfield.cpp b/core/src/fpdfdoc/doc_formfield.cpp
index 987dbd6b20..46ea01083d 100644
--- a/core/src/fpdfdoc/doc_formfield.cpp
+++ b/core/src/fpdfdoc/doc_formfield.cpp
@@ -571,7 +571,7 @@ FX_BOOL CPDF_FormField::SetItemSelection(int index,
m_pDict->RemoveAt("V");
}
} else if (pValue->IsArray()) {
- CPDF_Array* pArray = CPDF_Array::Create();
+ CPDF_Array* pArray = new CPDF_Array;
int iCount = CountOptions();
for (int i = 0; i < iCount; i++) {
if (i != index) {
@@ -598,13 +598,10 @@ FX_BOOL CPDF_FormField::SetItemSelection(int index,
if (!(m_Flags & FORMLIST_MULTISELECT)) {
m_pDict->SetAtString("V", PDF_EncodeText(opt_value));
} else {
- CPDF_Array* pArray = CPDF_Array::Create();
- if (!pArray) {
- return FALSE;
- }
- FX_BOOL bSelected;
+ CPDF_Array* pArray = new CPDF_Array;
int iCount = CountOptions();
for (int i = 0; i < iCount; i++) {
+ FX_BOOL bSelected;
if (i != index) {
bSelected = IsItemSelected(i);
} else {
@@ -619,10 +616,7 @@ FX_BOOL CPDF_FormField::SetItemSelection(int index,
}
} else if (m_Type == ComboBox) {
m_pDict->SetAtString("V", PDF_EncodeText(opt_value));
- CPDF_Array* pI = CPDF_Array::Create();
- if (!pI) {
- return FALSE;
- }
+ CPDF_Array* pI = new CPDF_Array;
pI->AddInteger(index);
m_pDict->SetAt("I", pI);
}
@@ -906,10 +900,7 @@ FX_BOOL CPDF_FormField::SelectOption(int iOptIndex,
if (!bSelected) {
return TRUE;
}
- pArray = CPDF_Array::Create();
- if (!pArray) {
- return FALSE;
- }
+ pArray = new CPDF_Array;
m_pDict->SetAt("I", pArray);
}
FX_BOOL bReturn = FALSE;
@@ -952,10 +943,7 @@ FX_BOOL CPDF_FormField::SelectOption(int iOptIndex,
return FALSE;
}
}
- CPDF_Number* pNum = CPDF_Number::Create(iOptIndex);
- if (!pNum) {
- return FALSE;
- }
+ CPDF_Number* pNum = new CPDF_Number(iOptIndex);
pArray->InsertAt(i, pNum);
bReturn = TRUE;
break;