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 804 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
815 (pRef && IsValidObjectNumber(pRef->GetRefObjNum()) && | 815 (pRef && IsValidObjectNumber(pRef->GetRefObjNum()) && |
816 m_ObjectInfo[pRef->GetRefObjNum()].pos != 0)) { | 816 m_ObjectInfo[pRef->GetRefObjNum()].pos != 0)) { |
817 auto it = pTrailer->begin(); | 817 auto it = pTrailer->begin(); |
818 while (it != pTrailer->end()) { | 818 while (it != pTrailer->end()) { |
819 const CFX_ByteString& key = it->first; | 819 const CFX_ByteString& key = it->first; |
820 CPDF_Object* pElement = it->second; | 820 CPDF_Object* pElement = it->second; |
821 ++it; | 821 ++it; |
822 uint32_t dwObjNum = | 822 uint32_t dwObjNum = |
823 pElement ? pElement->GetObjNum() : 0; | 823 pElement ? pElement->GetObjNum() : 0; |
824 if (dwObjNum) { | 824 if (dwObjNum) { |
825 m_pTrailer->SetAtReference(key.AsStringC(), | 825 m_pTrailer->SetAtReference(key, m_pDocument, |
826 m_pDocument, dwObjNum); | 826 dwObjNum); |
827 } else { | 827 } else { |
828 m_pTrailer->SetAt(key.AsStringC(), | 828 m_pTrailer->SetAt(key, pElement->Clone()); |
829 pElement->Clone()); | |
830 } | 829 } |
831 } | 830 } |
832 } | 831 } |
833 pObj->Release(); | 832 pObj->Release(); |
834 } else { | 833 } else { |
835 if (pObj->IsStream()) { | 834 if (pObj->IsStream()) { |
836 m_pTrailer = ToDictionary(pTrailer->Clone()); | 835 m_pTrailer = ToDictionary(pTrailer->Clone()); |
837 pObj->Release(); | 836 pObj->Release(); |
838 } else { | 837 } else { |
839 m_pTrailer = pTrailer; | 838 m_pTrailer = pTrailer; |
(...skipping 803 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1643 if (!LoadLinearizedAllCrossRefV4(m_LastXRefOffset, m_dwXrefStartObjNum) && | 1642 if (!LoadLinearizedAllCrossRefV4(m_LastXRefOffset, m_dwXrefStartObjNum) && |
1644 !LoadLinearizedAllCrossRefV5(m_LastXRefOffset)) { | 1643 !LoadLinearizedAllCrossRefV5(m_LastXRefOffset)) { |
1645 m_LastXRefOffset = 0; | 1644 m_LastXRefOffset = 0; |
1646 m_pSyntax->m_MetadataObjnum = dwSaveMetadataObjnum; | 1645 m_pSyntax->m_MetadataObjnum = dwSaveMetadataObjnum; |
1647 return FORMAT_ERROR; | 1646 return FORMAT_ERROR; |
1648 } | 1647 } |
1649 | 1648 |
1650 m_pSyntax->m_MetadataObjnum = dwSaveMetadataObjnum; | 1649 m_pSyntax->m_MetadataObjnum = dwSaveMetadataObjnum; |
1651 return SUCCESS; | 1650 return SUCCESS; |
1652 } | 1651 } |
OLD | NEW |