From 275e260a6cd4a8e506ba974feb85ebcd926c1739 Mon Sep 17 00:00:00 2001 From: Ryan Harrison Date: Mon, 18 Sep 2017 14:23:18 -0400 Subject: Convert string class names Automated using git grep & sed. Replace StringC classes with StringView classes. Remove the CFX_ prefix and put string classes in fxcrt namespace. Change AsStringC() to AsStringView(). Rename tests from TEST(fxcrt, *String*Foo) to TEST(*String*, Foo). Couple of tests needed to have their names regularlized. BUG=pdfium:894 Change-Id: I7ca038685c8d803795f3ed02545124f7a224c83d Reviewed-on: https://pdfium-review.googlesource.com/14151 Reviewed-by: Tom Sepez Commit-Queue: Ryan Harrison --- core/fpdfapi/page/cpdf_streamparser.cpp | 41 ++++++++++++++++----------------- 1 file changed, 20 insertions(+), 21 deletions(-) (limited to 'core/fpdfapi/page/cpdf_streamparser.cpp') 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& pPool) +CPDF_StreamParser::CPDF_StreamParser(const uint8_t* pData, + uint32_t dwSize, + const CFX_WeakPtr& 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_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_StreamParser::ReadNextObject( if (bIsNumber) { m_WordBuffer[m_WordSize] = 0; return pdfium::MakeUnique( - 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(m_pPool, name); } if (first_char == '(') { - CFX_ByteString str = ReadString(); + ByteString str = ReadString(); return pdfium::MakeUnique(m_pPool, str, false); } @@ -340,8 +339,8 @@ std::unique_ptr 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 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(buf.tellp()), - kMaxStringLength)); + return ByteString(buf.str().c_str(), + std::min(static_cast(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(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(code); - return CFX_ByteString( + return ByteString( buf.str().c_str(), std::min(static_cast(buf.tellp()), kMaxStringLength)); } -- cgit v1.2.3