OLD | NEW |
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 2367 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2378 break; | 2378 break; |
2379 } | 2379 } |
2380 if (key == FX_BSTRC("endobj")) { | 2380 if (key == FX_BSTRC("endobj")) { |
2381 m_Pos = SavedPos; | 2381 m_Pos = SavedPos; |
2382 break; | 2382 break; |
2383 } | 2383 } |
2384 if (key[0] != '/') { | 2384 if (key[0] != '/') { |
2385 continue; | 2385 continue; |
2386 } | 2386 } |
2387 key = PDF_NameDecode(key); | 2387 key = PDF_NameDecode(key); |
2388 CPDF_Object* pObj = GetObject(pObjList, objnum, gennum); | 2388 nonstd::unique_ptr<CPDF_Object, ReleaseDeleter<CPDF_Object>> obj( |
2389 if (pObj == NULL) { | 2389 GetObject(pObjList, objnum, gennum)); |
| 2390 if (!obj) { |
2390 if (pDict) { | 2391 if (pDict) { |
2391 pDict->Release(); | 2392 pDict->Release(); |
2392 } | 2393 } |
2393 uint8_t ch; | 2394 uint8_t ch; |
2394 while (1) { | 2395 while (1) { |
2395 if (!GetNextChar(ch)) { | 2396 if (!GetNextChar(ch)) { |
2396 break; | 2397 break; |
2397 } | 2398 } |
2398 if (ch == 0x0A || ch == 0x0D) { | 2399 if (ch == 0x0A || ch == 0x0D) { |
2399 break; | 2400 break; |
2400 } | 2401 } |
2401 } | 2402 } |
2402 return NULL; | 2403 return NULL; |
2403 } | 2404 } |
2404 if (key.GetLength() > 1) { | 2405 if (key.GetLength() > 1) { |
2405 pDict->AddValue(CFX_ByteStringC(key.c_str() + 1, key.GetLength() - 1), | 2406 pDict->AddValue(CFX_ByteStringC(key.c_str() + 1, key.GetLength() - 1), |
2406 pObj); | 2407 obj.release()); |
2407 } | 2408 } |
2408 } | 2409 } |
2409 if (pContext) { | 2410 if (pContext) { |
2410 pContext->m_DictEnd = m_Pos; | 2411 pContext->m_DictEnd = m_Pos; |
2411 if (pContext->m_Flags & PDFPARSE_NOSTREAM) { | 2412 if (pContext->m_Flags & PDFPARSE_NOSTREAM) { |
2412 return pDict; | 2413 return pDict; |
2413 } | 2414 } |
2414 } | 2415 } |
2415 FX_FILESIZE SavedPos = m_Pos; | 2416 FX_FILESIZE SavedPos = m_Pos; |
2416 FX_BOOL bIsNumber; | 2417 FX_BOOL bIsNumber; |
(...skipping 2274 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4691 return FALSE; | 4692 return FALSE; |
4692 } | 4693 } |
4693 CPDF_PageNode::~CPDF_PageNode() { | 4694 CPDF_PageNode::~CPDF_PageNode() { |
4694 int32_t iSize = m_childNode.GetSize(); | 4695 int32_t iSize = m_childNode.GetSize(); |
4695 for (int32_t i = 0; i < iSize; ++i) { | 4696 for (int32_t i = 0; i < iSize; ++i) { |
4696 CPDF_PageNode* pNode = (CPDF_PageNode*)m_childNode[i]; | 4697 CPDF_PageNode* pNode = (CPDF_PageNode*)m_childNode[i]; |
4697 delete pNode; | 4698 delete pNode; |
4698 } | 4699 } |
4699 m_childNode.RemoveAll(); | 4700 m_childNode.RemoveAll(); |
4700 } | 4701 } |
OLD | NEW |