diff options
author | Lei Zhang <thestig@chromium.org> | 2015-12-18 17:05:11 -0800 |
---|---|---|
committer | Lei Zhang <thestig@chromium.org> | 2015-12-18 17:05:11 -0800 |
commit | 4880d1a168729d42be736293fb93b514802e4f12 (patch) | |
tree | 9cfe5aa73113301487dce8bcef5139fb7295536a /core/src/fpdfapi/fpdf_parser | |
parent | aedd4555ec1a80121f176586cb72180337e4ccd8 (diff) | |
download | pdfium-4880d1a168729d42be736293fb93b514802e4f12.tar.xz |
Merge to XFA: Get rid of a few CPDF_Object Create() methods and just use new instead.
R=ochang@chromium.org
Review URL: https://codereview.chromium.org/1540693002 .
(cherry picked from commit d866ab0b44a571c884fdd8ba5a5319adaf607559)
Review URL: https://codereview.chromium.org/1541563002 .
Diffstat (limited to 'core/src/fpdfapi/fpdf_parser')
-rw-r--r-- | core/src/fpdfapi/fpdf_parser/fpdf_parser_objects.cpp | 4 | ||||
-rw-r--r-- | core/src/fpdfapi/fpdf_parser/fpdf_parser_parser.cpp | 32 |
2 files changed, 18 insertions, 18 deletions
diff --git a/core/src/fpdfapi/fpdf_parser/fpdf_parser_objects.cpp b/core/src/fpdfapi/fpdf_parser/fpdf_parser_objects.cpp index c503277f87..1322864757 100644 --- a/core/src/fpdfapi/fpdf_parser/fpdf_parser_objects.cpp +++ b/core/src/fpdfapi/fpdf_parser/fpdf_parser_objects.cpp @@ -544,7 +544,7 @@ void CPDF_Array::AddName(const CFX_ByteString& str) { } void CPDF_Array::AddString(const CFX_ByteString& str) { ASSERT(IsArray()); - Add(new CPDF_String(str)); + Add(new CPDF_String(str, FALSE)); } void CPDF_Array::AddInteger(int i) { ASSERT(IsArray()); @@ -781,7 +781,7 @@ void CPDF_Dictionary::SetAtName(const CFX_ByteStringC& key, } void CPDF_Dictionary::SetAtString(const CFX_ByteStringC& key, const CFX_ByteString& str) { - SetAt(key, new CPDF_String(str)); + SetAt(key, new CPDF_String(str, FALSE)); } void CPDF_Dictionary::SetAtReference(const CFX_ByteStringC& key, CPDF_IndirectObjects* pDoc, diff --git a/core/src/fpdfapi/fpdf_parser/fpdf_parser_parser.cpp b/core/src/fpdfapi/fpdf_parser/fpdf_parser_parser.cpp index 97f17032b4..1b341f8692 100644 --- a/core/src/fpdfapi/fpdf_parser/fpdf_parser_parser.cpp +++ b/core/src/fpdfapi/fpdf_parser/fpdf_parser_parser.cpp @@ -2033,17 +2033,17 @@ CPDF_Object* CPDF_SyntaxParser::GetObject(CPDF_IndirectObjects* pObjList, m_Pos = SavedPos; if (bTypeOnly) return (CPDF_Object*)PDFOBJ_NUMBER; - return CPDF_Number::Create(word); + return new CPDF_Number(word); } if (word == "true" || word == "false") { if (bTypeOnly) return (CPDF_Object*)PDFOBJ_BOOLEAN; - return CPDF_Boolean::Create(word == "true"); + return new CPDF_Boolean(word == "true"); } if (word == "null") { if (bTypeOnly) return (CPDF_Object*)PDFOBJ_NULL; - return CPDF_Null::Create(); + return new CPDF_Null; } if (word == "(") { if (bTypeOnly) @@ -2052,7 +2052,7 @@ CPDF_Object* CPDF_SyntaxParser::GetObject(CPDF_IndirectObjects* pObjList, if (m_pCryptoHandler && bDecrypt) { m_pCryptoHandler->Decrypt(objnum, gennum, str); } - return CPDF_String::Create(str, FALSE); + return new CPDF_String(str, FALSE); } if (word == "<") { if (bTypeOnly) @@ -2061,12 +2061,12 @@ CPDF_Object* CPDF_SyntaxParser::GetObject(CPDF_IndirectObjects* pObjList, if (m_pCryptoHandler && bDecrypt) { m_pCryptoHandler->Decrypt(objnum, gennum, str); } - return CPDF_String::Create(str, TRUE); + return new CPDF_String(str, TRUE); } if (word == "[") { if (bTypeOnly) return (CPDF_Object*)PDFOBJ_ARRAY; - CPDF_Array* pArray = CPDF_Array::Create(); + CPDF_Array* pArray = new CPDF_Array; while (CPDF_Object* pObj = GetObject(pObjList, objnum, gennum)) pArray->Add(pObj); @@ -2075,7 +2075,7 @@ CPDF_Object* CPDF_SyntaxParser::GetObject(CPDF_IndirectObjects* pObjList, if (word[0] == '/') { if (bTypeOnly) return (CPDF_Object*)PDFOBJ_NAME; - return CPDF_Name::Create( + return new CPDF_Name( PDF_NameDecode(CFX_ByteStringC(m_WordBuffer + 1, m_WordSize - 1))); } if (word == "<<") { @@ -2088,7 +2088,7 @@ CPDF_Object* CPDF_SyntaxParser::GetObject(CPDF_IndirectObjects* pObjList, int32_t nKeys = 0; FX_FILESIZE dwSignValuePos = 0; nonstd::unique_ptr<CPDF_Dictionary, ReleaseDeleter<CPDF_Dictionary>> pDict( - CPDF_Dictionary::Create()); + new CPDF_Dictionary); while (1) { FX_BOOL bIsNumber; CFX_ByteString key = GetNextWord(bIsNumber); @@ -2194,17 +2194,17 @@ CPDF_Object* CPDF_SyntaxParser::GetObjectByStrict( m_Pos = SavedPos; if (bTypeOnly) return (CPDF_Object*)PDFOBJ_NUMBER; - return CPDF_Number::Create(word); + return new CPDF_Number(word); } if (word == "true" || word == "false") { if (bTypeOnly) return (CPDF_Object*)PDFOBJ_BOOLEAN; - return CPDF_Boolean::Create(word == "true"); + return new CPDF_Boolean(word == "true"); } if (word == "null") { if (bTypeOnly) return (CPDF_Object*)PDFOBJ_NULL; - return CPDF_Null::Create(); + return new CPDF_Null; } if (word == "(") { if (bTypeOnly) @@ -2212,7 +2212,7 @@ CPDF_Object* CPDF_SyntaxParser::GetObjectByStrict( CFX_ByteString str = ReadString(); if (m_pCryptoHandler) m_pCryptoHandler->Decrypt(objnum, gennum, str); - return CPDF_String::Create(str, FALSE); + return new CPDF_String(str, FALSE); } if (word == "<") { if (bTypeOnly) @@ -2220,13 +2220,13 @@ CPDF_Object* CPDF_SyntaxParser::GetObjectByStrict( CFX_ByteString str = ReadHexString(); if (m_pCryptoHandler) m_pCryptoHandler->Decrypt(objnum, gennum, str); - return CPDF_String::Create(str, TRUE); + return new CPDF_String(str, TRUE); } if (word == "[") { if (bTypeOnly) return (CPDF_Object*)PDFOBJ_ARRAY; nonstd::unique_ptr<CPDF_Array, ReleaseDeleter<CPDF_Array>> pArray( - CPDF_Array::Create()); + new CPDF_Array); while (CPDF_Object* pObj = GetObject(pObjList, objnum, gennum)) pArray->Add(pObj); return m_WordBuffer[0] == ']' ? pArray.release() : nullptr; @@ -2234,7 +2234,7 @@ CPDF_Object* CPDF_SyntaxParser::GetObjectByStrict( if (word[0] == '/') { if (bTypeOnly) return (CPDF_Object*)PDFOBJ_NAME; - return CPDF_Name::Create( + return new CPDF_Name( PDF_NameDecode(CFX_ByteStringC(m_WordBuffer + 1, m_WordSize - 1))); } if (word == "<<") { @@ -2244,7 +2244,7 @@ CPDF_Object* CPDF_SyntaxParser::GetObjectByStrict( pContext->m_DictStart = SavedPos; nonstd::unique_ptr<CPDF_Dictionary, ReleaseDeleter<CPDF_Dictionary>> pDict( - CPDF_Dictionary::Create()); + new CPDF_Dictionary); while (1) { FX_BOOL bIsNumber; FX_FILESIZE SavedPos = m_Pos; |