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

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

Issue 1540693002: Get rid of a few CPDF_Object Create() methods and just use new instead. (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: rebase 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/doc_utils.cpp » ('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 987dbd6b208ecc1a17acd00126830cfa6e4a7eb6..46ea01083d3d0383d4c0c9a871dc2f0959b29063 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;
« no previous file with comments | « core/src/fpdfdoc/doc_form.cpp ('k') | core/src/fpdfdoc/doc_utils.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698