summaryrefslogtreecommitdiff
path: root/core/src
diff options
context:
space:
mode:
authorLei Zhang <thestig@chromium.org>2015-10-01 15:08:10 -0700
committerLei Zhang <thestig@chromium.org>2015-10-01 15:08:10 -0700
commit24a3b4ea99a40cc251b68561469b9099419adfe9 (patch)
tree17aaf6ab021ee43d1ba4f665b8047775dd303950 /core/src
parente95f39f10400746f0dc49c8afe3b3f21cdbbf381 (diff)
downloadpdfium-24a3b4ea99a40cc251b68561469b9099419adfe9.tar.xz
XFA: Remove tests for failures after new statements.
Manual merge of commit 357d16f8453c2cf0c0afd00eec9e86d03d55fe69. Original code review: https://codereview.chromium.org/1090693002 R=tsepez@chromium.org Review URL: https://codereview.chromium.org/1379683006 .
Diffstat (limited to 'core/src')
-rw-r--r--core/src/fpdfdoc/doc_annot.cpp3
-rw-r--r--core/src/fpdfdoc/doc_form.cpp3
-rw-r--r--core/src/fpdfdoc/doc_tagged.cpp15
-rw-r--r--core/src/fpdfdoc/doc_vt.cpp17
-rw-r--r--core/src/fpdfdoc/pdf_vt.h17
5 files changed, 14 insertions, 41 deletions
diff --git a/core/src/fpdfdoc/doc_annot.cpp b/core/src/fpdfdoc/doc_annot.cpp
index e50e4057be..57b0665ec4 100644
--- a/core/src/fpdfdoc/doc_annot.cpp
+++ b/core/src/fpdfdoc/doc_annot.cpp
@@ -233,9 +233,6 @@ CPDF_Form* CPDF_Annot::GetAPForm(const CPDF_Page* pPage, AppearanceMode mode) {
return pForm;
}
pForm = new CPDF_Form(m_pList->m_pDocument, pPage->m_pResources, pStream);
- if (pForm == NULL) {
- return NULL;
- }
pForm->ParseContent(NULL, NULL, NULL, NULL);
m_APMap.SetAt(pStream, pForm);
return pForm;
diff --git a/core/src/fpdfdoc/doc_form.cpp b/core/src/fpdfdoc/doc_form.cpp
index e57ac9aa50..970b4b9f40 100644
--- a/core/src/fpdfdoc/doc_form.cpp
+++ b/core/src/fpdfdoc/doc_form.cpp
@@ -102,9 +102,6 @@ CFieldTree::_Node* CFieldTree::AddChild(_Node* pParent,
return NULL;
}
_Node* pNode = new _Node;
- if (pNode == NULL) {
- return NULL;
- }
pNode->parent = pParent;
pNode->short_name = short_name;
pNode->field_ptr = field_ptr;
diff --git a/core/src/fpdfdoc/doc_tagged.cpp b/core/src/fpdfdoc/doc_tagged.cpp
index d8e24c78b3..facad46886 100644
--- a/core/src/fpdfdoc/doc_tagged.cpp
+++ b/core/src/fpdfdoc/doc_tagged.cpp
@@ -20,9 +20,6 @@ CPDF_StructTree* CPDF_StructTree::LoadPage(const CPDF_Document* pDoc,
return NULL;
}
CPDF_StructTreeImpl* pTree = new CPDF_StructTreeImpl(pDoc);
- if (pTree == NULL) {
- return NULL;
- }
pTree->LoadPageTree(pPageDict);
return pTree;
}
@@ -31,9 +28,6 @@ CPDF_StructTree* CPDF_StructTree::LoadDoc(const CPDF_Document* pDoc) {
return NULL;
}
CPDF_StructTreeImpl* pTree = new CPDF_StructTreeImpl(pDoc);
- if (pTree == NULL) {
- return NULL;
- }
pTree->LoadDocTree();
return pTree;
}
@@ -63,9 +57,6 @@ void CPDF_StructTreeImpl::LoadDocTree() {
if (pKids->GetType() == PDFOBJ_DICTIONARY) {
CPDF_StructElementImpl* pStructElementImpl =
new CPDF_StructElementImpl(this, NULL, (CPDF_Dictionary*)pKids);
- if (pStructElementImpl == NULL) {
- return;
- }
m_Kids.Add(pStructElementImpl);
return;
}
@@ -77,9 +68,6 @@ void CPDF_StructTreeImpl::LoadDocTree() {
CPDF_Dictionary* pKid = pArray->GetDict(i);
CPDF_StructElementImpl* pStructElementImpl =
new CPDF_StructElementImpl(this, NULL, pKid);
- if (pStructElementImpl == NULL) {
- return;
- }
m_Kids.Add(pStructElementImpl);
}
}
@@ -138,9 +126,6 @@ CPDF_StructElementImpl* CPDF_StructTreeImpl::AddPageNode(CPDF_Dictionary* pDict,
return pElement;
}
pElement = new CPDF_StructElementImpl(this, NULL, pDict);
- if (pElement == NULL) {
- return NULL;
- }
map.SetAt(pDict, pElement);
CPDF_Dictionary* pParent = pDict->GetDict(FX_BSTRC("P"));
if (pParent == NULL ||
diff --git a/core/src/fpdfdoc/doc_vt.cpp b/core/src/fpdfdoc/doc_vt.cpp
index 480fce5c1e..396a7d6b71 100644
--- a/core/src/fpdfdoc/doc_vt.cpp
+++ b/core/src/fpdfdoc/doc_vt.cpp
@@ -69,14 +69,13 @@ void CSection::ResetLinePlace() {
}
CPVT_WordPlace CSection::AddWord(const CPVT_WordPlace& place,
const CPVT_WordInfo& wordinfo) {
- if (CPVT_WordInfo* pWord = new CPVT_WordInfo(wordinfo)) {
- int32_t nWordIndex =
- FPDF_MAX(FPDF_MIN(place.nWordIndex, 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);
+ int32_t nWordIndex =
+ FPDF_MAX(FPDF_MIN(place.nWordIndex, m_WordArray.GetSize()), 0);
+ if (nWordIndex == m_WordArray.GetSize()) {
+ m_WordArray.Add(pWord);
+ } else {
+ m_WordArray.InsertAt(nWordIndex, pWord);
}
return place;
}
@@ -1663,7 +1662,7 @@ FX_BOOL CPDF_VariableText::IsLatinWord(FX_WORD word) {
}
IPDF_VariableText_Iterator* CPDF_VariableText::GetIterator() {
if (!m_pVTIterator) {
- return m_pVTIterator = new CPDF_VariableText_Iterator(this);
+ m_pVTIterator = new CPDF_VariableText_Iterator(this);
}
return m_pVTIterator;
}
diff --git a/core/src/fpdfdoc/pdf_vt.h b/core/src/fpdfdoc/pdf_vt.h
index a237ef225e..2cd673fbe5 100644
--- a/core/src/fpdfdoc/pdf_vt.h
+++ b/core/src/fpdfdoc/pdf_vt.h
@@ -223,18 +223,13 @@ class CLines {
}
int32_t Add(const CPVT_LineInfo& lineinfo) {
if (m_nTotal >= GetSize()) {
- if (CLine* pLine = 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() {
for (int32_t i = GetSize() - 1; i >= m_nTotal; i--) {