summaryrefslogtreecommitdiff
path: root/core/fpdfapi
diff options
context:
space:
mode:
authorRyan Harrison <rharrison@chromium.org>2017-09-18 14:23:18 -0400
committerChromium commit bot <commit-bot@chromium.org>2017-09-18 18:40:16 +0000
commit275e260a6cd4a8e506ba974feb85ebcd926c1739 (patch)
tree2029b9158ec044764ceff122fe5fb5d0a3f123d1 /core/fpdfapi
parent450fbeaaabf1ab340c1018de2e58f1950657517e (diff)
downloadpdfium-275e260a6cd4a8e506ba974feb85ebcd926c1739.tar.xz
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 <tsepez@chromium.org> Commit-Queue: Ryan Harrison <rharrison@chromium.org>
Diffstat (limited to 'core/fpdfapi')
-rw-r--r--core/fpdfapi/cmaps/cmap_int.h2
-rw-r--r--core/fpdfapi/cmaps/fpdf_cmaps.cpp2
-rw-r--r--core/fpdfapi/edit/cpdf_creator.cpp34
-rw-r--r--core/fpdfapi/edit/cpdf_pagecontentgenerator.cpp16
-rw-r--r--core/fpdfapi/edit/cpdf_pagecontentgenerator.h4
-rw-r--r--core/fpdfapi/edit/cpdf_pagecontentgenerator_unittest.cpp43
-rw-r--r--core/fpdfapi/font/cpdf_cidfont.cpp22
-rw-r--r--core/fpdfapi/font/cpdf_cidfont.h2
-rw-r--r--core/fpdfapi/font/cpdf_cmap.cpp8
-rw-r--r--core/fpdfapi/font/cpdf_cmap.h4
-rw-r--r--core/fpdfapi/font/cpdf_cmapmanager.cpp4
-rw-r--r--core/fpdfapi/font/cpdf_cmapmanager.h8
-rw-r--r--core/fpdfapi/font/cpdf_cmapparser.cpp16
-rw-r--r--core/fpdfapi/font/cpdf_cmapparser.h12
-rw-r--r--core/fpdfapi/font/cpdf_font.cpp30
-rw-r--r--core/fpdfapi/font/cpdf_font.h14
-rw-r--r--core/fpdfapi/font/cpdf_fontencoding.cpp6
-rw-r--r--core/fpdfapi/font/cpdf_fontencoding.h4
-rw-r--r--core/fpdfapi/font/cpdf_simplefont.cpp6
-rw-r--r--core/fpdfapi/font/cpdf_simplefont.h4
-rw-r--r--core/fpdfapi/font/cpdf_tounicodemap.cpp47
-rw-r--r--core/fpdfapi/font/cpdf_tounicodemap.h6
-rw-r--r--core/fpdfapi/font/cpdf_tounicodemap_unittest.cpp2
-rw-r--r--core/fpdfapi/font/cpdf_truetypefont.cpp2
-rw-r--r--core/fpdfapi/page/cpdf_allstates.cpp2
-rw-r--r--core/fpdfapi/page/cpdf_colorspace.cpp11
-rw-r--r--core/fpdfapi/page/cpdf_colorspace.h2
-rw-r--r--core/fpdfapi/page/cpdf_contentmark.cpp8
-rw-r--r--core/fpdfapi/page/cpdf_contentmark.h10
-rw-r--r--core/fpdfapi/page/cpdf_contentmarkitem.h6
-rw-r--r--core/fpdfapi/page/cpdf_docpagedata.cpp6
-rw-r--r--core/fpdfapi/page/cpdf_docpagedata.h4
-rw-r--r--core/fpdfapi/page/cpdf_generalstate.cpp44
-rw-r--r--core/fpdfapi/page/cpdf_generalstate.h8
-rw-r--r--core/fpdfapi/page/cpdf_image.cpp2
-rw-r--r--core/fpdfapi/page/cpdf_page.cpp4
-rw-r--r--core/fpdfapi/page/cpdf_page.h4
-rw-r--r--core/fpdfapi/page/cpdf_pageobjectholder.h8
-rw-r--r--core/fpdfapi/page/cpdf_psengine.cpp6
-rw-r--r--core/fpdfapi/page/cpdf_streamcontentparser.cpp100
-rw-r--r--core/fpdfapi/page/cpdf_streamcontentparser.h29
-rw-r--r--core/fpdfapi/page/cpdf_streamcontentparser_unittest.cpp40
-rw-r--r--core/fpdfapi/page/cpdf_streamparser.cpp41
-rw-r--r--core/fpdfapi/page/cpdf_streamparser.h12
-rw-r--r--core/fpdfapi/page/cpdf_textobject.cpp4
-rw-r--r--core/fpdfapi/page/cpdf_textobject.h6
-rw-r--r--core/fpdfapi/parser/cfdf_document.cpp8
-rw-r--r--core/fpdfapi/parser/cfdf_document.h2
-rw-r--r--core/fpdfapi/parser/cpdf_array.cpp10
-rw-r--r--core/fpdfapi/parser/cpdf_array.h8
-rw-r--r--core/fpdfapi/parser/cpdf_boolean.cpp6
-rw-r--r--core/fpdfapi/parser/cpdf_boolean.h4
-rw-r--r--core/fpdfapi/parser/cpdf_crypto_handler.cpp8
-rw-r--r--core/fpdfapi/parser/cpdf_crypto_handler.h4
-rw-r--r--core/fpdfapi/parser/cpdf_data_avail.cpp22
-rw-r--r--core/fpdfapi/parser/cpdf_data_avail.h4
-rw-r--r--core/fpdfapi/parser/cpdf_dictionary.cpp65
-rw-r--r--core/fpdfapi/parser/cpdf_dictionary.h67
-rw-r--r--core/fpdfapi/parser/cpdf_document.cpp26
-rw-r--r--core/fpdfapi/parser/cpdf_document.h2
-rw-r--r--core/fpdfapi/parser/cpdf_indirect_object_holder.cpp2
-rw-r--r--core/fpdfapi/parser/cpdf_indirect_object_holder.h4
-rw-r--r--core/fpdfapi/parser/cpdf_name.cpp11
-rw-r--r--core/fpdfapi/parser/cpdf_name.h10
-rw-r--r--core/fpdfapi/parser/cpdf_number.cpp14
-rw-r--r--core/fpdfapi/parser/cpdf_number.h6
-rw-r--r--core/fpdfapi/parser/cpdf_object.cpp10
-rw-r--r--core/fpdfapi/parser/cpdf_object.h6
-rw-r--r--core/fpdfapi/parser/cpdf_object_walker.cpp8
-rw-r--r--core/fpdfapi/parser/cpdf_object_walker.h4
-rw-r--r--core/fpdfapi/parser/cpdf_parser.cpp17
-rw-r--r--core/fpdfapi/parser/cpdf_parser.h4
-rw-r--r--core/fpdfapi/parser/cpdf_reference.cpp4
-rw-r--r--core/fpdfapi/parser/cpdf_reference.h2
-rw-r--r--core/fpdfapi/parser/cpdf_security_handler.cpp70
-rw-r--r--core/fpdfapi/parser/cpdf_security_handler.h6
-rw-r--r--core/fpdfapi/parser/cpdf_simple_parser.cpp18
-rw-r--r--core/fpdfapi/parser/cpdf_simple_parser.h6
-rw-r--r--core/fpdfapi/parser/cpdf_simple_parser_unittest.cpp2
-rw-r--r--core/fpdfapi/parser/cpdf_stream.cpp2
-rw-r--r--core/fpdfapi/parser/cpdf_stream.h2
-rw-r--r--core/fpdfapi/parser/cpdf_stream_acc.h4
-rw-r--r--core/fpdfapi/parser/cpdf_string.cpp16
-rw-r--r--core/fpdfapi/parser/cpdf_string.h14
-rw-r--r--core/fpdfapi/parser/cpdf_syntax_parser.cpp61
-rw-r--r--core/fpdfapi/parser/cpdf_syntax_parser.h20
-rw-r--r--core/fpdfapi/parser/fpdf_parser_decode.cpp24
-rw-r--r--core/fpdfapi/parser/fpdf_parser_decode.h18
-rw-r--r--core/fpdfapi/parser/fpdf_parser_decode_unittest.cpp2
-rw-r--r--core/fpdfapi/parser/fpdf_parser_utility.cpp20
-rw-r--r--core/fpdfapi/parser/fpdf_parser_utility.h2
-rw-r--r--core/fpdfapi/render/cpdf_charposlist.cpp2
-rw-r--r--core/fpdfapi/render/cpdf_dibsource.cpp12
-rw-r--r--core/fpdfapi/render/cpdf_imagerenderer.cpp4
-rw-r--r--core/fpdfapi/render/cpdf_textrenderer.cpp2
-rw-r--r--core/fpdfapi/render/cpdf_textrenderer.h2
-rw-r--r--core/fpdfapi/render/cpdf_type3cache.cpp2
-rw-r--r--core/fpdfapi/render/cpdf_type3cache.h2
98 files changed, 641 insertions, 665 deletions
diff --git a/core/fpdfapi/cmaps/cmap_int.h b/core/fpdfapi/cmaps/cmap_int.h
index e84dc11e5a..e661792843 100644
--- a/core/fpdfapi/cmaps/cmap_int.h
+++ b/core/fpdfapi/cmaps/cmap_int.h
@@ -23,7 +23,7 @@ struct FXCMAP_CMap {
int m_UseOffset;
};
-void FPDFAPI_FindEmbeddedCMap(const CFX_ByteString& name,
+void FPDFAPI_FindEmbeddedCMap(const ByteString& name,
int charset,
int coding,
const FXCMAP_CMap*& pMap);
diff --git a/core/fpdfapi/cmaps/fpdf_cmaps.cpp b/core/fpdfapi/cmaps/fpdf_cmaps.cpp
index 80ebbdef70..01c8da9691 100644
--- a/core/fpdfapi/cmaps/fpdf_cmaps.cpp
+++ b/core/fpdfapi/cmaps/fpdf_cmaps.cpp
@@ -53,7 +53,7 @@ static int compareDWordSingle(const void* p1, const void* p2) {
}; // extern "C"
-void FPDFAPI_FindEmbeddedCMap(const CFX_ByteString& bsName,
+void FPDFAPI_FindEmbeddedCMap(const ByteString& bsName,
int charset,
int coding,
const FXCMAP_CMap*& pMap) {
diff --git a/core/fpdfapi/edit/cpdf_creator.cpp b/core/fpdfapi/edit/cpdf_creator.cpp
index 38a21ba0cb..c3143b5322 100644
--- a/core/fpdfapi/edit/cpdf_creator.cpp
+++ b/core/fpdfapi/edit/cpdf_creator.cpp
@@ -33,7 +33,7 @@ class CFX_FileBufferArchive : public IFX_ArchiveStream {
bool WriteBlock(const void* pBuf, size_t size) override;
bool WriteByte(uint8_t byte) override;
bool WriteDWord(uint32_t i) override;
- bool WriteString(const CFX_ByteStringC& str) override;
+ bool WriteString(const ByteStringView& str) override;
FX_FILESIZE CurrentOffset() const override { return offset_; }
@@ -105,7 +105,7 @@ bool CFX_FileBufferArchive::WriteDWord(uint32_t i) {
return WriteBlock(buf, static_cast<size_t>(FXSYS_strlen(buf)));
}
-bool CFX_FileBufferArchive::WriteString(const CFX_ByteStringC& str) {
+bool CFX_FileBufferArchive::WriteString(const ByteStringView& str) {
return WriteBlock(str.raw_str(), str.GetLength());
}
@@ -220,7 +220,7 @@ bool CPDF_Creator::WriteDirectObj(uint32_t objnum,
break;
case CPDF_Object::STRING: {
- CFX_ByteString str = pObj->GetString();
+ ByteString str = pObj->GetString();
bool bHex = pObj->AsString()->IsHex();
if (!m_pCryptoHandler || !bEncrypt) {
if (!pObj->WriteTo(m_Archive.get()))
@@ -229,9 +229,9 @@ bool CPDF_Creator::WriteDirectObj(uint32_t objnum,
}
CPDF_Encryptor encryptor(m_pCryptoHandler.Get(), objnum,
(uint8_t*)str.c_str(), str.GetLength());
- CFX_ByteString content = PDF_EncodeString(
- CFX_ByteString(encryptor.GetData(), encryptor.GetSize()), bHex);
- if (!m_Archive->WriteString(content.AsStringC()))
+ ByteString content = PDF_EncodeString(
+ ByteString(encryptor.GetData(), encryptor.GetSize()), bHex);
+ if (!m_Archive->WriteString(content.AsStringView()))
return false;
break;
}
@@ -290,10 +290,10 @@ bool CPDF_Creator::WriteDirectObj(uint32_t objnum,
bool bSignDict = p->IsSignatureDict();
for (const auto& it : *p) {
bool bSignValue = false;
- const CFX_ByteString& key = it.first;
+ const ByteString& key = it.first;
CPDF_Object* pValue = it.second.get();
if (!m_Archive->WriteString("/") ||
- !m_Archive->WriteString(PDF_NameEncode(key).AsStringC())) {
+ !m_Archive->WriteString(PDF_NameEncode(key).AsStringView())) {
return false;
}
@@ -521,11 +521,11 @@ int32_t CPDF_Creator::WriteDoc_Stage3() {
m_XrefStart = m_Archive->CurrentOffset();
if (!IsIncremental() || !m_pParser->IsXRefStream()) {
if (!IsIncremental() || m_pParser->GetLastXRefOffset() == 0) {
- CFX_ByteString str;
+ ByteString str;
str = pdfium::ContainsKey(m_ObjectOffsets, 1)
? "xref\r\n"
: "xref\r\n0 1\r\n0000000000 65535 f\r\n";
- if (!m_Archive->WriteString(str.AsStringC()))
+ if (!m_Archive->WriteString(str.AsStringView()))
return -1;
m_CurObjNum = 1;
@@ -542,7 +542,7 @@ int32_t CPDF_Creator::WriteDoc_Stage3() {
}
}
if (m_iStage == 81) {
- CFX_ByteString str;
+ ByteString str;
uint32_t i = m_CurObjNum;
uint32_t j;
while (i <= dwLastObjNum) {
@@ -575,7 +575,7 @@ int32_t CPDF_Creator::WriteDoc_Stage3() {
m_iStage = 90;
}
if (m_iStage == 82) {
- CFX_ByteString str;
+ ByteString str;
uint32_t iCount = pdfium::CollectionSize<uint32_t>(m_NewObjNumArray);
uint32_t i = m_CurObjNum;
while (i < iCount) {
@@ -627,7 +627,7 @@ int32_t CPDF_Creator::WriteDoc_Stage4() {
if (m_pParser) {
CPDF_Dictionary* p = m_pParser->GetTrailer();
for (const auto& it : *p) {
- const CFX_ByteString& key = it.first;
+ const ByteString& key = it.first;
CPDF_Object* pValue = it.second.get();
if (key == "Encrypt" || key == "Size" || key == "Filter" ||
key == "Index" || key == "Length" || key == "Prev" || key == "W" ||
@@ -635,7 +635,7 @@ int32_t CPDF_Creator::WriteDoc_Stage4() {
continue;
}
if (!m_Archive->WriteString(("/")) ||
- !m_Archive->WriteString(PDF_NameEncode(key).AsStringC())) {
+ !m_Archive->WriteString(PDF_NameEncode(key).AsStringView())) {
return -1;
}
if (!pValue->IsInline()) {
@@ -782,7 +782,7 @@ void CPDF_Creator::InitID() {
} else {
std::vector<uint8_t> buffer =
GenerateFileID((uint32_t)(uintptr_t)this, m_dwLastObjNum);
- CFX_ByteString bsBuffer(buffer.data(), buffer.size());
+ ByteString bsBuffer(buffer.data(), buffer.size());
m_pIDArray->AddNew<CPDF_String>(bsBuffer, true);
}
}
@@ -795,7 +795,7 @@ void CPDF_Creator::InitID() {
}
std::vector<uint8_t> buffer =
GenerateFileID((uint32_t)(uintptr_t)this, m_dwLastObjNum);
- CFX_ByteString bsBuffer(buffer.data(), buffer.size());
+ ByteString bsBuffer(buffer.data(), buffer.size());
m_pIDArray->AddNew<CPDF_String>(bsBuffer, true);
return;
}
@@ -803,7 +803,7 @@ void CPDF_Creator::InitID() {
m_pIDArray->Add(m_pIDArray->GetObjectAt(0)->Clone());
if (m_pEncryptDict && !pOldIDArray && m_pParser && !idArrayPreExisting) {
if (m_pEncryptDict->GetStringFor("Filter") == "Standard") {
- CFX_ByteString user_pass = m_pParser->GetPassword();
+ ByteString user_pass = m_pParser->GetPassword();
uint32_t flag = PDF_ENCRYPT_CONTENT;
CPDF_SecurityHandler handler;
handler.OnCreate(m_pEncryptDict.Get(), m_pIDArray.get(),
diff --git a/core/fpdfapi/edit/cpdf_pagecontentgenerator.cpp b/core/fpdfapi/edit/cpdf_pagecontentgenerator.cpp
index 9153bf4cea..c0c6604671 100644
--- a/core/fpdfapi/edit/cpdf_pagecontentgenerator.cpp
+++ b/core/fpdfapi/edit/cpdf_pagecontentgenerator.cpp
@@ -121,9 +121,9 @@ void CPDF_PageContentGenerator::GenerateContent() {
pStream->GetObjNum());
}
-CFX_ByteString CPDF_PageContentGenerator::RealizeResource(
+ByteString CPDF_PageContentGenerator::RealizeResource(
uint32_t dwResourceObjNum,
- const CFX_ByteString& bsType) {
+ const ByteString& bsType) {
ASSERT(dwResourceObjNum);
if (!m_pObjHolder->m_pResources) {
m_pObjHolder->m_pResources = m_pDocument->NewIndirect<CPDF_Dictionary>();
@@ -135,7 +135,7 @@ CFX_ByteString CPDF_PageContentGenerator::RealizeResource(
if (!pResList)
pResList = m_pObjHolder->m_pResources->SetNewFor<CPDF_Dictionary>(bsType);
- CFX_ByteString name;
+ ByteString name;
int idnum = 1;
while (1) {
name.Format("FX%c%d", bsType[0], idnum);
@@ -188,7 +188,7 @@ void CPDF_PageContentGenerator::ProcessImage(std::ostringstream* buf,
pImage->ConvertStreamToIndirectObject();
uint32_t dwObjNum = pStream->GetObjNum();
- CFX_ByteString name = RealizeResource(dwObjNum, "XObject");
+ ByteString name = RealizeResource(dwObjNum, "XObject");
if (bWasInline)
pImageObj->SetImage(m_pDocument->GetPageData()->GetImage(dwObjNum));
@@ -295,7 +295,7 @@ void CPDF_PageContentGenerator::ProcessGraphics(std::ostringstream* buf,
return;
}
- CFX_ByteString name;
+ ByteString name;
auto it = m_pObjHolder->m_GraphicsMap.find(graphD);
if (it != m_pObjHolder->m_GraphicsMap.end()) {
name = it->second;
@@ -330,7 +330,7 @@ void CPDF_PageContentGenerator::ProcessDefaultGraphics(
defaultGraphics.strokeAlpha = 1.0f;
defaultGraphics.blendType = FXDIB_BLEND_NORMAL;
auto it = m_pObjHolder->m_GraphicsMap.find(defaultGraphics);
- CFX_ByteString name;
+ ByteString name;
if (it != m_pObjHolder->m_GraphicsMap.end()) {
name = it->second;
} else {
@@ -368,7 +368,7 @@ void CPDF_PageContentGenerator::ProcessText(std::ostringstream* buf,
return;
fontD.baseFont = pFont->GetBaseFont();
auto it = m_pObjHolder->m_FontsMap.find(fontD);
- CFX_ByteString dictName;
+ ByteString dictName;
if (it != m_pObjHolder->m_FontsMap.end()) {
dictName = it->second;
} else {
@@ -387,7 +387,7 @@ void CPDF_PageContentGenerator::ProcessText(std::ostringstream* buf,
}
*buf << "/" << PDF_NameEncode(dictName) << " " << pTextObj->GetFontSize()
<< " Tf ";
- CFX_ByteString text;
+ ByteString text;
for (uint32_t charcode : pTextObj->m_CharCodes) {
if (charcode != CPDF_Font::kInvalidCharCode)
pFont->AppendChar(&text, charcode);
diff --git a/core/fpdfapi/edit/cpdf_pagecontentgenerator.h b/core/fpdfapi/edit/cpdf_pagecontentgenerator.h
index 518d358451..433ad3361a 100644
--- a/core/fpdfapi/edit/cpdf_pagecontentgenerator.h
+++ b/core/fpdfapi/edit/cpdf_pagecontentgenerator.h
@@ -37,8 +37,8 @@ class CPDF_PageContentGenerator {
void ProcessGraphics(std::ostringstream* buf, CPDF_PageObject* pPageObj);
void ProcessDefaultGraphics(std::ostringstream* buf);
void ProcessText(std::ostringstream* buf, CPDF_TextObject* pTextObj);
- CFX_ByteString RealizeResource(uint32_t dwResourceObjNum,
- const CFX_ByteString& bsType);
+ ByteString RealizeResource(uint32_t dwResourceObjNum,
+ const ByteString& bsType);
CFX_UnownedPtr<CPDF_PageObjectHolder> const m_pObjHolder;
CFX_UnownedPtr<CPDF_Document> const m_pDocument;
diff --git a/core/fpdfapi/edit/cpdf_pagecontentgenerator_unittest.cpp b/core/fpdfapi/edit/cpdf_pagecontentgenerator_unittest.cpp
index 1dd6d25e2a..a0db869410 100644
--- a/core/fpdfapi/edit/cpdf_pagecontentgenerator_unittest.cpp
+++ b/core/fpdfapi/edit/cpdf_pagecontentgenerator_unittest.cpp
@@ -36,8 +36,8 @@ class CPDF_PageContentGeneratorTest : public testing::Test {
}
CPDF_Dictionary* TestGetResource(CPDF_PageContentGenerator* pGen,
- const CFX_ByteString& type,
- const CFX_ByteString& name) {
+ const ByteString& type,
+ const ByteString& name) {
return pGen->m_pObjHolder->m_pResources->GetDictFor(type)->GetDictFor(name);
}
@@ -58,7 +58,7 @@ TEST_F(CPDF_PageContentGeneratorTest, ProcessRect) {
CPDF_PageContentGenerator generator(pTestPage.get());
std::ostringstream buf;
TestProcessPath(&generator, &buf, pPathObj.get());
- EXPECT_EQ("q 1 0 0 1 0 0 cm 10 5 3 25 re B* Q\n", CFX_ByteString(buf));
+ EXPECT_EQ("q 1 0 0 1 0 0 cm 10 5 3 25 re B* Q\n", ByteString(buf));
pPathObj = pdfium::MakeUnique<CPDF_PathObject>();
pPathObj->m_Path.AppendPoint(CFX_PointF(0, 0), FXPT_TYPE::MoveTo, false);
@@ -71,7 +71,7 @@ TEST_F(CPDF_PageContentGeneratorTest, ProcessRect) {
buf.str("");
TestProcessPath(&generator, &buf, pPathObj.get());
- EXPECT_EQ("q 1 0 0 1 0 0 cm 0 0 5.2 3.78 re n Q\n", CFX_ByteString(buf));
+ EXPECT_EQ("q 1 0 0 1 0 0 cm 0 0 5.2 3.78 re n Q\n", ByteString(buf));
}
TEST_F(CPDF_PageContentGeneratorTest, ProcessPath) {
@@ -105,7 +105,7 @@ TEST_F(CPDF_PageContentGeneratorTest, ProcessPath) {
EXPECT_EQ(
"q 1 0 0 1 0 0 cm 3.102 4.67 m 5.45 0.29 l 4.24 3.15 4.65 2.98 3.456 0.24"
" c 10.6 11.15 l 11 12.5 l 11.46 12.67 11.84 12.96 12 13.64 c h f Q\n",
- CFX_ByteString(buf));
+ ByteString(buf));
}
TEST_F(CPDF_PageContentGeneratorTest, ProcessGraphics) {
@@ -132,7 +132,7 @@ TEST_F(CPDF_PageContentGeneratorTest, ProcessGraphics) {
CPDF_PageContentGenerator generator(pTestPage.get());
std::ostringstream buf;
TestProcessPath(&generator, &buf, pPathObj.get());
- CFX_ByteString pathString(buf);
+ ByteString pathString(buf);
// Color RGB values used are integers divided by 255.
EXPECT_EQ("q 0.501961 0.701961 0.34902 rg 1 0.901961 0 RG /",
@@ -150,7 +150,7 @@ TEST_F(CPDF_PageContentGeneratorTest, ProcessGraphics) {
pPathObj->m_GraphState.SetLineWidth(10.5f);
buf.str("");
TestProcessPath(&generator, &buf, pPathObj.get());
- CFX_ByteString pathString2(buf);
+ ByteString pathString2(buf);
EXPECT_EQ("q 0.501961 0.701961 0.34902 rg 1 0.901961 0 RG 10.5 w /",
pathString2.Left(55));
EXPECT_EQ(" gs 1 0 0 1 0 0 cm 1 2 m 3 4 l 5 6 l h B Q\n",
@@ -185,25 +185,25 @@ TEST_F(CPDF_PageContentGeneratorTest, ProcessStandardText) {
pTextObj->SetText("Hello World");
std::ostringstream buf;
TestProcessText(&generator, &buf, pTextObj.get());
- CFX_ByteString textString(buf);
+ ByteString textString(buf);
auto firstResourceAt = textString.Find('/');
ASSERT_TRUE(firstResourceAt.has_value());
firstResourceAt = firstResourceAt.value() + 1;
auto secondResourceAt = textString.ReverseFind('/');
ASSERT_TRUE(secondResourceAt.has_value());
secondResourceAt = secondResourceAt.value() + 1;
- CFX_ByteString firstString = textString.Left(firstResourceAt.value());
- CFX_ByteString midString =
+ ByteString firstString = textString.Left(firstResourceAt.value());
+ ByteString midString =
textString.Mid(firstResourceAt.value(),
secondResourceAt.value() - firstResourceAt.value());
- CFX_ByteString lastString =
+ ByteString lastString =
textString.Right(textString.GetLength() - secondResourceAt.value());
// q and Q must be outside the BT .. ET operations
- CFX_ByteString compareString1 =
+ ByteString compareString1 =
"q 0.501961 0.701961 0.34902 rg 1 0.901961 0 RG /";
// Color RGB values used are integers divided by 255.
- CFX_ByteString compareString2 = " gs BT 1 0 0 1 100 100 Tm /";
- CFX_ByteString compareString3 = " 10 Tf <48656C6C6F20576F726C64> Tj ET Q\n";
+ ByteString compareString2 = " gs BT 1 0 0 1 100 100 Tm /";
+ ByteString compareString3 = " 10 Tf <48656C6C6F20576F726C64> Tj ET Q\n";
EXPECT_LT(compareString1.GetLength() + compareString2.GetLength() +
compareString3.GetLength(),
textString.GetLength());
@@ -257,17 +257,16 @@ TEST_F(CPDF_PageContentGeneratorTest, ProcessText) {
TestProcessText(&generator, &buf, pTextObj.get());
}
- CFX_ByteString textString(buf);
+ ByteString textString(buf);
auto firstResourceAt = textString.Find('/');
ASSERT_TRUE(firstResourceAt.has_value());
firstResourceAt = firstResourceAt.value() + 1;
- CFX_ByteString firstString = textString.Left(firstResourceAt.value());
- CFX_ByteString lastString =
+ ByteString firstString = textString.Left(firstResourceAt.value());
+ ByteString lastString =
textString.Right(textString.GetLength() - firstResourceAt.value());
// q and Q must be outside the BT .. ET operations
- CFX_ByteString compareString1 = "q BT 1 0 0 1 0 0 Tm /";
- CFX_ByteString compareString2 =
- " 15.5 Tf <4920616D20696E646972656374> Tj ET Q\n";
+ ByteString compareString1 = "q BT 1 0 0 1 0 0 Tm /";
+ ByteString compareString2 = " 15.5 Tf <4920616D20696E646972656374> Tj ET Q\n";
EXPECT_LT(compareString1.GetLength() + compareString2.GetLength(),
textString.GetLength());
EXPECT_EQ(compareString1, textString.Left(compareString1.GetLength()));
@@ -305,7 +304,7 @@ TEST_F(CPDF_PageContentGeneratorTest, ProcessEmptyForm) {
CPDF_PageContentGenerator generator(pTestForm.get());
std::ostringstream buf;
generator.ProcessPageObjects(&buf);
- EXPECT_EQ("", CFX_ByteString(buf));
+ EXPECT_EQ("", ByteString(buf));
}
TEST_F(CPDF_PageContentGeneratorTest, ProcessFormWithPath) {
@@ -330,5 +329,5 @@ TEST_F(CPDF_PageContentGeneratorTest, ProcessFormWithPath) {
CPDF_PageContentGenerator generator(pTestForm.get());
std::ostringstream process_buf;
generator.ProcessPageObjects(&process_buf);
- EXPECT_EQ(content, CFX_ByteString(process_buf));
+ EXPECT_EQ(content, ByteString(process_buf));
}
diff --git a/core/fpdfapi/font/cpdf_cidfont.cpp b/core/fpdfapi/font/cpdf_cidfont.cpp
index a67abd29ac..9b326f5c4f 100644
--- a/core/fpdfapi/font/cpdf_cidfont.cpp
+++ b/core/fpdfapi/font/cpdf_cidfont.cpp
@@ -239,12 +239,12 @@ bool CPDF_CIDFont::IsVertWriting() const {
return m_pCMap && m_pCMap->IsVertWriting();
}
-CFX_WideString CPDF_CIDFont::UnicodeFromCharCode(uint32_t charcode) const {
- CFX_WideString str = CPDF_Font::UnicodeFromCharCode(charcode);
+WideString CPDF_CIDFont::UnicodeFromCharCode(uint32_t charcode) const {
+ WideString str = CPDF_Font::UnicodeFromCharCode(charcode);
if (!str.IsEmpty())
return str;
wchar_t ret = GetUnicodeFromCharCode(charcode);
- return ret ? ret : CFX_WideString();
+ return ret ? ret : WideString();
}
wchar_t CPDF_CIDFont::GetUnicodeFromCharCode(uint32_t charcode) const {
@@ -356,12 +356,12 @@ bool CPDF_CIDFont::Load() {
if (!pEncoding)
return false;
- CFX_ByteString subtype = pCIDFontDict->GetStringFor("Subtype");
+ ByteString subtype = pCIDFontDict->GetStringFor("Subtype");
m_bType1 = (subtype == "CIDFontType0");
CPDF_CMapManager& manager = GetFontGlobals()->m_CMapManager;
if (pEncoding->IsName()) {
- CFX_ByteString cmap = pEncoding->GetString();
+ ByteString cmap = pEncoding->GetString();
bool bPromptCJK = m_pFontFile && m_bType1;
m_pCMap = manager.GetPredefinedCMap(cmap, bPromptCJK);
if (!m_pCMap)
@@ -380,7 +380,7 @@ bool CPDF_CIDFont::Load() {
CPDF_Dictionary* pCIDInfo = pCIDFontDict->GetDictFor("CIDSystemInfo");
if (pCIDInfo) {
m_Charset = CPDF_CMapParser::CharsetFromOrdering(
- pCIDInfo->GetStringFor("Ordering").AsStringC());
+ pCIDInfo->GetStringFor("Ordering").AsStringView());
}
}
if (m_Charset != CIDSET_UNKNOWN) {
@@ -621,7 +621,7 @@ int CPDF_CIDFont::GlyphFromCharCode(uint32_t charcode, bool* pVertGlyph) {
if (m_Flags & FXFONT_SYMBOLIC)
return cid;
- CFX_WideString uni_str = UnicodeFromCharCode(charcode);
+ WideString uni_str = UnicodeFromCharCode(charcode);
if (uni_str.IsEmpty())
return cid;
@@ -633,7 +633,7 @@ int CPDF_CIDFont::GlyphFromCharCode(uint32_t charcode, bool* pVertGlyph) {
if (unicode == 0)
unicode = GetUnicodeFromCharCode(charcode);
if (unicode == 0) {
- CFX_WideString unicode_str = UnicodeFromCharCode(charcode);
+ WideString unicode_str = UnicodeFromCharCode(charcode);
if (!unicode_str.IsEmpty())
unicode = unicode_str[0];
}
@@ -651,8 +651,8 @@ int CPDF_CIDFont::GlyphFromCharCode(uint32_t charcode, bool* pVertGlyph) {
iBaseEncoding = PDFFONT_ENCODING_WINANSI;
else if (bMacRoman)
iBaseEncoding = PDFFONT_ENCODING_MACROMAN;
- const char* name = GetAdobeCharName(
- iBaseEncoding, std::vector<CFX_ByteString>(), charcode);
+ const char* name =
+ GetAdobeCharName(iBaseEncoding, std::vector<ByteString>(), charcode);
if (!name)
return charcode ? static_cast<int>(charcode) : -1;
@@ -729,7 +729,7 @@ int CPDF_CIDFont::GlyphFromCharCode(uint32_t charcode, bool* pVertGlyph) {
}
if (FXFT_Get_Charmap_Encoding(FXFT_Get_Face_Charmap(m_Font.GetFace())) ==
FXFT_ENCODING_UNICODE) {
- CFX_WideString unicode_str = UnicodeFromCharCode(charcode);
+ WideString unicode_str = UnicodeFromCharCode(charcode);
if (unicode_str.IsEmpty())
return -1;
diff --git a/core/fpdfapi/font/cpdf_cidfont.h b/core/fpdfapi/font/cpdf_cidfont.h
index 07982a418f..f4ddcfd577 100644
--- a/core/fpdfapi/font/cpdf_cidfont.h
+++ b/core/fpdfapi/font/cpdf_cidfont.h
@@ -54,7 +54,7 @@ class CPDF_CIDFont : public CPDF_Font {
bool IsVertWriting() const override;
bool IsUnicodeCompatible() const override;
bool Load() override;
- CFX_WideString UnicodeFromCharCode(uint32_t charcode) const override;
+ WideString UnicodeFromCharCode(uint32_t charcode) const override;
uint32_t CharCodeFromUnicode(wchar_t Unicode) const override;
uint16_t CIDFromCharCode(uint32_t charcode) const;
diff --git a/core/fpdfapi/font/cpdf_cmap.cpp b/core/fpdfapi/font/cpdf_cmap.cpp
index 0d3745e44a..54f7b34ca0 100644
--- a/core/fpdfapi/font/cpdf_cmap.cpp
+++ b/core/fpdfapi/font/cpdf_cmap.cpp
@@ -248,7 +248,7 @@ CPDF_CMap::CPDF_CMap()
CPDF_CMap::~CPDF_CMap() {}
void CPDF_CMap::LoadPredefined(CPDF_CMapManager* pMgr,
- const CFX_ByteString& bsName,
+ const ByteString& bsName,
bool bPromptCJK) {
m_PredefinedCMap = bsName;
if (m_PredefinedCMap == "Identity-H" || m_PredefinedCMap == "Identity-V") {
@@ -257,14 +257,14 @@ void CPDF_CMap::LoadPredefined(CPDF_CMapManager* pMgr,
m_bLoaded = true;
return;
}
- CFX_ByteString cmapid = m_PredefinedCMap;
+ ByteString cmapid = m_PredefinedCMap;
m_bVertical = cmapid.Last() == 'V';
if (cmapid.GetLength() > 2) {
cmapid = cmapid.Left(cmapid.GetLength() - 2);
}
const PredefinedCMap* map = nullptr;
for (size_t i = 0; i < FX_ArraySize(g_PredefinedCMaps); ++i) {
- if (cmapid == CFX_ByteStringC(g_PredefinedCMaps[i].m_pName)) {
+ if (cmapid == ByteStringView(g_PredefinedCMaps[i].m_pName)) {
map = &g_PredefinedCMaps[i];
break;
}
@@ -295,7 +295,7 @@ void CPDF_CMap::LoadEmbedded(const uint8_t* pData, uint32_t size) {
CPDF_CMapParser parser(this);
CPDF_SimpleParser syntax(pData, size);
while (1) {
- CFX_ByteStringC word = syntax.GetWord();
+ ByteStringView word = syntax.GetWord();
if (word.IsEmpty()) {
break;
}
diff --git a/core/fpdfapi/font/cpdf_cmap.h b/core/fpdfapi/font/cpdf_cmap.h
index f4d6ca9113..3e23d03a01 100644
--- a/core/fpdfapi/font/cpdf_cmap.h
+++ b/core/fpdfapi/font/cpdf_cmap.h
@@ -51,7 +51,7 @@ class CPDF_CMap : public CFX_Retainable {
friend CFX_RetainPtr<T> pdfium::MakeRetain(Args&&... args);
void LoadPredefined(CPDF_CMapManager* pMgr,
- const CFX_ByteString& name,
+ const ByteString& name,
bool bPromptCJK);
void LoadEmbedded(const uint8_t* pData, uint32_t dwSize);
@@ -70,7 +70,7 @@ class CPDF_CMap : public CFX_Retainable {
CPDF_CMap();
~CPDF_CMap() override;
- CFX_ByteString m_PredefinedCMap;
+ ByteString m_PredefinedCMap;
bool m_bLoaded;
bool m_bVertical;
CIDSet m_Charset;
diff --git a/core/fpdfapi/font/cpdf_cmapmanager.cpp b/core/fpdfapi/font/cpdf_cmapmanager.cpp
index 040af5556a..a449db6a45 100644
--- a/core/fpdfapi/font/cpdf_cmapmanager.cpp
+++ b/core/fpdfapi/font/cpdf_cmapmanager.cpp
@@ -17,7 +17,7 @@ CPDF_CMapManager::CPDF_CMapManager() {}
CPDF_CMapManager::~CPDF_CMapManager() {}
CFX_RetainPtr<CPDF_CMap> CPDF_CMapManager::GetPredefinedCMap(
- const CFX_ByteString& name,
+ const ByteString& name,
bool bPromptCJK) {
auto it = m_CMaps.find(name);
if (it != m_CMaps.end())
@@ -31,7 +31,7 @@ CFX_RetainPtr<CPDF_CMap> CPDF_CMapManager::GetPredefinedCMap(
}
CFX_RetainPtr<CPDF_CMap> CPDF_CMapManager::LoadPredefinedCMap(
- const CFX_ByteString& name,
+ const ByteString& name,
bool bPromptCJK) {
const char* pname = name.c_str();
if (*pname == '/')
diff --git a/core/fpdfapi/font/cpdf_cmapmanager.h b/core/fpdfapi/font/cpdf_cmapmanager.h
index 1bc1c6f839..6a860e6859 100644
--- a/core/fpdfapi/font/cpdf_cmapmanager.h
+++ b/core/fpdfapi/font/cpdf_cmapmanager.h
@@ -11,7 +11,7 @@
#include <memory>
#include "core/fpdfapi/font/cpdf_cidfont.h"
-#include "core/fxcrt/cfx_bytestring.h"
+#include "core/fxcrt/bytestring.h"
#include "core/fxcrt/cfx_retain_ptr.h"
class CPDF_CMapManager {
@@ -19,17 +19,17 @@ class CPDF_CMapManager {
CPDF_CMapManager();
~CPDF_CMapManager();
- CFX_RetainPtr<CPDF_CMap> GetPredefinedCMap(const CFX_ByteString& name,
+ CFX_RetainPtr<CPDF_CMap> GetPredefinedCMap(const ByteString& name,
bool bPromptCJK);
CPDF_CID2UnicodeMap* GetCID2UnicodeMap(CIDSet charset, bool bPromptCJK);
private:
- CFX_RetainPtr<CPDF_CMap> LoadPredefinedCMap(const CFX_ByteString& name,
+ CFX_RetainPtr<CPDF_CMap> LoadPredefinedCMap(const ByteString& name,
bool bPromptCJK);
std::unique_ptr<CPDF_CID2UnicodeMap> LoadCID2UnicodeMap(CIDSet charset,
bool bPromptCJK);
- std::map<CFX_ByteString, CFX_RetainPtr<CPDF_CMap>> m_CMaps;
+ std::map<ByteString, CFX_RetainPtr<CPDF_CMap>> m_CMaps;
std::unique_ptr<CPDF_CID2UnicodeMap> m_CID2UnicodeMaps[6];
};
diff --git a/core/fpdfapi/font/cpdf_cmapparser.cpp b/core/fpdfapi/font/cpdf_cmapparser.cpp
index 101ae5f0c8..f7d4dc1c33 100644
--- a/core/fpdfapi/font/cpdf_cmapparser.cpp
+++ b/core/fpdfapi/font/cpdf_cmapparser.cpp
@@ -32,9 +32,9 @@ CIDSet CIDSetFromSizeT(size_t index) {
return static_cast<CIDSet>(index);
}
-CFX_ByteStringC CMap_GetString(const CFX_ByteStringC& word) {
+ByteStringView CMap_GetString(const ByteStringView& word) {
if (word.GetLength() <= 2)
- return CFX_ByteStringC();
+ return ByteStringView();
return word.Right(word.GetLength() - 2);
}
@@ -45,7 +45,7 @@ CPDF_CMapParser::CPDF_CMapParser(CPDF_CMap* pCMap)
CPDF_CMapParser::~CPDF_CMapParser() {}
-void CPDF_CMapParser::ParseWord(const CFX_ByteStringC& word) {
+void CPDF_CMapParser::ParseWord(const ByteStringView& word) {
if (word.IsEmpty()) {
return;
}
@@ -126,7 +126,7 @@ void CPDF_CMapParser::ParseWord(const CFX_ByteStringC& word) {
}
if (m_CodeSeq % 2) {
CPDF_CMap::CodeRange range;
- if (CMap_GetCodeRange(range, m_LastWord.AsStringC(), word))
+ if (CMap_GetCodeRange(range, m_LastWord.AsStringView(), word))
m_CodeRanges.push_back(range);
}
m_CodeSeq++;
@@ -136,7 +136,7 @@ void CPDF_CMapParser::ParseWord(const CFX_ByteStringC& word) {
}
// Static.
-uint32_t CPDF_CMapParser::CMap_GetCode(const CFX_ByteStringC& word) {
+uint32_t CPDF_CMapParser::CMap_GetCode(const ByteStringView& word) {
if (word.IsEmpty())
return 0;
pdfium::base::CheckedNumeric<uint32_t> num = 0;
@@ -160,8 +160,8 @@ uint32_t CPDF_CMapParser::CMap_GetCode(const CFX_ByteStringC& word) {
// Static.
bool CPDF_CMapParser::CMap_GetCodeRange(CPDF_CMap::CodeRange& range,
- const CFX_ByteStringC& first,
- const CFX_ByteStringC& second) {
+ const ByteStringView& first,
+ const ByteStringView& second) {
if (first.GetLength() == 0 || first[0] != '<')
return false;
@@ -193,7 +193,7 @@ bool CPDF_CMapParser::CMap_GetCodeRange(CPDF_CMap::CodeRange& range,
}
// static
-CIDSet CPDF_CMapParser::CharsetFromOrdering(const CFX_ByteStringC& ordering) {
+CIDSet CPDF_CMapParser::CharsetFromOrdering(const ByteStringView& ordering) {
for (size_t charset = 1; charset < FX_ArraySize(g_CharsetNames); ++charset) {
if (ordering == g_CharsetNames[charset])
return CIDSetFromSizeT(charset);
diff --git a/core/fpdfapi/font/cpdf_cmapparser.h b/core/fpdfapi/font/cpdf_cmapparser.h
index b0a0ced30f..b3c8326b98 100644
--- a/core/fpdfapi/font/cpdf_cmapparser.h
+++ b/core/fpdfapi/font/cpdf_cmapparser.h
@@ -20,7 +20,7 @@ class CPDF_CMapParser {
explicit CPDF_CMapParser(CPDF_CMap* pMap);
~CPDF_CMapParser();
- void ParseWord(const CFX_ByteStringC& str);
+ void ParseWord(const ByteStringView& str);
bool HasAdditionalMappings() const {
return !m_AdditionalCharcodeToCIDMappings.empty();
}
@@ -28,16 +28,16 @@ class CPDF_CMapParser {
return std::move(m_AdditionalCharcodeToCIDMappings);
}
- static CIDSet CharsetFromOrdering(const CFX_ByteStringC& ordering);
+ static CIDSet CharsetFromOrdering(const ByteStringView& ordering);
private:
friend class cpdf_cmapparser_CMap_GetCode_Test;
friend class cpdf_cmapparser_CMap_GetCodeRange_Test;
- static uint32_t CMap_GetCode(const CFX_ByteStringC& word);
+ static uint32_t CMap_GetCode(const ByteStringView& word);
static bool CMap_GetCodeRange(CPDF_CMap::CodeRange& range,
- const CFX_ByteStringC& first,
- const CFX_ByteStringC& second);
+ const ByteStringView& first,
+ const ByteStringView& second);
CFX_UnownedPtr<CPDF_CMap> const m_pCMap;
int m_Status;
@@ -45,7 +45,7 @@ class CPDF_CMapParser {
uint32_t m_CodePoints[4];
std::vector<CPDF_CMap::CodeRange> m_CodeRanges;
std::vector<CPDF_CMap::CIDRange> m_AdditionalCharcodeToCIDMappings;
- CFX_ByteString m_LastWord;
+ ByteString m_LastWord;
};
#endif // CORE_FPDFAPI_FONT_CPDF_CMAPPARSER_H_
diff --git a/core/fpdfapi/font/cpdf_font.cpp b/core/fpdfapi/font/cpdf_font.cpp
index 0fd8b45326..9aaaa27b2e 100644
--- a/core/fpdfapi/font/cpdf_font.cpp
+++ b/core/fpdfapi/font/cpdf_font.cpp
@@ -37,7 +37,7 @@ const uint8_t kChineseFontNames[][5] = {{0xCB, 0xCE, 0xCC, 0xE5, 0x00},
{0xB7, 0xC2, 0xCB, 0xCE, 0x00},
{0xD0, 0xC2, 0xCB, 0xCE, 0x00}};
-void GetPredefinedEncoding(const CFX_ByteString& value, int* basemap) {
+void GetPredefinedEncoding(const ByteString& value, int* basemap) {
if (value == "WinAnsiEncoding")
*basemap = PDFFONT_ENCODING_WINANSI;
else if (value == "MacRomanEncoding")
@@ -140,17 +140,17 @@ int CPDF_Font::AppendChar(char* buf, uint32_t charcode) const {
return 1;
}
-void CPDF_Font::AppendChar(CFX_ByteString* str, uint32_t charcode) const {
+void CPDF_Font::AppendChar(ByteString* str, uint32_t charcode) const {
char buf[4];
int len = AppendChar(buf, charcode);
- *str += CFX_ByteStringC(buf, len);
+ *str += ByteStringView(buf, len);
}
-CFX_WideString CPDF_Font::UnicodeFromCharCode(uint32_t charcode) const {
+WideString CPDF_Font::UnicodeFromCharCode(uint32_t charcode) const {
if (!m_bToUnicodeLoaded)
LoadUnicodeMap();
- return m_pToUnicodeMap ? m_pToUnicodeMap->Lookup(charcode) : CFX_WideString();
+ return m_pToUnicodeMap ? m_pToUnicodeMap->Lookup(charcode) : WideString();
}
uint32_t CPDF_Font::CharCodeFromUnicode(wchar_t unicode) const {
@@ -297,8 +297,8 @@ int CPDF_Font::GetStringWidth(const char* pString, int size) {
// static
CPDF_Font* CPDF_Font::GetStockFont(CPDF_Document* pDoc,
- const CFX_ByteStringC& name) {
- CFX_ByteString fontname(name);
+ const ByteStringView& name) {
+ ByteString fontname(name);
int font_id = PDF_GetStandardFontName(&fontname);
if (font_id < 0)
return nullptr;
@@ -319,12 +319,12 @@ CPDF_Font* CPDF_Font::GetStockFont(CPDF_Document* pDoc,
std::unique_ptr<CPDF_Font> CPDF_Font::Create(CPDF_Document* pDoc,
CPDF_Dictionary* pFontDict) {
- CFX_ByteString type = pFontDict->GetStringFor("Subtype");
+ ByteString type = pFontDict->GetStringFor("Subtype");
std::unique_ptr<CPDF_Font> pFont;
if (type == "TrueType") {
- CFX_ByteString tag = pFontDict->GetStringFor("BaseFont").Left(4);
+ ByteString tag = pFontDict->GetStringFor("BaseFont").Left(4);
for (size_t i = 0; i < FX_ArraySize(kChineseFontNames); ++i) {
- if (tag == CFX_ByteString(kChineseFontNames[i], 4)) {
+ if (tag == ByteString(kChineseFontNames[i], 4)) {
CPDF_Dictionary* pFontDesc = pFontDict->GetDictFor("FontDescriptor");
if (!pFontDesc || !pFontDesc->KeyExist("FontFile2"))
pFont = pdfium::MakeUnique<CPDF_CIDFont>();
@@ -358,7 +358,7 @@ uint32_t CPDF_Font::GetNextChar(const char* pString,
void CPDF_Font::LoadPDFEncoding(CPDF_Object* pEncoding,
int& iBaseEncoding,
- std::vector<CFX_ByteString>* pCharNames,
+ std::vector<ByteString>* pCharNames,
bool bEmbedded,
bool bTrueType) {
if (!pEncoding) {
@@ -380,7 +380,7 @@ void CPDF_Font::LoadPDFEncoding(CPDF_Object* pEncoding,
iBaseEncoding = PDFFONT_ENCODING_ADOBE_SYMBOL;
return;
}
- CFX_ByteString bsEncoding = pEncoding->GetString();
+ ByteString bsEncoding = pEncoding->GetString();
if (bsEncoding.Compare("MacExpertEncoding") == 0) {
bsEncoding = "WinAnsiEncoding";
}
@@ -394,7 +394,7 @@ void CPDF_Font::LoadPDFEncoding(CPDF_Object* pEncoding,
if (iBaseEncoding != PDFFONT_ENCODING_ADOBE_SYMBOL &&
iBaseEncoding != PDFFONT_ENCODING_ZAPFDINGBATS) {
- CFX_ByteString bsEncoding = pDict->GetStringFor("BaseEncoding");
+ ByteString bsEncoding = pDict->GetStringFor("BaseEncoding");
if (bsEncoding.Compare("MacExpertEncoding") == 0 && bTrueType) {
bsEncoding = "WinAnsiEncoding";
}
@@ -436,7 +436,7 @@ bool CPDF_Font::IsStandardFont() const {
const char* CPDF_Font::GetAdobeCharName(
int iBaseEncoding,
- const std::vector<CFX_ByteString>& charnames,
+ const std::vector<ByteString>& charnames,
int charcode) {
if (charcode < 0 || charcode >= 256) {
NOTREACHED();
@@ -466,7 +466,7 @@ int CPDF_Font::FallbackGlyphFromCharcode(int fallbackFont, uint32_t charcode) {
if (!pdfium::IndexInBounds(m_FontFallbacks, fallbackFont))
return -1;
- CFX_WideString str = UnicodeFromCharCode(charcode);
+ WideString str = UnicodeFromCharCode(charcode);
uint32_t unicode = !str.IsEmpty() ? str[0] : charcode;
int glyph =
FXFT_Get_Char_Index(m_FontFallbacks[fallbackFont]->GetFace(), unicode);
diff --git a/core/fpdfapi/font/cpdf_font.h b/core/fpdfapi/font/cpdf_font.h
index f70542223c..e92e2f24e5 100644
--- a/core/fpdfapi/font/cpdf_font.h
+++ b/core/fpdfapi/font/cpdf_font.h
@@ -32,7 +32,7 @@ class CPDF_Font {
static std::unique_ptr<CPDF_Font> Create(CPDF_Document* pDoc,
CPDF_Dictionary* pFontDict);
static CPDF_Font* GetStockFont(CPDF_Document* pDoc,
- const CFX_ByteStringC& fontname);
+ const ByteStringView& fontname);
static const uint32_t kInvalidCharCode = static_cast<uint32_t>(-1);
virtual ~CPDF_Font();
@@ -59,17 +59,17 @@ class CPDF_Font {
virtual int AppendChar(char* buf, uint32_t charcode) const;
virtual int GlyphFromCharCode(uint32_t charcode, bool* pVertGlyph) = 0;
virtual int GlyphFromCharCodeExt(uint32_t charcode);
- virtual CFX_WideString UnicodeFromCharCode(uint32_t charcode) const;
+ virtual WideString UnicodeFromCharCode(uint32_t charcode) const;
virtual uint32_t CharCodeFromUnicode(wchar_t Unicode) const;
virtual bool HasFontWidths() const;
- const CFX_ByteString& GetBaseFont() const { return m_BaseFont; }
+ const ByteString& GetBaseFont() const { return m_BaseFont; }
CFX_SubstFont* GetSubstFont() const { return m_Font.GetSubstFont(); }
bool IsEmbedded() const { return IsType3Font() || m_pFontFile != nullptr; }
CPDF_Dictionary* GetFontDict() const { return m_pFontDict; }
bool IsStandardFont() const;
FXFT_Face GetFace() const { return m_Font.GetFace(); }
- void AppendChar(CFX_ByteString* str, uint32_t charcode) const;
+ void AppendChar(ByteString* str, uint32_t charcode) const;
void GetFontBBox(FX_RECT& rect) const { rect = m_FontBBox; }
int GetTypeAscent() const { return m_Ascent; }
@@ -97,20 +97,20 @@ class CPDF_Font {
void LoadUnicodeMap() const; // logically const only.
void LoadPDFEncoding(CPDF_Object* pEncoding,
int& iBaseEncoding,
- std::vector<CFX_ByteString>* pCharNames,
+ std::vector<ByteString>* pCharNames,
bool bEmbedded,
bool bTrueType);
void LoadFontDescriptor(CPDF_Dictionary* pDict);
void CheckFontMetrics();
const char* GetAdobeCharName(int iBaseEncoding,
- const std::vector<CFX_ByteString>& charnames,
+ const std::vector<ByteString>& charnames,
int charcode);
CFX_UnownedPtr<CPDF_Document> m_pDocument;
CFX_Font m_Font;
std::vector<std::unique_ptr<CFX_Font>> m_FontFallbacks;
- CFX_ByteString m_BaseFont;
+ ByteString m_BaseFont;
CFX_RetainPtr<CPDF_StreamAcc> m_pFontFile;
CPDF_Dictionary* m_pFontDict;
mutable std::unique_ptr<CPDF_ToUnicodeMap> m_pToUnicodeMap;
diff --git a/core/fpdfapi/font/cpdf_fontencoding.cpp b/core/fpdfapi/font/cpdf_fontencoding.cpp
index 2cc6445ab2..6290f20f5e 100644
--- a/core/fpdfapi/font/cpdf_fontencoding.cpp
+++ b/core/fpdfapi/font/cpdf_fontencoding.cpp
@@ -1672,7 +1672,7 @@ bool CPDF_FontEncoding::IsIdentical(CPDF_FontEncoding* pAnother) const {
}
std::unique_ptr<CPDF_Object> CPDF_FontEncoding::Realize(
- CFX_WeakPtr<CFX_ByteStringPool> pPool) {
+ CFX_WeakPtr<ByteStringPool> pPool) {
int predefined = 0;
for (int cs = PDFFONT_ENCODING_WINANSI; cs < PDFFONT_ENCODING_ZAPFDINGBATS;
cs++) {
@@ -1761,10 +1761,10 @@ wchar_t PDF_UnicodeFromAdobeName(const char* name) {
return (wchar_t)(FXFT_unicode_from_adobe_name(name) & 0x7FFFFFFF);
}
-CFX_ByteString PDF_AdobeNameFromUnicode(wchar_t unicode) {
+ByteString PDF_AdobeNameFromUnicode(wchar_t unicode) {
char glyph_name[64];
FXFT_adobe_name_from_unicode(glyph_name, unicode);
- return CFX_ByteString(glyph_name);
+ return ByteString(glyph_name);
}
const char* PDF_CharNameFromPredefinedCharSet(int encoding, uint8_t charcode) {
diff --git a/core/fpdfapi/font/cpdf_fontencoding.h b/core/fpdfapi/font/cpdf_fontencoding.h
index 7a94db9f0e..075cc04c7c 100644
--- a/core/fpdfapi/font/cpdf_fontencoding.h
+++ b/core/fpdfapi/font/cpdf_fontencoding.h
@@ -28,7 +28,7 @@ uint32_t FT_CharCodeFromUnicode(int encoding, wchar_t unicode);
wchar_t FT_UnicodeFromCharCode(int encoding, uint32_t charcode);
wchar_t PDF_UnicodeFromAdobeName(const char* name);
-CFX_ByteString PDF_AdobeNameFromUnicode(wchar_t unicode);
+ByteString PDF_AdobeNameFromUnicode(wchar_t unicode);
const uint16_t* PDF_UnicodesForPredefinedCharSet(int encoding);
const char* PDF_CharNameFromPredefinedCharSet(int encoding, uint8_t charcode);
@@ -53,7 +53,7 @@ class CPDF_FontEncoding {
m_Unicodes[charcode] = unicode;
}
- std::unique_ptr<CPDF_Object> Realize(CFX_WeakPtr<CFX_ByteStringPool> pPool);
+ std::unique_ptr<CPDF_Object> Realize(CFX_WeakPtr<ByteStringPool> pPool);
public:
wchar_t m_Unicodes[256];
diff --git a/core/fpdfapi/font/cpdf_simplefont.cpp b/core/fpdfapi/font/cpdf_simplefont.cpp
index 56a4b13cb3..ccf514db07 100644
--- a/core/fpdfapi/font/cpdf_simplefont.cpp
+++ b/core/fpdfapi/font/cpdf_simplefont.cpp
@@ -196,13 +196,13 @@ bool CPDF_SimpleFont::IsUnicodeCompatible() const {
m_BaseEncoding != PDFFONT_ENCODING_ZAPFDINGBATS;
}
-CFX_WideString CPDF_SimpleFont::UnicodeFromCharCode(uint32_t charcode) const {
- CFX_WideString unicode = CPDF_Font::UnicodeFromCharCode(charcode);
+WideString CPDF_SimpleFont::UnicodeFromCharCode(uint32_t charcode) const {
+ WideString unicode = CPDF_Font::UnicodeFromCharCode(charcode);
if (!unicode.IsEmpty())
return unicode;
wchar_t ret = m_Encoding.UnicodeFromCharCode((uint8_t)charcode);
if (ret == 0)
- return CFX_WideString();
+ return WideString();
return ret;
}
diff --git a/core/fpdfapi/font/cpdf_simplefont.h b/core/fpdfapi/font/cpdf_simplefont.h
index 6a22f46966..5291211b24 100644
--- a/core/fpdfapi/font/cpdf_simplefont.h
+++ b/core/fpdfapi/font/cpdf_simplefont.h
@@ -24,7 +24,7 @@ class CPDF_SimpleFont : public CPDF_Font {
FX_RECT GetCharBBox(uint32_t charcode) override;
int GlyphFromCharCode(uint32_t charcode, bool* pVertGlyph) override;
bool IsUnicodeCompatible() const override;
- CFX_WideString UnicodeFromCharCode(uint32_t charcode) const override;
+ WideString UnicodeFromCharCode(uint32_t charcode) const override;
uint32_t CharCodeFromUnicode(wchar_t Unicode) const override;
CPDF_FontEncoding* GetEncoding() { return &m_Encoding; }
@@ -41,7 +41,7 @@ class CPDF_SimpleFont : public CPDF_Font {
CPDF_FontEncoding m_Encoding;
uint16_t m_GlyphIndex[256];
uint16_t m_ExtGID[256];
- std::vector<CFX_ByteString> m_CharNames;
+ std::vector<ByteString> m_CharNames;
int m_BaseEncoding;
uint16_t m_CharWidth[256];
FX_RECT m_CharBBox[256];
diff --git a/core/fpdfapi/font/cpdf_tounicodemap.cpp b/core/fpdfapi/font/cpdf_tounicodemap.cpp
index 9076f4a737..354f5061c3 100644
--- a/core/fpdfapi/font/cpdf_tounicodemap.cpp
+++ b/core/fpdfapi/font/cpdf_tounicodemap.cpp
@@ -14,7 +14,7 @@
#include "core/fxcrt/fx_safe_types.h"
#include "third_party/base/numerics/safe_conversions.h"
-CFX_WideString CPDF_ToUnicodeMap::Lookup(uint32_t charcode) const {
+WideString CPDF_ToUnicodeMap::Lookup(uint32_t charcode) const {
auto it = m_Map.find(charcode);
if (it != m_Map.end()) {
uint32_t value = it->second;
@@ -25,22 +25,22 @@ CFX_WideString CPDF_ToUnicodeMap::Lookup(uint32_t charcode) const {
const wchar_t* buf = m_MultiCharBuf.GetBuffer();
uint32_t buf_len = m_MultiCharBuf.GetLength();
if (!buf || buf_len == 0) {
- return CFX_WideString();
+ return WideString();
}
uint32_t index = value >> 16;
if (index >= buf_len) {
- return CFX_WideString();
+ return WideString();
}
uint32_t len = buf[index];
if (index + len < index || index + len >= buf_len) {
- return CFX_WideString();
+ return WideString();
}
- return CFX_WideString(buf + index + 1, len);
+ return WideString(buf + index + 1, len);
}
if (m_pBaseMap) {
return m_pBaseMap->UnicodeFromCID((uint16_t)charcode);
}
- return CFX_WideString();
+ return WideString();
}
uint32_t CPDF_ToUnicodeMap::ReverseLookup(wchar_t unicode) const {
@@ -52,7 +52,7 @@ uint32_t CPDF_ToUnicodeMap::ReverseLookup(wchar_t unicode) const {
}
// Static.
-uint32_t CPDF_ToUnicodeMap::StringToCode(const CFX_ByteStringC& str) {
+uint32_t CPDF_ToUnicodeMap::StringToCode(const ByteStringView& str) {
int len = str.GetLength();
if (len == 0)
return 0;
@@ -70,8 +70,8 @@ uint32_t CPDF_ToUnicodeMap::StringToCode(const CFX_ByteStringC& str) {
return result;
}
-static CFX_WideString StringDataAdd(CFX_WideString str) {
- CFX_WideString ret;
+static WideString StringDataAdd(WideString str) {
+ WideString ret;
int len = str.GetLength();
wchar_t value = 1;
for (int i = len - 1; i >= 0; --i) {
@@ -89,13 +89,12 @@ static CFX_WideString StringDataAdd(CFX_WideString str) {
}
// Static.
-CFX_WideString CPDF_ToUnicodeMap::StringToWideString(
- const CFX_ByteStringC& str) {
+WideString CPDF_ToUnicodeMap::StringToWideString(const ByteStringView& str) {
int len = str.GetLength();
if (len == 0)
- return CFX_WideString();
+ return WideString();
- CFX_WideString result;
+ WideString result;
if (str[0] == '<') {
int byte_pos = 0;
wchar_t ch = 0;
@@ -129,7 +128,7 @@ void CPDF_ToUnicodeMap::Load(CPDF_Stream* pStream) {
pAcc->LoadAllData(false);
CPDF_SimpleParser parser(pAcc->GetData(), pAcc->GetSize());
while (1) {
- CFX_ByteStringC word = parser.GetWord();
+ ByteStringView word = parser.GetWord();
if (word.IsEmpty()) {
break;
}
@@ -141,7 +140,7 @@ void CPDF_ToUnicodeMap::Load(CPDF_Stream* pStream) {
}
uint32_t srccode = StringToCode(word);
word = parser.GetWord();
- CFX_WideString destcode = StringToWideString(word);
+ WideString destcode = StringToWideString(word);
int len = destcode.GetLength();
if (len == 0) {
continue;
@@ -156,23 +155,23 @@ void CPDF_ToUnicodeMap::Load(CPDF_Stream* pStream) {
}
} else if (word == "beginbfrange") {
while (1) {
- CFX_ByteString low, high;
+ ByteString low, high;
low = parser.GetWord();
if (low.IsEmpty() || low == "endbfrange") {
break;
}
high = parser.GetWord();
- uint32_t lowcode = StringToCode(low.AsStringC());
+ uint32_t lowcode = StringToCode(low.AsStringView());
uint32_t highcode =
- (lowcode & 0xffffff00) | (StringToCode(high.AsStringC()) & 0xff);
+ (lowcode & 0xffffff00) | (StringToCode(high.AsStringView()) & 0xff);
if (highcode == (uint32_t)-1) {
break;
}
- CFX_ByteString start(parser.GetWord());
+ ByteString start(parser.GetWord());
if (start == "[") {
for (uint32_t code = lowcode; code <= highcode; code++) {
- CFX_ByteString dest(parser.GetWord());
- CFX_WideString destcode = StringToWideString(dest.AsStringC());
+ ByteString dest(parser.GetWord());
+ WideString destcode = StringToWideString(dest.AsStringView());
int len = destcode.GetLength();
if (len == 0) {
continue;
@@ -187,17 +186,17 @@ void CPDF_ToUnicodeMap::Load(CPDF_Stream* pStream) {
}
parser.GetWord();
} else {
- CFX_WideString destcode = StringToWideString(start.AsStringC());
+ WideString destcode = StringToWideString(start.AsStringView());
int len = destcode.GetLength();
uint32_t value = 0;
if (len == 1) {
- value = StringToCode(start.AsStringC());
+ value = StringToCode(start.AsStringView());
for (uint32_t code = lowcode; code <= highcode; code++) {
m_Map[code] = value++;
}
} else {
for (uint32_t code = lowcode; code <= highcode; code++) {
- CFX_WideString retcode;
+ WideString retcode;
if (code == lowcode) {
retcode = destcode;
} else {
diff --git a/core/fpdfapi/font/cpdf_tounicodemap.h b/core/fpdfapi/font/cpdf_tounicodemap.h
index 90a2638462..4e11140e75 100644
--- a/core/fpdfapi/font/cpdf_tounicodemap.h
+++ b/core/fpdfapi/font/cpdf_tounicodemap.h
@@ -22,15 +22,15 @@ class CPDF_ToUnicodeMap {
void Load(CPDF_Stream* pStream);
- CFX_WideString Lookup(uint32_t charcode) const;
+ WideString Lookup(uint32_t charcode) const;
uint32_t ReverseLookup(wchar_t unicode) const;
private:
friend class cpdf_tounicodemap_StringToCode_Test;
friend class cpdf_tounicodemap_StringToWideString_Test;
- static uint32_t StringToCode(const CFX_ByteStringC& str);
- static CFX_WideString StringToWideString(const CFX_ByteStringC& str);
+ static uint32_t StringToCode(const ByteStringView& str);
+ static WideString StringToWideString(const ByteStringView& str);
uint32_t GetUnicode();
diff --git a/core/fpdfapi/font/cpdf_tounicodemap_unittest.cpp b/core/fpdfapi/font/cpdf_tounicodemap_unittest.cpp
index 299f4d9b1e..4a5dc25a4c 100644
--- a/core/fpdfapi/font/cpdf_tounicodemap_unittest.cpp
+++ b/core/fpdfapi/font/cpdf_tounicodemap_unittest.cpp
@@ -21,7 +21,7 @@ TEST(cpdf_tounicodemap, StringToWideString) {
EXPECT_EQ(L"", CPDF_ToUnicodeMap::StringToWideString("<c2"));
- CFX_WideString res = L"\xc2ab";
+ WideString res = L"\xc2ab";
EXPECT_EQ(res, CPDF_ToUnicodeMap::StringToWideString("<c2ab"));
EXPECT_EQ(res, CPDF_ToUnicodeMap::StringToWideString("<c2abab"));
EXPECT_EQ(res, CPDF_ToUnicodeMap::StringToWideString("<c2ab 1234"));
diff --git a/core/fpdfapi/font/cpdf_truetypefont.cpp b/core/fpdfapi/font/cpdf_truetypefont.cpp
index 5fde64693a..a0542ecba4 100644
--- a/core/fpdfapi/font/cpdf_truetypefont.cpp
+++ b/core/fpdfapi/font/cpdf_truetypefont.cpp
@@ -137,7 +137,7 @@ void CPDF_TrueTypeFont::LoadGlyphMap() {
if (m_GlyphIndex[charcode] != 0 || !bToUnicode)
continue;
- CFX_WideString wsUnicode = UnicodeFromCharCode(charcode);
+ WideString wsUnicode = UnicodeFromCharCode(charcode);
if (!wsUnicode.IsEmpty()) {
m_GlyphIndex[charcode] =
FXFT_Get_Char_Index(m_Font.GetFace(), wsUnicode[0]);
diff --git a/core/fpdfapi/page/cpdf_allstates.cpp b/core/fpdfapi/page/cpdf_allstates.cpp
index cedc8479bc..afc87a2b5a 100644
--- a/core/fpdfapi/page/cpdf_allstates.cpp
+++ b/core/fpdfapi/page/cpdf_allstates.cpp
@@ -39,7 +39,7 @@ void CPDF_AllStates::SetLineDash(CPDF_Array* pArray, float phase, float scale) {
void CPDF_AllStates::ProcessExtGS(CPDF_Dictionary* pGS,
CPDF_StreamContentParser* pParser) {
for (const auto& it : *pGS) {
- const CFX_ByteString& key_str = it.first;
+ const ByteString& key_str = it.first;
CPDF_Object* pElement = it.second.get();
CPDF_Object* pObject = pElement ? pElement->GetDirect() : nullptr;
if (!pObject)
diff --git a/core/fpdfapi/page/cpdf_colorspace.cpp b/core/fpdfapi/page/cpdf_colorspace.cpp
index aee7316bdf..c37b5a4177 100644
--- a/core/fpdfapi/page/cpdf_colorspace.cpp
+++ b/core/fpdfapi/page/cpdf_colorspace.cpp
@@ -198,7 +198,7 @@ class CPDF_IndexedCS : public CPDF_ColorSpace {
CFX_UnownedPtr<CPDF_CountedColorSpace> m_pCountedBaseCS;
int m_nBaseComponents;
int m_MaxIndex;
- CFX_ByteString m_Table;
+ ByteString m_Table;
float* m_pCompMinMax;
};
@@ -364,8 +364,7 @@ void XYZ_to_sRGB_WhitePoint(float X,
} // namespace
-CPDF_ColorSpace* CPDF_ColorSpace::ColorspaceFromName(
- const CFX_ByteString& name) {
+CPDF_ColorSpace* CPDF_ColorSpace::ColorspaceFromName(const ByteString& name) {
if (name == "DeviceRGB" || name == "RGB")
return CPDF_ColorSpace::GetStockCS(PDFCS_DEVICERGB);
if (name == "DeviceGray" || name == "G")
@@ -422,7 +421,7 @@ std::unique_ptr<CPDF_ColorSpace> CPDF_ColorSpace::Load(
if (!pFamilyObj)
return nullptr;
- CFX_ByteString familyname = pFamilyObj->GetString();
+ ByteString familyname = pFamilyObj->GetString();
if (pArray->GetCount() == 1)
return std::unique_ptr<CPDF_ColorSpace>(ColorspaceFromName(familyname));
@@ -1029,7 +1028,7 @@ bool CPDF_IndexedCS::v_Load(CPDF_Document* pDoc,
} else if (CPDF_Stream* pStream = pTableObj->AsStream()) {
auto pAcc = pdfium::MakeRetain<CPDF_StreamAcc>(pStream);
pAcc->LoadAllData(false);
- m_Table = CFX_ByteStringC(pAcc->GetData(), pAcc->GetSize());
+ m_Table = ByteStringView(pAcc->GetData(), pAcc->GetSize());
}
return true;
}
@@ -1080,7 +1079,7 @@ void CPDF_SeparationCS::GetDefaultValue(int iComponent,
bool CPDF_SeparationCS::v_Load(CPDF_Document* pDoc,
CPDF_Array* pArray,
std::set<CPDF_Object*>* pVisited) {
- CFX_ByteString name = pArray->GetStringAt(1);
+ ByteString name = pArray->GetStringAt(1);
if (name == "None") {
m_Type = None;
return true;
diff --git a/core/fpdfapi/page/cpdf_colorspace.h b/core/fpdfapi/page/cpdf_colorspace.h
index 31dd32629b..d9f9a1dd44 100644
--- a/core/fpdfapi/page/cpdf_colorspace.h
+++ b/core/fpdfapi/page/cpdf_colorspace.h
@@ -42,7 +42,7 @@ struct PatternValue {
class CPDF_ColorSpace {
public:
static CPDF_ColorSpace* GetStockCS(int Family);
- static CPDF_ColorSpace* ColorspaceFromName(const CFX_ByteString& name);
+ static CPDF_ColorSpace* ColorspaceFromName(const ByteString& name);
static std::unique_ptr<CPDF_ColorSpace> Load(CPDF_Document* pDoc,
CPDF_Object* pCSObj);
static std::unique_ptr<CPDF_ColorSpace> Load(
diff --git a/core/fpdfapi/page/cpdf_contentmark.cpp b/core/fpdfapi/page/cpdf_contentmark.cpp
index 07f0bd931d..7d411b2084 100644
--- a/core/fpdfapi/page/cpdf_contentmark.cpp
+++ b/core/fpdfapi/page/cpdf_contentmark.cpp
@@ -36,7 +36,7 @@ int CPDF_ContentMark::GetMCID() const {
return pData ? pData->GetMCID() : -1;
}
-void CPDF_ContentMark::AddMark(const CFX_ByteString& name,
+void CPDF_ContentMark::AddMark(const ByteString& name,
CPDF_Dictionary* pDict,
bool bDirect) {
m_Ref.GetPrivateCopy()->AddMark(name, pDict, bDirect);
@@ -48,7 +48,7 @@ void CPDF_ContentMark::DeleteLastMark() {
m_Ref.SetNull();
}
-bool CPDF_ContentMark::HasMark(const CFX_ByteStringC& mark) const {
+bool CPDF_ContentMark::HasMark(const ByteStringView& mark) const {
const MarkData* pData = m_Ref.GetObject();
if (!pData)
return false;
@@ -60,7 +60,7 @@ bool CPDF_ContentMark::HasMark(const CFX_ByteStringC& mark) const {
return false;
}
-bool CPDF_ContentMark::LookupMark(const CFX_ByteStringC& mark,
+bool CPDF_ContentMark::LookupMark(const ByteStringView& mark,
CPDF_Dictionary*& pDict) const {
const MarkData* pData = m_Ref.GetObject();
if (!pData)
@@ -105,7 +105,7 @@ int CPDF_ContentMark::MarkData::GetMCID() const {
return -1;
}
-void CPDF_ContentMark::MarkData::AddMark(const CFX_ByteString& name,
+void CPDF_ContentMark::MarkData::AddMark(const ByteString& name,
CPDF_Dictionary* pDict,
bool bDirect) {
CPDF_ContentMarkItem item;
diff --git a/core/fpdfapi/page/cpdf_contentmark.h b/core/fpdfapi/page/cpdf_contentmark.h
index ab966c0728..1b2fe79e3c 100644
--- a/core/fpdfapi/page/cpdf_contentmark.h
+++ b/core/fpdfapi/page/cpdf_contentmark.h
@@ -27,11 +27,9 @@ class CPDF_ContentMark {
int CountItems() const;
const CPDF_ContentMarkItem& GetItem(int i) const;
- bool HasMark(const CFX_ByteStringC& mark) const;
- bool LookupMark(const CFX_ByteStringC& mark, CPDF_Dictionary*& pDict) const;
- void AddMark(const CFX_ByteString& name,
- CPDF_Dictionary* pDict,
- bool bDirect);
+ bool HasMark(const ByteStringView& mark) const;
+ bool LookupMark(const ByteStringView& mark, CPDF_Dictionary*& pDict) const;
+ void AddMark(const ByteString& name, CPDF_Dictionary* pDict, bool bDirect);
void DeleteLastMark();
bool HasRef() const { return !!m_Ref; }
@@ -48,7 +46,7 @@ class CPDF_ContentMark {
const CPDF_ContentMarkItem& GetItem(int index) const;
int GetMCID() const;
- void AddMark(const CFX_ByteString& name,
+ void AddMark(const ByteString& name,
CPDF_Dictionary* pDict,
bool bDictNeedClone);
void DeleteLastMark();
diff --git a/core/fpdfapi/page/cpdf_contentmarkitem.h b/core/fpdfapi/page/cpdf_contentmarkitem.h
index afd2833691..83c700fc52 100644
--- a/core/fpdfapi/page/cpdf_contentmarkitem.h
+++ b/core/fpdfapi/page/cpdf_contentmarkitem.h
@@ -26,17 +26,17 @@ class CPDF_ContentMarkItem {
CPDF_ContentMarkItem& operator=(CPDF_ContentMarkItem&& other) = default;
- CFX_ByteString GetName() const { return m_MarkName; }
+ ByteString GetName() const { return m_MarkName; }
ParamType GetParamType() const { return m_ParamType; }
CPDF_Dictionary* GetParam() const;
bool HasMCID() const;
- void SetName(const CFX_ByteString& name) { m_MarkName = name; }
+ void SetName(const ByteString& name) { m_MarkName = name; }
void SetDirectDict(std::unique_ptr<CPDF_Dictionary> pDict);
void SetPropertiesDict(CPDF_Dictionary* pDict);
private:
- CFX_ByteString m_MarkName;
+ ByteString m_MarkName;
ParamType m_ParamType;
CFX_UnownedPtr<CPDF_Dictionary> m_pPropertiesDict;
std::unique_ptr<CPDF_Dictionary> m_pDirectDict;
diff --git a/core/fpdfapi/page/cpdf_docpagedata.cpp b/core/fpdfapi/page/cpdf_docpagedata.cpp
index 1af9d6ee22..08345dac78 100644
--- a/core/fpdfapi/page/cpdf_docpagedata.cpp
+++ b/core/fpdfapi/page/cpdf_docpagedata.cpp
@@ -144,7 +144,7 @@ CPDF_Font* CPDF_DocPageData::GetFont(CPDF_Dictionary* pFontDict) {
return pFontData->AddRef();
}
-CPDF_Font* CPDF_DocPageData::GetStandardFont(const CFX_ByteString& fontName,
+CPDF_Font* CPDF_DocPageData::GetStandardFont(const ByteString& fontName,
CPDF_FontEncoding* pEncoding) {
if (fontName.IsEmpty())
return nullptr;
@@ -228,7 +228,7 @@ CPDF_ColorSpace* CPDF_DocPageData::GetColorSpaceGuarded(
pdfium::ScopedSetInsertion<CPDF_Object*> insertion(pVisited, pCSObj);
if (pCSObj->IsName()) {
- CFX_ByteString name = pCSObj->GetString();
+ ByteString name = pCSObj->GetString();
CPDF_ColorSpace* pCS = CPDF_ColorSpace::ColorspaceFromName(name);
if (!pCS && pResources) {
CPDF_Dictionary* pList = pResources->GetDictFor("ColorSpace");
@@ -422,7 +422,7 @@ CFX_RetainPtr<CPDF_IccProfile> CPDF_DocPageData::GetIccProfile(
uint8_t digest[20];
CRYPT_SHA1Generate(pAccessor->GetData(), pAccessor->GetSize(), digest);
- CFX_ByteString bsDigest(digest, 20);
+ ByteString bsDigest(digest, 20);
auto hash_it = m_HashProfileMap.find(bsDigest);
if (hash_it != m_HashProfileMap.end()) {
auto it_copied_stream = m_IccProfileMap.find(hash_it->second);
diff --git a/core/fpdfapi/page/cpdf_docpagedata.h b/core/fpdfapi/page/cpdf_docpagedata.h
index 40647bc9a6..3f1d392262 100644
--- a/core/fpdfapi/page/cpdf_docpagedata.h
+++ b/core/fpdfapi/page/cpdf_docpagedata.h
@@ -35,7 +35,7 @@ class CPDF_DocPageData {
bool IsForceClear() const { return m_bForceClear; }
CPDF_Font* GetFont(CPDF_Dictionary* pFontDict);
- CPDF_Font* GetStandardFont(const CFX_ByteString& fontName,
+ CPDF_Font* GetStandardFont(const ByteString& fontName,
CPDF_FontEncoding* pEncoding);
void ReleaseFont(const CPDF_Dictionary* pFontDict);
@@ -70,7 +70,7 @@ class CPDF_DocPageData {
bool m_bForceClear;
CFX_UnownedPtr<CPDF_Document> const m_pPDFDoc;
- std::map<CFX_ByteString, CPDF_Stream*> m_HashProfileMap;
+ std::map<ByteString, CPDF_Stream*> m_HashProfileMap;
std::map<const CPDF_Object*, CPDF_CountedColorSpace*> m_ColorSpaceMap;
std::map<const CPDF_Stream*, CFX_RetainPtr<CPDF_StreamAcc>> m_FontFileMap;
std::map<const CPDF_Dictionary*, CPDF_CountedFont*> m_FontMap;
diff --git a/core/fpdfapi/page/cpdf_generalstate.cpp b/core/fpdfapi/page/cpdf_generalstate.cpp
index 540707447e..c5c259f051 100644
--- a/core/fpdfapi/page/cpdf_generalstate.cpp
+++ b/core/fpdfapi/page/cpdf_generalstate.cpp
@@ -13,7 +13,7 @@
namespace {
-int RI_StringToId(const CFX_ByteString& ri) {
+int RI_StringToId(const ByteString& ri) {
uint32_t id = ri.GetID();
if (id == FXBSTR_ID('A', 'b', 's', 'o'))
return 1;
@@ -27,7 +27,7 @@ int RI_StringToId(const CFX_ByteString& ri) {
return 0;
}
-int GetBlendTypeInternal(const CFX_ByteString& mode) {
+int GetBlendTypeInternal(const ByteString& mode) {
switch (mode.GetID()) {
case FXBSTR_ID('N', 'o', 'r', 'm'):
case FXBSTR_ID('C', 'o', 'm', 'p'):
@@ -75,45 +75,45 @@ CPDF_GeneralState::CPDF_GeneralState(const CPDF_GeneralState& that)
CPDF_GeneralState::~CPDF_GeneralState() {}
-void CPDF_GeneralState::SetRenderIntent(const CFX_ByteString& ri) {
+void CPDF_GeneralState::SetRenderIntent(const ByteString& ri) {
m_Ref.GetPrivateCopy()->m_RenderIntent = RI_StringToId(ri);
}
-CFX_ByteString CPDF_GeneralState::GetBlendMode() const {
+ByteString CPDF_GeneralState::GetBlendMode() const {
switch (GetBlendType()) {
case FXDIB_BLEND_NORMAL:
- return CFX_ByteString("Normal");
+ return ByteString("Normal");
case FXDIB_BLEND_MULTIPLY:
- return CFX_ByteString("Multiply");
+ return ByteString("Multiply");
case FXDIB_BLEND_SCREEN:
- return CFX_ByteString("Screen");
+ return ByteString("Screen");
case FXDIB_BLEND_OVERLAY:
- return CFX_ByteString("Overlay");
+ return ByteString("Overlay");
case FXDIB_BLEND_DARKEN:
- return CFX_ByteString("Darken");
+ return ByteString("Darken");
case FXDIB_BLEND_LIGHTEN:
- return CFX_ByteString("Lighten");
+ return ByteString("Lighten");
case FXDIB_BLEND_COLORDODGE:
- return CFX_ByteString("ColorDodge");
+ return ByteString("ColorDodge");
case FXDIB_BLEND_COLORBURN:
- return CFX_ByteString("ColorBurn");
+ return ByteString("ColorBurn");
case FXDIB_BLEND_HARDLIGHT:
- return CFX_ByteString("HardLight");
+ return ByteString("HardLight");
case FXDIB_BLEND_SOFTLIGHT:
- return CFX_ByteString("SoftLight");
+ return ByteString("SoftLight");
case FXDIB_BLEND_DIFFERENCE:
- return CFX_ByteString("Difference");
+ return ByteString("Difference");
case FXDIB_BLEND_EXCLUSION:
- return CFX_ByteString("Exclusion");
+ return ByteString("Exclusion");
case FXDIB_BLEND_HUE:
- return CFX_ByteString("Hue");
+ return ByteString("Hue");
case FXDIB_BLEND_SATURATION:
- return CFX_ByteString("Saturation");
+ return ByteString("Saturation");
case FXDIB_BLEND_COLOR:
- return CFX_ByteString("Color");
+ return ByteString("Color");
case FXDIB_BLEND_LUMINOSITY:
- return CFX_ByteString("Luminosity");
+ return ByteString("Luminosity");
}
- return CFX_ByteString("Normal");
+ return ByteString("Normal");
}
int CPDF_GeneralState::GetBlendType() const {
@@ -171,7 +171,7 @@ void CPDF_GeneralState::SetTransferFunc(
m_Ref.GetPrivateCopy()->m_pTransferFunc = pFunc;
}
-void CPDF_GeneralState::SetBlendMode(const CFX_ByteString& mode) {
+void CPDF_GeneralState::SetBlendMode(const ByteString& mode) {
StateData* pData = m_Ref.GetPrivateCopy();
pData->m_BlendMode = mode;
pData->m_BlendType = GetBlendTypeInternal(mode);
diff --git a/core/fpdfapi/page/cpdf_generalstate.h b/core/fpdfapi/page/cpdf_generalstate.h
index b5b48a94cd..95f59784f2 100644
--- a/core/fpdfapi/page/cpdf_generalstate.h
+++ b/core/fpdfapi/page/cpdf_generalstate.h
@@ -25,9 +25,9 @@ class CPDF_GeneralState {
void Emplace() { m_Ref.Emplace(); }
bool HasRef() const { return !!m_Ref; }
- void SetRenderIntent(const CFX_ByteString& ri);
+ void SetRenderIntent(const ByteString& ri);
- CFX_ByteString GetBlendMode() const;
+ ByteString GetBlendMode() const;
int GetBlendType() const;
void SetBlendType(int type);
@@ -46,7 +46,7 @@ class CPDF_GeneralState {
CFX_RetainPtr<CPDF_TransferFunc> GetTransferFunc() const;
void SetTransferFunc(const CFX_RetainPtr<CPDF_TransferFunc>& pFunc);
- void SetBlendMode(const CFX_ByteString& mode);
+ void SetBlendMode(const ByteString& mode);
const CFX_Matrix* GetSMaskMatrix() const;
void SetSMaskMatrix(const CFX_Matrix& matrix);
@@ -83,7 +83,7 @@ class CPDF_GeneralState {
StateData(const StateData& that);
~StateData();
- CFX_ByteString m_BlendMode;
+ ByteString m_BlendMode;
int m_BlendType;
CFX_UnownedPtr<CPDF_Object> m_pSoftMask;
CFX_Matrix m_SMaskMatrix;
diff --git a/core/fpdfapi/page/cpdf_image.cpp b/core/fpdfapi/page/cpdf_image.cpp
index a551bd1811..6e8c0e13c0 100644
--- a/core/fpdfapi/page/cpdf_image.cpp
+++ b/core/fpdfapi/page/cpdf_image.cpp
@@ -201,7 +201,7 @@ void CPDF_Image::SetImage(const CFX_RetainPtr<CFX_DIBitmap>& pBitmap) {
pCS->AddNew<CPDF_Name>("Indexed");
pCS->AddNew<CPDF_Name>("DeviceRGB");
pCS->AddNew<CPDF_Number>(1);
- CFX_ByteString ct;
+ ByteString ct;
char* pBuf = ct.GetBuffer(6);
pBuf[0] = (char)reset_r;
pBuf[1] = (char)reset_g;
diff --git a/core/fpdfapi/page/cpdf_page.cpp b/core/fpdfapi/page/cpdf_page.cpp
index 6213e5fccb..148b30a51c 100644
--- a/core/fpdfapi/page/cpdf_page.cpp
+++ b/core/fpdfapi/page/cpdf_page.cpp
@@ -97,7 +97,7 @@ void CPDF_Page::SetRenderContext(
m_pRenderContext = std::move(pContext);
}
-CPDF_Object* CPDF_Page::GetPageAttr(const CFX_ByteString& name) const {
+CPDF_Object* CPDF_Page::GetPageAttr(const ByteString& name) const {
CPDF_Dictionary* pPageDict = m_pFormDict.Get();
std::set<CPDF_Dictionary*> visited;
while (1) {
@@ -112,7 +112,7 @@ CPDF_Object* CPDF_Page::GetPageAttr(const CFX_ByteString& name) const {
return nullptr;
}
-CFX_FloatRect CPDF_Page::GetBox(const CFX_ByteString& name) const {
+CFX_FloatRect CPDF_Page::GetBox(const ByteString& name) const {
CFX_FloatRect box;
CPDF_Array* pBox = ToArray(GetPageAttr(name));
if (pBox) {
diff --git a/core/fpdfapi/page/cpdf_page.h b/core/fpdfapi/page/cpdf_page.h
index 47fba3caec..e32a7f0fe8 100644
--- a/core/fpdfapi/page/cpdf_page.h
+++ b/core/fpdfapi/page/cpdf_page.h
@@ -62,8 +62,8 @@ class CPDF_Page : public CPDF_PageObjectHolder {
private:
void StartParse();
- CPDF_Object* GetPageAttr(const CFX_ByteString& name) const;
- CFX_FloatRect GetBox(const CFX_ByteString& name) const;
+ CPDF_Object* GetPageAttr(const ByteString& name) const;
+ CFX_FloatRect GetBox(const ByteString& name) const;
float m_PageWidth;
float m_PageHeight;
diff --git a/core/fpdfapi/page/cpdf_pageobjectholder.h b/core/fpdfapi/page/cpdf_pageobjectholder.h
index 9ac1a3bdba..c223d4b523 100644
--- a/core/fpdfapi/page/cpdf_pageobjectholder.h
+++ b/core/fpdfapi/page/cpdf_pageobjectholder.h
@@ -37,8 +37,8 @@ struct GraphicsData {
};
struct FontData {
- CFX_ByteString baseFont;
- CFX_ByteString type;
+ ByteString baseFont;
+ ByteString type;
bool operator<(const FontData& other) const;
};
@@ -76,8 +76,8 @@ class CPDF_PageObjectHolder {
CFX_UnownedPtr<CPDF_Document> m_pDocument;
CFX_UnownedPtr<CPDF_Dictionary> m_pPageResources;
CFX_UnownedPtr<CPDF_Dictionary> m_pResources;
- std::map<GraphicsData, CFX_ByteString> m_GraphicsMap;
- std::map<FontData, CFX_ByteString> m_FontsMap;
+ std::map<GraphicsData, ByteString> m_GraphicsMap;
+ std::map<FontData, ByteString> m_FontsMap;
CFX_FloatRect m_BBox;
int m_Transparency;
diff --git a/core/fpdfapi/page/cpdf_psengine.cpp b/core/fpdfapi/page/cpdf_psengine.cpp
index 658d73cda3..63560fccc0 100644
--- a/core/fpdfapi/page/cpdf_psengine.cpp
+++ b/core/fpdfapi/page/cpdf_psengine.cpp
@@ -133,7 +133,7 @@ float CPDF_PSEngine::Pop() {
bool CPDF_PSEngine::Parse(const char* str, int size) {
CPDF_SimpleParser parser(reinterpret_cast<const uint8_t*>(str), size);
- CFX_ByteStringC word = parser.GetWord();
+ ByteStringView word = parser.GetWord();
return word == "{" ? m_MainProc.Parse(&parser, 0) : false;
}
@@ -142,7 +142,7 @@ bool CPDF_PSProc::Parse(CPDF_SimpleParser* parser, int depth) {
return false;
while (1) {
- CFX_ByteStringC word = parser->GetWord();
+ ByteStringView word = parser->GetWord();
if (word.IsEmpty())
return false;
@@ -158,7 +158,7 @@ bool CPDF_PSProc::Parse(CPDF_SimpleParser* parser, int depth) {
std::unique_ptr<CPDF_PSOP> op;
for (const PDF_PSOpName& op_name : kPsOpNames) {
- if (word == CFX_ByteStringC(op_name.name)) {
+ if (word == ByteStringView(op_name.name)) {
op = pdfium::MakeUnique<CPDF_PSOP>(op_name.op);
break;
}
diff --git a/core/fpdfapi/page/cpdf_streamcontentparser.cpp b/core/fpdfapi/page/cpdf_streamcontentparser.cpp
index 3755b2985a..c58e456238 100644
--- a/core/fpdfapi/page/cpdf_streamcontentparser.cpp
+++ b/core/fpdfapi/page/cpdf_streamcontentparser.cpp
@@ -156,18 +156,17 @@ const AbbrPair InlineValueAbbr[] = {
struct AbbrReplacementOp {
bool is_replace_key;
- CFX_ByteString key;
- CFX_ByteStringC replacement;
+ ByteString key;
+ ByteStringView replacement;
};
-CFX_ByteStringC FindFullName(const AbbrPair* table,
- size_t count,
- const CFX_ByteStringC& abbr) {
+ByteStringView FindFullName(const AbbrPair* table,
+ size_t count,
+ const ByteStringView& abbr) {
auto* it = std::find_if(table, table + count, [abbr](const AbbrPair& pair) {
return pair.abbr == abbr;
});
- return it != table + count ? CFX_ByteStringC(it->full_name)
- : CFX_ByteStringC();
+ return it != table + count ? ByteStringView(it->full_name) : ByteStringView();
}
void ReplaceAbbr(CPDF_Object* pObj) {
@@ -176,10 +175,10 @@ void ReplaceAbbr(CPDF_Object* pObj) {
CPDF_Dictionary* pDict = pObj->AsDictionary();
std::vector<AbbrReplacementOp> replacements;
for (const auto& it : *pDict) {
- CFX_ByteString key = it.first;
+ ByteString key = it.first;
CPDF_Object* value = it.second.get();
- CFX_ByteStringC fullname = FindFullName(
- InlineKeyAbbr, FX_ArraySize(InlineKeyAbbr), key.AsStringC());
+ ByteStringView fullname = FindFullName(
+ InlineKeyAbbr, FX_ArraySize(InlineKeyAbbr), key.AsStringView());
if (!fullname.IsEmpty()) {
AbbrReplacementOp op;
op.is_replace_key = true;
@@ -190,9 +189,10 @@ void ReplaceAbbr(CPDF_Object* pObj) {
}
if (value->IsName()) {
- CFX_ByteString name = value->GetString();
- fullname = FindFullName(
- InlineValueAbbr, FX_ArraySize(InlineValueAbbr), name.AsStringC());
+ ByteString name = value->GetString();
+ fullname =
+ FindFullName(InlineValueAbbr, FX_ArraySize(InlineValueAbbr),
+ name.AsStringView());
if (!fullname.IsEmpty()) {
AbbrReplacementOp op;
op.is_replace_key = false;
@@ -206,9 +206,9 @@ void ReplaceAbbr(CPDF_Object* pObj) {
}
for (const auto& op : replacements) {
if (op.is_replace_key)
- pDict->ReplaceKey(op.key, CFX_ByteString(op.replacement));
+ pDict->ReplaceKey(op.key, ByteString(op.replacement));
else
- pDict->SetNewFor<CPDF_Name>(op.key, CFX_ByteString(op.replacement));
+ pDict->SetNewFor<CPDF_Name>(op.key, ByteString(op.replacement));
}
break;
}
@@ -217,11 +217,12 @@ void ReplaceAbbr(CPDF_Object* pObj) {
for (size_t i = 0; i < pArray->GetCount(); i++) {
CPDF_Object* pElement = pArray->GetObjectAt(i);
if (pElement->IsName()) {
- CFX_ByteString name = pElement->GetString();
- CFX_ByteStringC fullname = FindFullName(
- InlineValueAbbr, FX_ArraySize(InlineValueAbbr), name.AsStringC());
+ ByteString name = pElement->GetString();
+ ByteStringView fullname =
+ FindFullName(InlineValueAbbr, FX_ArraySize(InlineValueAbbr),
+ name.AsStringView());
if (!fullname.IsEmpty())
- pArray->SetNewAt<CPDF_Name>(i, CFX_ByteString(fullname));
+ pArray->SetNewAt<CPDF_Name>(i, ByteString(fullname));
} else {
ReplaceAbbr(pElement);
}
@@ -307,7 +308,7 @@ int CPDF_StreamContentParser::GetNextParamPos() {
return index;
}
-void CPDF_StreamContentParser::AddNameParam(const CFX_ByteStringC& bsName) {
+void CPDF_StreamContentParser::AddNameParam(const ByteStringView& bsName) {
ContentParam& param = m_ParamBuf[GetNextParamPos()];
if (bsName.GetLength() > 32) {
param.m_Type = ContentParam::OBJECT;
@@ -316,7 +317,7 @@ void CPDF_StreamContentParser::AddNameParam(const CFX_ByteStringC& bsName) {
} else {
param.m_Type = ContentParam::NAME;
if (bsName.Contains('#')) {
- CFX_ByteString str = PDF_NameDecode(bsName);
+ ByteString str = PDF_NameDecode(bsName);
memcpy(param.m_Name.m_Buffer, str.c_str(), str.GetLength());
param.m_Name.m_Len = str.GetLength();
} else {
@@ -326,7 +327,7 @@ void CPDF_StreamContentParser::AddNameParam(const CFX_ByteStringC& bsName) {
}
}
-void CPDF_StreamContentParser::AddNumberParam(const CFX_ByteStringC& str) {
+void CPDF_StreamContentParser::AddNumberParam(const ByteStringView& str) {
ContentParam& param = m_ParamBuf[GetNextParamPos()];
param.m_Type = ContentParam::NUMBER;
param.m_Number.m_bInteger = FX_atonum(str, &param.m_Number.m_Integer);
@@ -373,7 +374,7 @@ CPDF_Object* CPDF_StreamContentParser::GetObject(uint32_t index) {
param.m_Type = ContentParam::OBJECT;
param.m_pObject = pdfium::MakeUnique<CPDF_Name>(
m_pDocument->GetByteStringPool(),
- CFX_ByteString(param.m_Name.m_Buffer, param.m_Name.m_Len));
+ ByteString(param.m_Name.m_Buffer, param.m_Name.m_Len));
return param.m_pObject.get();
}
if (param.m_Type == ContentParam::OBJECT)
@@ -383,9 +384,9 @@ CPDF_Object* CPDF_StreamContentParser::GetObject(uint32_t index) {
return nullptr;
}
-CFX_ByteString CPDF_StreamContentParser::GetString(uint32_t index) {
+ByteString CPDF_StreamContentParser::GetString(uint32_t index) {
if (index >= m_ParamCount) {
- return CFX_ByteString();
+ return ByteString();
}
int real_index = m_ParamStartPos + m_ParamCount - index - 1;
if (real_index >= kParamBufSize) {
@@ -393,12 +394,12 @@ CFX_ByteString CPDF_StreamContentParser::GetString(uint32_t index) {
}
ContentParam& param = m_ParamBuf[real_index];
if (param.m_Type == ContentParam::NAME) {
- return CFX_ByteString(param.m_Name.m_Buffer, param.m_Name.m_Len);
+ return ByteString(param.m_Name.m_Buffer, param.m_Name.m_Len);
}
if (param.m_Type == 0 && param.m_pObject) {
return param.m_pObject->GetString();
}
- return CFX_ByteString();
+ return ByteString();
}
float CPDF_StreamContentParser::GetNumber(uint32_t index) {
@@ -559,7 +560,7 @@ CPDF_StreamContentParser::InitializeOpCodes() {
});
}
-void CPDF_StreamContentParser::OnOperator(const CFX_ByteStringC& op) {
+void CPDF_StreamContentParser::OnOperator(const ByteStringView& op) {
static const OpCodes s_OpCodes = InitializeOpCodes();
auto it = s_OpCodes.find(op.GetID());
@@ -586,7 +587,7 @@ void CPDF_StreamContentParser::Handle_EOFillStrokePath() {
}
void CPDF_StreamContentParser::Handle_BeginMarkedContent_Dictionary() {
- CFX_ByteString tag = GetString(1);
+ ByteString tag = GetString(1);
CPDF_Object* pProperty = GetObject(0);
if (!pProperty) {
return;
@@ -619,7 +620,7 @@ void CPDF_StreamContentParser::Handle_BeginImage() {
break;
}
auto word = m_pSyntax->GetWord();
- CFX_ByteString key(word.Right(word.GetLength() - 1));
+ ByteString key(word.Right(word.GetLength() - 1));
auto pObj = m_pSyntax->ReadNextObject(false, false, 0);
if (!key.IsEmpty()) {
uint32_t dwObjNum = pObj ? pObj->GetObjNum() : 0;
@@ -634,7 +635,7 @@ void CPDF_StreamContentParser::Handle_BeginImage() {
if (pDict->KeyExist("ColorSpace")) {
pCSObj = pDict->GetDirectObjectFor("ColorSpace");
if (pCSObj->IsName()) {
- CFX_ByteString name = pCSObj->GetString();
+ ByteString name = pCSObj->GetString();
if (name != "DeviceRGB" && name != "DeviceGray" && name != "DeviceCMYK") {
pCSObj = FindResourceObj("ColorSpace", name);
if (pCSObj && pCSObj->IsInline())
@@ -727,7 +728,7 @@ void CPDF_StreamContentParser::Handle_SetCachedDevice() {
}
void CPDF_StreamContentParser::Handle_ExecuteXObject() {
- CFX_ByteString name = GetString(0);
+ ByteString name = GetString(0);
if (name == m_LastImageName && m_pLastImage && m_pLastImage->GetStream() &&
m_pLastImage->GetStream()->GetObjNum()) {
CPDF_ImageObject* pObj = AddImage(m_pLastImage);
@@ -744,7 +745,7 @@ void CPDF_StreamContentParser::Handle_ExecuteXObject() {
return;
}
- CFX_ByteString type;
+ ByteString type;
if (pXObject->GetDict())
type = pXObject->GetDict()->GetStringFor("Subtype");
@@ -875,7 +876,7 @@ void CPDF_StreamContentParser::Handle_SetGray_Stroke() {
}
void CPDF_StreamContentParser::Handle_SetExtendGraphState() {
- CFX_ByteString name = GetString(0);
+ ByteString name = GetString(0);
CPDF_Dictionary* pGS = ToDictionary(FindResourceObj("ExtGState", name));
if (!pGS) {
m_bResourceMissing = true;
@@ -1155,9 +1156,8 @@ void CPDF_StreamContentParser::Handle_SetFont() {
}
}
-CPDF_Object* CPDF_StreamContentParser::FindResourceObj(
- const CFX_ByteString& type,
- const CFX_ByteString& name) {
+CPDF_Object* CPDF_StreamContentParser::FindResourceObj(const ByteString& type,
+ const ByteString& name) {
if (!m_pResources)
return nullptr;
CPDF_Dictionary* pDict = m_pResources->GetDictFor(type);
@@ -1170,7 +1170,7 @@ CPDF_Object* CPDF_StreamContentParser::FindResourceObj(
return pPageDict ? pPageDict->GetDirectObjectFor(name) : nullptr;
}
-CPDF_Font* CPDF_StreamContentParser::FindFont(const CFX_ByteString& name) {
+CPDF_Font* CPDF_StreamContentParser::FindFont(const ByteString& name) {
CPDF_Dictionary* pFontDict = ToDictionary(FindResourceObj("Font", name));
if (!pFontDict) {
m_bResourceMissing = true;
@@ -1186,12 +1186,12 @@ CPDF_Font* CPDF_StreamContentParser::FindFont(const CFX_ByteString& name) {
}
CPDF_ColorSpace* CPDF_StreamContentParser::FindColorSpace(
- const CFX_ByteString& name) {
+ const ByteString& name) {
if (name == "Pattern") {
return CPDF_ColorSpace::GetStockCS(PDFCS_PATTERN);
}
if (name == "DeviceGray" || name == "DeviceCMYK" || name == "DeviceRGB") {
- CFX_ByteString defname = "Default";
+ ByteString defname = "Default";
defname += name.Right(name.GetLength() - 7);
CPDF_Object* pDefObj = FindResourceObj("ColorSpace", defname);
if (!pDefObj) {
@@ -1213,7 +1213,7 @@ CPDF_ColorSpace* CPDF_StreamContentParser::FindColorSpace(
return m_pDocument->LoadColorSpace(pCSObj);
}
-CPDF_Pattern* CPDF_StreamContentParser::FindPattern(const CFX_ByteString& name,
+CPDF_Pattern* CPDF_StreamContentParser::FindPattern(const ByteString& name,
bool bShading) {
CPDF_Object* pPattern =
FindResourceObj(bShading ? "Shading" : "Pattern", name);
@@ -1225,7 +1225,7 @@ CPDF_Pattern* CPDF_StreamContentParser::FindPattern(const CFX_ByteString& name,
m_pCurStates->m_ParentMatrix);
}
-void CPDF_StreamContentParser::AddTextObject(CFX_ByteString* pStrs,
+void CPDF_StreamContentParser::AddTextObject(ByteString* pStrs,
float fInitKerning,
float* pKerning,
int nsegs) {
@@ -1290,7 +1290,7 @@ void CPDF_StreamContentParser::AddTextObject(CFX_ByteString* pStrs,
}
void CPDF_StreamContentParser::Handle_ShowText() {
- CFX_ByteString str = GetString(0);
+ ByteString str = GetString(0);
if (str.IsEmpty()) {
return;
}
@@ -1317,14 +1317,14 @@ void CPDF_StreamContentParser::Handle_ShowText_Positioning() {
}
return;
}
- std::vector<CFX_ByteString> strs(nsegs);
+ std::vector<ByteString> strs(nsegs);
std::vector<float> kernings(nsegs);
size_t iSegment = 0;
float fInitKerning = 0;
for (size_t i = 0; i < n; i++) {
CPDF_Object* pObj = pArray->GetDirectObjectAt(i);
if (pObj->IsString()) {
- CFX_ByteString str = pObj->GetString();
+ ByteString str = pObj->GetString();
if (str.IsEmpty())
continue;
strs[iSegment] = str;
@@ -1556,7 +1556,7 @@ void CPDF_StreamContentParser::ParsePathObject() {
case CPDF_StreamParser::EndOfData:
return;
case CPDF_StreamParser::Keyword: {
- CFX_ByteStringC strc = m_pSyntax->GetWord();
+ ByteStringView strc = m_pSyntax->GetWord();
int len = strc.GetLength();
if (len == 1) {
switch (strc[0]) {
@@ -1631,14 +1631,14 @@ void CPDF_StreamContentParser::ParsePathObject() {
}
// static
-CFX_ByteStringC CPDF_StreamContentParser::FindKeyAbbreviationForTesting(
- const CFX_ByteStringC& abbr) {
+ByteStringView CPDF_StreamContentParser::FindKeyAbbreviationForTesting(
+ const ByteStringView& abbr) {
return FindFullName(InlineKeyAbbr, FX_ArraySize(InlineKeyAbbr), abbr);
}
// static
-CFX_ByteStringC CPDF_StreamContentParser::FindValueAbbreviationForTesting(
- const CFX_ByteStringC& abbr) {
+ByteStringView CPDF_StreamContentParser::FindValueAbbreviationForTesting(
+ const ByteStringView& abbr) {
return FindFullName(InlineValueAbbr, FX_ArraySize(InlineValueAbbr), abbr);
}
diff --git a/core/fpdfapi/page/cpdf_streamcontentparser.h b/core/fpdfapi/page/cpdf_streamcontentparser.h
index a027129c31..c30c6b7d3c 100644
--- a/core/fpdfapi/page/cpdf_streamcontentparser.h
+++ b/core/fpdfapi/page/cpdf_streamcontentparser.h
@@ -50,12 +50,12 @@ class CPDF_StreamContentParser {
CPDF_AllStates* GetCurStates() const { return m_pCurStates.get(); }
bool IsColored() const { return m_bColored; }
const float* GetType3Data() const { return m_Type3Data; }
- CPDF_Font* FindFont(const CFX_ByteString& name);
+ CPDF_Font* FindFont(const ByteString& name);
- static CFX_ByteStringC FindKeyAbbreviationForTesting(
- const CFX_ByteStringC& abbr);
- static CFX_ByteStringC FindValueAbbreviationForTesting(
- const CFX_ByteStringC& abbr);
+ static ByteStringView FindKeyAbbreviationForTesting(
+ const ByteStringView& abbr);
+ static ByteStringView FindValueAbbreviationForTesting(
+ const ByteStringView& abbr);
private:
struct ContentParam {
@@ -84,17 +84,17 @@ class CPDF_StreamContentParser {
using OpCodes = std::map<uint32_t, void (CPDF_StreamContentParser::*)()>;
static OpCodes InitializeOpCodes();
- void AddNameParam(const CFX_ByteStringC& str);
- void AddNumberParam(const CFX_ByteStringC& str);
+ void AddNameParam(const ByteStringView& str);
+ void AddNumberParam(const ByteStringView& str);
void AddObjectParam(std::unique_ptr<CPDF_Object> pObj);
int GetNextParamPos();
void ClearAllParams();
CPDF_Object* GetObject(uint32_t index);
- CFX_ByteString GetString(uint32_t index);
+ ByteString GetString(uint32_t index);
float GetNumber(uint32_t index);
int GetInteger(uint32_t index) { return (int32_t)(GetNumber(index)); }
- void OnOperator(const CFX_ByteStringC& op);
- void AddTextObject(CFX_ByteString* pText,
+ void OnOperator(const ByteStringView& op);
+ void AddTextObject(ByteString* pText,
float fInitKerning,
float* pKerning,
int count);
@@ -113,10 +113,9 @@ class CPDF_StreamContentParser {
bool bColor,
bool bText,
bool bGraph);
- CPDF_ColorSpace* FindColorSpace(const CFX_ByteString& name);
- CPDF_Pattern* FindPattern(const CFX_ByteString& name, bool bShading);
- CPDF_Object* FindResourceObj(const CFX_ByteString& type,
- const CFX_ByteString& name);
+ CPDF_ColorSpace* FindColorSpace(const ByteString& name);
+ CPDF_Pattern* FindPattern(const ByteString& name, bool bShading);
+ CPDF_Object* FindResourceObj(const ByteString& type, const ByteString& name);
// Takes ownership of |pImageObj|, returns unowned pointer to it.
CPDF_ImageObject* AddImageObject(std::unique_ptr<CPDF_ImageObject> pImageObj);
@@ -217,7 +216,7 @@ class CPDF_StreamContentParser {
float m_PathCurrentX;
float m_PathCurrentY;
uint8_t m_PathClipType;
- CFX_ByteString m_LastImageName;
+ ByteString m_LastImageName;
CFX_RetainPtr<CPDF_Image> m_pLastImage;
bool m_bColored;
float m_Type3Data[6];
diff --git a/core/fpdfapi/page/cpdf_streamcontentparser_unittest.cpp b/core/fpdfapi/page/cpdf_streamcontentparser_unittest.cpp
index 6b43935a1d..0f4fc1e87a 100644
--- a/core/fpdfapi/page/cpdf_streamcontentparser_unittest.cpp
+++ b/core/fpdfapi/page/cpdf_streamcontentparser_unittest.cpp
@@ -6,39 +6,39 @@
#include "testing/gtest/include/gtest/gtest.h"
TEST(cpdf_streamcontentparser, PDF_FindKeyAbbreviation) {
- EXPECT_EQ(CFX_ByteStringC("BitsPerComponent"),
+ EXPECT_EQ(ByteStringView("BitsPerComponent"),
CPDF_StreamContentParser::FindKeyAbbreviationForTesting(
- CFX_ByteStringC("BPC")));
- EXPECT_EQ(CFX_ByteStringC("Width"),
+ ByteStringView("BPC")));
+ EXPECT_EQ(ByteStringView("Width"),
CPDF_StreamContentParser::FindKeyAbbreviationForTesting(
- CFX_ByteStringC("W")));
- EXPECT_EQ(CFX_ByteStringC(""),
+ ByteStringView("W")));
+ EXPECT_EQ(ByteStringView(""),
CPDF_StreamContentParser::FindKeyAbbreviationForTesting(
- CFX_ByteStringC("")));
- EXPECT_EQ(CFX_ByteStringC(""),
+ ByteStringView("")));
+ EXPECT_EQ(ByteStringView(""),
CPDF_StreamContentParser::FindKeyAbbreviationForTesting(
- CFX_ByteStringC("NoInList")));
+ ByteStringView("NoInList")));
// Prefix should not match.
- EXPECT_EQ(CFX_ByteStringC(""),
+ EXPECT_EQ(ByteStringView(""),
CPDF_StreamContentParser::FindKeyAbbreviationForTesting(
- CFX_ByteStringC("WW")));
+ ByteStringView("WW")));
}
TEST(cpdf_streamcontentparser, PDF_FindValueAbbreviation) {
- EXPECT_EQ(CFX_ByteStringC("DeviceGray"),
+ EXPECT_EQ(ByteStringView("DeviceGray"),
CPDF_StreamContentParser::FindValueAbbreviationForTesting(
- CFX_ByteStringC("G")));
- EXPECT_EQ(CFX_ByteStringC("DCTDecode"),
+ ByteStringView("G")));
+ EXPECT_EQ(ByteStringView("DCTDecode"),
CPDF_StreamContentParser::FindValueAbbreviationForTesting(
- CFX_ByteStringC("DCT")));
- EXPECT_EQ(CFX_ByteStringC(""),
+ ByteStringView("DCT")));
+ EXPECT_EQ(ByteStringView(""),
CPDF_StreamContentParser::FindValueAbbreviationForTesting(
- CFX_ByteStringC("")));
- EXPECT_EQ(CFX_ByteStringC(""),
+ ByteStringView("")));
+ EXPECT_EQ(ByteStringView(""),
CPDF_StreamContentParser::FindValueAbbreviationForTesting(
- CFX_ByteStringC("NoInList")));
+ ByteStringView("NoInList")));
// Prefix should not match.
- EXPECT_EQ(CFX_ByteStringC(""),
+ EXPECT_EQ(ByteStringView(""),
CPDF_StreamContentParser::FindValueAbbreviationForTesting(
- CFX_ByteStringC("II")));
+ ByteStringView("II")));
}
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));
}
diff --git a/core/fpdfapi/page/cpdf_streamparser.h b/core/fpdfapi/page/cpdf_streamparser.h
index fdc418c634..32001a8b6e 100644
--- a/core/fpdfapi/page/cpdf_streamparser.h
+++ b/core/fpdfapi/page/cpdf_streamparser.h
@@ -24,12 +24,12 @@ class CPDF_StreamParser {
CPDF_StreamParser(const uint8_t* pData, uint32_t dwSize);
CPDF_StreamParser(const uint8_t* pData,
uint32_t dwSize,
- const CFX_WeakPtr<CFX_ByteStringPool>& pPool);
+ const CFX_WeakPtr<ByteStringPool>& pPool);
~CPDF_StreamParser();
SyntaxType ParseNextElement();
- CFX_ByteStringC GetWord() const {
- return CFX_ByteStringC(m_WordBuffer, m_WordSize);
+ ByteStringView GetWord() const {
+ return ByteStringView(m_WordBuffer, m_WordSize);
}
uint32_t GetPos() const { return m_Pos; }
void SetPos(uint32_t pos) { m_Pos = pos; }
@@ -46,8 +46,8 @@ class CPDF_StreamParser {
friend class cpdf_streamparser_ReadHexString_Test;
void GetNextWord(bool& bIsNumber);
- CFX_ByteString ReadString();
- CFX_ByteString ReadHexString();
+ ByteString ReadString();
+ ByteString ReadHexString();
bool PositionIsInBounds() const;
const uint8_t* m_pBuf;
@@ -56,7 +56,7 @@ class CPDF_StreamParser {
uint8_t m_WordBuffer[256];
uint32_t m_WordSize;
std::unique_ptr<CPDF_Object> m_pLastObj;
- CFX_WeakPtr<CFX_ByteStringPool> m_pPool;
+ CFX_WeakPtr<ByteStringPool> m_pPool;
};
#endif // CORE_FPDFAPI_PAGE_CPDF_STREAMPARSER_H_
diff --git a/core/fpdfapi/page/cpdf_textobject.cpp b/core/fpdfapi/page/cpdf_textobject.cpp
index a4d714ff72..4baf61dd72 100644
--- a/core/fpdfapi/page/cpdf_textobject.cpp
+++ b/core/fpdfapi/page/cpdf_textobject.cpp
@@ -136,7 +136,7 @@ CFX_Matrix CPDF_TextObject::GetTextMatrix() const {
pTextMatrix[3], m_Pos.x, m_Pos.y);
}
-void CPDF_TextObject::SetSegments(const CFX_ByteString* pStrs,
+void CPDF_TextObject::SetSegments(const ByteString* pStrs,
const float* pKerning,
int nsegs) {
m_CharCodes.clear();
@@ -162,7 +162,7 @@ void CPDF_TextObject::SetSegments(const CFX_ByteString* pStrs,
}
}
-void CPDF_TextObject::SetText(const CFX_ByteString& str) {
+void CPDF_TextObject::SetText(const ByteString& str) {
SetSegments(&str, nullptr, 1);
RecalcPositionData();
SetDirty(true);
diff --git a/core/fpdfapi/page/cpdf_textobject.h b/core/fpdfapi/page/cpdf_textobject.h
index e08b7280de..5cffbd1434 100644
--- a/core/fpdfapi/page/cpdf_textobject.h
+++ b/core/fpdfapi/page/cpdf_textobject.h
@@ -47,7 +47,7 @@ class CPDF_TextObject : public CPDF_PageObject {
CPDF_Font* GetFont() const;
float GetFontSize() const;
- void SetText(const CFX_ByteString& text);
+ void SetText(const ByteString& text);
void SetPosition(float x, float y);
void RecalcPositionData();
@@ -58,9 +58,7 @@ class CPDF_TextObject : public CPDF_PageObject {
friend class CPDF_TextRenderer;
friend class CPDF_PageContentGenerator;
- void SetSegments(const CFX_ByteString* pStrs,
- const float* pKerning,
- int nSegs);
+ void SetSegments(const ByteString* pStrs, const float* pKerning, int nSegs);
CFX_PointF CalcPositionData(float horz_scale);
diff --git a/core/fpdfapi/parser/cfdf_document.cpp b/core/fpdfapi/parser/cfdf_document.cpp
index 41827db0d9..1f84f56547 100644
--- a/core/fpdfapi/parser/cfdf_document.cpp
+++ b/core/fpdfapi/parser/cfdf_document.cpp
@@ -52,7 +52,7 @@ void CFDF_Document::ParseStream(
parser.InitParser(m_pFile, 0);
while (1) {
bool bNumber;
- CFX_ByteString word = parser.GetNextWord(&bNumber);
+ ByteString word = parser.GetNextWord(&bNumber);
if (bNumber) {
uint32_t objnum = FXSYS_atoui(word.c_str());
if (!objnum)
@@ -89,9 +89,9 @@ void CFDF_Document::ParseStream(
}
}
-CFX_ByteString CFDF_Document::WriteToString() const {
+ByteString CFDF_Document::WriteToString() const {
if (!m_pRootDict)
- return CFX_ByteString();
+ return ByteString();
std::ostringstream buf;
buf << "%FDF-1.2\r\n";
@@ -102,5 +102,5 @@ CFX_ByteString CFDF_Document::WriteToString() const {
buf << "trailer\r\n<</Root " << m_pRootDict->GetObjNum()
<< " 0 R>>\r\n%%EOF\r\n";
- return CFX_ByteString(buf);
+ return ByteString(buf);
}
diff --git a/core/fpdfapi/parser/cfdf_document.h b/core/fpdfapi/parser/cfdf_document.h
index d58f93ced4..a24415b099 100644
--- a/core/fpdfapi/parser/cfdf_document.h
+++ b/core/fpdfapi/parser/cfdf_document.h
@@ -27,7 +27,7 @@ class CFDF_Document : public CPDF_IndirectObjectHolder {
CFDF_Document();
~CFDF_Document() override;
- CFX_ByteString WriteToString() const;
+ ByteString WriteToString() const;
CPDF_Dictionary* GetRoot() const { return m_pRootDict.Get(); }
protected:
diff --git a/core/fpdfapi/parser/cpdf_array.cpp b/core/fpdfapi/parser/cpdf_array.cpp
index a0957b6c2b..f4907ffdf1 100644
--- a/core/fpdfapi/parser/cpdf_array.cpp
+++ b/core/fpdfapi/parser/cpdf_array.cpp
@@ -20,7 +20,7 @@
CPDF_Array::CPDF_Array() {}
-CPDF_Array::CPDF_Array(const CFX_WeakPtr<CFX_ByteStringPool>& pPool)
+CPDF_Array::CPDF_Array(const CFX_WeakPtr<ByteStringPool>& pPool)
: m_pPool(pPool) {}
CPDF_Array::~CPDF_Array() {
@@ -100,15 +100,15 @@ CPDF_Object* CPDF_Array::GetDirectObjectAt(size_t i) const {
return m_Objects[i]->GetDirect();
}
-CFX_ByteString CPDF_Array::GetStringAt(size_t i) const {
+ByteString CPDF_Array::GetStringAt(size_t i) const {
if (i >= m_Objects.size())
- return CFX_ByteString();
+ return ByteString();
return m_Objects[i]->GetString();
}
-CFX_WideString CPDF_Array::GetUnicodeTextAt(size_t i) const {
+WideString CPDF_Array::GetUnicodeTextAt(size_t i) const {
if (i >= m_Objects.size())
- return CFX_WideString();
+ return WideString();
return m_Objects[i]->GetUnicodeText();
}
diff --git a/core/fpdfapi/parser/cpdf_array.h b/core/fpdfapi/parser/cpdf_array.h
index d1be233652..3b18025b2d 100644
--- a/core/fpdfapi/parser/cpdf_array.h
+++ b/core/fpdfapi/parser/cpdf_array.h
@@ -24,7 +24,7 @@ class CPDF_Array : public CPDF_Object {
std::vector<std::unique_ptr<CPDF_Object>>::const_iterator;
CPDF_Array();
- explicit CPDF_Array(const CFX_WeakPtr<CFX_ByteStringPool>& pPool);
+ explicit CPDF_Array(const CFX_WeakPtr<ByteStringPool>& pPool);
~CPDF_Array() override;
// CPDF_Object:
@@ -39,8 +39,8 @@ class CPDF_Array : public CPDF_Object {
size_t GetCount() const { return m_Objects.size(); }
CPDF_Object* GetObjectAt(size_t index) const;
CPDF_Object* GetDirectObjectAt(size_t index) const;
- CFX_ByteString GetStringAt(size_t index) const;
- CFX_WideString GetUnicodeTextAt(size_t index) const;
+ ByteString GetStringAt(size_t index) const;
+ WideString GetUnicodeTextAt(size_t index) const;
int GetIntegerAt(size_t index) const;
float GetNumberAt(size_t index) const;
CPDF_Dictionary* GetDictAt(size_t index) const;
@@ -112,7 +112,7 @@ class CPDF_Array : public CPDF_Object {
std::set<const CPDF_Object*>* pVisited) const override;
std::vector<std::unique_ptr<CPDF_Object>> m_Objects;
- CFX_WeakPtr<CFX_ByteStringPool> m_pPool;
+ CFX_WeakPtr<ByteStringPool> m_pPool;
};
inline CPDF_Array* ToArray(CPDF_Object* obj) {
diff --git a/core/fpdfapi/parser/cpdf_boolean.cpp b/core/fpdfapi/parser/cpdf_boolean.cpp
index 2633c876d3..a1dc450519 100644
--- a/core/fpdfapi/parser/cpdf_boolean.cpp
+++ b/core/fpdfapi/parser/cpdf_boolean.cpp
@@ -22,7 +22,7 @@ std::unique_ptr<CPDF_Object> CPDF_Boolean::Clone() const {
return pdfium::MakeUnique<CPDF_Boolean>(m_bValue);
}
-CFX_ByteString CPDF_Boolean::GetString() const {
+ByteString CPDF_Boolean::GetString() const {
return m_bValue ? "true" : "false";
}
@@ -30,7 +30,7 @@ int CPDF_Boolean::GetInteger() const {
return m_bValue;
}
-void CPDF_Boolean::SetString(const CFX_ByteString& str) {
+void CPDF_Boolean::SetString(const ByteString& str) {
m_bValue = (str == "true");
}
@@ -48,5 +48,5 @@ const CPDF_Boolean* CPDF_Boolean::AsBoolean() const {
bool CPDF_Boolean::WriteTo(IFX_ArchiveStream* archive) const {
return archive->WriteString(" ") &&
- archive->WriteString(GetString().AsStringC());
+ archive->WriteString(GetString().AsStringView());
}
diff --git a/core/fpdfapi/parser/cpdf_boolean.h b/core/fpdfapi/parser/cpdf_boolean.h
index 2dd1486b6a..c0a69d8932 100644
--- a/core/fpdfapi/parser/cpdf_boolean.h
+++ b/core/fpdfapi/parser/cpdf_boolean.h
@@ -22,9 +22,9 @@ class CPDF_Boolean : public CPDF_Object {
// CPDF_Object:
Type GetType() const override;
std::unique_ptr<CPDF_Object> Clone() const override;
- CFX_ByteString GetString() const override;
+ ByteString GetString() const override;
int GetInteger() const override;
- void SetString(const CFX_ByteString& str) override;
+ void SetString(const ByteString& str) override;
bool IsBoolean() const override;
CPDF_Boolean* AsBoolean() override;
const CPDF_Boolean* AsBoolean() const override;
diff --git a/core/fpdfapi/parser/cpdf_crypto_handler.cpp b/core/fpdfapi/parser/cpdf_crypto_handler.cpp
index 74428ba6a8..cae95f2c19 100644
--- a/core/fpdfapi/parser/cpdf_crypto_handler.cpp
+++ b/core/fpdfapi/parser/cpdf_crypto_handler.cpp
@@ -230,14 +230,14 @@ bool CPDF_CryptoHandler::CryptFinish(void* context,
return true;
}
-CFX_ByteString CPDF_CryptoHandler::Decrypt(uint32_t objnum,
- uint32_t gennum,
- const CFX_ByteString& str) {
+ByteString CPDF_CryptoHandler::Decrypt(uint32_t objnum,
+ uint32_t gennum,
+ const ByteString& str) {
CFX_BinaryBuf dest_buf;
void* context = DecryptStart(objnum, gennum);
DecryptStream(context, str.raw_str(), str.GetLength(), dest_buf);
DecryptFinish(context, dest_buf);
- return CFX_ByteString(dest_buf.GetBuffer(), dest_buf.GetSize());
+ return ByteString(dest_buf.GetBuffer(), dest_buf.GetSize());
}
void* CPDF_CryptoHandler::DecryptStart(uint32_t objnum, uint32_t gennum) {
diff --git a/core/fpdfapi/parser/cpdf_crypto_handler.h b/core/fpdfapi/parser/cpdf_crypto_handler.h
index adf0c6c680..252f41c333 100644
--- a/core/fpdfapi/parser/cpdf_crypto_handler.h
+++ b/core/fpdfapi/parser/cpdf_crypto_handler.h
@@ -28,9 +28,7 @@ class CPDF_CryptoHandler : public CFX_Retainable {
CPDF_SecurityHandler* pSecurityHandler);
uint32_t DecryptGetSize(uint32_t src_size);
void* DecryptStart(uint32_t objnum, uint32_t gennum);
- CFX_ByteString Decrypt(uint32_t objnum,
- uint32_t gennum,
- const CFX_ByteString& str);
+ ByteString Decrypt(uint32_t objnum, uint32_t gennum, const ByteString& str);
bool DecryptStream(void* context,
const uint8_t* src_buf,
uint32_t src_size,
diff --git a/core/fpdfapi/parser/cpdf_data_avail.cpp b/core/fpdfapi/parser/cpdf_data_avail.cpp
index b10029d4ce..994d082712 100644
--- a/core/fpdfapi/parser/cpdf_data_avail.cpp
+++ b/core/fpdfapi/parser/cpdf_data_avail.cpp
@@ -473,7 +473,7 @@ bool CPDF_DataAvail::CheckPage() {
if (!pObj->IsDictionary())
continue;
- CFX_ByteString type = pObj->GetDict()->GetStringFor("Type");
+ ByteString type = pObj->GetDict()->GetStringFor("Type");
if (type == "Pages") {
m_PagesArray.push_back(std::move(pObj));
continue;
@@ -661,7 +661,7 @@ std::unique_ptr<CPDF_Object> CPDF_DataAvail::ParseIndirectObjectAt(
m_syntaxParser.SetPos(pos);
bool bIsNumber;
- CFX_ByteString word = m_syntaxParser.GetNextWord(&bIsNumber);
+ ByteString word = m_syntaxParser.GetNextWord(&bIsNumber);
if (!bIsNumber)
return nullptr;
@@ -723,7 +723,7 @@ bool CPDF_DataAvail::IsLinearizedFile(uint8_t* pData, uint32_t dwLen) {
m_syntaxParser.SetPos(m_syntaxParser.m_HeaderOffset + 9);
bool bNumber;
- CFX_ByteString wordObjNum = m_syntaxParser.GetNextWord(&bNumber);
+ ByteString wordObjNum = m_syntaxParser.GetNextWord(&bNumber);
if (!bNumber)
return false;
@@ -761,7 +761,7 @@ bool CPDF_DataAvail::CheckEnd() {
m_syntaxParser.GetNextWord(nullptr);
bool bNumber;
- CFX_ByteString xrefpos_str = m_syntaxParser.GetNextWord(&bNumber);
+ ByteString xrefpos_str = m_syntaxParser.GetNextWord(&bNumber);
if (!bNumber) {
m_docStatus = PDF_DATAAVAIL_ERROR;
return false;
@@ -781,7 +781,7 @@ void CPDF_DataAvail::SetStartOffset(FX_FILESIZE dwOffset) {
m_Pos = dwOffset;
}
-bool CPDF_DataAvail::GetNextToken(CFX_ByteString* token) {
+bool CPDF_DataAvail::GetNextToken(ByteString* token) {
uint8_t ch;
if (!GetNextChar(ch))
return false;
@@ -814,7 +814,7 @@ bool CPDF_DataAvail::GetNextToken(CFX_ByteString* token) {
if (!PDFCharIsOther(ch) && !PDFCharIsNumeric(ch)) {
m_Pos--;
- *token = CFX_ByteString(buffer, index);
+ *token = ByteString(buffer, index);
return true;
}
if (index < sizeof(buffer))
@@ -837,7 +837,7 @@ bool CPDF_DataAvail::GetNextToken(CFX_ByteString* token) {
else
m_Pos--;
}
- *token = CFX_ByteString(buffer, index);
+ *token = ByteString(buffer, index);
return true;
}
@@ -854,7 +854,7 @@ bool CPDF_DataAvail::GetNextToken(CFX_ByteString* token) {
}
}
- *token = CFX_ByteString(buffer, index);
+ *token = ByteString(buffer, index);
return true;
}
@@ -885,7 +885,7 @@ bool CPDF_DataAvail::GetNextChar(uint8_t& ch) {
}
bool CPDF_DataAvail::CheckCrossRefItem() {
- CFX_ByteString token;
+ ByteString token;
while (1) {
const CPDF_ReadValidator::Session read_session(GetValidator().Get());
if (!GetNextToken(&token)) {
@@ -904,7 +904,7 @@ bool CPDF_DataAvail::CheckCrossRefItem() {
bool CPDF_DataAvail::CheckCrossRef() {
const CPDF_ReadValidator::Session read_session(GetValidator().Get());
- CFX_ByteString token;
+ ByteString token;
if (!GetNextToken(&token)) {
if (!GetValidator()->has_read_problems())
m_docStatus = PDF_DATAAVAIL_ERROR;
@@ -1046,7 +1046,7 @@ bool CPDF_DataAvail::CheckUnknownPageNode(uint32_t dwPageNo,
pPageNode->m_dwPageNo = dwPageNo;
CPDF_Dictionary* pDict = pPage->GetDict();
- const CFX_ByteString type = pDict->GetStringFor("Type");
+ const ByteString type = pDict->GetStringFor("Type");
if (type == "Page") {
pPageNode->m_type = PDF_PAGENODE_PAGE;
return true;
diff --git a/core/fpdfapi/parser/cpdf_data_avail.h b/core/fpdfapi/parser/cpdf_data_avail.h
index e2a4a20aa1..850ceeaae2 100644
--- a/core/fpdfapi/parser/cpdf_data_avail.h
+++ b/core/fpdfapi/parser/cpdf_data_avail.h
@@ -145,7 +145,7 @@ class CPDF_DataAvail final {
bool IsLinearizedFile(uint8_t* pData, uint32_t dwLen);
void SetStartOffset(FX_FILESIZE dwOffset);
- bool GetNextToken(CFX_ByteString* token);
+ bool GetNextToken(ByteString* token);
bool GetNextChar(uint8_t& ch);
std::unique_ptr<CPDF_Object> ParseIndirectObjectAt(
FX_FILESIZE pos,
@@ -200,7 +200,7 @@ class CPDF_DataAvail final {
FX_FILESIZE m_Pos;
FX_FILESIZE m_bufferOffset;
uint32_t m_bufferSize;
- CFX_ByteString m_WordBuf;
+ ByteString m_WordBuf;
uint8_t m_bufferData[512];
std::vector<uint32_t> m_XRefStreamList;
std::vector<uint32_t> m_PageObjList;
diff --git a/core/fpdfapi/parser/cpdf_dictionary.cpp b/core/fpdfapi/parser/cpdf_dictionary.cpp
index 4c035871df..570c57e557 100644
--- a/core/fpdfapi/parser/cpdf_dictionary.cpp
+++ b/core/fpdfapi/parser/cpdf_dictionary.cpp
@@ -22,9 +22,9 @@
#include "third_party/base/stl_util.h"
CPDF_Dictionary::CPDF_Dictionary()
- : CPDF_Dictionary(CFX_WeakPtr<CFX_ByteStringPool>()) {}
+ : CPDF_Dictionary(CFX_WeakPtr<ByteStringPool>()) {}
-CPDF_Dictionary::CPDF_Dictionary(const CFX_WeakPtr<CFX_ByteStringPool>& pPool)
+CPDF_Dictionary::CPDF_Dictionary(const CFX_WeakPtr<ByteStringPool>& pPool)
: m_pPool(pPool) {}
CPDF_Dictionary::~CPDF_Dictionary() {
@@ -78,58 +78,56 @@ std::unique_ptr<CPDF_Object> CPDF_Dictionary::CloneNonCyclic(
return std::move(pCopy);
}
-CPDF_Object* CPDF_Dictionary::GetObjectFor(const CFX_ByteString& key) const {
+CPDF_Object* CPDF_Dictionary::GetObjectFor(const ByteString& key) const {
auto it = m_Map.find(key);
return it != m_Map.end() ? it->second.get() : nullptr;
}
-CPDF_Object* CPDF_Dictionary::GetDirectObjectFor(
- const CFX_ByteString& key) const {
+CPDF_Object* CPDF_Dictionary::GetDirectObjectFor(const ByteString& key) const {
CPDF_Object* p = GetObjectFor(key);
return p ? p->GetDirect() : nullptr;
}
-CFX_ByteString CPDF_Dictionary::GetStringFor(const CFX_ByteString& key) const {
+ByteString CPDF_Dictionary::GetStringFor(const ByteString& key) const {
CPDF_Object* p = GetObjectFor(key);
- return p ? p->GetString() : CFX_ByteString();
+ return p ? p->GetString() : ByteString();
}
-CFX_WideString CPDF_Dictionary::GetUnicodeTextFor(
- const CFX_ByteString& key) const {
+WideString CPDF_Dictionary::GetUnicodeTextFor(const ByteString& key) const {
CPDF_Object* p = GetObjectFor(key);
if (CPDF_Reference* pRef = ToReference(p))
p = pRef->GetDirect();
- return p ? p->GetUnicodeText() : CFX_WideString();
+ return p ? p->GetUnicodeText() : WideString();
}
-CFX_ByteString CPDF_Dictionary::GetStringFor(const CFX_ByteString& key,
- const CFX_ByteString& def) const {
+ByteString CPDF_Dictionary::GetStringFor(const ByteString& key,
+ const ByteString& def) const {
CPDF_Object* p = GetObjectFor(key);
- return p ? p->GetString() : CFX_ByteString(def);
+ return p ? p->GetString() : ByteString(def);
}
-int CPDF_Dictionary::GetIntegerFor(const CFX_ByteString& key) const {
+int CPDF_Dictionary::GetIntegerFor(const ByteString& key) const {
CPDF_Object* p = GetObjectFor(key);
return p ? p->GetInteger() : 0;
}
-int CPDF_Dictionary::GetIntegerFor(const CFX_ByteString& key, int def) const {
+int CPDF_Dictionary::GetIntegerFor(const ByteString& key, int def) const {
CPDF_Object* p = GetObjectFor(key);
return p ? p->GetInteger() : def;
}
-float CPDF_Dictionary::GetNumberFor(const CFX_ByteString& key) const {
+float CPDF_Dictionary::GetNumberFor(const ByteString& key) const {
CPDF_Object* p = GetObjectFor(key);
return p ? p->GetNumber() : 0;
}
-bool CPDF_Dictionary::GetBooleanFor(const CFX_ByteString& key,
+bool CPDF_Dictionary::GetBooleanFor(const ByteString& key,
bool bDefault) const {
CPDF_Object* p = GetObjectFor(key);
return ToBoolean(p) ? p->GetInteger() != 0 : bDefault;
}
-CPDF_Dictionary* CPDF_Dictionary::GetDictFor(const CFX_ByteString& key) const {
+CPDF_Dictionary* CPDF_Dictionary::GetDictFor(const ByteString& key) const {
CPDF_Object* p = GetDirectObjectFor(key);
if (!p)
return nullptr;
@@ -140,15 +138,15 @@ CPDF_Dictionary* CPDF_Dictionary::GetDictFor(const CFX_ByteString& key) const {
return nullptr;
}
-CPDF_Array* CPDF_Dictionary::GetArrayFor(const CFX_ByteString& key) const {
+CPDF_Array* CPDF_Dictionary::GetArrayFor(const ByteString& key) const {
return ToArray(GetDirectObjectFor(key));
}
-CPDF_Stream* CPDF_Dictionary::GetStreamFor(const CFX_ByteString& key) const {
+CPDF_Stream* CPDF_Dictionary::GetStreamFor(const ByteString& key) const {
return ToStream(GetDirectObjectFor(key));
}
-CFX_FloatRect CPDF_Dictionary::GetRectFor(const CFX_ByteString& key) const {
+CFX_FloatRect CPDF_Dictionary::GetRectFor(const ByteString& key) const {
CFX_FloatRect rect;
CPDF_Array* pArray = GetArrayFor(key);
if (pArray)
@@ -156,7 +154,7 @@ CFX_FloatRect CPDF_Dictionary::GetRectFor(const CFX_ByteString& key) const {
return rect;
}
-CFX_Matrix CPDF_Dictionary::GetMatrixFor(const CFX_ByteString& key) const {
+CFX_Matrix CPDF_Dictionary::GetMatrixFor(const ByteString& key) const {
CFX_Matrix matrix;
CPDF_Array* pArray = GetArrayFor(key);
if (pArray)
@@ -164,7 +162,7 @@ CFX_Matrix CPDF_Dictionary::GetMatrixFor(const CFX_ByteString& key) const {
return matrix;
}
-bool CPDF_Dictionary::KeyExist(const CFX_ByteString& key) const {
+bool CPDF_Dictionary::KeyExist(const ByteString& key) const {
return pdfium::ContainsKey(m_Map, key);
}
@@ -175,7 +173,7 @@ bool CPDF_Dictionary::IsSignatureDict() const {
return pType && pType->GetString() == "Sig";
}
-CPDF_Object* CPDF_Dictionary::SetFor(const CFX_ByteString& key,
+CPDF_Object* CPDF_Dictionary::SetFor(const ByteString& key,
std::unique_ptr<CPDF_Object> pObj) {
if (!pObj) {
m_Map.erase(key);
@@ -188,7 +186,7 @@ CPDF_Object* CPDF_Dictionary::SetFor(const CFX_ByteString& key,
}
void CPDF_Dictionary::ConvertToIndirectObjectFor(
- const CFX_ByteString& key,
+ const ByteString& key,
CPDF_IndirectObjectHolder* pHolder) {
auto it = m_Map.find(key);
if (it == m_Map.end() || it->second->IsReference())
@@ -198,8 +196,7 @@ void CPDF_Dictionary::ConvertToIndirectObjectFor(
it->second = pdfium::MakeUnique<CPDF_Reference>(pHolder, pObj->GetObjNum());
}
-std::unique_ptr<CPDF_Object> CPDF_Dictionary::RemoveFor(
- const CFX_ByteString& key) {
+std::unique_ptr<CPDF_Object> CPDF_Dictionary::RemoveFor(const ByteString& key) {
std::unique_ptr<CPDF_Object> result;
auto it = m_Map.find(key);
if (it != m_Map.end()) {
@@ -209,8 +206,8 @@ std::unique_ptr<CPDF_Object> CPDF_Dictionary::RemoveFor(
return result;
}
-void CPDF_Dictionary::ReplaceKey(const CFX_ByteString& oldkey,
- const CFX_ByteString& newkey) {
+void CPDF_Dictionary::ReplaceKey(const ByteString& oldkey,
+ const ByteString& newkey) {
auto old_it = m_Map.find(oldkey);
if (old_it == m_Map.end())
return;
@@ -223,7 +220,7 @@ void CPDF_Dictionary::ReplaceKey(const CFX_ByteString& oldkey,
m_Map.erase(old_it);
}
-void CPDF_Dictionary::SetRectFor(const CFX_ByteString& key,
+void CPDF_Dictionary::SetRectFor(const ByteString& key,
const CFX_FloatRect& rect) {
CPDF_Array* pArray = SetNewFor<CPDF_Array>(key);
pArray->AddNew<CPDF_Number>(rect.left);
@@ -232,7 +229,7 @@ void CPDF_Dictionary::SetRectFor(const CFX_ByteString& key,
pArray->AddNew<CPDF_Number>(rect.top);
}
-void CPDF_Dictionary::SetMatrixFor(const CFX_ByteString& key,
+void CPDF_Dictionary::SetMatrixFor(const ByteString& key,
const CFX_Matrix& matrix) {
CPDF_Array* pArray = SetNewFor<CPDF_Array>(key);
pArray->AddNew<CPDF_Number>(matrix.a);
@@ -243,7 +240,7 @@ void CPDF_Dictionary::SetMatrixFor(const CFX_ByteString& key,
pArray->AddNew<CPDF_Number>(matrix.f);
}
-CFX_ByteString CPDF_Dictionary::MaybeIntern(const CFX_ByteString& str) {
+ByteString CPDF_Dictionary::MaybeIntern(const ByteString& str) {
return m_pPool ? m_pPool->Intern(str) : str;
}
@@ -252,10 +249,10 @@ bool CPDF_Dictionary::WriteTo(IFX_ArchiveStream* archive) const {
return false;
for (const auto& it : *this) {
- const CFX_ByteString& key = it.first;
+ const ByteString& key = it.first;
CPDF_Object* pValue = it.second.get();
if (!archive->WriteString("/") ||
- !archive->WriteString(PDF_NameEncode(key).AsStringC())) {
+ !archive->WriteString(PDF_NameEncode(key).AsStringView())) {
return false;
}
diff --git a/core/fpdfapi/parser/cpdf_dictionary.h b/core/fpdfapi/parser/cpdf_dictionary.h
index 31a09d954d..93c00c8c10 100644
--- a/core/fpdfapi/parser/cpdf_dictionary.h
+++ b/core/fpdfapi/parser/cpdf_dictionary.h
@@ -24,10 +24,10 @@ class CPDF_IndirectObjectHolder;
class CPDF_Dictionary : public CPDF_Object {
public:
using const_iterator =
- std::map<CFX_ByteString, std::unique_ptr<CPDF_Object>>::const_iterator;
+ std::map<ByteString, std::unique_ptr<CPDF_Object>>::const_iterator;
CPDF_Dictionary();
- explicit CPDF_Dictionary(const CFX_WeakPtr<CFX_ByteStringPool>& pPool);
+ explicit CPDF_Dictionary(const CFX_WeakPtr<ByteStringPool>& pPool);
~CPDF_Dictionary() override;
// CPDF_Object:
@@ -40,76 +40,73 @@ class CPDF_Dictionary : public CPDF_Object {
bool WriteTo(IFX_ArchiveStream* archive) const override;
size_t GetCount() const { return m_Map.size(); }
- CPDF_Object* GetObjectFor(const CFX_ByteString& key) const;
- CPDF_Object* GetDirectObjectFor(const CFX_ByteString& key) const;
- CFX_ByteString GetStringFor(const CFX_ByteString& key) const;
- CFX_ByteString GetStringFor(const CFX_ByteString& key,
- const CFX_ByteString& default_str) const;
- CFX_WideString GetUnicodeTextFor(const CFX_ByteString& key) const;
- int GetIntegerFor(const CFX_ByteString& key) const;
- int GetIntegerFor(const CFX_ByteString& key, int default_int) const;
- bool GetBooleanFor(const CFX_ByteString& key, bool bDefault = false) const;
- float GetNumberFor(const CFX_ByteString& key) const;
- CPDF_Dictionary* GetDictFor(const CFX_ByteString& key) const;
- CPDF_Stream* GetStreamFor(const CFX_ByteString& key) const;
- CPDF_Array* GetArrayFor(const CFX_ByteString& key) const;
- CFX_FloatRect GetRectFor(const CFX_ByteString& key) const;
- CFX_Matrix GetMatrixFor(const CFX_ByteString& key) const;
- float GetFloatFor(const CFX_ByteString& key) const {
- return GetNumberFor(key);
- }
-
- bool KeyExist(const CFX_ByteString& key) const;
+ CPDF_Object* GetObjectFor(const ByteString& key) const;
+ CPDF_Object* GetDirectObjectFor(const ByteString& key) const;
+ ByteString GetStringFor(const ByteString& key) const;
+ ByteString GetStringFor(const ByteString& key,
+ const ByteString& default_str) const;
+ WideString GetUnicodeTextFor(const ByteString& key) const;
+ int GetIntegerFor(const ByteString& key) const;
+ int GetIntegerFor(const ByteString& key, int default_int) const;
+ bool GetBooleanFor(const ByteString& key, bool bDefault = false) const;
+ float GetNumberFor(const ByteString& key) const;
+ CPDF_Dictionary* GetDictFor(const ByteString& key) const;
+ CPDF_Stream* GetStreamFor(const ByteString& key) const;
+ CPDF_Array* GetArrayFor(const ByteString& key) const;
+ CFX_FloatRect GetRectFor(const ByteString& key) const;
+ CFX_Matrix GetMatrixFor(const ByteString& key) const;
+ float GetFloatFor(const ByteString& key) const { return GetNumberFor(key); }
+
+ bool KeyExist(const ByteString& key) const;
bool IsSignatureDict() const;
// Set* functions invalidate iterators for the element with the key |key|.
// Takes ownership of |pObj|, returns an unowned pointer to it.
- CPDF_Object* SetFor(const CFX_ByteString& key,
- std::unique_ptr<CPDF_Object> pObj);
+ CPDF_Object* SetFor(const ByteString& key, std::unique_ptr<CPDF_Object> pObj);
// Creates a new object owned by the dictionary and returns an unowned
// pointer to it.
template <typename T, typename... Args>
typename std::enable_if<!CanInternStrings<T>::value, T*>::type SetNewFor(
- const CFX_ByteString& key,
+ const ByteString& key,
Args&&... args) {
return static_cast<T*>(
SetFor(key, pdfium::MakeUnique<T>(std::forward<Args>(args)...)));
}
template <typename T, typename... Args>
typename std::enable_if<CanInternStrings<T>::value, T*>::type SetNewFor(
- const CFX_ByteString& key,
+ const ByteString& key,
Args&&... args) {
return static_cast<T*>(SetFor(
key, pdfium::MakeUnique<T>(m_pPool, std::forward<Args>(args)...)));
}
// Convenience functions to convert native objects to array form.
- void SetRectFor(const CFX_ByteString& key, const CFX_FloatRect& rect);
- void SetMatrixFor(const CFX_ByteString& key, const CFX_Matrix& matrix);
+ void SetRectFor(const ByteString& key, const CFX_FloatRect& rect);
+ void SetMatrixFor(const ByteString& key, const CFX_Matrix& matrix);
- void ConvertToIndirectObjectFor(const CFX_ByteString& key,
+ void ConvertToIndirectObjectFor(const ByteString& key,
CPDF_IndirectObjectHolder* pHolder);
// Invalidates iterators for the element with the key |key|.
- std::unique_ptr<CPDF_Object> RemoveFor(const CFX_ByteString& key);
+ std::unique_ptr<CPDF_Object> RemoveFor(const ByteString& key);
// Invalidates iterators for the element with the key |oldkey|.
- void ReplaceKey(const CFX_ByteString& oldkey, const CFX_ByteString& newkey);
+ void ReplaceKey(const ByteString& oldkey, const ByteString& newkey);
const_iterator begin() const { return m_Map.begin(); }
const_iterator end() const { return m_Map.end(); }
- CFX_WeakPtr<CFX_ByteStringPool> GetByteStringPool() const { return m_pPool; }
+ CFX_WeakPtr<ByteStringPool> GetByteStringPool() const { return m_pPool; }
protected:
- CFX_ByteString MaybeIntern(const CFX_ByteString& str);
+ ByteString MaybeIntern(const ByteString& str);
std::unique_ptr<CPDF_Object> CloneNonCyclic(
bool bDirect,
std::set<const CPDF_Object*>* visited) const override;
- CFX_WeakPtr<CFX_ByteStringPool> m_pPool;
- std::map<CFX_ByteString, std::unique_ptr<CPDF_Object>> m_Map;
+ CFX_WeakPtr<ByteStringPool> m_pPool;
+ std::map<ByteString, std::unique_ptr<CPDF_Object>> m_Map;
};
inline CPDF_Dictionary* ToDictionary(CPDF_Object* obj) {
diff --git a/core/fpdfapi/parser/cpdf_document.cpp b/core/fpdfapi/parser/cpdf_document.cpp
index 47155176ae..f47551f82b 100644
--- a/core/fpdfapi/parser/cpdf_document.cpp
+++ b/core/fpdfapi/parser/cpdf_document.cpp
@@ -217,8 +217,8 @@ void InsertWidthArray(HDC hDC, int start, int end, CPDF_Array* pWidthArray) {
InsertWidthArrayImpl(widths, size, pWidthArray);
}
-CFX_ByteString FPDF_GetPSNameFromTT(HDC hDC) {
- CFX_ByteString result;
+ByteString FPDF_GetPSNameFromTT(HDC hDC) {
+ ByteString result;
DWORD size = ::GetFontData(hDC, 'eman', 0, nullptr, 0);
if (size != GDI_ERROR) {
LPBYTE buffer = FX_Alloc(BYTE, size);
@@ -299,7 +299,7 @@ int CalculateFlags(bool bold,
void ProcessNonbCJK(CPDF_Dictionary* pBaseDict,
bool bold,
bool italic,
- CFX_ByteString basefont,
+ ByteString basefont,
std::unique_ptr<CPDF_Array> pWidths) {
if (bold && italic)
basefont += ",BoldItalic";
@@ -316,7 +316,7 @@ void ProcessNonbCJK(CPDF_Dictionary* pBaseDict,
std::unique_ptr<CPDF_Dictionary> CalculateFontDesc(
CPDF_Document* pDoc,
- CFX_ByteString basefont,
+ ByteString basefont,
int flags,
int italicangle,
int ascend,
@@ -769,7 +769,7 @@ void CPDF_Document::DeletePage(int iPage) {
CPDF_Font* CPDF_Document::AddStandardFont(const char* font,
CPDF_FontEncoding* pEncoding) {
- CFX_ByteString name(font);
+ ByteString name(font);
if (PDF_GetStandardFontName(&name) < 0)
return nullptr;
return GetPageData()->GetStandardFont(name, pEncoding);
@@ -793,7 +793,7 @@ size_t CPDF_Document::CalculateEncodingDict(int charset,
const uint16_t* pUnicodes = g_FX_CharsetUnicodes[i].m_pUnicodes;
for (int j = 0; j < 128; j++) {
- CFX_ByteString name = PDF_AdobeNameFromUnicode(pUnicodes[j]);
+ ByteString name = PDF_AdobeNameFromUnicode(pUnicodes[j]);
pArray->AddNew<CPDF_Name>(name.IsEmpty() ? ".notdef" : name);
}
pBaseDict->SetNewFor<CPDF_Reference>("Encoding", this,
@@ -805,11 +805,11 @@ CPDF_Dictionary* CPDF_Document::ProcessbCJK(
CPDF_Dictionary* pBaseDict,
int charset,
bool bVert,
- CFX_ByteString basefont,
+ ByteString basefont,
std::function<void(wchar_t, wchar_t, CPDF_Array*)> Insert) {
CPDF_Dictionary* pFontDict = NewIndirect<CPDF_Dictionary>();
- CFX_ByteString cmap;
- CFX_ByteString ordering;
+ ByteString cmap;
+ ByteString ordering;
int supplement = 0;
CPDF_Array* pWidthArray = pFontDict->SetNewFor<CPDF_Array>("W");
switch (charset) {
@@ -875,7 +875,7 @@ CPDF_Font* CPDF_Document::AddFont(CFX_Font* pFont, int charset, bool bVert) {
bool bCJK = charset == FX_CHARSET_ChineseTraditional ||
charset == FX_CHARSET_ChineseSimplified ||
charset == FX_CHARSET_Hangul || charset == FX_CHARSET_ShiftJIS;
- CFX_ByteString basefont = pFont->GetFamilyName();
+ ByteString basefont = pFont->GetFamilyName();
basefont.Replace(" ", "");
int flags =
CalculateFlags(pFont->IsBold(), pFont->IsItalic(), pFont->IsFixedWidth(),
@@ -958,12 +958,12 @@ CPDF_Font* CPDF_Document::AddWindowsFont(LOGFONTW* pLogFont,
bool bTranslateName) {
LOGFONTA lfa;
memcpy(&lfa, pLogFont, (char*)lfa.lfFaceName - (char*)&lfa);
- CFX_ByteString face = CFX_ByteString::FromUnicode(pLogFont->lfFaceName);
+ ByteString face = ByteString::FromUnicode(pLogFont->lfFaceName);
if (face.GetLength() >= LF_FACESIZE)
return nullptr;
strncpy(lfa.lfFaceName, face.c_str(),
- (face.GetLength() + 1) * sizeof(CFX_ByteString::CharType));
+ (face.GetLength() + 1) * sizeof(ByteString::CharType));
return AddWindowsFont(&lfa, bVert, bTranslateName);
}
@@ -996,7 +996,7 @@ CPDF_Font* CPDF_Document::AddWindowsFont(LOGFONTA* pLogFont,
pLogFont->lfCharSet == FX_CHARSET_ChineseSimplified ||
pLogFont->lfCharSet == FX_CHARSET_Hangul ||
pLogFont->lfCharSet == FX_CHARSET_ShiftJIS;
- CFX_ByteString basefont;
+ ByteString basefont;
if (bTranslateName && bCJK)
basefont = FPDF_GetPSNameFromTT(hDC);
diff --git a/core/fpdfapi/parser/cpdf_document.h b/core/fpdfapi/parser/cpdf_document.h
index cc5076379e..ff80fa85c3 100644
--- a/core/fpdfapi/parser/cpdf_document.h
+++ b/core/fpdfapi/parser/cpdf_document.h
@@ -122,7 +122,7 @@ class CPDF_Document : public CPDF_IndirectObjectHolder {
CPDF_Dictionary* pBaseDict,
int charset,
bool bVert,
- CFX_ByteString basefont,
+ ByteString basefont,
std::function<void(wchar_t, wchar_t, CPDF_Array*)> Insert);
bool InsertDeletePDFPage(CPDF_Dictionary* pPages,
int nPagesToGo,
diff --git a/core/fpdfapi/parser/cpdf_indirect_object_holder.cpp b/core/fpdfapi/parser/cpdf_indirect_object_holder.cpp
index 434470abeb..2a57411368 100644
--- a/core/fpdfapi/parser/cpdf_indirect_object_holder.cpp
+++ b/core/fpdfapi/parser/cpdf_indirect_object_holder.cpp
@@ -23,7 +23,7 @@ CPDF_Object* FilterInvalidObjNum(CPDF_Object* obj) {
CPDF_IndirectObjectHolder::CPDF_IndirectObjectHolder()
: m_LastObjNum(0),
- m_pByteStringPool(pdfium::MakeUnique<CFX_ByteStringPool>()) {}
+ m_pByteStringPool(pdfium::MakeUnique<ByteStringPool>()) {}
CPDF_IndirectObjectHolder::~CPDF_IndirectObjectHolder() {
m_pByteStringPool.DeleteObject(); // Make weak.
diff --git a/core/fpdfapi/parser/cpdf_indirect_object_holder.h b/core/fpdfapi/parser/cpdf_indirect_object_holder.h
index b82377e5b7..ab99dd5fcc 100644
--- a/core/fpdfapi/parser/cpdf_indirect_object_holder.h
+++ b/core/fpdfapi/parser/cpdf_indirect_object_holder.h
@@ -58,7 +58,7 @@ class CPDF_IndirectObjectHolder {
uint32_t GetLastObjNum() const { return m_LastObjNum; }
void SetLastObjNum(uint32_t objnum) { m_LastObjNum = objnum; }
- CFX_WeakPtr<CFX_ByteStringPool> GetByteStringPool() const {
+ CFX_WeakPtr<ByteStringPool> GetByteStringPool() const {
return m_pByteStringPool;
}
@@ -72,7 +72,7 @@ class CPDF_IndirectObjectHolder {
uint32_t m_LastObjNum;
std::map<uint32_t, std::unique_ptr<CPDF_Object>> m_IndirectObjs;
std::vector<std::unique_ptr<CPDF_Object>> m_OrphanObjs;
- CFX_WeakPtr<CFX_ByteStringPool> m_pByteStringPool;
+ CFX_WeakPtr<ByteStringPool> m_pByteStringPool;
};
#endif // CORE_FPDFAPI_PARSER_CPDF_INDIRECT_OBJECT_HOLDER_H_
diff --git a/core/fpdfapi/parser/cpdf_name.cpp b/core/fpdfapi/parser/cpdf_name.cpp
index ae33bc7fa0..0dd9890702 100644
--- a/core/fpdfapi/parser/cpdf_name.cpp
+++ b/core/fpdfapi/parser/cpdf_name.cpp
@@ -10,8 +10,7 @@
#include "core/fxcrt/fx_stream.h"
#include "third_party/base/ptr_util.h"
-CPDF_Name::CPDF_Name(CFX_WeakPtr<CFX_ByteStringPool> pPool,
- const CFX_ByteString& str)
+CPDF_Name::CPDF_Name(CFX_WeakPtr<ByteStringPool> pPool, const ByteString& str)
: m_Name(str) {
if (pPool)
m_Name = pPool->Intern(m_Name);
@@ -27,11 +26,11 @@ std::unique_ptr<CPDF_Object> CPDF_Name::Clone() const {
return pdfium::MakeUnique<CPDF_Name>(nullptr, m_Name);
}
-CFX_ByteString CPDF_Name::GetString() const {
+ByteString CPDF_Name::GetString() const {
return m_Name;
}
-void CPDF_Name::SetString(const CFX_ByteString& str) {
+void CPDF_Name::SetString(const ByteString& str) {
m_Name = str;
}
@@ -47,11 +46,11 @@ const CPDF_Name* CPDF_Name::AsName() const {
return this;
}
-CFX_WideString CPDF_Name::GetUnicodeText() const {
+WideString CPDF_Name::GetUnicodeText() const {
return PDF_DecodeText(m_Name);
}
bool CPDF_Name::WriteTo(IFX_ArchiveStream* archive) const {
return archive->WriteString("/") &&
- archive->WriteString(PDF_NameEncode(GetString()).AsStringC());
+ archive->WriteString(PDF_NameEncode(GetString()).AsStringView());
}
diff --git a/core/fpdfapi/parser/cpdf_name.h b/core/fpdfapi/parser/cpdf_name.h
index 616f35f9bc..72a72a3a66 100644
--- a/core/fpdfapi/parser/cpdf_name.h
+++ b/core/fpdfapi/parser/cpdf_name.h
@@ -15,22 +15,22 @@
class CPDF_Name : public CPDF_Object {
public:
- CPDF_Name(CFX_WeakPtr<CFX_ByteStringPool> pPool, const CFX_ByteString& str);
+ CPDF_Name(CFX_WeakPtr<ByteStringPool> pPool, const ByteString& str);
~CPDF_Name() override;
// CPDF_Object:
Type GetType() const override;
std::unique_ptr<CPDF_Object> Clone() const override;
- CFX_ByteString GetString() const override;
- CFX_WideString GetUnicodeText() const override;
- void SetString(const CFX_ByteString& str) override;
+ ByteString GetString() const override;
+ WideString GetUnicodeText() const override;
+ void SetString(const ByteString& str) override;
bool IsName() const override;
CPDF_Name* AsName() override;
const CPDF_Name* AsName() const override;
bool WriteTo(IFX_ArchiveStream* archive) const override;
protected:
- CFX_ByteString m_Name;
+ ByteString m_Name;
};
inline CPDF_Name* ToName(CPDF_Object* obj) {
diff --git a/core/fpdfapi/parser/cpdf_number.cpp b/core/fpdfapi/parser/cpdf_number.cpp
index 9afe30adca..dac1f40b7f 100644
--- a/core/fpdfapi/parser/cpdf_number.cpp
+++ b/core/fpdfapi/parser/cpdf_number.cpp
@@ -14,7 +14,7 @@ CPDF_Number::CPDF_Number(int value) : m_bInteger(true), m_Integer(value) {}
CPDF_Number::CPDF_Number(float value) : m_bInteger(false), m_Float(value) {}
-CPDF_Number::CPDF_Number(const CFX_ByteStringC& str)
+CPDF_Number::CPDF_Number(const ByteStringView& str)
: m_bInteger(FX_atonum(str, &m_Integer)) {}
CPDF_Number::~CPDF_Number() {}
@@ -48,16 +48,16 @@ const CPDF_Number* CPDF_Number::AsNumber() const {
return this;
}
-void CPDF_Number::SetString(const CFX_ByteString& str) {
- m_bInteger = FX_atonum(str.AsStringC(), &m_Integer);
+void CPDF_Number::SetString(const ByteString& str) {
+ m_bInteger = FX_atonum(str.AsStringView(), &m_Integer);
}
-CFX_ByteString CPDF_Number::GetString() const {
- return m_bInteger ? CFX_ByteString::FormatInteger(m_Integer)
- : CFX_ByteString::FormatFloat(m_Float);
+ByteString CPDF_Number::GetString() const {
+ return m_bInteger ? ByteString::FormatInteger(m_Integer)
+ : ByteString::FormatFloat(m_Float);
}
bool CPDF_Number::WriteTo(IFX_ArchiveStream* archive) const {
return archive->WriteString(" ") &&
- archive->WriteString(GetString().AsStringC());
+ archive->WriteString(GetString().AsStringView());
}
diff --git a/core/fpdfapi/parser/cpdf_number.h b/core/fpdfapi/parser/cpdf_number.h
index 57f82274cb..661177363b 100644
--- a/core/fpdfapi/parser/cpdf_number.h
+++ b/core/fpdfapi/parser/cpdf_number.h
@@ -18,16 +18,16 @@ class CPDF_Number : public CPDF_Object {
CPDF_Number();
explicit CPDF_Number(int value);
explicit CPDF_Number(float value);
- explicit CPDF_Number(const CFX_ByteStringC& str);
+ explicit CPDF_Number(const ByteStringView& str);
~CPDF_Number() override;
// CPDF_Object:
Type GetType() const override;
std::unique_ptr<CPDF_Object> Clone() const override;
- CFX_ByteString GetString() const override;
+ ByteString GetString() const override;
float GetNumber() const override;
int GetInteger() const override;
- void SetString(const CFX_ByteString& str) override;
+ void SetString(const ByteString& str) override;
bool IsNumber() const override;
CPDF_Number* AsNumber() override;
const CPDF_Number* AsNumber() const override;
diff --git a/core/fpdfapi/parser/cpdf_object.cpp b/core/fpdfapi/parser/cpdf_object.cpp
index b35c6e5b6f..67632a040c 100644
--- a/core/fpdfapi/parser/cpdf_object.cpp
+++ b/core/fpdfapi/parser/cpdf_object.cpp
@@ -39,12 +39,12 @@ std::unique_ptr<CPDF_Object> CPDF_Object::CloneNonCyclic(
return Clone();
}
-CFX_ByteString CPDF_Object::GetString() const {
- return CFX_ByteString();
+ByteString CPDF_Object::GetString() const {
+ return ByteString();
}
-CFX_WideString CPDF_Object::GetUnicodeText() const {
- return CFX_WideString();
+WideString CPDF_Object::GetUnicodeText() const {
+ return WideString();
}
float CPDF_Object::GetNumber() const {
@@ -59,7 +59,7 @@ CPDF_Dictionary* CPDF_Object::GetDict() const {
return nullptr;
}
-void CPDF_Object::SetString(const CFX_ByteString& str) {
+void CPDF_Object::SetString(const ByteString& str) {
NOTREACHED();
}
diff --git a/core/fpdfapi/parser/cpdf_object.h b/core/fpdfapi/parser/cpdf_object.h
index a07ba677e8..4d4279f98a 100644
--- a/core/fpdfapi/parser/cpdf_object.h
+++ b/core/fpdfapi/parser/cpdf_object.h
@@ -55,13 +55,13 @@ class CPDF_Object {
virtual std::unique_ptr<CPDF_Object> CloneDirectObject() const;
virtual CPDF_Object* GetDirect() const;
- virtual CFX_ByteString GetString() const;
- virtual CFX_WideString GetUnicodeText() const;
+ virtual ByteString GetString() const;
+ virtual WideString GetUnicodeText() const;
virtual float GetNumber() const;
virtual int GetInteger() const;
virtual CPDF_Dictionary* GetDict() const;
- virtual void SetString(const CFX_ByteString& str);
+ virtual void SetString(const ByteString& str);
virtual bool IsArray() const;
virtual bool IsBoolean() const;
diff --git a/core/fpdfapi/parser/cpdf_object_walker.cpp b/core/fpdfapi/parser/cpdf_object_walker.cpp
index c6e0f0091d..cb59a05d06 100644
--- a/core/fpdfapi/parser/cpdf_object_walker.cpp
+++ b/core/fpdfapi/parser/cpdf_object_walker.cpp
@@ -57,11 +57,11 @@ class DictionaryIterator : public CPDF_ObjectWalker::SubobjectIterator {
dict_iterator_ = object()->GetDict()->begin();
}
- const CFX_ByteString& dict_key() const { return dict_key_; }
+ const ByteString& dict_key() const { return dict_key_; }
private:
CPDF_Dictionary::const_iterator dict_iterator_;
- CFX_ByteString dict_key_;
+ ByteString dict_key_;
};
class ArrayIterator : public CPDF_ObjectWalker::SubobjectIterator {
@@ -149,11 +149,11 @@ const CPDF_Object* CPDF_ObjectWalker::GetNext() {
parent_object_ = it->object();
dict_key_ = parent_object_->IsDictionary()
? static_cast<DictionaryIterator*>(it)->dict_key()
- : CFX_ByteString();
+ : ByteString();
current_depth_ = stack_.size();
}
}
- dict_key_ = CFX_ByteString();
+ dict_key_ = ByteString();
current_depth_ = 0;
return nullptr;
}
diff --git a/core/fpdfapi/parser/cpdf_object_walker.h b/core/fpdfapi/parser/cpdf_object_walker.h
index 5590440f8f..8cad3c32f3 100644
--- a/core/fpdfapi/parser/cpdf_object_walker.h
+++ b/core/fpdfapi/parser/cpdf_object_walker.h
@@ -41,7 +41,7 @@ class CPDF_ObjectWalker {
size_t current_depth() const { return current_depth_; }
const CPDF_Object* GetParent() const { return parent_object_; }
- const CFX_ByteString& dictionary_key() const { return dict_key_; }
+ const ByteString& dictionary_key() const { return dict_key_; }
private:
static std::unique_ptr<SubobjectIterator> MakeIterator(
@@ -50,7 +50,7 @@ class CPDF_ObjectWalker {
const CPDF_Object* next_object_;
const CPDF_Object* parent_object_;
- CFX_ByteString dict_key_;
+ ByteString dict_key_;
size_t current_depth_;
std::stack<std::unique_ptr<SubobjectIterator>> stack_;
diff --git a/core/fpdfapi/parser/cpdf_parser.cpp b/core/fpdfapi/parser/cpdf_parser.cpp
index a9cad02f5e..b0a8126a3d 100644
--- a/core/fpdfapi/parser/cpdf_parser.cpp
+++ b/core/fpdfapi/parser/cpdf_parser.cpp
@@ -239,7 +239,7 @@ CPDF_Parser::Error CPDF_Parser::StartParseInternal(CPDF_Document* pDocument) {
m_pSyntax->GetKeyword();
bool bNumber;
- CFX_ByteString xrefpos_str = m_pSyntax->GetNextWord(&bNumber);
+ ByteString xrefpos_str = m_pSyntax->GetNextWord(&bNumber);
if (!bNumber)
return FORMAT_ERROR;
@@ -314,7 +314,7 @@ CPDF_Parser::Error CPDF_Parser::SetEncryptHandler() {
}
if (m_pEncryptDict) {
- CFX_ByteString filter = m_pEncryptDict->GetStringFor("Filter");
+ ByteString filter = m_pEncryptDict->GetStringFor("Filter");
if (filter != "Standard")
return HANDLER_ERROR;
@@ -364,7 +364,7 @@ bool CPDF_Parser::VerifyCrossRefV4() {
FX_FILESIZE SavedPos = m_pSyntax->GetPos();
m_pSyntax->SetPos(it.second.pos);
bool is_num = false;
- CFX_ByteString num_str = m_pSyntax->GetNextWord(&is_num);
+ ByteString num_str = m_pSyntax->GetNextWord(&is_num);
m_pSyntax->SetPos(SavedPos);
if (!is_num || num_str.IsEmpty() ||
FXSYS_atoui(num_str.c_str()) != it.first) {
@@ -593,7 +593,7 @@ bool CPDF_Parser::ParseCrossRefV4(std::vector<CrossRefObjData>* out_objects) {
while (1) {
FX_FILESIZE SavedPos = m_pSyntax->GetPos();
bool bIsNumber;
- CFX_ByteString word = m_pSyntax->GetNextWord(&bIsNumber);
+ ByteString word = m_pSyntax->GetNextWord(&bIsNumber);
if (word.IsEmpty()) {
return false;
}
@@ -884,7 +884,7 @@ bool CPDF_Parser::RebuildCrossRef() {
m_ObjectInfo[pRef->GetRefObjNum()].pos != 0)) {
auto it = pTrailer->begin();
while (it != pTrailer->end()) {
- const CFX_ByteString& key = it->first;
+ const ByteString& key = it->first;
CPDF_Object* pElement = it->second.get();
++it;
uint32_t dwObjNum =
@@ -903,11 +903,10 @@ bool CPDF_Parser::RebuildCrossRef() {
: std::move(pObj)));
FX_FILESIZE dwSavePos = m_pSyntax->GetPos();
- CFX_ByteString strWord = m_pSyntax->GetKeyword();
+ ByteString strWord = m_pSyntax->GetKeyword();
if (!strWord.Compare("startxref")) {
bool bNumber;
- CFX_ByteString bsOffset =
- m_pSyntax->GetNextWord(&bNumber);
+ ByteString bsOffset = m_pSyntax->GetNextWord(&bNumber);
if (bNumber)
m_LastXRefOffset = FXSYS_atoi(bsOffset.c_str());
}
@@ -1316,7 +1315,7 @@ bool CPDF_Parser::ParseLinearizedHeader() {
FX_FILESIZE SavedPos = m_pSyntax->GetPos();
bool bIsNumber;
- CFX_ByteString word = m_pSyntax->GetNextWord(&bIsNumber);
+ ByteString word = m_pSyntax->GetNextWord(&bIsNumber);
if (!bIsNumber)
return false;
diff --git a/core/fpdfapi/parser/cpdf_parser.h b/core/fpdfapi/parser/cpdf_parser.h
index b4d0bee329..20bd6be9b4 100644
--- a/core/fpdfapi/parser/cpdf_parser.h
+++ b/core/fpdfapi/parser/cpdf_parser.h
@@ -63,7 +63,7 @@ class CPDF_Parser {
CPDF_Document* pDocument);
void SetPassword(const char* password) { m_Password = password; }
- CFX_ByteString GetPassword() { return m_Password; }
+ ByteString GetPassword() { return m_Password; }
CPDF_Dictionary* GetTrailer() const;
FX_FILESIZE GetLastXRefOffset() const { return m_LastXRefOffset; }
@@ -199,7 +199,7 @@ class CPDF_Parser {
CFX_UnownedPtr<CPDF_Dictionary> m_pEncryptDict;
FX_FILESIZE m_LastXRefOffset;
std::unique_ptr<CPDF_SecurityHandler> m_pSecurityHandler;
- CFX_ByteString m_Password;
+ ByteString m_Password;
std::unique_ptr<TrailerData> m_TrailerData;
std::unique_ptr<CPDF_LinearizedHeader> m_pLinearized;
uint32_t m_dwLinearizedFirstPageXRefStartObjNum;
diff --git a/core/fpdfapi/parser/cpdf_reference.cpp b/core/fpdfapi/parser/cpdf_reference.cpp
index ce4c308d8c..2ca0bddc4f 100644
--- a/core/fpdfapi/parser/cpdf_reference.cpp
+++ b/core/fpdfapi/parser/cpdf_reference.cpp
@@ -20,9 +20,9 @@ CPDF_Object::Type CPDF_Reference::GetType() const {
return REFERENCE;
}
-CFX_ByteString CPDF_Reference::GetString() const {
+ByteString CPDF_Reference::GetString() const {
CPDF_Object* obj = SafeGetDirect();
- return obj ? obj->GetString() : CFX_ByteString();
+ return obj ? obj->GetString() : ByteString();
}
float CPDF_Reference::GetNumber() const {
diff --git a/core/fpdfapi/parser/cpdf_reference.h b/core/fpdfapi/parser/cpdf_reference.h
index ab160302fe..f564ab5b9b 100644
--- a/core/fpdfapi/parser/cpdf_reference.h
+++ b/core/fpdfapi/parser/cpdf_reference.h
@@ -24,7 +24,7 @@ class CPDF_Reference : public CPDF_Object {
Type GetType() const override;
std::unique_ptr<CPDF_Object> Clone() const override;
CPDF_Object* GetDirect() const override;
- CFX_ByteString GetString() const override;
+ ByteString GetString() const override;
float GetNumber() const override;
int GetInteger() const override;
CPDF_Dictionary* GetDict() const override;
diff --git a/core/fpdfapi/parser/cpdf_security_handler.cpp b/core/fpdfapi/parser/cpdf_security_handler.cpp
index 03b90abf4a..b838e9cf05 100644
--- a/core/fpdfapi/parser/cpdf_security_handler.cpp
+++ b/core/fpdfapi/parser/cpdf_security_handler.cpp
@@ -42,12 +42,12 @@ void CalcEncryptKey(CPDF_Dictionary* pEncrypt,
CRYPT_md5_context md5;
CRYPT_MD5Start(&md5);
CRYPT_MD5Update(&md5, passcode, 32);
- CFX_ByteString okey = pEncrypt->GetStringFor("O");
+ ByteString okey = pEncrypt->GetStringFor("O");
CRYPT_MD5Update(&md5, (uint8_t*)okey.c_str(), okey.GetLength());
uint32_t perm = pEncrypt->GetIntegerFor("P");
CRYPT_MD5Update(&md5, (uint8_t*)&perm, 4);
if (pIdArray) {
- CFX_ByteString id = pIdArray->GetStringAt(0);
+ ByteString id = pIdArray->GetStringAt(0);
CRYPT_MD5Update(&md5, (uint8_t*)id.c_str(), id.GetLength());
}
if (!bIgnoreMeta && revision >= 3 &&
@@ -97,7 +97,7 @@ bool CPDF_SecurityHandler::OnInit(CPDF_Parser* pParser,
}
bool CPDF_SecurityHandler::CheckSecurity(int32_t key_len) {
- CFX_ByteString password = m_pParser->GetPassword();
+ ByteString password = m_pParser->GetPassword();
if (!password.IsEmpty() &&
CheckPassword(password.raw_str(), password.GetLength(), true,
m_EncryptKey, key_len)) {
@@ -113,7 +113,7 @@ uint32_t CPDF_SecurityHandler::GetPermissions() {
}
static bool LoadCryptInfo(CPDF_Dictionary* pEncryptDict,
- const CFX_ByteString& name,
+ const ByteString& name,
int& cipher,
int& keylen) {
int Version = pEncryptDict->GetIntegerFor("V");
@@ -144,7 +144,7 @@ static bool LoadCryptInfo(CPDF_Dictionary* pEncryptDict,
nKeyBits *= 8;
}
keylen = nKeyBits / 8;
- CFX_ByteString cipher_name = pDefFilter->GetStringFor("CFM");
+ ByteString cipher_name = pDefFilter->GetStringFor("CFM");
if (cipher_name == "AESV2" || cipher_name == "AESV3") {
cipher = FXCIPHER_AES;
}
@@ -164,10 +164,10 @@ bool CPDF_SecurityHandler::LoadDict(CPDF_Dictionary* pEncryptDict) {
m_Revision = pEncryptDict->GetIntegerFor("R");
m_Permissions = pEncryptDict->GetIntegerFor("P", -1);
if (m_Version < 4)
- return LoadCryptInfo(pEncryptDict, CFX_ByteString(), m_Cipher, m_KeyLen);
+ return LoadCryptInfo(pEncryptDict, ByteString(), m_Cipher, m_KeyLen);
- CFX_ByteString stmf_name = pEncryptDict->GetStringFor("StmF");
- CFX_ByteString strf_name = pEncryptDict->GetStringFor("StrF");
+ ByteString stmf_name = pEncryptDict->GetStringFor("StmF");
+ ByteString strf_name = pEncryptDict->GetStringFor("StrF");
if (stmf_name != strf_name)
return false;
@@ -183,8 +183,8 @@ bool CPDF_SecurityHandler::LoadDict(CPDF_Dictionary* pEncryptDict,
m_Revision = pEncryptDict->GetIntegerFor("R");
m_Permissions = pEncryptDict->GetIntegerFor("P", -1);
- CFX_ByteString strf_name;
- CFX_ByteString stmf_name;
+ ByteString strf_name;
+ ByteString stmf_name;
if (m_Version >= 4) {
stmf_name = pEncryptDict->GetStringFor("StmF");
strf_name = pEncryptDict->GetStringFor("StrF");
@@ -310,11 +310,11 @@ bool CPDF_SecurityHandler::AES256_CheckPassword(const uint8_t* password,
if (!m_pEncryptDict)
return false;
- CFX_ByteString okey = m_pEncryptDict->GetStringFor("O");
+ ByteString okey = m_pEncryptDict->GetStringFor("O");
if (okey.GetLength() < 48)
return false;
- CFX_ByteString ukey = m_pEncryptDict->GetStringFor("U");
+ ByteString ukey = m_pEncryptDict->GetStringFor("U");
if (ukey.GetLength() < 48)
return false;
@@ -351,9 +351,9 @@ bool CPDF_SecurityHandler::AES256_CheckPassword(const uint8_t* password,
CRYPT_SHA256Finish(&sha, digest);
}
- CFX_ByteString ekey = m_pEncryptDict
- ? m_pEncryptDict->GetStringFor(bOwner ? "OE" : "UE")
- : CFX_ByteString();
+ ByteString ekey = m_pEncryptDict
+ ? m_pEncryptDict->GetStringFor(bOwner ? "OE" : "UE")
+ : ByteString();
if (ekey.GetLength() < 32)
return false;
@@ -366,7 +366,7 @@ bool CPDF_SecurityHandler::AES256_CheckPassword(const uint8_t* password,
CRYPT_AESDecrypt(&aes, key, ekey.raw_str(), 32);
CRYPT_AESSetKey(&aes, 16, key, 32, false);
CRYPT_AESSetIV(&aes, iv);
- CFX_ByteString perms = m_pEncryptDict->GetStringFor("Perms");
+ ByteString perms = m_pEncryptDict->GetStringFor("Perms");
if (perms.IsEmpty())
return false;
@@ -415,8 +415,8 @@ bool CPDF_SecurityHandler::CheckUserPassword(const uint8_t* password,
int32_t key_len) {
CalcEncryptKey(m_pEncryptDict.Get(), password, pass_size, key, key_len,
bIgnoreEncryptMeta, m_pParser->GetIDArray());
- CFX_ByteString ukey =
- m_pEncryptDict ? m_pEncryptDict->GetStringFor("U") : CFX_ByteString();
+ ByteString ukey =
+ m_pEncryptDict ? m_pEncryptDict->GetStringFor("U") : ByteString();
if (ukey.GetLength() < 16) {
return false;
}
@@ -443,7 +443,7 @@ bool CPDF_SecurityHandler::CheckUserPassword(const uint8_t* password,
CRYPT_MD5Update(&md5, defpasscode, 32);
CPDF_Array* pIdArray = m_pParser->GetIDArray();
if (pIdArray) {
- CFX_ByteString id = pIdArray->GetStringAt(0);
+ ByteString id = pIdArray->GetStringAt(0);
CRYPT_MD5Update(&md5, (uint8_t*)id.c_str(), id.GetLength());
}
CRYPT_MD5Finish(&md5, ukeybuf);
@@ -452,10 +452,10 @@ bool CPDF_SecurityHandler::CheckUserPassword(const uint8_t* password,
return memcmp(ukey.c_str(), ukeybuf, 16) == 0;
}
-CFX_ByteString CPDF_SecurityHandler::GetUserPassword(const uint8_t* owner_pass,
- uint32_t pass_size,
- int32_t key_len) {
- CFX_ByteString okey = m_pEncryptDict->GetStringFor("O");
+ByteString CPDF_SecurityHandler::GetUserPassword(const uint8_t* owner_pass,
+ uint32_t pass_size,
+ int32_t key_len) {
+ ByteString okey = m_pEncryptDict->GetStringFor("O");
uint8_t passcode[32];
for (uint32_t i = 0; i < 32; i++) {
passcode[i] = i < pass_size ? owner_pass[i] : defpasscode[i - pass_size];
@@ -496,13 +496,13 @@ CFX_ByteString CPDF_SecurityHandler::GetUserPassword(const uint8_t* owner_pass,
while (len && defpasscode[len - 1] == okeybuf[len - 1]) {
len--;
}
- return CFX_ByteString(okeybuf, len);
+ return ByteString(okeybuf, len);
}
bool CPDF_SecurityHandler::CheckOwnerPassword(const uint8_t* password,
uint32_t pass_size,
uint8_t* key,
int32_t key_len) {
- CFX_ByteString user_pass = GetUserPassword(password, pass_size, key_len);
+ ByteString user_pass = GetUserPassword(password, pass_size, key_len);
if (CheckUserPassword(user_pass.raw_str(), user_pass.GetLength(), false, key,
key_len)) {
return true;
@@ -575,8 +575,7 @@ void CPDF_SecurityHandler::OnCreate(CPDF_Dictionary* pEncryptDict,
CRYPT_ArcFourCryptBlock(passcode, 32, tempkey, key_len);
}
}
- pEncryptDict->SetNewFor<CPDF_String>("O", CFX_ByteString(passcode, 32),
- false);
+ pEncryptDict->SetNewFor<CPDF_String>("O", ByteString(passcode, 32), false);
}
CalcEncryptKey(m_pEncryptDict.Get(), (uint8_t*)user_pass, user_size,
m_EncryptKey, key_len, false, pIdArray);
@@ -584,14 +583,13 @@ void CPDF_SecurityHandler::OnCreate(CPDF_Dictionary* pEncryptDict,
uint8_t tempbuf[32];
memcpy(tempbuf, defpasscode, 32);
CRYPT_ArcFourCryptBlock(tempbuf, 32, m_EncryptKey, key_len);
- pEncryptDict->SetNewFor<CPDF_String>("U", CFX_ByteString(tempbuf, 32),
- false);
+ pEncryptDict->SetNewFor<CPDF_String>("U", ByteString(tempbuf, 32), false);
} else {
CRYPT_md5_context md5;
CRYPT_MD5Start(&md5);
CRYPT_MD5Update(&md5, defpasscode, 32);
if (pIdArray) {
- CFX_ByteString id = pIdArray->GetStringAt(0);
+ ByteString id = pIdArray->GetStringAt(0);
CRYPT_MD5Update(&md5, (uint8_t*)id.c_str(), id.GetLength());
}
uint8_t digest[32];
@@ -605,8 +603,7 @@ void CPDF_SecurityHandler::OnCreate(CPDF_Dictionary* pEncryptDict,
CRYPT_ArcFourCryptBlock(digest, 16, tempkey, key_len);
}
CRYPT_MD5Generate(digest, 16, digest + 16);
- pEncryptDict->SetNewFor<CPDF_String>("U", CFX_ByteString(digest, 32),
- false);
+ pEncryptDict->SetNewFor<CPDF_String>("U", ByteString(digest, 32), false);
}
}
void CPDF_SecurityHandler::OnCreate(CPDF_Dictionary* pEncryptDict,
@@ -640,7 +637,7 @@ void CPDF_SecurityHandler::AES256_SetPassword(CPDF_Dictionary* pEncryptDict,
uint8_t digest[20];
CRYPT_SHA1Finish(&sha, digest);
- CFX_ByteString ukey = pEncryptDict->GetStringFor("U");
+ ByteString ukey = pEncryptDict->GetStringFor("U");
CRYPT_sha2_context sha2;
uint8_t digest1[48];
if (m_Revision >= 6) {
@@ -657,7 +654,7 @@ void CPDF_SecurityHandler::AES256_SetPassword(CPDF_Dictionary* pEncryptDict,
}
memcpy(digest1 + 32, digest, 16);
pEncryptDict->SetNewFor<CPDF_String>(bOwner ? "O" : "U",
- CFX_ByteString(digest1, 48), false);
+ ByteString(digest1, 48), false);
if (m_Revision >= 6) {
Revision6_Hash(password, size, digest + 8,
bOwner ? ukey.raw_str() : nullptr, digest1);
@@ -678,7 +675,7 @@ void CPDF_SecurityHandler::AES256_SetPassword(CPDF_Dictionary* pEncryptDict,
CRYPT_AESSetIV(&aes, iv);
CRYPT_AESEncrypt(&aes, digest1, key, 32);
pEncryptDict->SetNewFor<CPDF_String>(bOwner ? "OE" : "UE",
- CFX_ByteString(digest1, 32), false);
+ ByteString(digest1, 32), false);
}
void CPDF_SecurityHandler::AES256_SetPerms(CPDF_Dictionary* pEncryptDict,
@@ -709,6 +706,5 @@ void CPDF_SecurityHandler::AES256_SetPerms(CPDF_Dictionary* pEncryptDict,
uint8_t buf1[16];
CRYPT_AESEncrypt(&aes, buf1, buf, 16);
- pEncryptDict->SetNewFor<CPDF_String>("Perms", CFX_ByteString(buf1, 16),
- false);
+ pEncryptDict->SetNewFor<CPDF_String>("Perms", ByteString(buf1, 16), false);
}
diff --git a/core/fpdfapi/parser/cpdf_security_handler.h b/core/fpdfapi/parser/cpdf_security_handler.h
index 27f7f7c610..eb7d13f2e6 100644
--- a/core/fpdfapi/parser/cpdf_security_handler.h
+++ b/core/fpdfapi/parser/cpdf_security_handler.h
@@ -46,9 +46,9 @@ class CPDF_SecurityHandler {
uint32_t user_size,
uint32_t type = PDF_ENCRYPT_CONTENT);
- CFX_ByteString GetUserPassword(const uint8_t* owner_pass,
- uint32_t pass_size,
- int32_t key_len);
+ ByteString GetUserPassword(const uint8_t* owner_pass,
+ uint32_t pass_size,
+ int32_t key_len);
bool CheckPassword(const uint8_t* password,
uint32_t pass_size,
bool bOwner,
diff --git a/core/fpdfapi/parser/cpdf_simple_parser.cpp b/core/fpdfapi/parser/cpdf_simple_parser.cpp
index 650c216e05..d800796d58 100644
--- a/core/fpdfapi/parser/cpdf_simple_parser.cpp
+++ b/core/fpdfapi/parser/cpdf_simple_parser.cpp
@@ -11,7 +11,7 @@
CPDF_SimpleParser::CPDF_SimpleParser(const uint8_t* pData, uint32_t dwSize)
: m_pData(pData), m_dwSize(dwSize), m_dwCurPos(0) {}
-CPDF_SimpleParser::CPDF_SimpleParser(const CFX_ByteStringC& str)
+CPDF_SimpleParser::CPDF_SimpleParser(const ByteStringView& str)
: m_pData(str.raw_str()), m_dwSize(str.GetLength()), m_dwCurPos(0) {}
void CPDF_SimpleParser::ParseWord(const uint8_t*& pStart, uint32_t& dwSize) {
@@ -91,7 +91,7 @@ void CPDF_SimpleParser::ParseWord(const uint8_t*& pStart, uint32_t& dwSize) {
}
}
-CFX_ByteStringC CPDF_SimpleParser::GetWord() {
+ByteStringView CPDF_SimpleParser::GetWord() {
const uint8_t* pStart;
uint32_t dwSize;
ParseWord(pStart, dwSize);
@@ -102,8 +102,8 @@ CFX_ByteStringC CPDF_SimpleParser::GetWord() {
if (m_dwCurPos < m_dwSize) {
m_dwCurPos++;
}
- return CFX_ByteStringC(pStart,
- (FX_STRSIZE)(m_dwCurPos - (pStart - m_pData)));
+ return ByteStringView(pStart,
+ (FX_STRSIZE)(m_dwCurPos - (pStart - m_pData)));
}
if (dwSize == 1 && pStart[0] == '(') {
int level = 1;
@@ -130,13 +130,13 @@ CFX_ByteStringC CPDF_SimpleParser::GetWord() {
if (m_dwCurPos < m_dwSize) {
m_dwCurPos++;
}
- return CFX_ByteStringC(pStart,
- (FX_STRSIZE)(m_dwCurPos - (pStart - m_pData)));
+ return ByteStringView(pStart,
+ (FX_STRSIZE)(m_dwCurPos - (pStart - m_pData)));
}
- return CFX_ByteStringC(pStart, dwSize);
+ return ByteStringView(pStart, dwSize);
}
-bool CPDF_SimpleParser::FindTagParamFromStart(const CFX_ByteStringC& token,
+bool CPDF_SimpleParser::FindTagParamFromStart(const ByteStringView& token,
int nParams) {
nParams++;
uint32_t* pBuf = FX_Alloc(uint32_t, nParams);
@@ -152,7 +152,7 @@ bool CPDF_SimpleParser::FindTagParamFromStart(const CFX_ByteStringC& token,
if (buf_count > nParams) {
buf_count = nParams;
}
- CFX_ByteStringC word = GetWord();
+ ByteStringView word = GetWord();
if (word.IsEmpty()) {
FX_Free(pBuf);
return false;
diff --git a/core/fpdfapi/parser/cpdf_simple_parser.h b/core/fpdfapi/parser/cpdf_simple_parser.h
index 0ff6985660..72cf700f60 100644
--- a/core/fpdfapi/parser/cpdf_simple_parser.h
+++ b/core/fpdfapi/parser/cpdf_simple_parser.h
@@ -13,13 +13,13 @@
class CPDF_SimpleParser {
public:
CPDF_SimpleParser(const uint8_t* pData, uint32_t dwSize);
- explicit CPDF_SimpleParser(const CFX_ByteStringC& str);
+ explicit CPDF_SimpleParser(const ByteStringView& str);
- CFX_ByteStringC GetWord();
+ ByteStringView GetWord();
// Find the token and its |nParams| parameters from the start of data,
// and move the current position to the start of those parameters.
- bool FindTagParamFromStart(const CFX_ByteStringC& token, int nParams);
+ bool FindTagParamFromStart(const ByteStringView& token, int nParams);
// For testing only.
uint32_t GetCurPos() const { return m_dwCurPos; }
diff --git a/core/fpdfapi/parser/cpdf_simple_parser_unittest.cpp b/core/fpdfapi/parser/cpdf_simple_parser_unittest.cpp
index bdb532d3e0..a2f43386e7 100644
--- a/core/fpdfapi/parser/cpdf_simple_parser_unittest.cpp
+++ b/core/fpdfapi/parser/cpdf_simple_parser_unittest.cpp
@@ -50,7 +50,7 @@ TEST(SimpleParserTest, GetWord) {
for (size_t i = 0; i < FX_ArraySize(test_data); ++i) {
const pdfium::StrFuncTestData& data = test_data[i];
CPDF_SimpleParser parser(data.input, data.input_size);
- CFX_ByteStringC word = parser.GetWord();
+ ByteStringView word = parser.GetWord();
EXPECT_EQ(std::string(reinterpret_cast<const char*>(data.expected),
data.expected_size),
std::string(word.unterminated_c_str(), word.GetLength()))
diff --git a/core/fpdfapi/parser/cpdf_stream.cpp b/core/fpdfapi/parser/cpdf_stream.cpp
index fadaec1b7e..c00096df8b 100644
--- a/core/fpdfapi/parser/cpdf_stream.cpp
+++ b/core/fpdfapi/parser/cpdf_stream.cpp
@@ -145,7 +145,7 @@ bool CPDF_Stream::HasFilter() const {
return m_pDict && m_pDict->KeyExist("Filter");
}
-CFX_WideString CPDF_Stream::GetUnicodeText() const {
+WideString CPDF_Stream::GetUnicodeText() const {
auto pAcc = pdfium::MakeRetain<CPDF_StreamAcc>(this);
pAcc->LoadAllData(false);
return PDF_DecodeText(pAcc->GetData(), pAcc->GetSize());
diff --git a/core/fpdfapi/parser/cpdf_stream.h b/core/fpdfapi/parser/cpdf_stream.h
index 3c3b674a48..be70e05e72 100644
--- a/core/fpdfapi/parser/cpdf_stream.h
+++ b/core/fpdfapi/parser/cpdf_stream.h
@@ -30,7 +30,7 @@ class CPDF_Stream : public CPDF_Object {
Type GetType() const override;
std::unique_ptr<CPDF_Object> Clone() const override;
CPDF_Dictionary* GetDict() const override;
- CFX_WideString GetUnicodeText() const override;
+ WideString GetUnicodeText() const override;
bool IsStream() const override;
CPDF_Stream* AsStream() override;
const CPDF_Stream* AsStream() const override;
diff --git a/core/fpdfapi/parser/cpdf_stream_acc.h b/core/fpdfapi/parser/cpdf_stream_acc.h
index bc03cb097b..2161dd1950 100644
--- a/core/fpdfapi/parser/cpdf_stream_acc.h
+++ b/core/fpdfapi/parser/cpdf_stream_acc.h
@@ -34,7 +34,7 @@ class CPDF_StreamAcc : public CFX_Retainable {
const uint8_t* GetData() const;
uint32_t GetSize() const;
- const CFX_ByteString& GetImageDecoder() const { return m_ImageDecoder; }
+ const ByteString& GetImageDecoder() const { return m_ImageDecoder; }
const CPDF_Dictionary* GetImageParam() const { return m_pImageParam; }
std::unique_ptr<uint8_t, FxFreeDeleter> DetachData();
@@ -45,7 +45,7 @@ class CPDF_StreamAcc : public CFX_Retainable {
uint8_t* m_pData;
uint32_t m_dwSize;
bool m_bNewBuf;
- CFX_ByteString m_ImageDecoder;
+ ByteString m_ImageDecoder;
CPDF_Dictionary* m_pImageParam;
CFX_UnownedPtr<const CPDF_Stream> const m_pStream;
uint8_t* m_pSrcData;
diff --git a/core/fpdfapi/parser/cpdf_string.cpp b/core/fpdfapi/parser/cpdf_string.cpp
index 6ce6bf3473..1539861622 100644
--- a/core/fpdfapi/parser/cpdf_string.cpp
+++ b/core/fpdfapi/parser/cpdf_string.cpp
@@ -14,16 +14,16 @@
CPDF_String::CPDF_String() : m_bHex(false) {}
-CPDF_String::CPDF_String(CFX_WeakPtr<CFX_ByteStringPool> pPool,
- const CFX_ByteString& str,
+CPDF_String::CPDF_String(CFX_WeakPtr<ByteStringPool> pPool,
+ const ByteString& str,
bool bHex)
: m_String(str), m_bHex(bHex) {
if (pPool)
m_String = pPool->Intern(m_String);
}
-CPDF_String::CPDF_String(CFX_WeakPtr<CFX_ByteStringPool> pPool,
- const CFX_WideString& str)
+CPDF_String::CPDF_String(CFX_WeakPtr<ByteStringPool> pPool,
+ const WideString& str)
: m_String(PDF_EncodeText(str)), m_bHex(false) {
if (pPool)
m_String = pPool->Intern(m_String);
@@ -42,11 +42,11 @@ std::unique_ptr<CPDF_Object> CPDF_String::Clone() const {
return std::move(pRet);
}
-CFX_ByteString CPDF_String::GetString() const {
+ByteString CPDF_String::GetString() const {
return m_String;
}
-void CPDF_String::SetString(const CFX_ByteString& str) {
+void CPDF_String::SetString(const ByteString& str) {
m_String = str;
}
@@ -62,11 +62,11 @@ const CPDF_String* CPDF_String::AsString() const {
return this;
}
-CFX_WideString CPDF_String::GetUnicodeText() const {
+WideString CPDF_String::GetUnicodeText() const {
return PDF_DecodeText(m_String);
}
bool CPDF_String::WriteTo(IFX_ArchiveStream* archive) const {
return archive->WriteString(
- PDF_EncodeString(GetString(), IsHex()).AsStringC());
+ PDF_EncodeString(GetString(), IsHex()).AsStringView());
}
diff --git a/core/fpdfapi/parser/cpdf_string.h b/core/fpdfapi/parser/cpdf_string.h
index ccd6f530c1..9fd3e6ae8a 100644
--- a/core/fpdfapi/parser/cpdf_string.h
+++ b/core/fpdfapi/parser/cpdf_string.h
@@ -18,18 +18,18 @@
class CPDF_String : public CPDF_Object {
public:
CPDF_String();
- CPDF_String(CFX_WeakPtr<CFX_ByteStringPool> pPool,
- const CFX_ByteString& str,
+ CPDF_String(CFX_WeakPtr<ByteStringPool> pPool,
+ const ByteString& str,
bool bHex);
- CPDF_String(CFX_WeakPtr<CFX_ByteStringPool> pPool, const CFX_WideString& str);
+ CPDF_String(CFX_WeakPtr<ByteStringPool> pPool, const WideString& str);
~CPDF_String() override;
// CPDF_Object:
Type GetType() const override;
std::unique_ptr<CPDF_Object> Clone() const override;
- CFX_ByteString GetString() const override;
- CFX_WideString GetUnicodeText() const override;
- void SetString(const CFX_ByteString& str) override;
+ ByteString GetString() const override;
+ WideString GetUnicodeText() const override;
+ void SetString(const ByteString& str) override;
bool IsString() const override;
CPDF_String* AsString() override;
const CPDF_String* AsString() const override;
@@ -38,7 +38,7 @@ class CPDF_String : public CPDF_Object {
bool IsHex() const { return m_bHex; }
protected:
- CFX_ByteString m_String;
+ ByteString m_String;
bool m_bHex;
};
diff --git a/core/fpdfapi/parser/cpdf_syntax_parser.cpp b/core/fpdfapi/parser/cpdf_syntax_parser.cpp
index 779bf81e0f..4412105c7b 100644
--- a/core/fpdfapi/parser/cpdf_syntax_parser.cpp
+++ b/core/fpdfapi/parser/cpdf_syntax_parser.cpp
@@ -41,10 +41,9 @@ enum class ReadStatus { Normal, Backslash, Octal, FinishOctal, CarriageReturn };
int CPDF_SyntaxParser::s_CurrentRecursionDepth = 0;
CPDF_SyntaxParser::CPDF_SyntaxParser()
- : CPDF_SyntaxParser(CFX_WeakPtr<CFX_ByteStringPool>()) {}
+ : CPDF_SyntaxParser(CFX_WeakPtr<ByteStringPool>()) {}
-CPDF_SyntaxParser::CPDF_SyntaxParser(
- const CFX_WeakPtr<CFX_ByteStringPool>& pPool)
+CPDF_SyntaxParser::CPDF_SyntaxParser(const CFX_WeakPtr<ByteStringPool>& pPool)
: m_MetadataObjnum(0),
m_pFileAccess(nullptr),
m_pFileBuf(nullptr),
@@ -187,10 +186,10 @@ void CPDF_SyntaxParser::GetNextWordInternal(bool* bIsNumber) {
}
}
-CFX_ByteString CPDF_SyntaxParser::ReadString() {
+ByteString CPDF_SyntaxParser::ReadString() {
uint8_t ch;
if (!GetNextChar(ch))
- return CFX_ByteString();
+ return ByteString();
std::ostringstream buf;
int32_t parlevel = 0;
@@ -201,7 +200,7 @@ CFX_ByteString CPDF_SyntaxParser::ReadString() {
case ReadStatus::Normal:
if (ch == ')') {
if (parlevel == 0)
- return CFX_ByteString(buf);
+ return ByteString(buf);
parlevel--;
} else if (ch == '(') {
parlevel++;
@@ -270,13 +269,13 @@ CFX_ByteString CPDF_SyntaxParser::ReadString() {
}
GetNextChar(ch);
- return CFX_ByteString(buf);
+ return ByteString(buf);
}
-CFX_ByteString CPDF_SyntaxParser::ReadHexString() {
+ByteString CPDF_SyntaxParser::ReadHexString() {
uint8_t ch;
if (!GetNextChar(ch))
- return CFX_ByteString();
+ return ByteString();
std::ostringstream buf;
bool bFirst = true;
@@ -302,7 +301,7 @@ CFX_ByteString CPDF_SyntaxParser::ReadHexString() {
if (!bFirst)
buf << static_cast<char>(code);
- return CFX_ByteString(buf);
+ return ByteString(buf);
}
void CPDF_SyntaxParser::ToNextLine() {
@@ -344,20 +343,20 @@ void CPDF_SyntaxParser::ToNextWord() {
m_Pos--;
}
-CFX_ByteString CPDF_SyntaxParser::GetNextWord(bool* bIsNumber) {
+ByteString CPDF_SyntaxParser::GetNextWord(bool* bIsNumber) {
const CPDF_ReadValidator::Session read_session(GetValidator().Get());
GetNextWordInternal(bIsNumber);
return GetValidator()->has_read_problems()
- ? CFX_ByteString()
- : CFX_ByteString((const char*)m_WordBuffer, m_WordSize);
+ ? ByteString()
+ : ByteString((const char*)m_WordBuffer, m_WordSize);
}
-CFX_ByteString CPDF_SyntaxParser::PeekNextWord(bool* bIsNumber) {
+ByteString CPDF_SyntaxParser::PeekNextWord(bool* bIsNumber) {
const CFX_AutoRestorer<FX_FILESIZE> save_pos(&m_Pos);
return GetNextWord(bIsNumber);
}
-CFX_ByteString CPDF_SyntaxParser::GetKeyword() {
+ByteString CPDF_SyntaxParser::GetKeyword() {
return GetNextWord(nullptr);
}
@@ -386,15 +385,15 @@ std::unique_ptr<CPDF_Object> CPDF_SyntaxParser::GetObjectInternal(
FX_FILESIZE SavedObjPos = m_Pos;
bool bIsNumber;
- CFX_ByteString word = GetNextWord(&bIsNumber);
+ ByteString word = GetNextWord(&bIsNumber);
if (word.GetLength() == 0)
return nullptr;
if (bIsNumber) {
FX_FILESIZE SavedPos = m_Pos;
- CFX_ByteString nextword = GetNextWord(&bIsNumber);
+ ByteString nextword = GetNextWord(&bIsNumber);
if (bIsNumber) {
- CFX_ByteString nextword2 = GetNextWord(nullptr);
+ ByteString nextword2 = GetNextWord(nullptr);
if (nextword2 == "R") {
uint32_t refnum = FXSYS_atoui(word.c_str());
if (refnum == CPDF_Object::kInvalidObjNum)
@@ -403,7 +402,7 @@ std::unique_ptr<CPDF_Object> CPDF_SyntaxParser::GetObjectInternal(
}
}
m_Pos = SavedPos;
- return pdfium::MakeUnique<CPDF_Number>(word.AsStringC());
+ return pdfium::MakeUnique<CPDF_Number>(word.AsStringView());
}
if (word == "true" || word == "false")
@@ -413,13 +412,13 @@ std::unique_ptr<CPDF_Object> CPDF_SyntaxParser::GetObjectInternal(
return pdfium::MakeUnique<CPDF_Null>();
if (word == "(") {
- CFX_ByteString str = ReadString();
+ ByteString str = ReadString();
if (m_pCryptoHandler && bDecrypt)
str = m_pCryptoHandler->Decrypt(objnum, gennum, str);
return pdfium::MakeUnique<CPDF_String>(m_pPool, str, false);
}
if (word == "<") {
- CFX_ByteString str = ReadHexString();
+ ByteString str = ReadHexString();
if (m_pCryptoHandler && bDecrypt)
str = m_pCryptoHandler->Decrypt(objnum, gennum, str);
return pdfium::MakeUnique<CPDF_String>(m_pPool, str, true);
@@ -437,14 +436,14 @@ std::unique_ptr<CPDF_Object> CPDF_SyntaxParser::GetObjectInternal(
if (word[0] == '/') {
return pdfium::MakeUnique<CPDF_Name>(
m_pPool,
- PDF_NameDecode(CFX_ByteStringC(m_WordBuffer + 1, m_WordSize - 1)));
+ PDF_NameDecode(ByteStringView(m_WordBuffer + 1, m_WordSize - 1)));
}
if (word == "<<") {
FX_FILESIZE dwSignValuePos = 0;
std::unique_ptr<CPDF_Dictionary> pDict =
pdfium::MakeUnique<CPDF_Dictionary>(m_pPool);
while (1) {
- CFX_ByteString key = GetNextWord(nullptr);
+ ByteString key = GetNextWord(nullptr);
if (key.IsEmpty())
return nullptr;
@@ -477,7 +476,7 @@ std::unique_ptr<CPDF_Object> CPDF_SyntaxParser::GetObjectInternal(
}
if (!key.IsEmpty()) {
- CFX_ByteString keyNoSlash(key.raw_str() + 1, key.GetLength() - 1);
+ ByteString keyNoSlash(key.raw_str() + 1, key.GetLength() - 1);
pDict->SetFor(keyNoSlash, std::move(pObj));
}
}
@@ -492,7 +491,7 @@ std::unique_ptr<CPDF_Object> CPDF_SyntaxParser::GetObjectInternal(
}
FX_FILESIZE SavedPos = m_Pos;
- CFX_ByteString nextword = GetNextWord(nullptr);
+ ByteString nextword = GetNextWord(nullptr);
if (nextword != "stream") {
m_Pos = SavedPos;
return std::move(pDict);
@@ -526,7 +525,7 @@ std::unique_ptr<CPDF_Object> CPDF_SyntaxParser::GetIndirectObject(
const CPDF_ReadValidator::Session read_session(GetValidator().Get());
const FX_FILESIZE saved_pos = GetPos();
bool is_number = false;
- CFX_ByteString word = GetNextWord(&is_number);
+ ByteString word = GetNextWord(&is_number);
if (!is_number || word.IsEmpty()) {
SetPos(saved_pos);
return nullptr;
@@ -588,8 +587,8 @@ std::unique_ptr<CPDF_Stream> CPDF_SyntaxParser::ReadStream(
ToNextLine();
FX_FILESIZE streamStartPos = m_Pos;
- const CFX_ByteStringC kEndStreamStr("endstream");
- const CFX_ByteStringC kEndObjStr("endobj");
+ const ByteStringView kEndStreamStr("endstream");
+ const ByteStringView kEndObjStr("endobj");
CPDF_CryptoHandler* pCryptoHandler =
objnum == m_MetadataObjnum ? nullptr : m_pCryptoHandler.Get();
@@ -757,7 +756,7 @@ uint32_t CPDF_SyntaxParser::GetDirectNum() {
bool CPDF_SyntaxParser::IsWholeWord(FX_FILESIZE startpos,
FX_FILESIZE limit,
- const CFX_ByteStringC& tag,
+ const ByteStringView& tag,
bool checkKeyword) {
const uint32_t taglen = tag.GetLength();
@@ -783,7 +782,7 @@ bool CPDF_SyntaxParser::IsWholeWord(FX_FILESIZE startpos,
return true;
}
-bool CPDF_SyntaxParser::BackwardsSearchToWord(const CFX_ByteStringC& tag,
+bool CPDF_SyntaxParser::BackwardsSearchToWord(const ByteStringView& tag,
FX_FILESIZE limit) {
int32_t taglen = tag.GetLength();
if (taglen == 0)
@@ -817,7 +816,7 @@ bool CPDF_SyntaxParser::BackwardsSearchToWord(const CFX_ByteStringC& tag,
}
}
-FX_FILESIZE CPDF_SyntaxParser::FindTag(const CFX_ByteStringC& tag,
+FX_FILESIZE CPDF_SyntaxParser::FindTag(const ByteStringView& tag,
FX_FILESIZE limit) {
int32_t taglen = tag.GetLength();
int32_t match = 0;
diff --git a/core/fpdfapi/parser/cpdf_syntax_parser.h b/core/fpdfapi/parser/cpdf_syntax_parser.h
index 179058edf8..4e28c2fb92 100644
--- a/core/fpdfapi/parser/cpdf_syntax_parser.h
+++ b/core/fpdfapi/parser/cpdf_syntax_parser.h
@@ -26,7 +26,7 @@ class CPDF_SyntaxParser {
enum class ParseType { kStrict, kLoose };
CPDF_SyntaxParser();
- explicit CPDF_SyntaxParser(const CFX_WeakPtr<CFX_ByteStringPool>& pPool);
+ explicit CPDF_SyntaxParser(const CFX_WeakPtr<ByteStringPool>& pPool);
~CPDF_SyntaxParser();
void InitParser(const CFX_RetainPtr<IFX_SeekableReadStream>& pFileAccess,
@@ -56,16 +56,16 @@ class CPDF_SyntaxParser {
bool bDecrypt,
ParseType parse_type);
- CFX_ByteString GetKeyword();
+ ByteString GetKeyword();
void ToNextLine();
void ToNextWord();
- bool BackwardsSearchToWord(const CFX_ByteStringC& word, FX_FILESIZE limit);
- FX_FILESIZE FindTag(const CFX_ByteStringC& tag, FX_FILESIZE limit);
+ bool BackwardsSearchToWord(const ByteStringView& word, FX_FILESIZE limit);
+ FX_FILESIZE FindTag(const ByteStringView& tag, FX_FILESIZE limit);
void SetEncrypt(const CFX_RetainPtr<CPDF_CryptoHandler>& pCryptoHandler);
bool ReadBlock(uint8_t* pBuf, uint32_t size);
bool GetCharAt(FX_FILESIZE pos, uint8_t& ch);
- CFX_ByteString GetNextWord(bool* bIsNumber);
- CFX_ByteString PeekNextWord(bool* bIsNumber);
+ ByteString GetNextWord(bool* bIsNumber);
+ ByteString PeekNextWord(bool* bIsNumber);
CFX_RetainPtr<IFX_SeekableReadStream> GetFileAccess() const;
@@ -88,11 +88,11 @@ class CPDF_SyntaxParser {
void GetNextWordInternal(bool* bIsNumber);
bool IsWholeWord(FX_FILESIZE startpos,
FX_FILESIZE limit,
- const CFX_ByteStringC& tag,
+ const ByteStringView& tag,
bool checkKeyword);
- CFX_ByteString ReadString();
- CFX_ByteString ReadHexString();
+ ByteString ReadString();
+ ByteString ReadHexString();
unsigned int ReadEOLMarkers(FX_FILESIZE pos);
std::unique_ptr<CPDF_Stream> ReadStream(
std::unique_ptr<CPDF_Dictionary> pDict,
@@ -122,7 +122,7 @@ class CPDF_SyntaxParser {
CFX_RetainPtr<CPDF_CryptoHandler> m_pCryptoHandler;
uint8_t m_WordBuffer[257];
uint32_t m_WordSize;
- CFX_WeakPtr<CFX_ByteStringPool> m_pPool;
+ CFX_WeakPtr<ByteStringPool> m_pPool;
};
#endif // CORE_FPDFAPI_PARSER_CPDF_SYNTAX_PARSER_H_
diff --git a/core/fpdfapi/parser/fpdf_parser_decode.cpp b/core/fpdfapi/parser/fpdf_parser_decode.cpp
index 77024f2f09..0180aaf749 100644
--- a/core/fpdfapi/parser/fpdf_parser_decode.cpp
+++ b/core/fpdfapi/parser/fpdf_parser_decode.cpp
@@ -328,7 +328,7 @@ bool PDF_DataDecode(const uint8_t* src_buf,
bool bImageAcc,
uint8_t** dest_buf,
uint32_t* dest_size,
- CFX_ByteString* ImageEncoding,
+ ByteString* ImageEncoding,
CPDF_Dictionary** pImageParms) {
CPDF_Object* pDecoder = pDict ? pDict->GetDirectObjectFor("Filter") : nullptr;
if (!pDecoder || (!pDecoder->IsArray() && !pDecoder->IsName()))
@@ -337,7 +337,7 @@ bool PDF_DataDecode(const uint8_t* src_buf,
CPDF_Object* pParams =
pDict ? pDict->GetDirectObjectFor("DecodeParms") : nullptr;
- std::vector<std::pair<CFX_ByteString, CPDF_Object*>> DecoderArray;
+ std::vector<std::pair<ByteString, CPDF_Object*>> DecoderArray;
if (CPDF_Array* pDecoders = pDecoder->AsArray()) {
CPDF_Array* pParamsArray = ToArray(pParams);
for (size_t i = 0; i < pDecoders->GetCount(); ++i) {
@@ -354,7 +354,7 @@ bool PDF_DataDecode(const uint8_t* src_buf,
int nSize = pdfium::CollectionSize<int>(DecoderArray);
for (int i = 0; i < nSize; ++i) {
int estimated_size = i == nSize - 1 ? last_estimated_size : 0;
- CFX_ByteString decoder = DecoderArray[i].first;
+ ByteString decoder = DecoderArray[i].first;
CPDF_Dictionary* pParam = ToDictionary(DecoderArray[i].second);
uint8_t* new_buf = nullptr;
uint32_t new_size = 0xFFFFFFFF;
@@ -415,8 +415,8 @@ bool PDF_DataDecode(const uint8_t* src_buf,
return true;
}
-CFX_WideString PDF_DecodeText(const uint8_t* src_data, uint32_t src_len) {
- CFX_WideString result;
+WideString PDF_DecodeText(const uint8_t* src_data, uint32_t src_len) {
+ WideString result;
if (src_len >= 2 && ((src_data[0] == 0xfe && src_data[1] == 0xff) ||
(src_data[0] == 0xff && src_data[1] == 0xfe))) {
bool bBE = src_data[0] == 0xfe;
@@ -455,16 +455,16 @@ CFX_WideString PDF_DecodeText(const uint8_t* src_data, uint32_t src_len) {
return result;
}
-CFX_WideString PDF_DecodeText(const CFX_ByteString& bstr) {
+WideString PDF_DecodeText(const ByteString& bstr) {
return PDF_DecodeText(reinterpret_cast<const uint8_t*>(bstr.c_str()),
bstr.GetLength());
}
-CFX_ByteString PDF_EncodeText(const wchar_t* pString, int len) {
+ByteString PDF_EncodeText(const wchar_t* pString, int len) {
if (len == -1)
len = FXSYS_wcslen(pString);
- CFX_ByteString result;
+ ByteString result;
char* dest_buf1 = result.GetBuffer(len);
int i;
for (i = 0; i < len; ++i) {
@@ -502,11 +502,11 @@ CFX_ByteString PDF_EncodeText(const wchar_t* pString, int len) {
return result;
}
-CFX_ByteString PDF_EncodeText(const CFX_WideString& str) {
+ByteString PDF_EncodeText(const WideString& str) {
return PDF_EncodeText(str.c_str(), str.GetLength());
}
-CFX_ByteString PDF_EncodeString(const CFX_ByteString& src, bool bHex) {
+ByteString PDF_EncodeString(const ByteString& src, bool bHex) {
std::ostringstream result;
int srclen = src.GetLength();
if (bHex) {
@@ -518,7 +518,7 @@ CFX_ByteString PDF_EncodeString(const CFX_ByteString& src, bool bHex) {
result << buf[1];
}
result << '>';
- return CFX_ByteString(result);
+ return ByteString(result);
}
result << '(';
for (int i = 0; i < srclen; ++i) {
@@ -536,7 +536,7 @@ CFX_ByteString PDF_EncodeString(const CFX_ByteString& src, bool bHex) {
result << static_cast<char>(ch);
}
result << ')';
- return CFX_ByteString(result);
+ return ByteString(result);
}
bool FlateEncode(const uint8_t* src_buf,
diff --git a/core/fpdfapi/parser/fpdf_parser_decode.h b/core/fpdfapi/parser/fpdf_parser_decode.h
index 23ca0a0fae..6650b68c06 100644
--- a/core/fpdfapi/parser/fpdf_parser_decode.h
+++ b/core/fpdfapi/parser/fpdf_parser_decode.h
@@ -17,14 +17,14 @@ class CPDF_Dictionary;
// Indexed by 8-bit char code, contains unicode code points.
extern const uint16_t PDFDocEncoding[256];
-CFX_ByteString PDF_NameDecode(const CFX_ByteStringC& orig);
-CFX_ByteString PDF_NameDecode(const CFX_ByteString& orig);
-CFX_ByteString PDF_NameEncode(const CFX_ByteString& orig);
-CFX_ByteString PDF_EncodeString(const CFX_ByteString& src, bool bHex);
-CFX_WideString PDF_DecodeText(const uint8_t* pData, uint32_t size);
-CFX_WideString PDF_DecodeText(const CFX_ByteString& bstr);
-CFX_ByteString PDF_EncodeText(const wchar_t* pString, int len);
-CFX_ByteString PDF_EncodeText(const CFX_WideString& str);
+ByteString PDF_NameDecode(const ByteStringView& orig);
+ByteString PDF_NameDecode(const ByteString& orig);
+ByteString PDF_NameEncode(const ByteString& orig);
+ByteString PDF_EncodeString(const ByteString& src, bool bHex);
+WideString PDF_DecodeText(const uint8_t* pData, uint32_t size);
+WideString PDF_DecodeText(const ByteString& bstr);
+ByteString PDF_EncodeText(const wchar_t* pString, int len);
+ByteString PDF_EncodeText(const WideString& str);
bool FlateEncode(const uint8_t* src_buf,
uint32_t src_size,
@@ -90,7 +90,7 @@ bool PDF_DataDecode(const uint8_t* src_buf,
bool bImageAcc,
uint8_t** dest_buf,
uint32_t* dest_size,
- CFX_ByteString* ImageEncoding,
+ ByteString* ImageEncoding,
CPDF_Dictionary** pImageParms);
#endif // CORE_FPDFAPI_PARSER_FPDF_PARSER_DECODE_H_
diff --git a/core/fpdfapi/parser/fpdf_parser_decode_unittest.cpp b/core/fpdfapi/parser/fpdf_parser_decode_unittest.cpp
index c8e0c7a0e1..ae30959013 100644
--- a/core/fpdfapi/parser/fpdf_parser_decode_unittest.cpp
+++ b/core/fpdfapi/parser/fpdf_parser_decode_unittest.cpp
@@ -99,7 +99,7 @@ TEST(fpdf_parser_decode, EncodeText) {
for (size_t i = 0; i < FX_ArraySize(test_data); ++i) {
const auto& test_case = test_data[i];
- CFX_ByteString output = PDF_EncodeText(test_case.input);
+ ByteString output = PDF_EncodeText(test_case.input);
ASSERT_EQ(test_case.expected_length, output.GetLength()) << "for case "
<< i;
const char* str_ptr = output.c_str();
diff --git a/core/fpdfapi/parser/fpdf_parser_utility.cpp b/core/fpdfapi/parser/fpdf_parser_utility.cpp
index c6487f55a0..82804528ab 100644
--- a/core/fpdfapi/parser/fpdf_parser_utility.cpp
+++ b/core/fpdfapi/parser/fpdf_parser_utility.cpp
@@ -84,17 +84,17 @@ int32_t GetHeaderOffset(const CFX_RetainPtr<IFX_SeekableReadStream>& pFile) {
return kInvalidHeaderOffset;
}
-int32_t GetDirectInteger(CPDF_Dictionary* pDict, const CFX_ByteString& key) {
+int32_t GetDirectInteger(CPDF_Dictionary* pDict, const ByteString& key) {
CPDF_Number* pObj = ToNumber(pDict->GetObjectFor(key));
return pObj ? pObj->GetInteger() : 0;
}
-CFX_ByteString PDF_NameDecode(const CFX_ByteStringC& bstr) {
+ByteString PDF_NameDecode(const ByteStringView& bstr) {
if (!bstr.Contains('#'))
- return CFX_ByteString(bstr);
+ return ByteString(bstr);
int size = bstr.GetLength();
- CFX_ByteString result;
+ ByteString result;
char* pDestStart = result.GetBuffer(size);
char* pDest = pDestStart;
for (int i = 0; i < size; i++) {
@@ -110,11 +110,11 @@ CFX_ByteString PDF_NameDecode(const CFX_ByteStringC& bstr) {
return result;
}
-CFX_ByteString PDF_NameDecode(const CFX_ByteString& orig) {
- return orig.Contains("#") ? PDF_NameDecode(orig.AsStringC()) : orig;
+ByteString PDF_NameDecode(const ByteString& orig) {
+ return orig.Contains("#") ? PDF_NameDecode(orig.AsStringView()) : orig;
}
-CFX_ByteString PDF_NameEncode(const CFX_ByteString& orig) {
+ByteString PDF_NameEncode(const ByteString& orig) {
uint8_t* src_buf = (uint8_t*)orig.c_str();
int src_len = orig.GetLength();
int dest_len = 0;
@@ -131,7 +131,7 @@ CFX_ByteString PDF_NameEncode(const CFX_ByteString& orig) {
if (dest_len == src_len)
return orig;
- CFX_ByteString res;
+ ByteString res;
char* dest_buf = res.GetBuffer(dest_len);
dest_len = 0;
for (i = 0; i < src_len; i++) {
@@ -167,7 +167,7 @@ std::ostream& operator<<(std::ostream& buf, const CPDF_Object* pObj) {
buf << PDF_EncodeString(pObj->GetString(), pObj->AsString()->IsHex());
break;
case CPDF_Object::NAME: {
- CFX_ByteString str = pObj->GetString();
+ ByteString str = pObj->GetString();
buf << "/" << PDF_NameEncode(str);
break;
}
@@ -193,7 +193,7 @@ std::ostream& operator<<(std::ostream& buf, const CPDF_Object* pObj) {
const CPDF_Dictionary* p = pObj->AsDictionary();
buf << "<<";
for (const auto& it : *p) {
- const CFX_ByteString& key = it.first;
+ const ByteString& key = it.first;
CPDF_Object* pValue = it.second.get();
buf << "/" << PDF_NameEncode(key);
if (pValue && !pValue->IsInline()) {
diff --git a/core/fpdfapi/parser/fpdf_parser_utility.h b/core/fpdfapi/parser/fpdf_parser_utility.h
index 94ee1fcfd3..5f85551a53 100644
--- a/core/fpdfapi/parser/fpdf_parser_utility.h
+++ b/core/fpdfapi/parser/fpdf_parser_utility.h
@@ -41,7 +41,7 @@ constexpr int32_t kInvalidHeaderOffset = -1;
// |kInvalidHeaderOffset|.
int32_t GetHeaderOffset(const CFX_RetainPtr<IFX_SeekableReadStream>& pFile);
-int32_t GetDirectInteger(CPDF_Dictionary* pDict, const CFX_ByteString& key);
+int32_t GetDirectInteger(CPDF_Dictionary* pDict, const ByteString& key);
std::ostream& operator<<(std::ostream& buf, const CPDF_Object* pObj);
diff --git a/core/fpdfapi/render/cpdf_charposlist.cpp b/core/fpdfapi/render/cpdf_charposlist.cpp
index f5882d9944..f286474dd8 100644
--- a/core/fpdfapi/render/cpdf_charposlist.cpp
+++ b/core/fpdfapi/render/cpdf_charposlist.cpp
@@ -37,7 +37,7 @@ void CPDF_CharPosList::Load(const std::vector<uint32_t>& charCodes,
FXTEXT_CHARPOS& charpos = m_pCharPos[m_nChars++];
if (pCIDFont)
charpos.m_bFontStyle = true;
- CFX_WideString unicode = pFont->UnicodeFromCharCode(CharCode);
+ WideString unicode = pFont->UnicodeFromCharCode(CharCode);
charpos.m_Unicode = !unicode.IsEmpty() ? unicode[0] : CharCode;
charpos.m_GlyphIndex = pFont->GlyphFromCharCode(CharCode, &bVert);
uint32_t GlyphID = charpos.m_GlyphIndex;
diff --git a/core/fpdfapi/render/cpdf_dibsource.cpp b/core/fpdfapi/render/cpdf_dibsource.cpp
index 08bde6ed8d..86a01c596c 100644
--- a/core/fpdfapi/render/cpdf_dibsource.cpp
+++ b/core/fpdfapi/render/cpdf_dibsource.cpp
@@ -317,7 +317,7 @@ int CPDF_DIBSource::StartLoadDIBSource(CPDF_Document* pDoc,
int CPDF_DIBSource::ContinueLoadDIBSource(IFX_PauseIndicator* pPause) {
FXCODEC_STATUS ret;
if (m_Status == 1) {
- const CFX_ByteString& decoder = m_pStreamAcc->GetImageDecoder();
+ const ByteString& decoder = m_pStreamAcc->GetImageDecoder();
if (decoder == "JPXDecode") {
return 0;
}
@@ -397,7 +397,7 @@ bool CPDF_DIBSource::LoadColorInfo(const CPDF_Dictionary* pFormResources,
if (!m_bImageMask) {
CPDF_Object* pFilter = m_pDict->GetDirectObjectFor("Filter");
if (pFilter) {
- CFX_ByteString filter;
+ ByteString filter;
if (pFilter->IsName()) {
filter = pFilter->GetString();
} else if (CPDF_Array* pArray = pFilter->AsArray()) {
@@ -432,7 +432,7 @@ bool CPDF_DIBSource::LoadColorInfo(const CPDF_Dictionary* pFormResources,
m_Family = m_pColorSpace->GetFamily();
m_nComponents = m_pColorSpace->CountComponents();
if (m_Family == PDFCS_ICCBASED && pCSObj->IsName()) {
- CFX_ByteString cs = pCSObj->GetString();
+ ByteString cs = pCSObj->GetString();
if (cs == "DeviceGray")
m_nComponents = 1;
else if (cs == "DeviceRGB")
@@ -500,7 +500,7 @@ DIB_COMP_DATA* CPDF_DIBSource::GetDecodeAndMaskArray(bool* bDefaultDecode,
}
int CPDF_DIBSource::CreateDecoder() {
- const CFX_ByteString& decoder = m_pStreamAcc->GetImageDecoder();
+ const ByteString& decoder = m_pStreamAcc->GetImageDecoder();
if (decoder.IsEmpty())
return 1;
@@ -841,7 +841,7 @@ void CPDF_DIBSource::ValidateDictParam() {
CPDF_Object* pFilter = m_pDict->GetDirectObjectFor("Filter");
if (pFilter) {
if (pFilter->IsName()) {
- CFX_ByteString filter = pFilter->GetString();
+ ByteString filter = pFilter->GetString();
if (filter == "CCITTFaxDecode" || filter == "JBIG2Decode") {
m_bpc = 1;
m_nComponents = 1;
@@ -853,7 +853,7 @@ void CPDF_DIBSource::ValidateDictParam() {
m_bpc = 8;
}
} else if (CPDF_Array* pArray = pFilter->AsArray()) {
- CFX_ByteString filter = pArray->GetStringAt(pArray->GetCount() - 1);
+ ByteString filter = pArray->GetStringAt(pArray->GetCount() - 1);
if (filter == "CCITTFaxDecode" || filter == "JBIG2Decode") {
m_bpc = 1;
m_nComponents = 1;
diff --git a/core/fpdfapi/render/cpdf_imagerenderer.cpp b/core/fpdfapi/render/cpdf_imagerenderer.cpp
index fafa18e5a4..75a381c8fc 100644
--- a/core/fpdfapi/render/cpdf_imagerenderer.cpp
+++ b/core/fpdfapi/render/cpdf_imagerenderer.cpp
@@ -556,7 +556,7 @@ void CPDF_ImageRenderer::HandleFilters() {
return;
if (pFilters->IsName()) {
- CFX_ByteString bsDecodeType = pFilters->GetString();
+ ByteString bsDecodeType = pFilters->GetString();
if (bsDecodeType == "DCTDecode" || bsDecodeType == "JPXDecode")
m_Flags |= FXRENDER_IMAGE_LOSSY;
return;
@@ -567,7 +567,7 @@ void CPDF_ImageRenderer::HandleFilters() {
return;
for (size_t i = 0; i < pArray->GetCount(); i++) {
- CFX_ByteString bsDecodeType = pArray->GetStringAt(i);
+ ByteString bsDecodeType = pArray->GetStringAt(i);
if (bsDecodeType == "DCTDecode" || bsDecodeType == "JPXDecode") {
m_Flags |= FXRENDER_IMAGE_LOSSY;
break;
diff --git a/core/fpdfapi/render/cpdf_textrenderer.cpp b/core/fpdfapi/render/cpdf_textrenderer.cpp
index 83e61478da..283d9946fa 100644
--- a/core/fpdfapi/render/cpdf_textrenderer.cpp
+++ b/core/fpdfapi/render/cpdf_textrenderer.cpp
@@ -76,7 +76,7 @@ void CPDF_TextRenderer::DrawTextString(CFX_RenderDevice* pDevice,
CPDF_Font* pFont,
float font_size,
const CFX_Matrix* pMatrix,
- const CFX_ByteString& str,
+ const ByteString& str,
FX_ARGB fill_argb,
const CFX_GraphStateData* pGraphState,
const CPDF_RenderOptions* pOptions) {
diff --git a/core/fpdfapi/render/cpdf_textrenderer.h b/core/fpdfapi/render/cpdf_textrenderer.h
index 31c44d9599..ac8c8c5568 100644
--- a/core/fpdfapi/render/cpdf_textrenderer.h
+++ b/core/fpdfapi/render/cpdf_textrenderer.h
@@ -28,7 +28,7 @@ class CPDF_TextRenderer {
CPDF_Font* pFont,
float font_size,
const CFX_Matrix* matrix,
- const CFX_ByteString& str,
+ const ByteString& str,
FX_ARGB fill_argb,
const CFX_GraphStateData* pGraphState,
const CPDF_RenderOptions* pOptions);
diff --git a/core/fpdfapi/render/cpdf_type3cache.cpp b/core/fpdfapi/render/cpdf_type3cache.cpp
index f113e7a862..b87b5ef74a 100644
--- a/core/fpdfapi/render/cpdf_type3cache.cpp
+++ b/core/fpdfapi/render/cpdf_type3cache.cpp
@@ -92,7 +92,7 @@ CFX_GlyphBitmap* CPDF_Type3Cache::LoadGlyph(uint32_t charcode,
keygen.Generate(
4, FXSYS_round(pMatrix->a * 10000), FXSYS_round(pMatrix->b * 10000),
FXSYS_round(pMatrix->c * 10000), FXSYS_round(pMatrix->d * 10000));
- CFX_ByteString FaceGlyphsKey(keygen.m_Key, keygen.m_KeyLen);
+ ByteString FaceGlyphsKey(keygen.m_Key, keygen.m_KeyLen);
CPDF_Type3Glyphs* pSizeCache;
auto it = m_SizeMap.find(FaceGlyphsKey);
if (it == m_SizeMap.end()) {
diff --git a/core/fpdfapi/render/cpdf_type3cache.h b/core/fpdfapi/render/cpdf_type3cache.h
index 36a1d6f98a..ab748ba989 100644
--- a/core/fpdfapi/render/cpdf_type3cache.h
+++ b/core/fpdfapi/render/cpdf_type3cache.h
@@ -39,7 +39,7 @@ class CPDF_Type3Cache : public CFX_Retainable {
float retinaScaleY);
CFX_UnownedPtr<CPDF_Type3Font> const m_pFont;
- std::map<CFX_ByteString, std::unique_ptr<CPDF_Type3Glyphs>> m_SizeMap;
+ std::map<ByteString, std::unique_ptr<CPDF_Type3Glyphs>> m_SizeMap;
};
#endif // CORE_FPDFAPI_RENDER_CPDF_TYPE3CACHE_H_