| 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 "../../../include/fpdfapi/fpdf_parser.h" | 7 #include "../../../include/fpdfapi/fpdf_parser.h" |
| 8 #include "../../../include/fpdfapi/fpdf_module.h" | 8 #include "../../../include/fpdfapi/fpdf_module.h" |
| 9 #include "../../../include/fpdfapi/fpdf_page.h" | 9 #include "../../../include/fpdfapi/fpdf_page.h" |
| 10 #include "../../../../third_party/numerics/safe_math.h" | 10 #include "../../../../third_party/numerics/safe_math.h" |
| (...skipping 3810 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 3821 if (!pBuf) { | 3821 if (!pBuf) { |
| 3822 m_docStatus = PDF_DATAAVAIL_ERROR; | 3822 m_docStatus = PDF_DATAAVAIL_ERROR; |
| 3823 return FALSE; | 3823 return FALSE; |
| 3824 } | 3824 } |
| 3825 if (!m_pFileRead->ReadBlock(pBuf, m_dwTrailerOffset, iSize)) { | 3825 if (!m_pFileRead->ReadBlock(pBuf, m_dwTrailerOffset, iSize)) { |
| 3826 return FALSE; | 3826 return FALSE; |
| 3827 } | 3827 } |
| 3828 CFX_SmartPointer<IFX_FileStream> file(FX_CreateMemoryStream(pBuf, (size_
t)iSize, FALSE)); | 3828 CFX_SmartPointer<IFX_FileStream> file(FX_CreateMemoryStream(pBuf, (size_
t)iSize, FALSE)); |
| 3829 m_syntaxParser.InitParser((IFX_FileStream*)file, 0); | 3829 m_syntaxParser.InitParser((IFX_FileStream*)file, 0); |
| 3830 CPDF_Object *pTrailer = m_syntaxParser.GetObject(NULL, 0, 0, 0); | 3830 CPDF_Object *pTrailer = m_syntaxParser.GetObject(NULL, 0, 0, 0); |
| 3831 if (pTrailer->GetType() != PDFOBJ_DICTIONARY) { | |
| 3832 return FALSE; | |
| 3833 } | |
| 3834 if (!pTrailer) { | 3831 if (!pTrailer) { |
| 3835 m_Pos += m_syntaxParser.SavePos(); | 3832 m_Pos += m_syntaxParser.SavePos(); |
| 3836 pHints->AddSegment(m_Pos, iTrailerSize); | 3833 pHints->AddSegment(m_Pos, iTrailerSize); |
| 3837 return FALSE; | 3834 return FALSE; |
| 3838 } | 3835 } |
| 3836 if (pTrailer->GetType() != PDFOBJ_DICTIONARY) { |
| 3837 return FALSE; |
| 3838 } |
| 3839 CPDF_Dictionary *pTrailerDict = pTrailer->GetDict(); | 3839 CPDF_Dictionary *pTrailerDict = pTrailer->GetDict(); |
| 3840 if (pTrailerDict) { | 3840 if (pTrailerDict) { |
| 3841 CPDF_Object *pEncrypt = pTrailerDict->GetElement("Encrypt"); | 3841 CPDF_Object *pEncrypt = pTrailerDict->GetElement("Encrypt"); |
| 3842 if (pEncrypt && pEncrypt->GetType() == PDFOBJ_REFERENCE) { | 3842 if (pEncrypt && pEncrypt->GetType() == PDFOBJ_REFERENCE) { |
| 3843 m_docStatus = PDF_DATAAVAIL_LOADALLFILE; | 3843 m_docStatus = PDF_DATAAVAIL_LOADALLFILE; |
| 3844 pTrailer->Release(); | 3844 pTrailer->Release(); |
| 3845 return TRUE; | 3845 return TRUE; |
| 3846 } | 3846 } |
| 3847 } | 3847 } |
| 3848 FX_DWORD xrefpos = GetDirectInteger(pTrailer->GetDict(), FX_BSTRC("Prev"
)); | 3848 FX_DWORD xrefpos = GetDirectInteger(pTrailer->GetDict(), FX_BSTRC("Prev"
)); |
| (...skipping 577 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4426 { | 4426 { |
| 4427 FX_INT32 iSize = m_childNode.GetSize(); | 4427 FX_INT32 iSize = m_childNode.GetSize(); |
| 4428 for (FX_INT32 i = 0; i < iSize; ++i) { | 4428 for (FX_INT32 i = 0; i < iSize; ++i) { |
| 4429 CPDF_PageNode *pNode = (CPDF_PageNode*)m_childNode[i]; | 4429 CPDF_PageNode *pNode = (CPDF_PageNode*)m_childNode[i]; |
| 4430 if (pNode) { | 4430 if (pNode) { |
| 4431 delete pNode; | 4431 delete pNode; |
| 4432 } | 4432 } |
| 4433 } | 4433 } |
| 4434 m_childNode.RemoveAll(); | 4434 m_childNode.RemoveAll(); |
| 4435 } | 4435 } |
| OLD | NEW |