OLD | NEW |
1 // Copyright 2016 PDFium Authors. All rights reserved. | 1 // Copyright 2016 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 "core/fpdfapi/fpdf_parser/include/cpdf_parser.h" | 7 #include "core/fpdfapi/fpdf_parser/include/cpdf_parser.h" |
8 | 8 |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 1520 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1531 | 1531 |
1532 if (!IsLinearizedFile(pFileAccess, offset)) { | 1532 if (!IsLinearizedFile(pFileAccess, offset)) { |
1533 m_pSyntax->m_pFileAccess = nullptr; | 1533 m_pSyntax->m_pFileAccess = nullptr; |
1534 return StartParse(pFileAccess); | 1534 return StartParse(pFileAccess); |
1535 } | 1535 } |
1536 | 1536 |
1537 m_pDocument = new CPDF_Document(this); | 1537 m_pDocument = new CPDF_Document(this); |
1538 FX_FILESIZE dwFirstXRefOffset = m_pSyntax->SavePos(); | 1538 FX_FILESIZE dwFirstXRefOffset = m_pSyntax->SavePos(); |
1539 | 1539 |
1540 FX_BOOL bXRefRebuilt = FALSE; | 1540 FX_BOOL bXRefRebuilt = FALSE; |
1541 FX_BOOL bLoadV4 = FALSE; | 1541 FX_BOOL bLoadV4 = LoadCrossRefV4(dwFirstXRefOffset, 0, FALSE); |
1542 if (!(bLoadV4 = LoadCrossRefV4(dwFirstXRefOffset, 0, FALSE)) && | 1542 if (!bLoadV4 && !LoadCrossRefV5(&dwFirstXRefOffset, TRUE)) { |
1543 !LoadCrossRefV5(&dwFirstXRefOffset, TRUE)) { | |
1544 if (!RebuildCrossRef()) | 1543 if (!RebuildCrossRef()) |
1545 return FORMAT_ERROR; | 1544 return FORMAT_ERROR; |
1546 | 1545 |
1547 bXRefRebuilt = TRUE; | 1546 bXRefRebuilt = TRUE; |
1548 m_LastXRefOffset = 0; | 1547 m_LastXRefOffset = 0; |
1549 } | 1548 } |
1550 | 1549 |
1551 if (bLoadV4) { | 1550 if (bLoadV4) { |
1552 m_pTrailer = LoadTrailerV4(); | 1551 m_pTrailer = LoadTrailerV4(); |
1553 if (!m_pTrailer) | 1552 if (!m_pTrailer) |
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1644 if (!LoadLinearizedAllCrossRefV4(m_LastXRefOffset, m_dwXrefStartObjNum) && | 1643 if (!LoadLinearizedAllCrossRefV4(m_LastXRefOffset, m_dwXrefStartObjNum) && |
1645 !LoadLinearizedAllCrossRefV5(m_LastXRefOffset)) { | 1644 !LoadLinearizedAllCrossRefV5(m_LastXRefOffset)) { |
1646 m_LastXRefOffset = 0; | 1645 m_LastXRefOffset = 0; |
1647 m_pSyntax->m_MetadataObjnum = dwSaveMetadataObjnum; | 1646 m_pSyntax->m_MetadataObjnum = dwSaveMetadataObjnum; |
1648 return FORMAT_ERROR; | 1647 return FORMAT_ERROR; |
1649 } | 1648 } |
1650 | 1649 |
1651 m_pSyntax->m_MetadataObjnum = dwSaveMetadataObjnum; | 1650 m_pSyntax->m_MetadataObjnum = dwSaveMetadataObjnum; |
1652 return SUCCESS; | 1651 return SUCCESS; |
1653 } | 1652 } |
OLD | NEW |