Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(202)

Side by Side Diff: core/fpdfapi/parser/cpdf_parser.cpp

Issue 2425783002: Revert "Make CPDF_Object containers hold objects via unique pointers." (Closed)
Patch Set: Created 4 years, 2 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « core/fpdfapi/parser/cpdf_object_unittest.cpp ('k') | core/fpdfapi/parser/cpdf_reference.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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
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.get(); 829 CPDF_Object* pElement = it->second;
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
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 }
OLDNEW
« no previous file with comments | « core/fpdfapi/parser/cpdf_object_unittest.cpp ('k') | core/fpdfapi/parser/cpdf_reference.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698