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

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

Issue 2479303002: Use unique_ptr return from CPDF_Parser::ParseIndirectObject() (Closed)
Patch Set: Work around android 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 336 matching lines...) Expand 10 before | Expand all | Expand 10 after
347 if (pParser) 347 if (pParser)
348 SetLastObjNum(m_pParser->GetLastObjNum()); 348 SetLastObjNum(m_pParser->GetLastObjNum());
349 } 349 }
350 350
351 CPDF_Document::~CPDF_Document() { 351 CPDF_Document::~CPDF_Document() {
352 delete m_pDocPage; 352 delete m_pDocPage;
353 CPDF_ModuleMgr::Get()->GetPageModule()->ClearStockFont(this); 353 CPDF_ModuleMgr::Get()->GetPageModule()->ClearStockFont(this);
354 m_pByteStringPool.DeleteObject(); // Make weak. 354 m_pByteStringPool.DeleteObject(); // Make weak.
355 } 355 }
356 356
357 CPDF_Object* CPDF_Document::ParseIndirectObject(uint32_t objnum) { 357 std::unique_ptr<CPDF_Object> CPDF_Document::ParseIndirectObject(
358 uint32_t objnum) {
358 return m_pParser ? m_pParser->ParseIndirectObject(this, objnum) : nullptr; 359 return m_pParser ? m_pParser->ParseIndirectObject(this, objnum) : nullptr;
359 } 360 }
360 361
361 void CPDF_Document::LoadDocInternal() { 362 void CPDF_Document::LoadDocInternal() {
362 SetLastObjNum(m_pParser->GetLastObjNum()); 363 SetLastObjNum(m_pParser->GetLastObjNum());
363 364
364 CPDF_Object* pRootObj = GetOrParseIndirectObject(m_pParser->GetRootObjNum()); 365 CPDF_Object* pRootObj = GetOrParseIndirectObject(m_pParser->GetRootObjNum());
365 if (!pRootObj) 366 if (!pRootObj)
366 return; 367 return;
367 368
(...skipping 668 matching lines...) Expand 10 before | Expand all | Expand 10 after
1036 pBBox, pLogFont->lfWeight / 5); 1037 pBBox, pLogFont->lfWeight / 5);
1037 pFontDesc->SetIntegerFor("CapHeight", capheight); 1038 pFontDesc->SetIntegerFor("CapHeight", capheight);
1038 pFontDict->SetReferenceFor("FontDescriptor", this, 1039 pFontDict->SetReferenceFor("FontDescriptor", this,
1039 AddIndirectObject(pFontDesc)); 1040 AddIndirectObject(pFontDesc));
1040 hFont = SelectObject(hDC, hFont); 1041 hFont = SelectObject(hDC, hFont);
1041 DeleteObject(hFont); 1042 DeleteObject(hFont);
1042 DeleteDC(hDC); 1043 DeleteDC(hDC);
1043 return LoadFont(pBaseDict); 1044 return LoadFont(pBaseDict);
1044 } 1045 }
1045 #endif // _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_ 1046 #endif // _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698