summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--core/include/fpdfapi/fpdf_objects.h6
-rw-r--r--core/src/fpdfapi/fpdf_edit/fpdf_edit_doc.cpp3
-rw-r--r--core/src/fpdfapi/fpdf_parser/fpdf_parser_objects.cpp8
-rw-r--r--core/src/fpdfapi/fpdf_parser/fpdf_parser_parser.cpp28
-rw-r--r--core/src/fpdfdoc/doc_annot.cpp5
5 files changed, 17 insertions, 33 deletions
diff --git a/core/include/fpdfapi/fpdf_objects.h b/core/include/fpdfapi/fpdf_objects.h
index 570dc410c2..45b7cc63cb 100644
--- a/core/include/fpdfapi/fpdf_objects.h
+++ b/core/include/fpdfapi/fpdf_objects.h
@@ -675,12 +675,6 @@ public:
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 2db8d6095f..c37e92d832 100644
--- a/core/src/fpdfapi/fpdf_edit/fpdf_edit_doc.cpp
+++ b/core/src/fpdfapi/fpdf_edit/fpdf_edit_doc.cpp
@@ -1063,7 +1063,8 @@ static int InsertDeletePDFPage(CPDF_Document* pDoc, CPDF_Dictionary* pPages,
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 3f9f4ccc82..a3e409df57 100644
--- a/core/src/fpdfapi/fpdf_parser/fpdf_parser_objects.cpp
+++ b/core/src/fpdfapi/fpdf_parser/fpdf_parser_objects.cpp
@@ -506,7 +506,7 @@ void CPDF_Array::SetAt(FX_DWORD i, CPDF_Object* pObj, CPDF_IndirectObjects* pObj
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);
}
@@ -515,7 +515,7 @@ void CPDF_Array::InsertAt(FX_DWORD index, CPDF_Object* pObj, CPDF_IndirectObject
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);
}
@@ -524,7 +524,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);
}
@@ -752,7 +752,7 @@ void CPDF_Dictionary::SetAt(const CFX_ByteStringC& key, CPDF_Object* pObj, CPDF_
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 {
diff --git a/core/src/fpdfapi/fpdf_parser/fpdf_parser_parser.cpp b/core/src/fpdfapi/fpdf_parser/fpdf_parser_parser.cpp
index 685ee047aa..f7174f7a72 100644
--- a/core/src/fpdfapi/fpdf_parser/fpdf_parser_parser.cpp
+++ b/core/src/fpdfapi/fpdf_parser/fpdf_parser_parser.cpp
@@ -2062,7 +2062,6 @@ CPDF_Object* CPDF_SyntaxParser::GetObject(CPDF_IndirectObjects* pObjList, FX_DWO
FX_BOOL bTypeOnly = pContext && (pContext->m_Flags & PDFPARSE_TYPEONLY);
FX_BOOL bIsNumber;
CFX_ByteString word = GetNextWord(bIsNumber);
- CPDF_Object* pRet = NULL;
if (word.GetLength() == 0) {
if (bTypeOnly) {
return (CPDF_Object*)PDFOBJ_INVALID;
@@ -2079,38 +2078,33 @@ CPDF_Object* CPDF_SyntaxParser::GetObject(CPDF_IndirectObjects* pObjList, FX_DWO
if (bTypeOnly) {
return (CPDF_Object*)PDFOBJ_REFERENCE;
}
- pRet = CPDF_Reference::Create(pObjList, objnum);
- return pRet;
+ return new CPDF_Reference(pObjList, objnum);
} else {
m_Pos = SavedPos;
if (bTypeOnly) {
return (CPDF_Object*)PDFOBJ_NUMBER;
}
- pRet = CPDF_Number::Create(word);
- return pRet;
+ return CPDF_Number::Create(word);
}
} else {
m_Pos = SavedPos;
if (bTypeOnly) {
return (CPDF_Object*)PDFOBJ_NUMBER;
}
- pRet = CPDF_Number::Create(word);
- return pRet;
+ return CPDF_Number::Create(word);
}
}
if (word == FX_BSTRC("true") || word == FX_BSTRC("false")) {
if (bTypeOnly) {
return (CPDF_Object*)PDFOBJ_BOOLEAN;
}
- pRet = CPDF_Boolean::Create(word == FX_BSTRC("true"));
- return pRet;
+ return CPDF_Boolean::Create(word == FX_BSTRC("true"));
}
if (word == FX_BSTRC("null")) {
if (bTypeOnly) {
return (CPDF_Object*)PDFOBJ_NULL;
}
- pRet = CPDF_Null::Create();
- return pRet;
+ return CPDF_Null::Create();
}
if (word == FX_BSTRC("(")) {
if (bTypeOnly) {
@@ -2120,8 +2114,7 @@ CPDF_Object* CPDF_SyntaxParser::GetObject(CPDF_IndirectObjects* pObjList, FX_DWO
if (m_pCryptoHandler && bDecrypt) {
m_pCryptoHandler->Decrypt(objnum, gennum, str);
}
- pRet = CPDF_String::Create(str, FALSE);
- return pRet;
+ return CPDF_String::Create(str, FALSE);
}
if (word == FX_BSTRC("<")) {
if (bTypeOnly) {
@@ -2131,8 +2124,7 @@ CPDF_Object* CPDF_SyntaxParser::GetObject(CPDF_IndirectObjects* pObjList, FX_DWO
if (m_pCryptoHandler && bDecrypt) {
m_pCryptoHandler->Decrypt(objnum, gennum, str);
}
- pRet = CPDF_String::Create(str, TRUE);
- return pRet;
+ return CPDF_String::Create(str, TRUE);
}
if (word == FX_BSTRC("[")) {
if (bTypeOnly) {
@@ -2151,8 +2143,8 @@ CPDF_Object* CPDF_SyntaxParser::GetObject(CPDF_IndirectObjects* pObjList, FX_DWO
if (bTypeOnly) {
return (CPDF_Object*)PDFOBJ_NAME;
}
- pRet = CPDF_Name::Create(PDF_NameDecode(CFX_ByteStringC(m_WordBuffer + 1, m_WordSize - 1)));
- return pRet;
+ return CPDF_Name::Create(
+ PDF_NameDecode(CFX_ByteStringC(m_WordBuffer + 1, m_WordSize - 1)));
}
if (word == FX_BSTRC("<<")) {
if (bTypeOnly) {
@@ -2264,7 +2256,7 @@ CPDF_Object* CPDF_SyntaxParser::GetObjectByStrict(CPDF_IndirectObjects* pObjList
if (bTypeOnly) {
return (CPDF_Object*)PDFOBJ_REFERENCE;
}
- return CPDF_Reference::Create(pObjList, objnum);
+ return new CPDF_Reference(pObjList, objnum);
} else {
m_Pos = SavedPos;
if (bTypeOnly) {
diff --git a/core/src/fpdfdoc/doc_annot.cpp b/core/src/fpdfdoc/doc_annot.cpp
index 98cd01ba15..0a746190c0 100644
--- a/core/src/fpdfdoc/doc_annot.cpp
+++ b/core/src/fpdfdoc/doc_annot.cpp
@@ -31,10 +31,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);