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

Side by Side Diff: core/src/fpdfapi/fpdf_parser/fpdf_parser_parser.cpp

Issue 1351383004: Change nonstd::unique_ptr to take a custom deleter. (Closed) Base URL: https://pdfium.googlesource.com/pdfium@master
Patch Set: address comments Created 5 years, 3 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/include/fxcrt/fx_basic.h ('k') | third_party/base/nonstd_unique_ptr.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 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 <set> 7 #include <set>
8 #include <utility> 8 #include <utility>
9 #include <vector> 9 #include <vector>
10 10
(...skipping 2358 matching lines...) Expand 10 before | Expand all | Expand 10 after
2369 break; 2369 break;
2370 } 2370 }
2371 if (key == FX_BSTRC("endobj")) { 2371 if (key == FX_BSTRC("endobj")) {
2372 m_Pos = SavedPos; 2372 m_Pos = SavedPos;
2373 break; 2373 break;
2374 } 2374 }
2375 if (key[0] != '/') { 2375 if (key[0] != '/') {
2376 continue; 2376 continue;
2377 } 2377 }
2378 key = PDF_NameDecode(key); 2378 key = PDF_NameDecode(key);
2379 CPDF_Object* pObj = GetObject(pObjList, objnum, gennum); 2379 nonstd::unique_ptr<CPDF_Object, ReleaseDeleter<CPDF_Object>> obj(
2380 if (pObj == NULL) { 2380 GetObject(pObjList, objnum, gennum));
2381 if (!obj) {
2381 if (pDict) { 2382 if (pDict) {
2382 pDict->Release(); 2383 pDict->Release();
2383 } 2384 }
2384 uint8_t ch; 2385 uint8_t ch;
2385 while (1) { 2386 while (1) {
2386 if (!GetNextChar(ch)) { 2387 if (!GetNextChar(ch)) {
2387 break; 2388 break;
2388 } 2389 }
2389 if (ch == 0x0A || ch == 0x0D) { 2390 if (ch == 0x0A || ch == 0x0D) {
2390 break; 2391 break;
2391 } 2392 }
2392 } 2393 }
2393 return NULL; 2394 return NULL;
2394 } 2395 }
2395 if (key.GetLength() > 1) { 2396 if (key.GetLength() > 1) {
2396 pDict->AddValue(CFX_ByteStringC(key.c_str() + 1, key.GetLength() - 1), 2397 pDict->AddValue(CFX_ByteStringC(key.c_str() + 1, key.GetLength() - 1),
2397 pObj); 2398 obj.release());
2398 } 2399 }
2399 } 2400 }
2400 if (pContext) { 2401 if (pContext) {
2401 pContext->m_DictEnd = m_Pos; 2402 pContext->m_DictEnd = m_Pos;
2402 if (pContext->m_Flags & PDFPARSE_NOSTREAM) { 2403 if (pContext->m_Flags & PDFPARSE_NOSTREAM) {
2403 return pDict; 2404 return pDict;
2404 } 2405 }
2405 } 2406 }
2406 FX_FILESIZE SavedPos = m_Pos; 2407 FX_FILESIZE SavedPos = m_Pos;
2407 FX_BOOL bIsNumber; 2408 FX_BOOL bIsNumber;
(...skipping 2274 matching lines...) Expand 10 before | Expand all | Expand 10 after
4682 return FALSE; 4683 return FALSE;
4683 } 4684 }
4684 CPDF_PageNode::~CPDF_PageNode() { 4685 CPDF_PageNode::~CPDF_PageNode() {
4685 int32_t iSize = m_childNode.GetSize(); 4686 int32_t iSize = m_childNode.GetSize();
4686 for (int32_t i = 0; i < iSize; ++i) { 4687 for (int32_t i = 0; i < iSize; ++i) {
4687 CPDF_PageNode* pNode = (CPDF_PageNode*)m_childNode[i]; 4688 CPDF_PageNode* pNode = (CPDF_PageNode*)m_childNode[i];
4688 delete pNode; 4689 delete pNode;
4689 } 4690 }
4690 m_childNode.RemoveAll(); 4691 m_childNode.RemoveAll();
4691 } 4692 }
OLDNEW
« no previous file with comments | « core/include/fxcrt/fx_basic.h ('k') | third_party/base/nonstd_unique_ptr.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698