Chromium Code Reviews| Index: core/fpdfapi/fpdf_parser/cpdf_document.cpp |
| diff --git a/core/fpdfapi/fpdf_parser/cpdf_document.cpp b/core/fpdfapi/fpdf_parser/cpdf_document.cpp |
| index 7f692956756607ce63c3858bc5778b58d9358de2..bda6e3328fa23fd2db0b8261cb267b7531fb0eaf 100644 |
| --- a/core/fpdfapi/fpdf_parser/cpdf_document.cpp |
| +++ b/core/fpdfapi/fpdf_parser/cpdf_document.cpp |
| @@ -496,49 +496,43 @@ CPDF_Document::~CPDF_Document() { |
| CPDF_ModuleMgr::Get()->GetPageModule()->ClearStockFont(this); |
| } |
| -void CPDF_Document::LoadDoc() { |
| +void CPDF_Document::LoadDocInternal() { |
| m_LastObjNum = m_pParser->GetLastObjNum(); |
| + |
| CPDF_Object* pRootObj = GetIndirectObject(m_pParser->GetRootObjNum()); |
| - if (!pRootObj) { |
| + if (!pRootObj) |
| return; |
| - } |
| + |
| m_pRootDict = pRootObj->GetDict(); |
| - if (!m_pRootDict) { |
| + if (!m_pRootDict) |
| return; |
| - } |
| + |
| CPDF_Object* pInfoObj = GetIndirectObject(m_pParser->GetInfoObjNum()); |
| - if (pInfoObj) { |
| + if (pInfoObj) |
| m_pInfoDict = pInfoObj->GetDict(); |
| - } |
| - CPDF_Array* pIDArray = m_pParser->GetIDArray(); |
| - if (pIDArray) { |
| + if (CPDF_Array* pIDArray = m_pParser->GetIDArray()) { |
| m_ID1 = pIDArray->GetStringAt(0); |
| m_ID2 = pIDArray->GetStringAt(1); |
| } |
| +} |
| + |
| +void CPDF_Document::LoadDoc() { |
| + LoadDocInternal(); |
| + |
|
Tom Sepez
2016/08/16 18:08:01
nit: blank line not needed here.
dsinclair
2016/08/16 18:28:18
Done.
|
| m_PageList.SetSize(RetrievePageCount()); |
| } |
| -void CPDF_Document::LoadAsynDoc(CPDF_Dictionary* pLinearized) { |
| +void CPDF_Document::LoadLinearizedDoc(CPDF_Dictionary* pLinearized) { |
| m_bLinearized = true; |
| - m_LastObjNum = m_pParser->GetLastObjNum(); |
| - CPDF_Object* pIndirectObj = GetIndirectObject(m_pParser->GetRootObjNum()); |
| - m_pRootDict = pIndirectObj ? pIndirectObj->GetDict() : nullptr; |
| - if (!m_pRootDict) { |
| - return; |
| - } |
| - pIndirectObj = GetIndirectObject(m_pParser->GetInfoObjNum()); |
| - m_pInfoDict = pIndirectObj ? pIndirectObj->GetDict() : nullptr; |
| - CPDF_Array* pIDArray = m_pParser->GetIDArray(); |
| - if (pIDArray) { |
| - m_ID1 = pIDArray->GetStringAt(0); |
| - m_ID2 = pIDArray->GetStringAt(1); |
| - } |
| + |
|
Tom Sepez
2016/08/16 18:08:01
nit: blank line not needed here (but the one at 52
dsinclair
2016/08/16 18:28:18
Done.
|
| + LoadDocInternal(); |
| + |
| uint32_t dwPageCount = 0; |
| CPDF_Object* pCount = pLinearized->GetObjectBy("N"); |
| if (ToNumber(pCount)) |
| dwPageCount = pCount->GetInteger(); |
| - |
| m_PageList.SetSize(dwPageCount); |
| + |
| CPDF_Object* pNo = pLinearized->GetObjectBy("P"); |
| if (ToNumber(pNo)) |
| m_iFirstPageNo = pNo->GetInteger(); |