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

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

Issue 2510223002: Make CPDF_Dictionary use unique pointers. (Closed)
Patch Set: rebase 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/cfdf_document.cpp ('k') | core/fpdfapi/parser/cpdf_dictionary.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_data_avail.h" 7 #include "core/fpdfapi/parser/cpdf_data_avail.h"
8 8
9 #include <algorithm> 9 #include <algorithm>
10 #include <memory> 10 #include <memory>
(...skipping 124 matching lines...) Expand 10 before | Expand all | Expand 10 after
135 new_obj_array.push_back(pArray->GetObjectAt(k)); 135 new_obj_array.push_back(pArray->GetObjectAt(k));
136 } break; 136 } break;
137 case CPDF_Object::STREAM: 137 case CPDF_Object::STREAM:
138 pObj = pObj->GetDict(); 138 pObj = pObj->GetDict();
139 case CPDF_Object::DICTIONARY: { 139 case CPDF_Object::DICTIONARY: {
140 CPDF_Dictionary* pDict = pObj->GetDict(); 140 CPDF_Dictionary* pDict = pObj->GetDict();
141 if (pDict && pDict->GetStringFor("Type") == "Page" && !bParsePage) 141 if (pDict && pDict->GetStringFor("Type") == "Page" && !bParsePage)
142 continue; 142 continue;
143 143
144 for (const auto& it : *pDict) { 144 for (const auto& it : *pDict) {
145 const CFX_ByteString& key = it.first; 145 if (it.first != "Parent")
146 CPDF_Object* value = it.second; 146 new_obj_array.push_back(it.second.get());
147 if (key != "Parent")
148 new_obj_array.push_back(value);
149 } 147 }
150 } break; 148 } break;
151 case CPDF_Object::REFERENCE: { 149 case CPDF_Object::REFERENCE: {
152 CPDF_Reference* pRef = pObj->AsReference(); 150 CPDF_Reference* pRef = pObj->AsReference();
153 uint32_t dwNum = pRef->GetRefObjNum(); 151 uint32_t dwNum = pRef->GetRefObjNum();
154 152
155 FX_FILESIZE offset; 153 FX_FILESIZE offset;
156 uint32_t size = GetObjectSize(dwNum, offset); 154 uint32_t size = GetObjectSize(dwNum, offset);
157 if (size == 0 || offset < 0 || offset >= m_dwFileLen) 155 if (size == 0 || offset < 0 || offset >= m_dwFileLen)
158 break; 156 break;
(...skipping 1541 matching lines...) Expand 10 before | Expand all | Expand 10 after
1700 return AreObjectsAvailable(obj_array, true, nullptr, dummy); 1698 return AreObjectsAvailable(obj_array, true, nullptr, dummy);
1701 } 1699 }
1702 1700
1703 CPDF_DataAvail::PageNode::PageNode() : m_type(PDF_PAGENODE_UNKNOWN) {} 1701 CPDF_DataAvail::PageNode::PageNode() : m_type(PDF_PAGENODE_UNKNOWN) {}
1704 1702
1705 CPDF_DataAvail::PageNode::~PageNode() { 1703 CPDF_DataAvail::PageNode::~PageNode() {
1706 for (int32_t i = 0; i < m_childNode.GetSize(); ++i) 1704 for (int32_t i = 0; i < m_childNode.GetSize(); ++i)
1707 delete m_childNode[i]; 1705 delete m_childNode[i];
1708 m_childNode.RemoveAll(); 1706 m_childNode.RemoveAll();
1709 } 1707 }
OLDNEW
« no previous file with comments | « core/fpdfapi/parser/cfdf_document.cpp ('k') | core/fpdfapi/parser/cpdf_dictionary.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698