diff options
Diffstat (limited to 'core/src/fpdfdoc')
-rw-r--r-- | core/src/fpdfdoc/doc_ap.cpp | 17 | ||||
-rw-r--r-- | core/src/fpdfdoc/doc_basic.cpp | 2 | ||||
-rw-r--r-- | core/src/fpdfdoc/doc_form.cpp | 17 | ||||
-rw-r--r-- | core/src/fpdfdoc/doc_formfield.cpp | 24 | ||||
-rw-r--r-- | core/src/fpdfdoc/doc_utils.cpp | 6 |
5 files changed, 17 insertions, 49 deletions
diff --git a/core/src/fpdfdoc/doc_ap.cpp b/core/src/fpdfdoc/doc_ap.cpp index 0efaa8caa5..d0adc06691 100644 --- a/core/src/fpdfdoc/doc_ap.cpp +++ b/core/src/fpdfdoc/doc_ap.cpp @@ -311,10 +311,7 @@ static FX_BOOL GenerateWidgetAP(CPDF_Document* pDoc, return FALSE; } if (!pFontDict) { - pFontDict = CPDF_Dictionary::Create(); - if (!pFontDict) { - return FALSE; - } + pFontDict = new CPDF_Dictionary; pFontDict->SetAtName("Type", "Font"); pFontDict->SetAtName("Subtype", "Type1"); pFontDict->SetAtName("BaseFont", "Helvetica"); @@ -419,7 +416,7 @@ static FX_BOOL GenerateWidgetAP(CPDF_Document* pDoc, rcBody.Normalize(); CPDF_Dictionary* pAPDict = pAnnotDict->GetDict("AP"); if (!pAPDict) { - pAPDict = CPDF_Dictionary::Create(); + pAPDict = new CPDF_Dictionary; pAnnotDict->SetAt("AP", pAPDict); } CPDF_Stream* pNormalStream = pAPDict->GetStream("N"); @@ -436,10 +433,7 @@ static FX_BOOL GenerateWidgetAP(CPDF_Document* pDoc, if (pStreamResList) { CPDF_Dictionary* pStreamResFontList = pStreamResList->GetDict("Font"); if (!pStreamResFontList) { - pStreamResFontList = CPDF_Dictionary::Create(); - if (!pStreamResFontList) { - return FALSE; - } + pStreamResFontList = new CPDF_Dictionary; pStreamResList->SetAt("Font", pStreamResFontList); } if (!pStreamResFontList->KeyExist(sFontName)) { @@ -684,10 +678,7 @@ static FX_BOOL GenerateWidgetAP(CPDF_Document* pDoc, if (pStreamResList) { CPDF_Dictionary* pStreamResFontList = pStreamResList->GetDict("Font"); if (!pStreamResFontList) { - pStreamResFontList = CPDF_Dictionary::Create(); - if (!pStreamResFontList) { - return FALSE; - } + pStreamResFontList = new CPDF_Dictionary; pStreamResList->SetAt("Font", pStreamResFontList); } if (!pStreamResFontList->KeyExist(sFontName)) { diff --git a/core/src/fpdfdoc/doc_basic.cpp b/core/src/fpdfdoc/doc_basic.cpp index d976650ae0..3fb997878b 100644 --- a/core/src/fpdfdoc/doc_basic.cpp +++ b/core/src/fpdfdoc/doc_basic.cpp @@ -329,7 +329,7 @@ FX_BOOL CPDF_FileSpec::GetFileName(CFX_WideString& csFileName) const { return TRUE; } CPDF_FileSpec::CPDF_FileSpec() { - m_pObj = CPDF_Dictionary::Create(); + m_pObj = new CPDF_Dictionary; if (CPDF_Dictionary* pDict = ToDictionary(m_pObj)) { pDict->SetAtName("Type", "Filespec"); } diff --git a/core/src/fpdfdoc/doc_form.cpp b/core/src/fpdfdoc/doc_form.cpp index 20b59cd498..9f949cc965 100644 --- a/core/src/fpdfdoc/doc_form.cpp +++ b/core/src/fpdfdoc/doc_form.cpp @@ -1048,10 +1048,7 @@ CFDF_Document* CPDF_InterForm::ExportToFDF( pMainDict->SetAt("F", static_cast<CPDF_Object*>(filespec)); } } - CPDF_Array* pFields = CPDF_Array::Create(); - if (!pFields) { - return NULL; - } + CPDF_Array* pFields = new CPDF_Array; pMainDict->SetAt("Fields", pFields); int nCount = m_pFieldTree->m_Root.CountFields(); for (int i = 0; i < nCount; i++) { @@ -1069,16 +1066,8 @@ CFDF_Document* CPDF_InterForm::ExportToFDF( continue; CFX_WideString fullname = GetFullName(pField->GetFieldDict()); - CPDF_Dictionary* pFieldDict = CPDF_Dictionary::Create(); - if (!pFieldDict) - return nullptr; - - CPDF_String* pString = CPDF_String::Create(fullname); - if (!pString) { - pFieldDict->Release(); - return nullptr; - } - pFieldDict->SetAt("T", pString); + CPDF_Dictionary* pFieldDict = new CPDF_Dictionary; + pFieldDict->SetAt("T", new CPDF_String(fullname)); if (pField->GetType() == CPDF_FormField::CheckBox || pField->GetType() == CPDF_FormField::RadioButton) { CFX_WideString csExport = pField->GetCheckValue(FALSE); 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; diff --git a/core/src/fpdfdoc/doc_utils.cpp b/core/src/fpdfdoc/doc_utils.cpp index b0705ea556..01a7470ef0 100644 --- a/core/src/fpdfdoc/doc_utils.cpp +++ b/core/src/fpdfdoc/doc_utils.cpp @@ -228,7 +228,7 @@ void InitInterFormDict(CPDF_Dictionary*& pFormDict, CPDF_Document* pDocument) { return; } if (!pFormDict) { - pFormDict = CPDF_Dictionary::Create(); + pFormDict = new CPDF_Dictionary; FX_DWORD dwObjNum = pDocument->AddIndirectObject(pFormDict); CPDF_Dictionary* pRoot = pDocument->GetRoot(); pRoot->SetAtReference("AcroForm", pDocument, dwObjNum); @@ -560,12 +560,12 @@ void AddInterFormFont(CPDF_Dictionary*& pFormDict, } CPDF_Dictionary* pDR = pFormDict->GetDict("DR"); if (!pDR) { - pDR = CPDF_Dictionary::Create(); + pDR = new CPDF_Dictionary; pFormDict->SetAt("DR", pDR); } CPDF_Dictionary* pFonts = pDR->GetDict("Font"); if (!pFonts) { - pFonts = CPDF_Dictionary::Create(); + pFonts = new CPDF_Dictionary; pDR->SetAt("Font", pFonts); } if (csNameTag.IsEmpty()) { |