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/parser/cpdf_parser.h" | 7 #include "core/fpdfapi/parser/cpdf_parser.h" |
8 | 8 |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
11 #include "core/fpdfapi/parser/cpdf_array.h" | 11 #include "core/fpdfapi/parser/cpdf_array.h" |
12 #include "core/fpdfapi/parser/cpdf_crypto_handler.h" | 12 #include "core/fpdfapi/parser/cpdf_crypto_handler.h" |
13 #include "core/fpdfapi/parser/cpdf_dictionary.h" | 13 #include "core/fpdfapi/parser/cpdf_dictionary.h" |
14 #include "core/fpdfapi/parser/cpdf_document.h" | 14 #include "core/fpdfapi/parser/cpdf_document.h" |
15 #include "core/fpdfapi/parser/cpdf_linearized.h" | 15 #include "core/fpdfapi/parser/cpdf_linearized_header.h" |
16 #include "core/fpdfapi/parser/cpdf_number.h" | 16 #include "core/fpdfapi/parser/cpdf_number.h" |
17 #include "core/fpdfapi/parser/cpdf_reference.h" | 17 #include "core/fpdfapi/parser/cpdf_reference.h" |
18 #include "core/fpdfapi/parser/cpdf_security_handler.h" | 18 #include "core/fpdfapi/parser/cpdf_security_handler.h" |
19 #include "core/fpdfapi/parser/cpdf_stream.h" | 19 #include "core/fpdfapi/parser/cpdf_stream.h" |
20 #include "core/fpdfapi/parser/cpdf_stream_acc.h" | 20 #include "core/fpdfapi/parser/cpdf_stream_acc.h" |
21 #include "core/fpdfapi/parser/cpdf_syntax_parser.h" | 21 #include "core/fpdfapi/parser/cpdf_syntax_parser.h" |
22 #include "core/fpdfapi/parser/fpdf_parser_utility.h" | 22 #include "core/fpdfapi/parser/fpdf_parser_utility.h" |
23 #include "core/fxcrt/fx_ext.h" | 23 #include "core/fxcrt/fx_ext.h" |
24 #include "core/fxcrt/fx_safe_types.h" | 24 #include "core/fxcrt/fx_safe_types.h" |
25 #include "third_party/base/stl_util.h" | 25 #include "third_party/base/stl_util.h" |
(...skipping 1416 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1442 word = m_pSyntax->GetNextWord(&bIsNumber); | 1442 word = m_pSyntax->GetNextWord(&bIsNumber); |
1443 if (!bIsNumber) | 1443 if (!bIsNumber) |
1444 return false; | 1444 return false; |
1445 | 1445 |
1446 uint32_t gennum = FXSYS_atoui(word.c_str()); | 1446 uint32_t gennum = FXSYS_atoui(word.c_str()); |
1447 if (m_pSyntax->GetKeyword() != "obj") { | 1447 if (m_pSyntax->GetKeyword() != "obj") { |
1448 m_pSyntax->RestorePos(SavedPos); | 1448 m_pSyntax->RestorePos(SavedPos); |
1449 return false; | 1449 return false; |
1450 } | 1450 } |
1451 | 1451 |
1452 m_pLinearized = CPDF_Linearized::CreateForObject( | 1452 m_pLinearized = CPDF_LinearizedHeader::CreateForObject( |
1453 pdfium::WrapUnique(m_pSyntax->GetObject(nullptr, objnum, gennum, true))); | 1453 pdfium::WrapUnique(m_pSyntax->GetObject(nullptr, objnum, gennum, true))); |
1454 if (!m_pLinearized) | 1454 if (!m_pLinearized) |
1455 return false; | 1455 return false; |
1456 m_LastXRefOffset = m_pLinearized->GetLastXRefOffset(); | 1456 m_LastXRefOffset = m_pLinearized->GetLastXRefOffset(); |
1457 // Move parser onto first page xref table start. | 1457 // Move parser onto first page xref table start. |
1458 m_pSyntax->GetNextWord(nullptr); | 1458 m_pSyntax->GetNextWord(nullptr); |
1459 return true; | 1459 return true; |
1460 } | 1460 } |
1461 | 1461 |
1462 CPDF_Parser::Error CPDF_Parser::StartLinearizedParse( | 1462 CPDF_Parser::Error CPDF_Parser::StartLinearizedParse( |
(...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1586 if (!LoadLinearizedAllCrossRefV4(m_LastXRefOffset, m_dwXrefStartObjNum) && | 1586 if (!LoadLinearizedAllCrossRefV4(m_LastXRefOffset, m_dwXrefStartObjNum) && |
1587 !LoadLinearizedAllCrossRefV5(m_LastXRefOffset)) { | 1587 !LoadLinearizedAllCrossRefV5(m_LastXRefOffset)) { |
1588 m_LastXRefOffset = 0; | 1588 m_LastXRefOffset = 0; |
1589 m_pSyntax->m_MetadataObjnum = dwSaveMetadataObjnum; | 1589 m_pSyntax->m_MetadataObjnum = dwSaveMetadataObjnum; |
1590 return FORMAT_ERROR; | 1590 return FORMAT_ERROR; |
1591 } | 1591 } |
1592 | 1592 |
1593 m_pSyntax->m_MetadataObjnum = dwSaveMetadataObjnum; | 1593 m_pSyntax->m_MetadataObjnum = dwSaveMetadataObjnum; |
1594 return SUCCESS; | 1594 return SUCCESS; |
1595 } | 1595 } |
OLD | NEW |