summaryrefslogtreecommitdiff
path: root/core/fpdfapi
diff options
context:
space:
mode:
authorArtem Strygin <art-snake@yandex-team.ru>2017-09-22 00:06:59 +0300
committerChromium commit bot <commit-bot@chromium.org>2017-09-21 21:44:36 +0000
commit09b5ce623fc47bc3d19d60aa2a219c838971dd4b (patch)
tree3f6d000ff4894f29cc86d4c29e90d19059b91b81 /core/fpdfapi
parentb872a93e5cd940dc28ad960b13b0cf01a6db3400 (diff)
downloadpdfium-09b5ce623fc47bc3d19d60aa2a219c838971dd4b.tar.xz
Rename CPDF_SyntaxParser::GetObject to GetObjectBody
Change-Id: Ia8fd1893f862391fbada396f505ac16985b59cd6 Reviewed-on: https://pdfium-review.googlesource.com/12850 Commit-Queue: Art Snake <art-snake@yandex-team.ru> Reviewed-by: dsinclair <dsinclair@chromium.org>
Diffstat (limited to 'core/fpdfapi')
-rw-r--r--core/fpdfapi/parser/cfdf_document.cpp4
-rw-r--r--core/fpdfapi/parser/cpdf_data_avail.cpp4
-rw-r--r--core/fpdfapi/parser/cpdf_parser.cpp8
-rw-r--r--core/fpdfapi/parser/cpdf_syntax_parser.cpp30
-rw-r--r--core/fpdfapi/parser/cpdf_syntax_parser.h13
-rw-r--r--core/fpdfapi/parser/cpdf_syntax_parser_unittest.cpp2
6 files changed, 32 insertions, 29 deletions
diff --git a/core/fpdfapi/parser/cfdf_document.cpp b/core/fpdfapi/parser/cfdf_document.cpp
index 1d5cf8ade7..9c833cedcf 100644
--- a/core/fpdfapi/parser/cfdf_document.cpp
+++ b/core/fpdfapi/parser/cfdf_document.cpp
@@ -67,7 +67,7 @@ void CFDF_Document::ParseStream(
break;
std::unique_ptr<CPDF_Object> pObj =
- parser.GetObject(this, objnum, 0, false);
+ parser.GetObjectBody(this, objnum, 0, false);
if (!pObj)
break;
@@ -80,7 +80,7 @@ void CFDF_Document::ParseStream(
break;
std::unique_ptr<CPDF_Dictionary> pMainDict =
- ToDictionary(parser.GetObject(this, 0, 0, false));
+ ToDictionary(parser.GetObjectBody(this, 0, 0, false));
if (pMainDict)
m_pRootDict = pMainDict->GetDictFor("Root");
diff --git a/core/fpdfapi/parser/cpdf_data_avail.cpp b/core/fpdfapi/parser/cpdf_data_avail.cpp
index 98afd450d7..ec865ba936 100644
--- a/core/fpdfapi/parser/cpdf_data_avail.cpp
+++ b/core/fpdfapi/parser/cpdf_data_avail.cpp
@@ -677,7 +677,7 @@ std::unique_ptr<CPDF_Object> CPDF_DataAvail::ParseIndirectObjectAt(
}
std::unique_ptr<CPDF_Object> pObj =
- m_syntaxParser.GetObject(pObjList, parser_objnum, gennum, false);
+ m_syntaxParser.GetObjectBody(pObjList, parser_objnum, gennum, false);
m_syntaxParser.SetPos(SavedPos);
return pObj;
}
@@ -923,7 +923,7 @@ bool CPDF_DataAvail::CheckTrailer() {
const CPDF_ReadValidator::Session read_session(GetValidator().Get());
m_syntaxParser.SetPos(m_dwTrailerOffset);
const std::unique_ptr<CPDF_Object> pTrailer =
- m_syntaxParser.GetObject(nullptr, 0, 0, false);
+ m_syntaxParser.GetObjectBody(nullptr, 0, 0, false);
if (!pTrailer) {
if (!GetValidator()->has_read_problems())
m_docStatus = PDF_DATAAVAIL_ERROR;
diff --git a/core/fpdfapi/parser/cpdf_parser.cpp b/core/fpdfapi/parser/cpdf_parser.cpp
index a45ac13ad5..6fb0d5fa1d 100644
--- a/core/fpdfapi/parser/cpdf_parser.cpp
+++ b/core/fpdfapi/parser/cpdf_parser.cpp
@@ -876,7 +876,7 @@ bool CPDF_Parser::RebuildCrossRef() {
m_pSyntax->SetPos(pos + i - m_pSyntax->m_HeaderOffset);
std::unique_ptr<CPDF_Object> pObj =
- m_pSyntax->GetObject(m_pDocument.Get(), 0, 0, false);
+ m_pSyntax->GetObjectBody(m_pDocument.Get(), 0, 0, false);
if (pObj) {
if (pObj->IsDictionary() || pObj->AsStream()) {
CPDF_Stream* pStream = pObj->AsStream();
@@ -1237,7 +1237,7 @@ std::unique_ptr<CPDF_Object> CPDF_Parser::ParseIndirectObject(
return nullptr;
syntax.SetPos(offset + it->second);
- return syntax.GetObject(pObjList, 0, 0, false);
+ return syntax.GetObjectBody(pObjList, 0, 0, false);
}
RetainPtr<CPDF_StreamAcc> CPDF_Parser::GetObjectStream(uint32_t objnum) {
@@ -1300,7 +1300,7 @@ std::unique_ptr<CPDF_Dictionary> CPDF_Parser::LoadTrailerV4() {
if (m_pSyntax->GetKeyword() != "trailer")
return nullptr;
- return ToDictionary(m_pSyntax->GetObject(m_pDocument.Get(), 0, 0, false));
+ return ToDictionary(m_pSyntax->GetObjectBody(m_pDocument.Get(), 0, 0, false));
}
uint32_t CPDF_Parser::GetPermissions() const {
@@ -1337,7 +1337,7 @@ bool CPDF_Parser::ParseLinearizedHeader() {
}
m_pLinearized = CPDF_LinearizedHeader::CreateForObject(
- m_pSyntax->GetObject(nullptr, objnum, gennum, false));
+ m_pSyntax->GetObjectBody(nullptr, objnum, gennum, false));
if (!m_pLinearized)
return false;
diff --git a/core/fpdfapi/parser/cpdf_syntax_parser.cpp b/core/fpdfapi/parser/cpdf_syntax_parser.cpp
index bf6d90ca9a..96a863e661 100644
--- a/core/fpdfapi/parser/cpdf_syntax_parser.cpp
+++ b/core/fpdfapi/parser/cpdf_syntax_parser.cpp
@@ -360,20 +360,20 @@ ByteString CPDF_SyntaxParser::GetKeyword() {
return GetNextWord(nullptr);
}
-std::unique_ptr<CPDF_Object> CPDF_SyntaxParser::GetObject(
+std::unique_ptr<CPDF_Object> CPDF_SyntaxParser::GetObjectBody(
CPDF_IndirectObjectHolder* pObjList,
uint32_t objnum,
uint32_t gennum,
bool bDecrypt) {
const CPDF_ReadValidator::Session read_session(GetValidator().Get());
- auto result =
- GetObjectInternal(pObjList, objnum, gennum, bDecrypt, ParseType::kLoose);
+ auto result = GetObjectBodyInternal(pObjList, objnum, gennum, bDecrypt,
+ ParseType::kLoose);
if (GetValidator()->has_read_problems())
return nullptr;
return result;
}
-std::unique_ptr<CPDF_Object> CPDF_SyntaxParser::GetObjectInternal(
+std::unique_ptr<CPDF_Object> CPDF_SyntaxParser::GetObjectBodyInternal(
CPDF_IndirectObjectHolder* pObjList,
uint32_t objnum,
uint32_t gennum,
@@ -425,8 +425,8 @@ std::unique_ptr<CPDF_Object> CPDF_SyntaxParser::GetObjectInternal(
}
if (word == "[") {
auto pArray = pdfium::MakeUnique<CPDF_Array>();
- while (std::unique_ptr<CPDF_Object> pObj =
- GetObject(pObjList, objnum, gennum, true)) {
+ while (std::unique_ptr<CPDF_Object> pObj = GetObjectBodyInternal(
+ pObjList, objnum, gennum, true, ParseType::kLoose)) {
pArray->Add(std::move(pObj));
}
return (parse_type == ParseType::kLoose || m_WordBuffer[0] == ']')
@@ -465,8 +465,8 @@ std::unique_ptr<CPDF_Object> CPDF_SyntaxParser::GetObjectInternal(
if (key.IsEmpty() && parse_type == ParseType::kLoose)
continue;
- std::unique_ptr<CPDF_Object> pObj =
- GetObject(pObjList, objnum, gennum, true);
+ std::unique_ptr<CPDF_Object> pObj = GetObjectBodyInternal(
+ pObjList, objnum, gennum, true, ParseType::kLoose);
if (!pObj) {
if (parse_type == ParseType::kLoose)
continue;
@@ -487,7 +487,9 @@ std::unique_ptr<CPDF_Object> CPDF_SyntaxParser::GetObjectInternal(
dwSignValuePos) {
AutoRestorer<FX_FILESIZE> save_pos(&m_Pos);
m_Pos = dwSignValuePos;
- pDict->SetFor("Contents", GetObject(pObjList, objnum, gennum, false));
+ pDict->SetFor("Contents",
+ GetObjectBodyInternal(pObjList, objnum, gennum, false,
+ ParseType::kLoose));
}
FX_FILESIZE SavedPos = m_Pos;
@@ -504,14 +506,14 @@ std::unique_ptr<CPDF_Object> CPDF_SyntaxParser::GetObjectInternal(
return nullptr;
}
-std::unique_ptr<CPDF_Object> CPDF_SyntaxParser::GetObjectForStrict(
+std::unique_ptr<CPDF_Object> CPDF_SyntaxParser::GetObjectBodyForStrict(
CPDF_IndirectObjectHolder* pObjList,
uint32_t objnum,
uint32_t gennum,
bool bDecrypt) {
const CPDF_ReadValidator::Session read_session(GetValidator().Get());
- auto result =
- GetObjectInternal(pObjList, objnum, gennum, bDecrypt, ParseType::kStrict);
+ auto result = GetObjectBodyInternal(pObjList, objnum, gennum, bDecrypt,
+ ParseType::kStrict);
if (GetValidator()->has_read_problems())
return nullptr;
return result;
@@ -549,8 +551,8 @@ std::unique_ptr<CPDF_Object> CPDF_SyntaxParser::GetIndirectObject(
return nullptr;
}
- std::unique_ptr<CPDF_Object> pObj =
- GetObjectInternal(pObjList, objnum, parser_gennum, bDecrypt, parse_type);
+ std::unique_ptr<CPDF_Object> pObj = GetObjectBodyInternal(
+ pObjList, objnum, parser_gennum, bDecrypt, parse_type);
if (pObj) {
if (!objnum)
pObj->m_ObjNum = parser_objnum;
diff --git a/core/fpdfapi/parser/cpdf_syntax_parser.h b/core/fpdfapi/parser/cpdf_syntax_parser.h
index 2b642b5963..3a8f7c59ec 100644
--- a/core/fpdfapi/parser/cpdf_syntax_parser.h
+++ b/core/fpdfapi/parser/cpdf_syntax_parser.h
@@ -38,12 +38,13 @@ class CPDF_SyntaxParser {
FX_FILESIZE GetPos() const { return m_Pos; }
void SetPos(FX_FILESIZE pos) { m_Pos = std::min(pos, m_FileLen); }
- std::unique_ptr<CPDF_Object> GetObject(CPDF_IndirectObjectHolder* pObjList,
- uint32_t objnum,
- uint32_t gennum,
- bool bDecrypt);
+ std::unique_ptr<CPDF_Object> GetObjectBody(
+ CPDF_IndirectObjectHolder* pObjList,
+ uint32_t objnum,
+ uint32_t gennum,
+ bool bDecrypt);
- std::unique_ptr<CPDF_Object> GetObjectForStrict(
+ std::unique_ptr<CPDF_Object> GetObjectBodyForStrict(
CPDF_IndirectObjectHolder* pObjList,
uint32_t objnum,
uint32_t gennum,
@@ -103,7 +104,7 @@ class CPDF_SyntaxParser {
static_cast<FX_FILESIZE>(m_BufOffset + m_BufSize) <= pos;
}
- std::unique_ptr<CPDF_Object> GetObjectInternal(
+ std::unique_ptr<CPDF_Object> GetObjectBodyInternal(
CPDF_IndirectObjectHolder* pObjList,
uint32_t objnum,
uint32_t gennum,
diff --git a/core/fpdfapi/parser/cpdf_syntax_parser_unittest.cpp b/core/fpdfapi/parser/cpdf_syntax_parser_unittest.cpp
index 6b54c70db6..af559c5ba6 100644
--- a/core/fpdfapi/parser/cpdf_syntax_parser_unittest.cpp
+++ b/core/fpdfapi/parser/cpdf_syntax_parser_unittest.cpp
@@ -152,7 +152,7 @@ TEST(cpdf_syntax_parser, GetInvalidReference) {
uint8_t data[] = "4294967295 0 R";
parser.InitParser(pdfium::MakeRetain<CFX_MemoryStream>(data, 14, false), 0);
std::unique_ptr<CPDF_Object> ref =
- parser.GetObject(nullptr, CPDF_Object::kInvalidObjNum, 0, false);
+ parser.GetObjectBody(nullptr, CPDF_Object::kInvalidObjNum, 0, false);
EXPECT_FALSE(ref);
}