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 |
(...skipping 938 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
949 | 949 |
950 uint32_t objnum = pObject->m_ObjNum; | 950 uint32_t objnum = pObject->m_ObjNum; |
951 if (!objnum) | 951 if (!objnum) |
952 return false; | 952 return false; |
953 | 953 |
954 CPDF_Object* pUnownedObject = pObject.get(); | 954 CPDF_Object* pUnownedObject = pObject.get(); |
955 if (m_pDocument) { | 955 if (m_pDocument) { |
956 CPDF_Dictionary* pRootDict = m_pDocument->GetRoot(); | 956 CPDF_Dictionary* pRootDict = m_pDocument->GetRoot(); |
957 if (pRootDict && pRootDict->GetObjNum() == objnum) | 957 if (pRootDict && pRootDict->GetObjNum() == objnum) |
958 return false; | 958 return false; |
959 // Takes ownership of object (std::move someday). | |
960 if (!m_pDocument->ReplaceIndirectObjectIfHigherGeneration( | 959 if (!m_pDocument->ReplaceIndirectObjectIfHigherGeneration( |
961 objnum, pObject.release())) { | 960 objnum, std::move(pObject))) { |
962 return false; | 961 return false; |
963 } | 962 } |
964 } | 963 } |
965 | 964 |
966 CPDF_Stream* pStream = pUnownedObject->AsStream(); | 965 CPDF_Stream* pStream = pUnownedObject->AsStream(); |
967 if (!pStream) | 966 if (!pStream) |
968 return false; | 967 return false; |
969 | 968 |
970 CPDF_Dictionary* pDict = pStream->GetDict(); | 969 CPDF_Dictionary* pDict = pStream->GetDict(); |
971 *pos = pDict->GetIntegerFor("Prev"); | 970 *pos = pDict->GetIntegerFor("Prev"); |
(...skipping 635 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1607 if (!LoadLinearizedAllCrossRefV4(m_LastXRefOffset, m_dwXrefStartObjNum) && | 1606 if (!LoadLinearizedAllCrossRefV4(m_LastXRefOffset, m_dwXrefStartObjNum) && |
1608 !LoadLinearizedAllCrossRefV5(m_LastXRefOffset)) { | 1607 !LoadLinearizedAllCrossRefV5(m_LastXRefOffset)) { |
1609 m_LastXRefOffset = 0; | 1608 m_LastXRefOffset = 0; |
1610 m_pSyntax->m_MetadataObjnum = dwSaveMetadataObjnum; | 1609 m_pSyntax->m_MetadataObjnum = dwSaveMetadataObjnum; |
1611 return FORMAT_ERROR; | 1610 return FORMAT_ERROR; |
1612 } | 1611 } |
1613 | 1612 |
1614 m_pSyntax->m_MetadataObjnum = dwSaveMetadataObjnum; | 1613 m_pSyntax->m_MetadataObjnum = dwSaveMetadataObjnum; |
1615 return SUCCESS; | 1614 return SUCCESS; |
1616 } | 1615 } |
OLD | NEW |