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 "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 Loading... | |
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 Loading... | |
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 Loading... | |
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 Loading... | |
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 } |
OLD | NEW |