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

Side by Side Diff: core/fpdfapi/page/cpdf_streamparser.cpp

Issue 2498223005: Make CPDF_Array take unique_ptrs (Closed)
Patch Set: nits 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/page/cpdf_streamcontentparser.cpp ('k') | core/fpdfapi/parser/cpdf_array.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/page/pageint.h" 7 #include "core/fpdfapi/page/pageint.h"
8 8
9 #include <limits.h> 9 #include <limits.h>
10 10
(...skipping 367 matching lines...) Expand 10 before | Expand all | Expand 10 after
378 if (first_char == '[') { 378 if (first_char == '[') {
379 if ((!bAllowNestedArray && dwInArrayLevel) || 379 if ((!bAllowNestedArray && dwInArrayLevel) ||
380 dwInArrayLevel > kMaxNestedArrayLevel) { 380 dwInArrayLevel > kMaxNestedArrayLevel) {
381 return nullptr; 381 return nullptr;
382 } 382 }
383 383
384 CPDF_Array* pArray = new CPDF_Array; 384 CPDF_Array* pArray = new CPDF_Array;
385 while (1) { 385 while (1) {
386 CPDF_Object* pObj = ReadNextObject(bAllowNestedArray, dwInArrayLevel + 1); 386 CPDF_Object* pObj = ReadNextObject(bAllowNestedArray, dwInArrayLevel + 1);
387 if (pObj) { 387 if (pObj) {
388 pArray->Add(pObj); 388 pArray->Add(pdfium::WrapUnique(pObj));
389 continue; 389 continue;
390 } 390 }
391
392 if (!m_WordSize || m_WordBuffer[0] == ']') 391 if (!m_WordSize || m_WordBuffer[0] == ']')
393 break; 392 break;
394 } 393 }
395 return pArray; 394 return pArray;
396 } 395 }
397 396
398 if (m_WordSize == 5 && !memcmp(m_WordBuffer, "false", 5)) 397 if (m_WordSize == 5 && !memcmp(m_WordBuffer, "false", 5))
399 return new CPDF_Boolean(false); 398 return new CPDF_Boolean(false);
400 399
401 if (m_WordSize == 4) { 400 if (m_WordSize == 4) {
(...skipping 216 matching lines...) Expand 10 before | Expand all | Expand 10 after
618 617
619 if (buf.GetLength() > kMaxStringLength) 618 if (buf.GetLength() > kMaxStringLength)
620 return CFX_ByteString(buf.GetBuffer(), kMaxStringLength); 619 return CFX_ByteString(buf.GetBuffer(), kMaxStringLength);
621 620
622 return buf.MakeString(); 621 return buf.MakeString();
623 } 622 }
624 623
625 bool CPDF_StreamParser::PositionIsInBounds() const { 624 bool CPDF_StreamParser::PositionIsInBounds() const {
626 return m_Pos < m_Size; 625 return m_Pos < m_Size;
627 } 626 }
OLDNEW
« no previous file with comments | « core/fpdfapi/page/cpdf_streamcontentparser.cpp ('k') | core/fpdfapi/parser/cpdf_array.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698