summaryrefslogtreecommitdiff
path: root/core/fpdfapi/page
diff options
context:
space:
mode:
Diffstat (limited to 'core/fpdfapi/page')
-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
22 files changed, 175 insertions, 182 deletions
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);