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

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

Issue 1886263003: Rename CFX_ByteTextBuf::GetByteString() to AsStringC(). (Closed) Base URL: https://pdfium.googlesource.com/pdfium.git@master
Patch Set: Created 4 years, 8 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 | « no previous file | core/fpdfapi/fpdf_parser/cpdf_syntax_parser.cpp » ('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 544 matching lines...) Expand 10 before | Expand all | Expand 10 after
555 int status = 0; 555 int status = 0;
556 int iEscCode = 0; 556 int iEscCode = 0;
557 while (1) { 557 while (1) {
558 switch (status) { 558 switch (status) {
559 case 0: 559 case 0:
560 if (ch == ')') { 560 if (ch == ')') {
561 if (parlevel == 0) { 561 if (parlevel == 0) {
562 if (buf.GetLength() > MAX_STRING_LENGTH) { 562 if (buf.GetLength() > MAX_STRING_LENGTH) {
563 return CFX_ByteString(buf.GetBuffer(), MAX_STRING_LENGTH); 563 return CFX_ByteString(buf.GetBuffer(), MAX_STRING_LENGTH);
564 } 564 }
565 return buf.GetByteString(); 565 return buf.AsStringC();
Tom Sepez 2016/04/14 20:21:08 note: this will make more sense and seem less dang
566 } 566 }
567 parlevel--; 567 parlevel--;
568 buf.AppendChar(')'); 568 buf.AppendChar(')');
569 } else if (ch == '(') { 569 } else if (ch == '(') {
570 parlevel++; 570 parlevel++;
571 buf.AppendChar('('); 571 buf.AppendChar('(');
572 } else if (ch == '\\') { 572 } else if (ch == '\\') {
573 status = 1; 573 status = 1;
574 } else { 574 } else {
575 buf.AppendChar((char)ch); 575 buf.AppendChar((char)ch);
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
634 break; 634 break;
635 635
636 ch = m_pBuf[m_Pos++]; 636 ch = m_pBuf[m_Pos++];
637 } 637 }
638 if (PositionIsInBounds()) 638 if (PositionIsInBounds())
639 ++m_Pos; 639 ++m_Pos;
640 640
641 if (buf.GetLength() > MAX_STRING_LENGTH) { 641 if (buf.GetLength() > MAX_STRING_LENGTH) {
642 return CFX_ByteString(buf.GetBuffer(), MAX_STRING_LENGTH); 642 return CFX_ByteString(buf.GetBuffer(), MAX_STRING_LENGTH);
643 } 643 }
644 return buf.GetByteString(); 644 return buf.AsStringC();
645 } 645 }
646 646
647 CFX_ByteString CPDF_StreamParser::ReadHexString() { 647 CFX_ByteString CPDF_StreamParser::ReadHexString() {
648 if (!PositionIsInBounds()) 648 if (!PositionIsInBounds())
649 return CFX_ByteString(); 649 return CFX_ByteString();
650 650
651 CFX_ByteTextBuf buf; 651 CFX_ByteTextBuf buf;
652 bool bFirst = true; 652 bool bFirst = true;
653 int code = 0; 653 int code = 0;
654 while (PositionIsInBounds()) { 654 while (PositionIsInBounds()) {
(...skipping 13 matching lines...) Expand all
668 buf.AppendByte((uint8_t)code); 668 buf.AppendByte((uint8_t)code);
669 } 669 }
670 bFirst = !bFirst; 670 bFirst = !bFirst;
671 } 671 }
672 if (!bFirst) 672 if (!bFirst)
673 buf.AppendChar((char)code); 673 buf.AppendChar((char)code);
674 674
675 if (buf.GetLength() > MAX_STRING_LENGTH) 675 if (buf.GetLength() > MAX_STRING_LENGTH)
676 return CFX_ByteString(buf.GetBuffer(), MAX_STRING_LENGTH); 676 return CFX_ByteString(buf.GetBuffer(), MAX_STRING_LENGTH);
677 677
678 return buf.GetByteString(); 678 return buf.AsStringC();
679 } 679 }
680 680
681 bool CPDF_StreamParser::PositionIsInBounds() const { 681 bool CPDF_StreamParser::PositionIsInBounds() const {
682 return m_Pos < m_Size; 682 return m_Pos < m_Size;
683 } 683 }
684 684
685 CPDF_ContentParser::CPDF_ContentParser() 685 CPDF_ContentParser::CPDF_ContentParser()
686 : m_Status(Ready), 686 : m_Status(Ready),
687 m_InternalStage(STAGE_GETCONTENT), 687 m_InternalStage(STAGE_GETCONTENT),
688 m_pObjectHolder(nullptr), 688 m_pObjectHolder(nullptr),
(...skipping 196 matching lines...) Expand 10 before | Expand all | Expand 10 after
885 } 885 }
886 m_Status = Done; 886 m_Status = Done;
887 return; 887 return;
888 } 888 }
889 steps++; 889 steps++;
890 if (pPause && pPause->NeedToPauseNow()) { 890 if (pPause && pPause->NeedToPauseNow()) {
891 break; 891 break;
892 } 892 }
893 } 893 }
894 } 894 }
OLDNEW
« no previous file with comments | « no previous file | core/fpdfapi/fpdf_parser/cpdf_syntax_parser.cpp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698