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 4090 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
4101 CPDF_Object* pTrailer = m_syntaxParser.GetObject(nullptr, 0, 0); | 4101 CPDF_Object* pTrailer = m_syntaxParser.GetObject(nullptr, 0, 0); |
4102 if (!pTrailer) { | 4102 if (!pTrailer) { |
4103 m_Pos += m_syntaxParser.SavePos(); | 4103 m_Pos += m_syntaxParser.SavePos(); |
4104 pHints->AddSegment(m_Pos, iTrailerSize); | 4104 pHints->AddSegment(m_Pos, iTrailerSize); |
4105 return FALSE; | 4105 return FALSE; |
4106 } | 4106 } |
4107 if (pTrailer->GetType() != PDFOBJ_DICTIONARY) { | 4107 if (pTrailer->GetType() != PDFOBJ_DICTIONARY) { |
4108 pTrailer->Release(); | 4108 pTrailer->Release(); |
4109 return FALSE; | 4109 return FALSE; |
4110 } | 4110 } |
4111 CPDF_Dictionary* pTrailerDict = pTrailer->GetDict(); | 4111 CPDF_Dictionary* pTrailerDict = pTrailer->GetDict(); |
Lei Zhang
2015/09/04 21:10:40
Check is right above on line 4107.
| |
4112 if (pTrailerDict) { | 4112 CPDF_Object* pEncrypt = pTrailerDict->GetElement("Encrypt"); |
4113 CPDF_Object* pEncrypt = pTrailerDict->GetElement("Encrypt"); | 4113 if (pEncrypt && pEncrypt->GetType() == PDFOBJ_REFERENCE) { |
4114 if (pEncrypt && pEncrypt->GetType() == PDFOBJ_REFERENCE) { | 4114 m_docStatus = PDF_DATAAVAIL_LOADALLFILE; |
4115 m_docStatus = PDF_DATAAVAIL_LOADALLFILE; | 4115 pTrailer->Release(); |
4116 pTrailer->Release(); | 4116 return TRUE; |
4117 return TRUE; | |
4118 } | |
4119 } | 4117 } |
4120 FX_DWORD xrefpos = GetDirectInteger(pTrailer->GetDict(), FX_BSTRC("Prev")); | 4118 FX_DWORD xrefpos = GetDirectInteger(pTrailer->GetDict(), FX_BSTRC("Prev")); |
4121 if (xrefpos) { | 4119 if (xrefpos) { |
4122 m_dwPrevXRefOffset = | 4120 m_dwPrevXRefOffset = |
4123 GetDirectInteger(pTrailer->GetDict(), FX_BSTRC("XRefStm")); | 4121 GetDirectInteger(pTrailer->GetDict(), FX_BSTRC("XRefStm")); |
4124 pTrailer->Release(); | 4122 pTrailer->Release(); |
4125 if (m_dwPrevXRefOffset) { | 4123 if (m_dwPrevXRefOffset) { |
4126 m_docStatus = PDF_DATAAVAIL_LOADALLFILE; | 4124 m_docStatus = PDF_DATAAVAIL_LOADALLFILE; |
4127 } else { | 4125 } else { |
4128 m_dwPrevXRefOffset = xrefpos; | 4126 m_dwPrevXRefOffset = xrefpos; |
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
4224 pPageNode->m_type = PDF_PAGENODE_ARRAY; | 4222 pPageNode->m_type = PDF_PAGENODE_ARRAY; |
4225 pPage->Release(); | 4223 pPage->Release(); |
4226 return TRUE; | 4224 return TRUE; |
4227 } | 4225 } |
4228 if (pPage->GetType() != PDFOBJ_DICTIONARY) { | 4226 if (pPage->GetType() != PDFOBJ_DICTIONARY) { |
4229 pPage->Release(); | 4227 pPage->Release(); |
4230 m_docStatus = PDF_DATAAVAIL_ERROR; | 4228 m_docStatus = PDF_DATAAVAIL_ERROR; |
4231 return FALSE; | 4229 return FALSE; |
4232 } | 4230 } |
4233 pPageNode->m_dwPageNo = dwPageNo; | 4231 pPageNode->m_dwPageNo = dwPageNo; |
4234 CPDF_Dictionary* pDict = pPage->GetDict(); | 4232 CPDF_Dictionary* pDict = pPage->GetDict(); |
Lei Zhang
2015/09/04 21:10:40
Check on line 4226.
| |
4235 CFX_ByteString type = | 4233 CFX_ByteString type = pDict->GetString(FX_BSTRC("Type")); |
4236 pDict ? pDict->GetString(FX_BSTRC("Type")) : CFX_ByteString(); | |
4237 if (type == FX_BSTRC("Pages")) { | 4234 if (type == FX_BSTRC("Pages")) { |
4238 pPageNode->m_type = PDF_PAGENODE_PAGES; | 4235 pPageNode->m_type = PDF_PAGENODE_PAGES; |
4239 CPDF_Object* pKids = pDict->GetElement(FX_BSTRC("Kids")); | 4236 CPDF_Object* pKids = pDict->GetElement(FX_BSTRC("Kids")); |
4240 if (!pKids) { | 4237 if (!pKids) { |
4241 m_docStatus = PDF_DATAAVAIL_PAGE; | 4238 m_docStatus = PDF_DATAAVAIL_PAGE; |
4242 return TRUE; | 4239 return TRUE; |
4243 } | 4240 } |
4244 switch (pKids->GetType()) { | 4241 switch (pKids->GetType()) { |
4245 case PDFOBJ_REFERENCE: { | 4242 case PDFOBJ_REFERENCE: { |
4246 CPDF_Reference* pKid = (CPDF_Reference*)pKids; | 4243 CPDF_Reference* pKid = (CPDF_Reference*)pKids; |
(...skipping 438 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
4685 return FALSE; | 4682 return FALSE; |
4686 } | 4683 } |
4687 CPDF_PageNode::~CPDF_PageNode() { | 4684 CPDF_PageNode::~CPDF_PageNode() { |
4688 int32_t iSize = m_childNode.GetSize(); | 4685 int32_t iSize = m_childNode.GetSize(); |
4689 for (int32_t i = 0; i < iSize; ++i) { | 4686 for (int32_t i = 0; i < iSize; ++i) { |
4690 CPDF_PageNode* pNode = (CPDF_PageNode*)m_childNode[i]; | 4687 CPDF_PageNode* pNode = (CPDF_PageNode*)m_childNode[i]; |
4691 delete pNode; | 4688 delete pNode; |
4692 } | 4689 } |
4693 m_childNode.RemoveAll(); | 4690 m_childNode.RemoveAll(); |
4694 } | 4691 } |
OLD | NEW |