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

Side by Side Diff: core/fpdfapi/fpdf_page/fpdf_page_parser_old.cpp

Issue 1977093002: Make CFX_ByteString(const CFX_ByteStringC&) explicit. (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Rebase, nit Created 4 years, 7 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/fpdfapi/fpdf_page/fpdf_page_parser.cpp ('k') | core/fpdfapi/fpdf_page/pageint.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 "core/fpdfapi/fpdf_page/pageint.h" 7 #include "core/fpdfapi/fpdf_page/pageint.h"
8 8
9 #include <limits.h> 9 #include <limits.h>
10 10
(...skipping 484 matching lines...) Expand 10 before | Expand all | Expand 10 after
495 int status = 0; 495 int status = 0;
496 int iEscCode = 0; 496 int iEscCode = 0;
497 while (1) { 497 while (1) {
498 switch (status) { 498 switch (status) {
499 case 0: 499 case 0:
500 if (ch == ')') { 500 if (ch == ')') {
501 if (parlevel == 0) { 501 if (parlevel == 0) {
502 if (buf.GetLength() > kMaxStringLength) { 502 if (buf.GetLength() > kMaxStringLength) {
503 return CFX_ByteString(buf.GetBuffer(), kMaxStringLength); 503 return CFX_ByteString(buf.GetBuffer(), kMaxStringLength);
504 } 504 }
505 return buf.AsStringC(); 505 return buf.MakeString();
506 } 506 }
507 parlevel--; 507 parlevel--;
508 buf.AppendChar(')'); 508 buf.AppendChar(')');
509 } else if (ch == '(') { 509 } else if (ch == '(') {
510 parlevel++; 510 parlevel++;
511 buf.AppendChar('('); 511 buf.AppendChar('(');
512 } else if (ch == '\\') { 512 } else if (ch == '\\') {
513 status = 1; 513 status = 1;
514 } else { 514 } else {
515 buf.AppendChar((char)ch); 515 buf.AppendChar((char)ch);
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
574 break; 574 break;
575 575
576 ch = m_pBuf[m_Pos++]; 576 ch = m_pBuf[m_Pos++];
577 } 577 }
578 if (PositionIsInBounds()) 578 if (PositionIsInBounds())
579 ++m_Pos; 579 ++m_Pos;
580 580
581 if (buf.GetLength() > kMaxStringLength) { 581 if (buf.GetLength() > kMaxStringLength) {
582 return CFX_ByteString(buf.GetBuffer(), kMaxStringLength); 582 return CFX_ByteString(buf.GetBuffer(), kMaxStringLength);
583 } 583 }
584 return buf.AsStringC(); 584 return buf.MakeString();
585 } 585 }
586 586
587 CFX_ByteString CPDF_StreamParser::ReadHexString() { 587 CFX_ByteString CPDF_StreamParser::ReadHexString() {
588 if (!PositionIsInBounds()) 588 if (!PositionIsInBounds())
589 return CFX_ByteString(); 589 return CFX_ByteString();
590 590
591 CFX_ByteTextBuf buf; 591 CFX_ByteTextBuf buf;
592 bool bFirst = true; 592 bool bFirst = true;
593 int code = 0; 593 int code = 0;
594 while (PositionIsInBounds()) { 594 while (PositionIsInBounds()) {
(...skipping 13 matching lines...) Expand all
608 buf.AppendByte((uint8_t)code); 608 buf.AppendByte((uint8_t)code);
609 } 609 }
610 bFirst = !bFirst; 610 bFirst = !bFirst;
611 } 611 }
612 if (!bFirst) 612 if (!bFirst)
613 buf.AppendChar((char)code); 613 buf.AppendChar((char)code);
614 614
615 if (buf.GetLength() > kMaxStringLength) 615 if (buf.GetLength() > kMaxStringLength)
616 return CFX_ByteString(buf.GetBuffer(), kMaxStringLength); 616 return CFX_ByteString(buf.GetBuffer(), kMaxStringLength);
617 617
618 return buf.AsStringC(); 618 return buf.MakeString();
619 } 619 }
620 620
621 bool CPDF_StreamParser::PositionIsInBounds() const { 621 bool CPDF_StreamParser::PositionIsInBounds() const {
622 return m_Pos < m_Size; 622 return m_Pos < m_Size;
623 } 623 }
624 624
625 CPDF_ContentParser::CPDF_ContentParser() 625 CPDF_ContentParser::CPDF_ContentParser()
626 : m_Status(Ready), 626 : m_Status(Ready),
627 m_InternalStage(STAGE_GETCONTENT), 627 m_InternalStage(STAGE_GETCONTENT),
628 m_pObjectHolder(nullptr), 628 m_pObjectHolder(nullptr),
(...skipping 191 matching lines...) Expand 10 before | Expand all | Expand 10 after
820 } 820 }
821 m_Status = Done; 821 m_Status = Done;
822 return; 822 return;
823 } 823 }
824 steps++; 824 steps++;
825 if (pPause && pPause->NeedToPauseNow()) { 825 if (pPause && pPause->NeedToPauseNow()) {
826 break; 826 break;
827 } 827 }
828 } 828 }
829 } 829 }
OLDNEW
« no previous file with comments | « core/fpdfapi/fpdf_page/fpdf_page_parser.cpp ('k') | core/fpdfapi/fpdf_page/pageint.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698