summaryrefslogtreecommitdiff
path: root/core
diff options
context:
space:
mode:
Diffstat (limited to 'core')
-rw-r--r--core/src/fpdfdoc/doc_annot.cpp15
-rw-r--r--core/src/fpdfdoc/doc_form.cpp14
-rw-r--r--core/src/fpdfdoc/doc_link.cpp5
-rw-r--r--core/src/fpdfdoc/doc_metadata.cpp13
-rw-r--r--core/src/fpdfdoc/doc_tagged.cpp27
-rw-r--r--core/src/fpdfdoc/doc_vt.cpp40
-rw-r--r--core/src/fpdfdoc/doc_vtmodule.cpp2
-rw-r--r--core/src/fpdfdoc/pdf_vt.h23
8 files changed, 47 insertions, 92 deletions
diff --git a/core/src/fpdfdoc/doc_annot.cpp b/core/src/fpdfdoc/doc_annot.cpp
index 8952845570..cc6b5ccfee 100644
--- a/core/src/fpdfdoc/doc_annot.cpp
+++ b/core/src/fpdfdoc/doc_annot.cpp
@@ -37,10 +37,7 @@ CPDF_AnnotList::CPDF_AnnotList(CPDF_Page* pPage)
pAnnots->RemoveAt(i + 1);
pDict = pAnnots->GetDict(i);
}
- CPDF_Annot* pAnnot = FX_NEW CPDF_Annot(pDict);
- if (pAnnot == NULL) {
- break;
- }
+ CPDF_Annot* pAnnot = new CPDF_Annot(pDict);
pAnnot->m_pList = this;
m_AnnotList.Add(pAnnot);
if (bRegenerateAP && pDict->GetConstString(FX_BSTRC("Subtype")) == FX_BSTRC("Widget"))
@@ -225,10 +222,7 @@ CPDF_Form* CPDF_Annot::GetAPForm(const CPDF_Page* pPage, AppearanceMode mode)
if (m_APMap.Lookup(pStream, (void*&)pForm)) {
return pForm;
}
- pForm = FX_NEW CPDF_Form(m_pList->m_pDocument, pPage->m_pResources, pStream);
- if (pForm == NULL) {
- return NULL;
- }
+ pForm = new CPDF_Form(m_pList->m_pDocument, pPage->m_pResources, pStream);
pForm->ParseContent(NULL, NULL, NULL, NULL);
m_APMap.SetAt(pStream, pForm);
return pForm;
@@ -323,10 +317,7 @@ CPDF_PageObject* CPDF_Annot::GetBorder(FX_BOOL bPrint, const CPDF_RenderOptions*
int B = (FX_INT32)(pColor->GetNumber(2) * 255);
argb = ArgbEncode(0xff, R, G, B);
}
- CPDF_PathObject *pPathObject = FX_NEW CPDF_PathObject();
- if (!pPathObject) {
- return NULL;
- }
+ CPDF_PathObject *pPathObject = new CPDF_PathObject();
CPDF_GraphStateData *pGraphState = pPathObject->m_GraphState.GetModify();
if (!pGraphState) {
pPathObject->Release();
diff --git a/core/src/fpdfdoc/doc_form.cpp b/core/src/fpdfdoc/doc_form.cpp
index d8ca525f0a..47f4a9139c 100644
--- a/core/src/fpdfdoc/doc_form.cpp
+++ b/core/src/fpdfdoc/doc_form.cpp
@@ -126,10 +126,7 @@ CFieldTree::_Node *CFieldTree::AddChild(_Node *pParent, const CFX_WideString &sh
if (pParent == NULL) {
return NULL;
}
- _Node *pNode = FX_NEW _Node;
- if (pNode == NULL) {
- return NULL;
- }
+ _Node* pNode = new _Node;
pNode->parent = pParent;
pNode->short_name = short_name;
pNode->field_ptr = field_ptr;
@@ -270,7 +267,7 @@ CPDF_InterForm::CPDF_InterForm(CPDF_Document* pDocument, FX_BOOL bGenerateAP) :
m_bGenerateAP = bGenerateAP;
m_pFormNotify = NULL;
m_bUpdated = FALSE;
- m_pFieldTree = FX_NEW CFieldTree;
+ m_pFieldTree = new CFieldTree;
CPDF_Dictionary* pRoot = m_pDocument->GetRoot();
m_pFormDict = pRoot->GetDict("AcroForm");
if (m_pFormDict == NULL) {
@@ -1334,7 +1331,7 @@ CPDF_FormField* CPDF_InterForm::AddTerminalField(const CPDF_Dictionary* pFieldDi
}
}
}
- pField = FX_NEW CPDF_FormField(this, pParent);
+ pField = new CPDF_FormField(this, pParent);
CPDF_Object* pTObj = pDict->GetElement("T");
if (pTObj && pTObj->GetType() == PDFOBJ_REFERENCE) {
CPDF_Object* pClone = pTObj->Clone(TRUE);
@@ -1371,10 +1368,7 @@ CPDF_FormControl* CPDF_InterForm::AddControl(const CPDF_FormField* pField, const
if (m_ControlMap.Lookup((CPDF_Dictionary*)pWidgetDict, rValue)) {
return (CPDF_FormControl*)rValue;
}
- CPDF_FormControl* pControl = FX_NEW CPDF_FormControl((CPDF_FormField*)pField, (CPDF_Dictionary*)pWidgetDict);
- if (pControl == NULL) {
- return NULL;
- }
+ CPDF_FormControl* pControl = new CPDF_FormControl((CPDF_FormField*)pField, (CPDF_Dictionary*)pWidgetDict);
m_ControlMap.SetAt((CPDF_Dictionary*)pWidgetDict, pControl);
((CPDF_FormField*)pField)->m_ControlList.Add(pControl);
return pControl;
diff --git a/core/src/fpdfdoc/doc_link.cpp b/core/src/fpdfdoc/doc_link.cpp
index 4a42e21388..9a08d1583e 100644
--- a/core/src/fpdfdoc/doc_link.cpp
+++ b/core/src/fpdfdoc/doc_link.cpp
@@ -24,10 +24,7 @@ CFX_PtrArray* CPDF_LinkList::GetPageLinks(CPDF_Page* pPage)
}
CFX_PtrArray* pPageLinkList = NULL;
if (!m_PageMap.Lookup((FX_LPVOID)(FX_UINTPTR)objnum, (FX_LPVOID&)pPageLinkList)) {
- pPageLinkList = FX_NEW CFX_PtrArray;
- if (pPageLinkList == NULL) {
- return NULL;
- }
+ pPageLinkList = new CFX_PtrArray;
m_PageMap.SetAt((FX_LPVOID)(FX_UINTPTR)objnum, pPageLinkList);
LoadPageLinks(pPage, pPageLinkList);
}
diff --git a/core/src/fpdfdoc/doc_metadata.cpp b/core/src/fpdfdoc/doc_metadata.cpp
index 232f6eea21..e6c7a641e6 100644
--- a/core/src/fpdfdoc/doc_metadata.cpp
+++ b/core/src/fpdfdoc/doc_metadata.cpp
@@ -28,14 +28,13 @@ CPDF_Metadata::CPDF_Metadata()
{
m_pData = FX_Alloc(PDFDOC_METADATA, 1);
CFX_CMapByteStringToPtr *&pStringMap = ((PDFDOC_LPMETADATA)m_pData)->m_pStringMap;
- pStringMap = FX_NEW CFX_CMapByteStringToPtr;
- if (pStringMap != NULL) {
- CFX_ByteString bstr;
- for (int i = 0; i < 18; i += 2) {
- bstr = gs_FPDFDOC_Metadata_Titles[i];
- pStringMap->AddValue(bstr, (void*)gs_FPDFDOC_Metadata_Titles[i + 1]);
- }
+ pStringMap = new CFX_CMapByteStringToPtr;
+ CFX_ByteString bstr;
+ for (int i = 0; i < 18; i += 2) {
+ bstr = gs_FPDFDOC_Metadata_Titles[i];
+ pStringMap->AddValue(bstr, (void*)gs_FPDFDOC_Metadata_Titles[i + 1]);
}
+
}
CPDF_Metadata::~CPDF_Metadata()
{
diff --git a/core/src/fpdfdoc/doc_tagged.cpp b/core/src/fpdfdoc/doc_tagged.cpp
index c5fe39b6ee..e3cd744c61 100644
--- a/core/src/fpdfdoc/doc_tagged.cpp
+++ b/core/src/fpdfdoc/doc_tagged.cpp
@@ -20,10 +20,7 @@ CPDF_StructTree* CPDF_StructTree::LoadPage(const CPDF_Document* pDoc, const CPDF
if (!IsTagged(pDoc)) {
return NULL;
}
- CPDF_StructTreeImpl* pTree = FX_NEW CPDF_StructTreeImpl(pDoc);
- if (pTree == NULL) {
- return NULL;
- }
+ CPDF_StructTreeImpl* pTree = new CPDF_StructTreeImpl(pDoc);
pTree->LoadPageTree(pPageDict);
return pTree;
}
@@ -32,10 +29,7 @@ CPDF_StructTree* CPDF_StructTree::LoadDoc(const CPDF_Document* pDoc)
if (!IsTagged(pDoc)) {
return NULL;
}
- CPDF_StructTreeImpl* pTree = FX_NEW CPDF_StructTreeImpl(pDoc);
- if (pTree == NULL) {
- return NULL;
- }
+ CPDF_StructTreeImpl* pTree = new CPDF_StructTreeImpl(pDoc);
pTree->LoadDocTree();
return pTree;
}
@@ -66,10 +60,7 @@ void CPDF_StructTreeImpl::LoadDocTree()
return;
}
if (pKids->GetType() == PDFOBJ_DICTIONARY) {
- CPDF_StructElementImpl* pStructElementImpl = FX_NEW CPDF_StructElementImpl(this, NULL, (CPDF_Dictionary*)pKids);
- if (pStructElementImpl == NULL) {
- return;
- }
+ CPDF_StructElementImpl* pStructElementImpl = new CPDF_StructElementImpl(this, NULL, (CPDF_Dictionary*)pKids);
m_Kids.Add(pStructElementImpl);
return;
}
@@ -79,10 +70,7 @@ void CPDF_StructTreeImpl::LoadDocTree()
CPDF_Array* pArray = (CPDF_Array*)pKids;
for (FX_DWORD i = 0; i < pArray->GetCount(); i ++) {
CPDF_Dictionary* pKid = pArray->GetDict(i);
- CPDF_StructElementImpl* pStructElementImpl = FX_NEW CPDF_StructElementImpl(this, NULL, pKid);
- if (pStructElementImpl == NULL) {
- return;
- }
+ CPDF_StructElementImpl* pStructElementImpl = new CPDF_StructElementImpl(this, NULL, pKid);
m_Kids.Add(pStructElementImpl);
}
}
@@ -140,10 +128,7 @@ CPDF_StructElementImpl* CPDF_StructTreeImpl::AddPageNode(CPDF_Dictionary* pDict,
if (map.Lookup(pDict, (FX_LPVOID&)pElement)) {
return pElement;
}
- pElement = FX_NEW CPDF_StructElementImpl(this, NULL, pDict);
- if (pElement == NULL) {
- return NULL;
- }
+ pElement = new CPDF_StructElementImpl(this, NULL, pDict);
map.SetAt(pDict, pElement);
CPDF_Dictionary* pParent = pDict->GetDict(FX_BSTRC("P"));
if (pParent == NULL || pParent->GetString(FX_BSTRC("Type")) == FX_BSTRC("StructTreeRoot")) {
@@ -321,7 +306,7 @@ void CPDF_StructElementImpl::LoadKid(FX_DWORD PageObjNum, CPDF_Object* pKidObj,
pKid->m_Type = CPDF_StructKid::Element;
pKid->m_Element.m_pDict = pKidDict;
if (m_pTree->m_pPage == NULL) {
- pKid->m_Element.m_pElement = FX_NEW CPDF_StructElementImpl(m_pTree, this, pKidDict);
+ pKid->m_Element.m_pElement = new CPDF_StructElementImpl(m_pTree, this, pKidDict);
} else {
pKid->m_Element.m_pElement = NULL;
}
diff --git a/core/src/fpdfdoc/doc_vt.cpp b/core/src/fpdfdoc/doc_vt.cpp
index fd3f5bafd1..3ae23ffcbc 100644
--- a/core/src/fpdfdoc/doc_vt.cpp
+++ b/core/src/fpdfdoc/doc_vt.cpp
@@ -77,13 +77,12 @@ void CSection::ResetLinePlace()
}
CPVT_WordPlace CSection::AddWord(const CPVT_WordPlace & place, const CPVT_WordInfo & wordinfo)
{
- if (CPVT_WordInfo * pWord = FX_NEW CPVT_WordInfo(wordinfo)) {
- FX_INT32 nWordIndex = FPDF_MAX(FPDF_MIN(place.nWordIndex, this->m_WordArray.GetSize()), 0);
- if (nWordIndex == m_WordArray.GetSize()) {
- m_WordArray.Add(pWord);
- } else {
- m_WordArray.InsertAt(nWordIndex, pWord);
- }
+ CPVT_WordInfo * pWord = new CPVT_WordInfo(wordinfo);
+ FX_INT32 nWordIndex = FPDF_MAX(FPDF_MIN(place.nWordIndex, this->m_WordArray.GetSize()), 0);
+ if (nWordIndex == m_WordArray.GetSize()) {
+ m_WordArray.Add(pWord);
+ } else {
+ m_WordArray.InsertAt(nWordIndex, pWord);
}
return place;
}
@@ -834,8 +833,8 @@ void CPDF_VariableText::Initialize()
if (!m_bInitial) {
CPVT_SectionInfo secinfo;
if (m_bRichText) {
- secinfo.pSecProps = FX_NEW CPVT_SecProps(0.0f, 0.0f, 0);
- secinfo.pWordProps = FX_NEW CPVT_WordProps(GetDefaultFontIndex(), PVT_DEFAULT_FONTSIZE, 0, 0, 0);
+ secinfo.pSecProps = new CPVT_SecProps(0.0f, 0.0f, 0);
+ secinfo.pWordProps = new CPVT_WordProps(GetDefaultFontIndex(), PVT_DEFAULT_FONTSIZE, 0, 0, 0);
}
CPVT_WordPlace place;
place.nSecIndex = 0;
@@ -868,11 +867,9 @@ CPVT_WordPlace CPDF_VariableText::InsertWord(const CPVT_WordPlace & place, FX_WO
CPVT_WordPlace newplace = place;
newplace.nWordIndex ++;
if (m_bRichText) {
- CPVT_WordProps * pNewProps = pWordProps ? FX_NEW CPVT_WordProps(*pWordProps) : FX_NEW CPVT_WordProps();
- if (pNewProps) {
- pNewProps->nFontIndex = GetWordFontIndex(word, charset, pWordProps->nFontIndex);
- return AddWord(newplace, CPVT_WordInfo(word, charset, -1, pNewProps));
- }
+ CPVT_WordProps * pNewProps = pWordProps ? new CPVT_WordProps(*pWordProps) : new CPVT_WordProps();
+ pNewProps->nFontIndex = GetWordFontIndex(word, charset, pWordProps->nFontIndex);
+ return AddWord(newplace, CPVT_WordInfo(word, charset, -1, pNewProps));
} else {
FX_INT32 nFontIndex = GetSubWord() > 0 ? GetDefaultFontIndex() : GetWordFontIndex(word, charset, GetDefaultFontIndex());
return AddWord(newplace, CPVT_WordInfo(word, charset, nFontIndex, NULL));
@@ -900,10 +897,10 @@ CPVT_WordPlace CPDF_VariableText::InsertSection(const CPVT_WordPlace & place, co
CPVT_SectionInfo secinfo;
if (m_bRichText) {
if (pSecProps) {
- secinfo.pSecProps = FX_NEW CPVT_SecProps(*pSecProps);
+ secinfo.pSecProps = new CPVT_SecProps(*pSecProps);
}
if (pWordProps) {
- secinfo.pWordProps = FX_NEW CPVT_WordProps(*pWordProps);
+ secinfo.pWordProps = new CPVT_WordProps(*pWordProps);
}
}
AddSection(NewPlace, secinfo);
@@ -989,10 +986,10 @@ void CPDF_VariableText::SetText(FX_LPCWSTR text, FX_INT32 charset, const CPVT_Se
CPVT_SectionInfo secinfo;
if (m_bRichText) {
if (pSecProps) {
- secinfo.pSecProps = FX_NEW CPVT_SecProps(*pSecProps);
+ secinfo.pSecProps = new CPVT_SecProps(*pSecProps);
}
if (pWordProps) {
- secinfo.pWordProps = FX_NEW CPVT_WordProps(*pWordProps);
+ secinfo.pWordProps = new CPVT_WordProps(*pWordProps);
}
}
if (CSection * pSection = m_SectionArray.GetAt(0)) {
@@ -1280,10 +1277,7 @@ CPVT_WordPlace CPDF_VariableText::AddSection(const CPVT_WordPlace & place, const
return place;
}
FX_INT32 nSecIndex = FPDF_MAX(FPDF_MIN(place.nSecIndex, m_SectionArray.GetSize()), 0);
- CSection * pSection = FX_NEW CSection(this);
- if (!pSection) {
- return place;
- }
+ CSection * pSection = new CSection(this);
pSection->m_SecInfo = secinfo;
pSection->SecPlace.nSecIndex = nSecIndex;
if (nSecIndex == m_SectionArray.GetSize()) {
@@ -1676,7 +1670,7 @@ FX_BOOL CPDF_VariableText::IsLatinWord(FX_WORD word)
IPDF_VariableText_Iterator * CPDF_VariableText::GetIterator()
{
if (!m_pVTIterator) {
- return m_pVTIterator = FX_NEW CPDF_VariableText_Iterator(this);
+ m_pVTIterator = new CPDF_VariableText_Iterator(this);
}
return m_pVTIterator;
}
diff --git a/core/src/fpdfdoc/doc_vtmodule.cpp b/core/src/fpdfdoc/doc_vtmodule.cpp
index c44cbacf3c..f82de258a6 100644
--- a/core/src/fpdfdoc/doc_vtmodule.cpp
+++ b/core/src/fpdfdoc/doc_vtmodule.cpp
@@ -9,7 +9,7 @@
#include "pdf_vt.h"
IPDF_VariableText* IPDF_VariableText::NewVariableText()
{
- return FX_NEW CPDF_VariableText();
+ return new CPDF_VariableText();
}
void IPDF_VariableText::DelVariableText(IPDF_VariableText* pVT)
{
diff --git a/core/src/fpdfdoc/pdf_vt.h b/core/src/fpdfdoc/pdf_vt.h
index f910dfd372..19c75479ea 100644
--- a/core/src/fpdfdoc/pdf_vt.h
+++ b/core/src/fpdfdoc/pdf_vt.h
@@ -106,14 +106,14 @@ struct CPVT_SectionInfo {
if (pSecProps) {
*pSecProps = *other.pSecProps;
} else {
- pSecProps = FX_NEW CPVT_SecProps(*other.pSecProps);
+ pSecProps = new CPVT_SecProps(*other.pSecProps);
}
}
if (other.pWordProps) {
if (pWordProps) {
*pWordProps = *other.pWordProps;
} else {
- pWordProps = FX_NEW CPVT_WordProps(*other.pWordProps);
+ pWordProps = new CPVT_WordProps(*other.pWordProps);
}
}
}
@@ -169,7 +169,7 @@ struct CPVT_WordInfo {
if (pWordProps) {
*pWordProps = *word.pWordProps;
} else {
- pWordProps = FX_NEW CPVT_WordProps(*word.pWordProps);
+ pWordProps = new CPVT_WordProps(*word.pWordProps);
}
}
}
@@ -258,18 +258,13 @@ public:
FX_INT32 Add(const CPVT_LineInfo & lineinfo)
{
if (m_nTotal >= GetSize()) {
- if (CLine * pLine = FX_NEW CLine) {
- pLine->m_LineInfo = lineinfo;
- m_Lines.Add(pLine);
- return m_nTotal++;
- }
- return m_nTotal;
- } else {
- if (CLine * pLine = GetAt(m_nTotal)) {
- pLine->m_LineInfo = lineinfo;
- }
- return m_nTotal++;
+ CLine* pLine = new CLine;
+ pLine->m_LineInfo = lineinfo;
+ m_Lines.Add(pLine);
+ } else if (CLine* pLine = GetAt(m_nTotal)) {
+ pLine->m_LineInfo = lineinfo;
}
+ return m_nTotal++;
}
void Clear()
{