summaryrefslogtreecommitdiff
path: root/core/src/fpdfapi/fpdf_parser
diff options
context:
space:
mode:
authorLei Zhang <thestig@chromium.org>2015-06-22 15:16:15 -0700
committerLei Zhang <thestig@chromium.org>2015-06-22 15:16:15 -0700
commit6ea012325fca56a37b9adbda2d3549569d242271 (patch)
treeb368fc4fe7f8647cb509513d96dce8eec14d7c42 /core/src/fpdfapi/fpdf_parser
parent5ab3fc60fc44aca144607416d18e7efdc1203fe6 (diff)
downloadpdfium-6ea012325fca56a37b9adbda2d3549569d242271.tar.xz
Cleanup: Get rid of CPDF_Reference::Create().
Just call new CPDF_Reference instead. R=jam@chromium.org Review URL: https://codereview.chromium.org/1194343002.
Diffstat (limited to 'core/src/fpdfapi/fpdf_parser')
-rw-r--r--core/src/fpdfapi/fpdf_parser/fpdf_parser_objects.cpp8
-rw-r--r--core/src/fpdfapi/fpdf_parser/fpdf_parser_parser.cpp28
2 files changed, 14 insertions, 22 deletions
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) {