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 808 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
819 pStream ? pStream->GetDict() : pObj->AsDictionary()) { | 819 pStream ? pStream->GetDict() : pObj->AsDictionary()) { |
820 if (m_pTrailer) { | 820 if (m_pTrailer) { |
821 CPDF_Object* pRoot = pTrailer->GetObjectFor("Root"); | 821 CPDF_Object* pRoot = pTrailer->GetObjectFor("Root"); |
822 CPDF_Reference* pRef = ToReference(pRoot); | 822 CPDF_Reference* pRef = ToReference(pRoot); |
823 if (!pRoot || | 823 if (!pRoot || |
824 (pRef && IsValidObjectNumber(pRef->GetRefObjNum()) && | 824 (pRef && IsValidObjectNumber(pRef->GetRefObjNum()) && |
825 m_ObjectInfo[pRef->GetRefObjNum()].pos != 0)) { | 825 m_ObjectInfo[pRef->GetRefObjNum()].pos != 0)) { |
826 auto it = pTrailer->begin(); | 826 auto it = pTrailer->begin(); |
827 while (it != pTrailer->end()) { | 827 while (it != pTrailer->end()) { |
828 const CFX_ByteString& key = it->first; | 828 const CFX_ByteString& key = it->first; |
829 CPDF_Object* pElement = it->second; | 829 CPDF_Object* pElement = it->second.get(); |
830 ++it; | 830 ++it; |
831 uint32_t dwObjNum = | 831 uint32_t dwObjNum = |
832 pElement ? pElement->GetObjNum() : 0; | 832 pElement ? pElement->GetObjNum() : 0; |
833 if (dwObjNum) { | 833 if (dwObjNum) { |
834 m_pTrailer->SetReferenceFor(key, m_pDocument, | 834 m_pTrailer->SetReferenceFor(key, m_pDocument, |
835 dwObjNum); | 835 dwObjNum); |
836 } else { | 836 } else { |
837 m_pTrailer->SetFor(key, pElement->Clone()); | 837 m_pTrailer->SetFor(key, pElement->Clone()); |
838 } | 838 } |
839 } | 839 } |
(...skipping 778 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1618 if (!LoadLinearizedAllCrossRefV4(m_LastXRefOffset, m_dwXrefStartObjNum) && | 1618 if (!LoadLinearizedAllCrossRefV4(m_LastXRefOffset, m_dwXrefStartObjNum) && |
1619 !LoadLinearizedAllCrossRefV5(m_LastXRefOffset)) { | 1619 !LoadLinearizedAllCrossRefV5(m_LastXRefOffset)) { |
1620 m_LastXRefOffset = 0; | 1620 m_LastXRefOffset = 0; |
1621 m_pSyntax->m_MetadataObjnum = dwSaveMetadataObjnum; | 1621 m_pSyntax->m_MetadataObjnum = dwSaveMetadataObjnum; |
1622 return FORMAT_ERROR; | 1622 return FORMAT_ERROR; |
1623 } | 1623 } |
1624 | 1624 |
1625 m_pSyntax->m_MetadataObjnum = dwSaveMetadataObjnum; | 1625 m_pSyntax->m_MetadataObjnum = dwSaveMetadataObjnum; |
1626 return SUCCESS; | 1626 return SUCCESS; |
1627 } | 1627 } |
OLD | NEW |