| OLD | NEW |
| 1 // Copyright 2014 PDFium Authors. All rights reserved. | 1 // Copyright 2014 PDFium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com | 5 // Original code copyright 2014 Foxit Software Inc. http://www.foxitsoftware.com |
| 6 | 6 |
| 7 #include <set> | 7 #include <set> |
| 8 #include <utility> | 8 #include <utility> |
| 9 #include <vector> | 9 #include <vector> |
| 10 | 10 |
| (...skipping 4100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4111 if (!pTrailer) { | 4111 if (!pTrailer) { |
| 4112 m_Pos += m_syntaxParser.SavePos(); | 4112 m_Pos += m_syntaxParser.SavePos(); |
| 4113 pHints->AddSegment(m_Pos, iTrailerSize); | 4113 pHints->AddSegment(m_Pos, iTrailerSize); |
| 4114 return FALSE; | 4114 return FALSE; |
| 4115 } | 4115 } |
| 4116 if (pTrailer->GetType() != PDFOBJ_DICTIONARY) { | 4116 if (pTrailer->GetType() != PDFOBJ_DICTIONARY) { |
| 4117 pTrailer->Release(); | 4117 pTrailer->Release(); |
| 4118 return FALSE; | 4118 return FALSE; |
| 4119 } | 4119 } |
| 4120 CPDF_Dictionary* pTrailerDict = pTrailer->GetDict(); | 4120 CPDF_Dictionary* pTrailerDict = pTrailer->GetDict(); |
| 4121 if (pTrailerDict) { | 4121 CPDF_Object* pEncrypt = pTrailerDict->GetElement("Encrypt"); |
| 4122 CPDF_Object* pEncrypt = pTrailerDict->GetElement("Encrypt"); | 4122 if (pEncrypt && pEncrypt->GetType() == PDFOBJ_REFERENCE) { |
| 4123 if (pEncrypt && pEncrypt->GetType() == PDFOBJ_REFERENCE) { | 4123 m_docStatus = PDF_DATAAVAIL_LOADALLFILE; |
| 4124 m_docStatus = PDF_DATAAVAIL_LOADALLFILE; | 4124 pTrailer->Release(); |
| 4125 pTrailer->Release(); | 4125 return TRUE; |
| 4126 return TRUE; | |
| 4127 } | |
| 4128 } | 4126 } |
| 4129 FX_DWORD xrefpos = GetDirectInteger(pTrailer->GetDict(), FX_BSTRC("Prev")); | 4127 FX_DWORD xrefpos = GetDirectInteger(pTrailer->GetDict(), FX_BSTRC("Prev")); |
| 4130 if (xrefpos) { | 4128 if (xrefpos) { |
| 4131 m_dwPrevXRefOffset = | 4129 m_dwPrevXRefOffset = |
| 4132 GetDirectInteger(pTrailer->GetDict(), FX_BSTRC("XRefStm")); | 4130 GetDirectInteger(pTrailer->GetDict(), FX_BSTRC("XRefStm")); |
| 4133 pTrailer->Release(); | 4131 pTrailer->Release(); |
| 4134 if (m_dwPrevXRefOffset) { | 4132 if (m_dwPrevXRefOffset) { |
| 4135 m_docStatus = PDF_DATAAVAIL_LOADALLFILE; | 4133 m_docStatus = PDF_DATAAVAIL_LOADALLFILE; |
| 4136 } else { | 4134 } else { |
| 4137 m_dwPrevXRefOffset = xrefpos; | 4135 m_dwPrevXRefOffset = xrefpos; |
| (...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4234 pPage->Release(); | 4232 pPage->Release(); |
| 4235 return TRUE; | 4233 return TRUE; |
| 4236 } | 4234 } |
| 4237 if (pPage->GetType() != PDFOBJ_DICTIONARY) { | 4235 if (pPage->GetType() != PDFOBJ_DICTIONARY) { |
| 4238 pPage->Release(); | 4236 pPage->Release(); |
| 4239 m_docStatus = PDF_DATAAVAIL_ERROR; | 4237 m_docStatus = PDF_DATAAVAIL_ERROR; |
| 4240 return FALSE; | 4238 return FALSE; |
| 4241 } | 4239 } |
| 4242 pPageNode->m_dwPageNo = dwPageNo; | 4240 pPageNode->m_dwPageNo = dwPageNo; |
| 4243 CPDF_Dictionary* pDict = pPage->GetDict(); | 4241 CPDF_Dictionary* pDict = pPage->GetDict(); |
| 4244 CFX_ByteString type = | 4242 CFX_ByteString type = pDict->GetString(FX_BSTRC("Type")); |
| 4245 pDict ? pDict->GetString(FX_BSTRC("Type")) : CFX_ByteString(); | |
| 4246 if (type == FX_BSTRC("Pages")) { | 4243 if (type == FX_BSTRC("Pages")) { |
| 4247 pPageNode->m_type = PDF_PAGENODE_PAGES; | 4244 pPageNode->m_type = PDF_PAGENODE_PAGES; |
| 4248 CPDF_Object* pKids = pDict->GetElement(FX_BSTRC("Kids")); | 4245 CPDF_Object* pKids = pDict->GetElement(FX_BSTRC("Kids")); |
| 4249 if (!pKids) { | 4246 if (!pKids) { |
| 4250 m_docStatus = PDF_DATAAVAIL_PAGE; | 4247 m_docStatus = PDF_DATAAVAIL_PAGE; |
| 4251 return TRUE; | 4248 return TRUE; |
| 4252 } | 4249 } |
| 4253 switch (pKids->GetType()) { | 4250 switch (pKids->GetType()) { |
| 4254 case PDFOBJ_REFERENCE: { | 4251 case PDFOBJ_REFERENCE: { |
| 4255 CPDF_Reference* pKid = (CPDF_Reference*)pKids; | 4252 CPDF_Reference* pKid = (CPDF_Reference*)pKids; |
| (...skipping 438 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4694 return FALSE; | 4691 return FALSE; |
| 4695 } | 4692 } |
| 4696 CPDF_PageNode::~CPDF_PageNode() { | 4693 CPDF_PageNode::~CPDF_PageNode() { |
| 4697 int32_t iSize = m_childNode.GetSize(); | 4694 int32_t iSize = m_childNode.GetSize(); |
| 4698 for (int32_t i = 0; i < iSize; ++i) { | 4695 for (int32_t i = 0; i < iSize; ++i) { |
| 4699 CPDF_PageNode* pNode = (CPDF_PageNode*)m_childNode[i]; | 4696 CPDF_PageNode* pNode = (CPDF_PageNode*)m_childNode[i]; |
| 4700 delete pNode; | 4697 delete pNode; |
| 4701 } | 4698 } |
| 4702 m_childNode.RemoveAll(); | 4699 m_childNode.RemoveAll(); |
| 4703 } | 4700 } |
| OLD | NEW |