diff options
Diffstat (limited to 'core/fpdfapi/page/cpdf_streamparser.cpp')
-rw-r--r-- | core/fpdfapi/page/cpdf_streamparser.cpp | 41 |
1 files changed, 20 insertions, 21 deletions
diff --git a/core/fpdfapi/page/cpdf_streamparser.cpp b/core/fpdfapi/page/cpdf_streamparser.cpp index f745331818..46cbfeb1fe 100644 --- a/core/fpdfapi/page/cpdf_streamparser.cpp +++ b/core/fpdfapi/page/cpdf_streamparser.cpp @@ -64,7 +64,7 @@ uint32_t DecodeInlineStream(const uint8_t* src_buf, uint32_t limit, int width, int height, - const CFX_ByteString& decoder, + const ByteString& decoder, CPDF_Dictionary* pParam, uint8_t** dest_buf, uint32_t* dest_size) { @@ -104,10 +104,9 @@ uint32_t DecodeInlineStream(const uint8_t* src_buf, CPDF_StreamParser::CPDF_StreamParser(const uint8_t* pData, uint32_t dwSize) : m_pBuf(pData), m_Size(dwSize), m_Pos(0), m_pPool(nullptr) {} -CPDF_StreamParser::CPDF_StreamParser( - const uint8_t* pData, - uint32_t dwSize, - const CFX_WeakPtr<CFX_ByteStringPool>& pPool) +CPDF_StreamParser::CPDF_StreamParser(const uint8_t* pData, + uint32_t dwSize, + const CFX_WeakPtr<ByteStringPool>& pPool) : m_pBuf(pData), m_Size(dwSize), m_Pos(0), m_pPool(pPool) {} CPDF_StreamParser::~CPDF_StreamParser() {} @@ -122,7 +121,7 @@ std::unique_ptr<CPDF_Stream> CPDF_StreamParser::ReadInlineStream( if (PDFCharIsWhitespace(m_pBuf[m_Pos])) m_Pos++; - CFX_ByteString Decoder; + ByteString Decoder; CPDF_Dictionary* pParam = nullptr; CPDF_Object* pFilter = pDict->GetDirectObjectFor("Filter"); if (pFilter) { @@ -312,18 +311,18 @@ std::unique_ptr<CPDF_Object> CPDF_StreamParser::ReadNextObject( if (bIsNumber) { m_WordBuffer[m_WordSize] = 0; return pdfium::MakeUnique<CPDF_Number>( - CFX_ByteStringC(m_WordBuffer, m_WordSize)); + ByteStringView(m_WordBuffer, m_WordSize)); } int first_char = m_WordBuffer[0]; if (first_char == '/') { - CFX_ByteString name = - PDF_NameDecode(CFX_ByteStringC(m_WordBuffer + 1, m_WordSize - 1)); + ByteString name = + PDF_NameDecode(ByteStringView(m_WordBuffer + 1, m_WordSize - 1)); return pdfium::MakeUnique<CPDF_Name>(m_pPool, name); } if (first_char == '(') { - CFX_ByteString str = ReadString(); + ByteString str = ReadString(); return pdfium::MakeUnique<CPDF_String>(m_pPool, str, false); } @@ -340,8 +339,8 @@ std::unique_ptr<CPDF_Object> CPDF_StreamParser::ReadNextObject( if (!m_WordSize || m_WordBuffer[0] != '/') return nullptr; - CFX_ByteString key = - PDF_NameDecode(CFX_ByteStringC(m_WordBuffer + 1, m_WordSize - 1)); + ByteString key = + PDF_NameDecode(ByteStringView(m_WordBuffer + 1, m_WordSize - 1)); std::unique_ptr<CPDF_Object> pObj = ReadNextObject(true, bInArray, dwRecursionLevel + 1); if (!pObj) @@ -464,9 +463,9 @@ void CPDF_StreamParser::GetNextWord(bool& bIsNumber) { } } -CFX_ByteString CPDF_StreamParser::ReadString() { +ByteString CPDF_StreamParser::ReadString() { if (!PositionIsInBounds()) - return CFX_ByteString(); + return ByteString(); uint8_t ch = m_pBuf[m_Pos++]; std::ostringstream buf; @@ -478,9 +477,9 @@ CFX_ByteString CPDF_StreamParser::ReadString() { case 0: if (ch == ')') { if (parlevel == 0) { - return CFX_ByteString(buf.str().c_str(), - std::min(static_cast<FX_STRSIZE>(buf.tellp()), - kMaxStringLength)); + return ByteString(buf.str().c_str(), + std::min(static_cast<FX_STRSIZE>(buf.tellp()), + kMaxStringLength)); } parlevel--; buf << ')'; @@ -555,14 +554,14 @@ CFX_ByteString CPDF_StreamParser::ReadString() { if (PositionIsInBounds()) ++m_Pos; - return CFX_ByteString( + return ByteString( buf.str().c_str(), std::min(static_cast<FX_STRSIZE>(buf.tellp()), kMaxStringLength)); } -CFX_ByteString CPDF_StreamParser::ReadHexString() { +ByteString CPDF_StreamParser::ReadHexString() { if (!PositionIsInBounds()) - return CFX_ByteString(); + return ByteString(); std::ostringstream buf; bool bFirst = true; @@ -588,7 +587,7 @@ CFX_ByteString CPDF_StreamParser::ReadHexString() { if (!bFirst) buf << static_cast<char>(code); - return CFX_ByteString( + return ByteString( buf.str().c_str(), std::min(static_cast<FX_STRSIZE>(buf.tellp()), kMaxStringLength)); } |