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

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

Issue 2479303002: Use unique_ptr return from CPDF_Parser::ParseIndirectObject() (Closed)
Patch Set: 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
OLDNEW
1 // Copyright 2014 PDFium Authors. All rights reserved. 1 // Copyright 2014 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_document.h" 7 #include "core/fpdfapi/parser/cpdf_document.h"
8 8
9 #include <memory> 9 #include <memory>
10 #include <set> 10 #include <set>
(...skipping 335 matching lines...) Expand 10 before | Expand all | Expand 10 after
346 if (pParser) 346 if (pParser)
347 SetLastObjNum(m_pParser->GetLastObjNum()); 347 SetLastObjNum(m_pParser->GetLastObjNum());
348 } 348 }
349 349
350 CPDF_Document::~CPDF_Document() { 350 CPDF_Document::~CPDF_Document() {
351 delete m_pDocPage; 351 delete m_pDocPage;
352 CPDF_ModuleMgr::Get()->GetPageModule()->ClearStockFont(this); 352 CPDF_ModuleMgr::Get()->GetPageModule()->ClearStockFont(this);
353 m_pByteStringPool.DeleteObject(); // Make weak. 353 m_pByteStringPool.DeleteObject(); // Make weak.
354 } 354 }
355 355
356 CPDF_Object* CPDF_Document::ParseIndirectObject(uint32_t objnum) { 356 std::unique_ptr<CPDF_Object> CPDF_Document::ParseIndirectObject(
357 uint32_t objnum) {
357 return m_pParser ? m_pParser->ParseIndirectObject(this, objnum) : nullptr; 358 return m_pParser ? m_pParser->ParseIndirectObject(this, objnum) : nullptr;
358 } 359 }
359 360
360 void CPDF_Document::LoadDocInternal() { 361 void CPDF_Document::LoadDocInternal() {
361 SetLastObjNum(m_pParser->GetLastObjNum()); 362 SetLastObjNum(m_pParser->GetLastObjNum());
362 363
363 CPDF_Object* pRootObj = GetOrParseIndirectObject(m_pParser->GetRootObjNum()); 364 CPDF_Object* pRootObj = GetOrParseIndirectObject(m_pParser->GetRootObjNum());
364 if (!pRootObj) 365 if (!pRootObj)
365 return; 366 return;
366 367
(...skipping 678 matching lines...) Expand 10 before | Expand all | Expand 10 after
1045 pBBox, pLogFont->lfWeight / 5); 1046 pBBox, pLogFont->lfWeight / 5);
1046 pFontDesc->SetIntegerFor("CapHeight", capheight); 1047 pFontDesc->SetIntegerFor("CapHeight", capheight);
1047 pFontDict->SetReferenceFor("FontDescriptor", this, 1048 pFontDict->SetReferenceFor("FontDescriptor", this,
1048 AddIndirectObject(pFontDesc)); 1049 AddIndirectObject(pFontDesc));
1049 hFont = SelectObject(hDC, hFont); 1050 hFont = SelectObject(hDC, hFont);
1050 DeleteObject(hFont); 1051 DeleteObject(hFont);
1051 DeleteDC(hDC); 1052 DeleteDC(hDC);
1052 return LoadFont(pBaseDict); 1053 return LoadFont(pBaseDict);
1053 } 1054 }
1054 #endif // _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_ 1055 #endif // _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698