summaryrefslogtreecommitdiff
path: root/core
diff options
context:
space:
mode:
authorTom Sepez <tsepez@chromium.org>2015-10-26 15:09:33 -0700
committerTom Sepez <tsepez@chromium.org>2015-10-26 15:09:33 -0700
commit811a4f617283a3ea22381a293b71d3c68c628905 (patch)
tree317ab838ad97d630a6f4d858319baa9ac4e3c91d /core
parentb1abf37585d86df780603a5d8a5a6af4161202a6 (diff)
downloadpdfium-811a4f617283a3ea22381a293b71d3c68c628905.tar.xz
Remove CPDF_Reference::Create(), make logic match master
Makes the files in this CL identical to master, since there are no XFA specifics. R=thestig@chromium.org Review URL: https://codereview.chromium.org/1425663003 .
Diffstat (limited to 'core')
-rw-r--r--core/include/fpdfapi/fpdf_objects.h4
-rw-r--r--core/src/fpdfapi/fpdf_edit/fpdf_edit_doc.cpp3
-rw-r--r--core/src/fpdfapi/fpdf_parser/fpdf_parser_objects.cpp17
-rw-r--r--core/src/fpdfdoc/doc_annot.cpp5
4 files changed, 10 insertions, 19 deletions
diff --git a/core/include/fpdfapi/fpdf_objects.h b/core/include/fpdfapi/fpdf_objects.h
index 7287814f9a..419d5fc23e 100644
--- a/core/include/fpdfapi/fpdf_objects.h
+++ b/core/include/fpdfapi/fpdf_objects.h
@@ -585,10 +585,6 @@ class CPDF_Null : public CPDF_Object {
};
class CPDF_Reference : public CPDF_Object {
public:
- static CPDF_Reference* Create(CPDF_IndirectObjects* pDoc, int objnum) {
- return new CPDF_Reference(pDoc, objnum);
- }
-
CPDF_Reference(CPDF_IndirectObjects* pDoc, int objnum)
: CPDF_Object(PDFOBJ_REFERENCE), m_pObjList(pDoc), m_RefObjNum(objnum) {}
diff --git a/core/src/fpdfapi/fpdf_edit/fpdf_edit_doc.cpp b/core/src/fpdfapi/fpdf_edit/fpdf_edit_doc.cpp
index 0f6d973a3a..9c1c292fb7 100644
--- a/core/src/fpdfapi/fpdf_edit/fpdf_edit_doc.cpp
+++ b/core/src/fpdfapi/fpdf_edit/fpdf_edit_doc.cpp
@@ -1026,8 +1026,7 @@ static int InsertDeletePDFPage(CPDF_Document* pDoc,
if (pKid->GetString("Type") == FX_BSTRC("Page")) {
if (nPagesToGo == 0) {
if (bInsert) {
- pKidList->InsertAt(i,
- CPDF_Reference::Create(pDoc, pPage->GetObjNum()));
+ pKidList->InsertAt(i, new CPDF_Reference(pDoc, pPage->GetObjNum()));
pPage->SetAtReference("Parent", pDoc, pPages->GetObjNum());
} else {
pKidList->RemoveAt(i);
diff --git a/core/src/fpdfapi/fpdf_parser/fpdf_parser_objects.cpp b/core/src/fpdfapi/fpdf_parser/fpdf_parser_objects.cpp
index 2bf529accd..07b1a208d7 100644
--- a/core/src/fpdfapi/fpdf_parser/fpdf_parser_objects.cpp
+++ b/core/src/fpdfapi/fpdf_parser/fpdf_parser_objects.cpp
@@ -521,7 +521,7 @@ void CPDF_Array::SetAt(FX_DWORD i,
pOld->Release();
if (pObj->GetObjNum()) {
ASSERT(pObjs != NULL);
- pObj = CPDF_Reference::Create(pObjs, pObj->GetObjNum());
+ pObj = new CPDF_Reference(pObjs, pObj->GetObjNum());
}
m_Objects.SetAt(i, pObj);
}
@@ -531,7 +531,7 @@ void CPDF_Array::InsertAt(FX_DWORD index,
ASSERT(pObj != NULL);
if (pObj->GetObjNum()) {
ASSERT(pObjs != NULL);
- pObj = CPDF_Reference::Create(pObjs, pObj->GetObjNum());
+ pObj = new CPDF_Reference(pObjs, pObj->GetObjNum());
}
m_Objects.InsertAt(index, pObj);
}
@@ -539,7 +539,7 @@ void CPDF_Array::Add(CPDF_Object* pObj, CPDF_IndirectObjects* pObjs) {
ASSERT(pObj != NULL);
if (pObj->GetObjNum()) {
ASSERT(pObjs != NULL);
- pObj = CPDF_Reference::Create(pObjs, pObj->GetObjNum());
+ pObj = new CPDF_Reference(pObjs, pObj->GetObjNum());
}
m_Objects.Add(pObj);
}
@@ -731,7 +731,7 @@ void CPDF_Dictionary::SetAt(const CFX_ByteStringC& key,
if (pObj) {
if (pObj->GetObjNum()) {
ASSERT(pObjs != NULL);
- pObj = CPDF_Reference::Create(pObjs, pObj->GetObjNum());
+ pObj = new CPDF_Reference(pObjs, pObj->GetObjNum());
}
m_Map.SetAt(key, pObj);
} else {
@@ -967,15 +967,14 @@ FX_BOOL CPDF_Stream::Identical(CPDF_Stream* pOther) const {
IFX_FileRead* pFile = NULL;
uint8_t* pBuf = NULL;
FX_DWORD offset = 0;
- if (m_GenNum != (FX_DWORD)-1) {
- pFile = m_pFile;
- pBuf = pOther->m_pDataBuf;
- offset = m_FileOffset;
- }
if (pOther->m_GenNum != (FX_DWORD)-1) {
pFile = pOther->m_pFile;
pBuf = m_pDataBuf;
offset = pOther->m_FileOffset;
+ } else if (m_GenNum != (FX_DWORD)-1) {
+ pFile = m_pFile;
+ pBuf = pOther->m_pDataBuf;
+ offset = m_FileOffset;
}
if (NULL == pBuf) {
return FALSE;
diff --git a/core/src/fpdfdoc/doc_annot.cpp b/core/src/fpdfdoc/doc_annot.cpp
index dc5ccb811c..d37b1aaadb 100644
--- a/core/src/fpdfdoc/doc_annot.cpp
+++ b/core/src/fpdfdoc/doc_annot.cpp
@@ -30,10 +30,7 @@ CPDF_AnnotList::CPDF_AnnotList(CPDF_Page* pPage) {
FX_DWORD dwObjNum = pDict->GetObjNum();
if (dwObjNum == 0) {
dwObjNum = m_pDocument->AddIndirectObject(pDict);
- CPDF_Reference* pAction = CPDF_Reference::Create(m_pDocument, dwObjNum);
- if (pAction == NULL) {
- break;
- }
+ CPDF_Reference* pAction = new CPDF_Reference(m_pDocument, dwObjNum);
pAnnots->InsertAt(i, pAction);
pAnnots->RemoveAt(i + 1);
pDict = pAnnots->GetDict(i);