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

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

Issue 2477003002: Pass object to ReplaceIndirectObjectIfHigherGeneration() by unique_ptr. (Closed)
Patch Set: Fix issuse Created 4 years, 1 month 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') | no next file » | 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 938 matching lines...) Expand 10 before | Expand all | Expand 10 after
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
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 }
OLDNEW
« no previous file with comments | « core/fpdfapi/parser/cpdf_object_unittest.cpp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698