summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--core/include/fpdfapi/fpdf_parser.h9
-rw-r--r--core/include/fpdfdoc/fpdf_doc.h26
-rw-r--r--core/include/fxcrt/fx_string.h1
-rw-r--r--core/src/fpdfapi/fpdf_edit/fpdf_edit_create.cpp251
-rw-r--r--core/src/fpdfapi/fpdf_edit/fpdf_edit_doc.cpp42
-rw-r--r--core/src/fpdfapi/fpdf_edit/fpdf_edit_image.cpp54
-rw-r--r--core/src/fpdfapi/fpdf_font/fpdf_font.cpp154
-rw-r--r--core/src/fpdfapi/fpdf_font/fpdf_font_cid.cpp68
-rw-r--r--core/src/fpdfapi/fpdf_page/fpdf_page.cpp20
-rw-r--r--core/src/fpdfapi/fpdf_page/fpdf_page_colors.cpp37
-rw-r--r--core/src/fpdfapi/fpdf_page/fpdf_page_doc.cpp28
-rw-r--r--core/src/fpdfapi/fpdf_page/fpdf_page_func.cpp36
-rw-r--r--core/src/fpdfapi/fpdf_page/fpdf_page_graph_state.cpp15
-rw-r--r--core/src/fpdfapi/fpdf_page/fpdf_page_image.cpp11
-rw-r--r--core/src/fpdfapi/fpdf_page/fpdf_page_parser.cpp53
-rw-r--r--core/src/fpdfapi/fpdf_page/fpdf_page_parser_old.cpp64
-rw-r--r--core/src/fpdfapi/fpdf_page/fpdf_page_pattern.cpp31
-rw-r--r--core/src/fpdfapi/fpdf_parser/fpdf_parser_decode.cpp62
-rw-r--r--core/src/fpdfapi/fpdf_parser/fpdf_parser_document.cpp40
-rw-r--r--core/src/fpdfapi/fpdf_parser/fpdf_parser_encrypt.cpp99
-rw-r--r--core/src/fpdfapi/fpdf_parser/fpdf_parser_fdf.cpp42
-rw-r--r--core/src/fpdfapi/fpdf_parser/fpdf_parser_objects.cpp16
-rw-r--r--core/src/fpdfapi/fpdf_parser/fpdf_parser_parser.cpp335
-rw-r--r--core/src/fpdfapi/fpdf_parser/fpdf_parser_utility.cpp26
-rw-r--r--core/src/fpdfapi/fpdf_render/fpdf_render.cpp16
-rw-r--r--core/src/fpdfapi/fpdf_render/fpdf_render_image.cpp42
-rw-r--r--core/src/fpdfapi/fpdf_render/fpdf_render_loadimage.cpp45
-rw-r--r--core/src/fpdfapi/fpdf_render/fpdf_render_pattern.cpp27
-rw-r--r--core/src/fpdfapi/fpdf_render/fpdf_render_text.cpp3
-rw-r--r--core/src/fpdfdoc/doc_action.cpp32
-rw-r--r--core/src/fpdfdoc/doc_annot.cpp19
-rw-r--r--core/src/fpdfdoc/doc_ap.cpp17
-rw-r--r--core/src/fpdfdoc/doc_basic.cpp67
-rw-r--r--core/src/fpdfdoc/doc_bookmark.cpp2
-rw-r--r--core/src/fpdfdoc/doc_form.cpp36
-rw-r--r--core/src/fpdfdoc/doc_formcontrol.cpp9
-rw-r--r--core/src/fpdfdoc/doc_link.cpp2
-rw-r--r--core/src/fpdfdoc/doc_metadata.cpp2
-rw-r--r--core/src/fpdfdoc/doc_ocg.cpp90
-rw-r--r--core/src/fpdfdoc/doc_tagged.cpp58
-rw-r--r--core/src/fpdfdoc/doc_viewerPreferences.cpp22
-rw-r--r--core/src/fpdftext/fpdf_text_int.cpp4
-rw-r--r--core/src/fxcrt/fx_basic_bstring.cpp4
-rw-r--r--core/src/fxcrt/fx_basic_wstring.cpp2
-rw-r--r--core/src/fxcrt/fx_basic_wstring_unittest.cpp14
-rw-r--r--core/src/fxcrt/fx_xml_parser.cpp26
-rw-r--r--core/src/fxcrt/fxcrt_platforms.cpp6
-rw-r--r--core/src/fxge/android/fpf_skiafontmgr.cpp7
-rw-r--r--core/src/fxge/ge/fx_ge_fontmap.cpp17
-rw-r--r--core/src/fxge/ge/fx_ge_ps.cpp158
-rw-r--r--fpdfsdk/src/fpdf_ext.cpp2
-rw-r--r--fpdfsdk/src/fpdf_transformpage.cpp8
-rw-r--r--fpdfsdk/src/fpdfdoc.cpp8
-rw-r--r--fpdfsdk/src/fpdfformfill.cpp4
-rw-r--r--fpdfsdk/src/fpdfppo.cpp4
-rw-r--r--fpdfsdk/src/fpdfview.cpp18
-rw-r--r--fpdfsdk/src/fsdk_mgr.cpp2
57 files changed, 1093 insertions, 1200 deletions
diff --git a/core/include/fpdfapi/fpdf_parser.h b/core/include/fpdfapi/fpdf_parser.h
index ad85de4c9a..a266b20ba2 100644
--- a/core/include/fpdfapi/fpdf_parser.h
+++ b/core/include/fpdfapi/fpdf_parser.h
@@ -313,11 +313,10 @@ class CPDF_SyntaxParser {
void GetNextWord();
- FX_BOOL IsWholeWord(FX_FILESIZE startpos,
- FX_FILESIZE limit,
- const uint8_t* tag,
- FX_DWORD taglen,
- FX_BOOL checkKeyword);
+ bool IsWholeWord(FX_FILESIZE startpos,
+ FX_FILESIZE limit,
+ const CFX_ByteStringC& tag,
+ FX_BOOL checkKeyword);
CFX_ByteString ReadString();
diff --git a/core/include/fpdfdoc/fpdf_doc.h b/core/include/fpdfdoc/fpdf_doc.h
index 2633017013..6163440674 100644
--- a/core/include/fpdfdoc/fpdf_doc.h
+++ b/core/include/fpdfdoc/fpdf_doc.h
@@ -1091,42 +1091,40 @@ class CPDF_ApSettings {
int GetRotation() const;
FX_ARGB GetBorderColor(int& iColorType) const {
- return GetColor(iColorType, FX_BSTRC("BC"));
+ return GetColor(iColorType, "BC");
}
FX_FLOAT GetOriginalBorderColor(int index) const {
- return GetOriginalColor(index, FX_BSTRC("BC"));
+ return GetOriginalColor(index, "BC");
}
void GetOriginalBorderColor(int& iColorType, FX_FLOAT fc[4]) const {
- GetOriginalColor(iColorType, fc, FX_BSTRC("BC"));
+ GetOriginalColor(iColorType, fc, "BC");
}
FX_ARGB GetBackgroundColor(int& iColorType) const {
- return GetColor(iColorType, FX_BSTRC("BG"));
+ return GetColor(iColorType, "BG");
}
FX_FLOAT GetOriginalBackgroundColor(int index) const {
- return GetOriginalColor(index, FX_BSTRC("BG"));
+ return GetOriginalColor(index, "BG");
}
void GetOriginalBackgroundColor(int& iColorType, FX_FLOAT fc[4]) const {
- GetOriginalColor(iColorType, fc, FX_BSTRC("BG"));
+ GetOriginalColor(iColorType, fc, "BG");
}
- CFX_WideString GetNormalCaption() const { return GetCaption(FX_BSTRC("CA")); }
+ CFX_WideString GetNormalCaption() const { return GetCaption("CA"); }
- CFX_WideString GetRolloverCaption() const {
- return GetCaption(FX_BSTRC("RC"));
- }
+ CFX_WideString GetRolloverCaption() const { return GetCaption("RC"); }
- CFX_WideString GetDownCaption() const { return GetCaption(FX_BSTRC("AC")); }
+ CFX_WideString GetDownCaption() const { return GetCaption("AC"); }
- CPDF_Stream* GetNormalIcon() const { return GetIcon(FX_BSTRC("I")); }
+ CPDF_Stream* GetNormalIcon() const { return GetIcon("I"); }
- CPDF_Stream* GetRolloverIcon() const { return GetIcon(FX_BSTRC("RI")); }
+ CPDF_Stream* GetRolloverIcon() const { return GetIcon("RI"); }
- CPDF_Stream* GetDownIcon() const { return GetIcon(FX_BSTRC("IX")); }
+ CPDF_Stream* GetDownIcon() const { return GetIcon("IX"); }
CPDF_IconFit GetIconFit() const;
diff --git a/core/include/fxcrt/fx_string.h b/core/include/fxcrt/fx_string.h
index f493c53ed9..1c1e237076 100644
--- a/core/include/fxcrt/fx_string.h
+++ b/core/include/fxcrt/fx_string.h
@@ -135,7 +135,6 @@ inline bool operator==(const char* lhs, const CFX_ByteStringC& rhs) {
inline bool operator!=(const char* lhs, const CFX_ByteStringC& rhs) {
return rhs != lhs;
}
-#define FX_BSTRC(str) CFX_ByteStringC(str, sizeof str - 1)
#define FXBSTR_ID(c1, c2, c3, c4) ((c1 << 24) | (c2 << 16) | (c3 << 8) | (c4))
// A mutable string with shared buffers using copy-on-write semantics that
diff --git a/core/src/fpdfapi/fpdf_edit/fpdf_edit_create.cpp b/core/src/fpdfapi/fpdf_edit/fpdf_edit_create.cpp
index 88cdf2c5dc..52129d9e54 100644
--- a/core/src/fpdfapi/fpdf_edit/fpdf_edit_create.cpp
+++ b/core/src/fpdfapi/fpdf_edit/fpdf_edit_create.cpp
@@ -18,7 +18,7 @@ int32_t PDF_CreatorAppendObject(const CPDF_Object* pObj,
FX_FILESIZE& offset) {
int32_t len = 0;
if (pObj == NULL) {
- if (pFile->AppendString(FX_BSTRC(" null")) < 0) {
+ if (pFile->AppendString(" null") < 0) {
return -1;
}
offset += 5;
@@ -26,14 +26,14 @@ int32_t PDF_CreatorAppendObject(const CPDF_Object* pObj,
}
switch (pObj->GetType()) {
case PDFOBJ_NULL:
- if (pFile->AppendString(FX_BSTRC(" null")) < 0) {
+ if (pFile->AppendString(" null") < 0) {
return -1;
}
offset += 5;
break;
case PDFOBJ_BOOLEAN:
case PDFOBJ_NUMBER:
- if (pFile->AppendString(FX_BSTRC(" ")) < 0) {
+ if (pFile->AppendString(" ") < 0) {
return -1;
}
if ((len = pFile->AppendString(pObj->GetString())) < 0) {
@@ -51,7 +51,7 @@ int32_t PDF_CreatorAppendObject(const CPDF_Object* pObj,
break;
}
case PDFOBJ_NAME: {
- if (pFile->AppendString(FX_BSTRC("/")) < 0) {
+ if (pFile->AppendString("/") < 0) {
return -1;
}
CFX_ByteString str = pObj->GetString();
@@ -62,17 +62,17 @@ int32_t PDF_CreatorAppendObject(const CPDF_Object* pObj,
break;
}
case PDFOBJ_REFERENCE: {
- if (pFile->AppendString(FX_BSTRC(" ")) < 0)
+ if (pFile->AppendString(" ") < 0)
return -1;
if ((len = pFile->AppendDWord(pObj->AsReference()->GetRefObjNum())) < 0)
return -1;
- if (pFile->AppendString(FX_BSTRC(" 0 R ")) < 0)
+ if (pFile->AppendString(" 0 R ") < 0)
return -1;
offset += len + 6;
break;
}
case PDFOBJ_ARRAY: {
- if (pFile->AppendString(FX_BSTRC("[")) < 0) {
+ if (pFile->AppendString("[") < 0) {
return -1;
}
offset += 1;
@@ -80,13 +80,13 @@ int32_t PDF_CreatorAppendObject(const CPDF_Object* pObj,
for (FX_DWORD i = 0; i < p->GetCount(); i++) {
CPDF_Object* pElement = p->GetElement(i);
if (pElement->GetObjNum()) {
- if (pFile->AppendString(FX_BSTRC(" ")) < 0) {
+ if (pFile->AppendString(" ") < 0) {
return -1;
}
if ((len = pFile->AppendDWord(pElement->GetObjNum())) < 0) {
return -1;
}
- if (pFile->AppendString(FX_BSTRC(" 0 R")) < 0) {
+ if (pFile->AppendString(" 0 R") < 0) {
return -1;
}
offset += len + 5;
@@ -96,14 +96,14 @@ int32_t PDF_CreatorAppendObject(const CPDF_Object* pObj,
}
}
}
- if (pFile->AppendString(FX_BSTRC("]")) < 0) {
+ if (pFile->AppendString("]") < 0) {
return -1;
}
offset += 1;
break;
}
case PDFOBJ_DICTIONARY: {
- if (pFile->AppendString(FX_BSTRC("<<")) < 0) {
+ if (pFile->AppendString("<<") < 0) {
return -1;
}
offset += 2;
@@ -112,7 +112,7 @@ int32_t PDF_CreatorAppendObject(const CPDF_Object* pObj,
while (pos) {
CFX_ByteString key;
CPDF_Object* pValue = p->GetNextElement(pos, key);
- if (pFile->AppendString(FX_BSTRC("/")) < 0) {
+ if (pFile->AppendString("/") < 0) {
return -1;
}
if ((len = pFile->AppendString(PDF_NameEncode(key))) < 0) {
@@ -120,13 +120,13 @@ int32_t PDF_CreatorAppendObject(const CPDF_Object* pObj,
}
offset += len + 1;
if (pValue->GetObjNum()) {
- if (pFile->AppendString(FX_BSTRC(" ")) < 0) {
+ if (pFile->AppendString(" ") < 0) {
return -1;
}
if ((len = pFile->AppendDWord(pValue->GetObjNum())) < 0) {
return -1;
}
- if (pFile->AppendString(FX_BSTRC(" 0 R")) < 0) {
+ if (pFile->AppendString(" 0 R") < 0) {
return -1;
}
offset += len + 5;
@@ -136,7 +136,7 @@ int32_t PDF_CreatorAppendObject(const CPDF_Object* pObj,
}
}
}
- if (pFile->AppendString(FX_BSTRC(">>")) < 0) {
+ if (pFile->AppendString(">>") < 0) {
return -1;
}
offset += 2;
@@ -147,7 +147,7 @@ int32_t PDF_CreatorAppendObject(const CPDF_Object* pObj,
if (PDF_CreatorAppendObject(p->GetDict(), pFile, offset) < 0) {
return -1;
}
- if (pFile->AppendString(FX_BSTRC("stream\r\n")) < 0) {
+ if (pFile->AppendString("stream\r\n") < 0) {
return -1;
}
offset += 8;
@@ -157,7 +157,7 @@ int32_t PDF_CreatorAppendObject(const CPDF_Object* pObj,
return -1;
}
offset += acc.GetSize();
- if ((len = pFile->AppendString(FX_BSTRC("\r\nendstream"))) < 0) {
+ if ((len = pFile->AppendString("\r\nendstream")) < 0) {
return -1;
}
offset += len;
@@ -183,17 +183,15 @@ int32_t PDF_CreatorWriteTrailer(CPDF_Document* pDocument,
while (pos) {
CFX_ByteString key;
CPDF_Object* pValue = p->GetNextElement(pos, key);
- if (key == FX_BSTRC("Encrypt") || key == FX_BSTRC("Size") ||
- key == FX_BSTRC("Filter") || key == FX_BSTRC("Index") ||
- key == FX_BSTRC("Length") || key == FX_BSTRC("Prev") ||
- key == FX_BSTRC("W") || key == FX_BSTRC("XRefStm") ||
- key == FX_BSTRC("Type") || key == FX_BSTRC("ID")) {
+ if (key == "Encrypt" || key == "Size" || key == "Filter" ||
+ key == "Index" || key == "Length" || key == "Prev" || key == "W" ||
+ key == "XRefStm" || key == "Type" || key == "ID") {
continue;
}
- if (bCompress && key == FX_BSTRC("DecodeParms")) {
+ if (bCompress && key == "DecodeParms") {
continue;
}
- if (pFile->AppendString((FX_BSTRC("/"))) < 0) {
+ if (pFile->AppendString(("/")) < 0) {
return -1;
}
if ((len = pFile->AppendString(PDF_NameEncode(key))) < 0) {
@@ -201,13 +199,13 @@ int32_t PDF_CreatorWriteTrailer(CPDF_Document* pDocument,
}
offset += len + 1;
if (pValue->GetObjNum()) {
- if (pFile->AppendString(FX_BSTRC(" ")) < 0) {
+ if (pFile->AppendString(" ") < 0) {
return -1;
}
if ((len = pFile->AppendDWord(pValue->GetObjNum())) < 0) {
return -1;
}
- if (pFile->AppendString(FX_BSTRC(" 0 R ")) < 0) {
+ if (pFile->AppendString(" 0 R ") < 0) {
return -1;
}
offset += len + 6;
@@ -218,7 +216,7 @@ int32_t PDF_CreatorWriteTrailer(CPDF_Document* pDocument,
}
}
if (pIDArray) {
- if (pFile->AppendString((FX_BSTRC("/ID"))) < 0) {
+ if (pFile->AppendString(("/ID")) < 0) {
return -1;
}
offset += 3;
@@ -228,30 +226,30 @@ int32_t PDF_CreatorWriteTrailer(CPDF_Document* pDocument,
}
return offset;
}
- if (pFile->AppendString(FX_BSTRC("\r\n/Root ")) < 0) {
+ if (pFile->AppendString("\r\n/Root ") < 0) {
return -1;
}
if ((len = pFile->AppendDWord(pDocument->GetRoot()->GetObjNum())) < 0) {
return -1;
}
- if (pFile->AppendString(FX_BSTRC(" 0 R\r\n")) < 0) {
+ if (pFile->AppendString(" 0 R\r\n") < 0) {
return -1;
}
offset += len + 14;
if (pDocument->GetInfo()) {
- if (pFile->AppendString(FX_BSTRC("/Info ")) < 0) {
+ if (pFile->AppendString("/Info ") < 0) {
return -1;
}
if ((len = pFile->AppendDWord(pDocument->GetInfo()->GetObjNum())) < 0) {
return -1;
}
- if (pFile->AppendString(FX_BSTRC(" 0 R\r\n")) < 0) {
+ if (pFile->AppendString(" 0 R\r\n") < 0) {
return -1;
}
offset += len + 12;
}
if (pIDArray) {
- if (pFile->AppendString((FX_BSTRC("/ID"))) < 0) {
+ if (pFile->AppendString(("/ID")) < 0) {
return -1;
}
offset += 3;
@@ -270,17 +268,17 @@ int32_t PDF_CreatorWriteEncrypt(const CPDF_Dictionary* pEncryptDict,
FXSYS_assert(pFile);
FX_FILESIZE offset = 0;
int32_t len = 0;
- if (pFile->AppendString(FX_BSTRC("/Encrypt")) < 0) {
+ if (pFile->AppendString("/Encrypt") < 0) {
return -1;
}
offset += 8;
- if (pFile->AppendString(FX_BSTRC(" ")) < 0) {
+ if (pFile->AppendString(" ") < 0) {
return -1;
}
if ((len = pFile->AppendDWord(dwObjNum)) < 0) {
return -1;
}
- if (pFile->AppendString(FX_BSTRC(" 0 R ")) < 0) {
+ if (pFile->AppendString(" 0 R ") < 0) {
return -1;
}
offset += len + 6;
@@ -348,7 +346,7 @@ FX_BOOL CPDF_FlateEncoder::Initialize(CPDF_Stream* pStream,
m_dwSize = destAcc.GetSize();
m_pData = (uint8_t*)destAcc.DetachData();
m_pDict = ToDictionary(pStream->GetDict()->Clone());
- m_pDict->RemoveAt(FX_BSTRC("Filter"));
+ m_pDict->RemoveAt("Filter");
m_bNewData = TRUE;
m_bCloned = TRUE;
} else {
@@ -473,8 +471,8 @@ FX_FILESIZE CPDF_ObjectStream::End(CPDF_Creator* pCreator) {
CFX_ByteTextBuf tempBuffer;
int32_t iCount = m_ObjNumArray.GetSize();
for (int32_t i = 0; i < iCount; i++) {
- tempBuffer << m_ObjNumArray.ElementAt(i) << FX_BSTRC(" ")
- << m_OffsetArray.ElementAt(i) << FX_BSTRC(" ");
+ tempBuffer << m_ObjNumArray.ElementAt(i) << " "
+ << m_OffsetArray.ElementAt(i) << " ";
}
FX_FILESIZE& offset = pCreator->m_Offset;
int32_t len = pFile->AppendDWord(m_dwObjNum);
@@ -482,8 +480,7 @@ FX_FILESIZE CPDF_ObjectStream::End(CPDF_Creator* pCreator) {
return -1;
}
offset += len;
- if ((len = pFile->AppendString(FX_BSTRC(" 0 obj\r\n<</Type /ObjStm /N "))) <
- 0) {
+ if ((len = pFile->AppendString(" 0 obj\r\n<</Type /ObjStm /N ")) < 0) {
return -1;
}
offset += len;
@@ -491,13 +488,13 @@ FX_FILESIZE CPDF_ObjectStream::End(CPDF_Creator* pCreator) {
return -1;
}
offset += len;
- if (pFile->AppendString(FX_BSTRC("/First ")) < 0) {
+ if (pFile->AppendString("/First ") < 0) {
return -1;
}
if ((len = pFile->AppendDWord((FX_DWORD)tempBuffer.GetLength())) < 0) {
return -1;
}
- if (pFile->AppendString(FX_BSTRC("/Length ")) < 0) {
+ if (pFile->AppendString("/Length ") < 0) {
return -1;
}
offset += len + 15;
@@ -507,7 +504,7 @@ FX_FILESIZE CPDF_ObjectStream::End(CPDF_Creator* pCreator) {
return -1;
}
offset += len;
- if ((len = pFile->AppendString(FX_BSTRC(">>stream\r\n"))) < 0) {
+ if ((len = pFile->AppendString(">>stream\r\n")) < 0) {
return -1;
}
if (pFile->AppendBlock(tempBuffer.GetBuffer(), tempBuffer.GetLength()) <
@@ -531,12 +528,12 @@ FX_FILESIZE CPDF_ObjectStream::End(CPDF_Creator* pCreator) {
}
offset += len;
if (pCreator->m_bCompress) {
- if (pFile->AppendString(FX_BSTRC("/Filter /FlateDecode")) < 0) {
+ if (pFile->AppendString("/Filter /FlateDecode") < 0) {
return -1;
}
offset += 20;
}
- if ((len = pFile->AppendString(FX_BSTRC(">>stream\r\n"))) < 0) {
+ if ((len = pFile->AppendString(">>stream\r\n")) < 0) {
return -1;
}
if (pFile->AppendBlock(encryptor.m_pData, encryptor.m_dwSize) < 0) {
@@ -544,8 +541,7 @@ FX_FILESIZE CPDF_ObjectStream::End(CPDF_Creator* pCreator) {
}
offset += len + encryptor.m_dwSize;
}
- if ((len = pFile->AppendString(FX_BSTRC("\r\nendstream\r\nendobj\r\n"))) <
- 0) {
+ if ((len = pFile->AppendString("\r\nendstream\r\nendobj\r\n")) < 0) {
return -1;
}
offset += len;
@@ -716,8 +712,8 @@ FX_BOOL CPDF_XRefStream::GenerateXRefStream(CPDF_Creator* pCreator,
return FALSE;
}
offset += len;
- if ((len = pFile->AppendString(
- FX_BSTRC(" 0 obj\r\n<</Type /XRef/W[1 4 2]/Index["))) < 0) {
+ if ((len = pFile->AppendString(" 0 obj\r\n<</Type /XRef/W[1 4 2]/Index[")) <
+ 0) {
return FALSE;
}
offset += len;
@@ -725,7 +721,7 @@ FX_BOOL CPDF_XRefStream::GenerateXRefStream(CPDF_Creator* pCreator,
if ((len = pFile->AppendDWord(0)) < 0) {
return FALSE;
}
- if ((len = pFile->AppendString(FX_BSTRC(" "))) < 0) {
+ if ((len = pFile->AppendString(" ")) < 0) {
return FALSE;
}
offset += len + 1;
@@ -739,20 +735,20 @@ FX_BOOL CPDF_XRefStream::GenerateXRefStream(CPDF_Creator* pCreator,
if ((len = pFile->AppendDWord(m_IndexArray.ElementAt(i * 2))) < 0) {
return FALSE;
}
- if (pFile->AppendString(FX_BSTRC(" ")) < 0) {
+ if (pFile->AppendString(" ") < 0) {
return FALSE;
}
offset += len + 1;
if ((len = pFile->AppendDWord(m_IndexArray.ElementAt(i * 2 + 1))) < 0) {
return FALSE;
}
- if (pFile->AppendString(FX_BSTRC(" ")) < 0) {
+ if (pFile->AppendString(" ") < 0) {
return FALSE;
}
offset += len + 1;
}
}
- if (pFile->AppendString(FX_BSTRC("]/Size ")) < 0) {
+ if (pFile->AppendString("]/Size ") < 0) {
return FALSE;
}
if ((len = pFile->AppendDWord(objnum + 1)) < 0) {
@@ -760,7 +756,7 @@ FX_BOOL CPDF_XRefStream::GenerateXRefStream(CPDF_Creator* pCreator,
}
offset += len + 7;
if (m_PrevOffset > 0) {
- if (pFile->AppendString(FX_BSTRC("/Prev ")) < 0) {
+ if (pFile->AppendString("/Prev ") < 0) {
return FALSE;
}
FX_CHAR offset_buf[20];
@@ -777,19 +773,19 @@ FX_BOOL CPDF_XRefStream::GenerateXRefStream(CPDF_Creator* pCreator,
encoder.Initialize(m_Buffer.GetBuffer(), m_Buffer.GetLength(),
pCreator->m_bCompress, bPredictor);
if (pCreator->m_bCompress) {
- if (pFile->AppendString(FX_BSTRC("/Filter /FlateDecode")) < 0) {
+ if (pFile->AppendString("/Filter /FlateDecode") < 0) {
return FALSE;
}
offset += 20;
if (bPredictor) {
if ((len = pFile->AppendString(
- FX_BSTRC("/DecodeParms<</Columns 7/Predictor 12>>"))) < 0) {
+ "/DecodeParms<</Columns 7/Predictor 12>>")) < 0) {
return FALSE;
}
offset += len;
}
}
- if (pFile->AppendString(FX_BSTRC("/Length ")) < 0) {
+ if (pFile->AppendString("/Length ") < 0) {
return FALSE;
}
if ((len = pFile->AppendDWord(encoder.m_dwSize)) < 0) {
@@ -815,15 +811,14 @@ FX_BOOL CPDF_XRefStream::GenerateXRefStream(CPDF_Creator* pCreator,
offset += len;
}
}
- if ((len = pFile->AppendString(FX_BSTRC(">>stream\r\n"))) < 0) {
+ if ((len = pFile->AppendString(">>stream\r\n")) < 0) {
return FALSE;
}
offset += len;
if (pFile->AppendBlock(encoder.m_pData, encoder.m_dwSize) < 0) {
return FALSE;
}
- if ((len = pFile->AppendString(FX_BSTRC("\r\nendstream\r\nendobj\r\n"))) <
- 0) {
+ if ((len = pFile->AppendString("\r\nendstream\r\nendobj\r\n")) < 0) {
return FALSE;
}
offset += encoder.m_dwSize + len;
@@ -940,7 +935,7 @@ int32_t CPDF_Creator::WriteIndirectObjectToStream(const CPDF_Object* pObj) {
CPDF_Dictionary* pDict = pObj->GetDict();
if (pObj->IsStream())
- if (pDict && pDict->GetString(FX_BSTRC("Type")) == FX_BSTRC("XRef"))
+ if (pDict && pDict->GetString("Type") == "XRef")
return 0;
return 1;
@@ -949,7 +944,7 @@ int32_t CPDF_Creator::WriteIndirectObjectToStream(const CPDF_Object* pObj) {
return 1;
if (IsSignatureDict(pDict))
return 1;
- if (pDict->GetString(FX_BSTRC("Type")) == FX_BSTRC("Page"))
+ if (pDict->GetString("Type") == "Page")
return 1;
}
@@ -1014,15 +1009,14 @@ int32_t CPDF_Creator::WriteStream(const CPDF_Object* pStream,
encoder.m_dwSize)) {
return -1;
}
- if ((FX_DWORD)encoder.m_pDict->GetInteger(FX_BSTRC("Length")) !=
- encryptor.m_dwSize) {
+ if ((FX_DWORD)encoder.m_pDict->GetInteger("Length") != encryptor.m_dwSize) {
encoder.CloneDict();
- encoder.m_pDict->SetAtInteger(FX_BSTRC("Length"), encryptor.m_dwSize);
+ encoder.m_pDict->SetAtInteger("Length", encryptor.m_dwSize);
}
if (WriteDirectObj(objnum, encoder.m_pDict) < 0) {
return -1;
}
- int len = m_File.AppendString(FX_BSTRC("stream\r\n"));
+ int len = m_File.AppendString("stream\r\n");
if (len < 0) {
return -1;
}
@@ -1031,7 +1025,7 @@ int32_t CPDF_Creator::WriteStream(const CPDF_Object* pStream,
return -1;
}
m_Offset += encryptor.m_dwSize;
- if ((len = m_File.AppendString(FX_BSTRC("\r\nendstream"))) < 0) {
+ if ((len = m_File.AppendString("\r\nendstream")) < 0) {
return -1;
}
m_Offset += len;
@@ -1044,7 +1038,7 @@ int32_t CPDF_Creator::WriteIndirectObj(FX_DWORD objnum,
return -1;
m_Offset += len;
- if ((len = m_File.AppendString(FX_BSTRC(" 0 obj\r\n"))) < 0)
+ if ((len = m_File.AppendString(" 0 obj\r\n")) < 0)
return -1;
m_Offset += len;
@@ -1058,7 +1052,7 @@ int32_t CPDF_Creator::WriteIndirectObj(FX_DWORD objnum,
if (WriteDirectObj(objnum, pObj) < 0)
return -1;
}
- if ((len = m_File.AppendString(FX_BSTRC("\r\nendobj\r\n"))) < 0)
+ if ((len = m_File.AppendString("\r\nendobj\r\n")) < 0)
return -1;
m_Offset += len;
@@ -1078,7 +1072,7 @@ int32_t CPDF_Creator::WriteDirectObj(FX_DWORD objnum,
FX_BOOL bEncrypt) {
int32_t len = 0;
if (pObj == NULL) {
- if (m_File.AppendString(FX_BSTRC(" null")) < 0) {
+ if (m_File.AppendString(" null") < 0) {
return -1;
}
m_Offset += 5;
@@ -1086,14 +1080,14 @@ int32_t CPDF_Creator::WriteDirectObj(FX_DWORD objnum,
}
switch (pObj->GetType()) {
case PDFOBJ_NULL:
- if (m_File.AppendString(FX_BSTRC(" null")) < 0) {
+ if (m_File.AppendString(" null") < 0) {
return -1;
}
m_Offset += 5;
break;
case PDFOBJ_BOOLEAN:
case PDFOBJ_NUMBER:
- if (m_File.AppendString(FX_BSTRC(" ")) < 0) {
+ if (m_File.AppendString(" ") < 0) {
return -1;
}
if ((len = m_File.AppendString(pObj->GetString())) < 0) {
@@ -1131,15 +1125,15 @@ int32_t CPDF_Creator::WriteDirectObj(FX_DWORD objnum,
CPDF_Encryptor encryptor;
CPDF_CryptoHandler* pHandler = m_pCryptoHandler;
encryptor.Initialize(pHandler, objnum, encoder.m_pData, encoder.m_dwSize);
- if ((FX_DWORD)encoder.m_pDict->GetInteger(FX_BSTRC("Length")) !=
+ if ((FX_DWORD)encoder.m_pDict->GetInteger("Length") !=
encryptor.m_dwSize) {
encoder.CloneDict();
- encoder.m_pDict->SetAtInteger(FX_BSTRC("Length"), encryptor.m_dwSize);
+ encoder.m_pDict->SetAtInteger("Length", encryptor.m_dwSize);
}
if (WriteDirectObj(objnum, encoder.m_pDict) < 0) {
return -1;
}
- if ((len = m_File.AppendString(FX_BSTRC("stream\r\n"))) < 0) {
+ if ((len = m_File.AppendString("stream\r\n")) < 0) {
return -1;
}
m_Offset += len;
@@ -1147,14 +1141,14 @@ int32_t CPDF_Creator::WriteDirectObj(FX_DWORD objnum,
return -1;
}
m_Offset += encryptor.m_dwSize;
- if ((len = m_File.AppendString(FX_BSTRC("\r\nendstream"))) < 0) {
+ if ((len = m_File.AppendString("\r\nendstream")) < 0) {
return -1;
}
m_Offset += len;
break;
}
case PDFOBJ_NAME: {
- if (m_File.AppendString(FX_BSTRC("/")) < 0) {
+ if (m_File.AppendString("/") < 0) {
return -1;
}
CFX_ByteString str = pObj->GetString();
@@ -1165,17 +1159,17 @@ int32_t CPDF_Creator::WriteDirectObj(FX_DWORD objnum,
break;
}
case PDFOBJ_REFERENCE: {
- if (m_File.AppendString(FX_BSTRC(" ")) < 0)
+ if (m_File.AppendString(" ") < 0)
return -1;
if ((len = m_File.AppendDWord(pObj->AsReference()->GetRefObjNum())) < 0)
return -1;
- if (m_File.AppendString(FX_BSTRC(" 0 R")) < 0)
+ if (m_File.AppendString(" 0 R") < 0)
return -1;
m_Offset += len + 5;
break;
}
case PDFOBJ_ARRAY: {
- if (m_File.AppendString(FX_BSTRC("[")) < 0) {
+ if (m_File.AppendString("[") < 0) {
return -1;
}
m_Offset += 1;
@@ -1183,13 +1177,13 @@ int32_t CPDF_Creator::WriteDirectObj(FX_DWORD objnum,
for (FX_DWORD i = 0; i < p->GetCount(); i++) {
CPDF_Object* pElement = p->GetElement(i);
if (pElement->GetObjNum()) {
- if (m_File.AppendString(FX_BSTRC(" ")) < 0) {
+ if (m_File.AppendString(" ") < 0) {
return -1;
}
if ((len = m_File.AppendDWord(pElement->GetObjNum())) < 0) {
return -1;
}
- if (m_File.AppendString(FX_BSTRC(" 0 R")) < 0) {
+ if (m_File.AppendString(" 0 R") < 0) {
return -1;
}
m_Offset += len + 5;
@@ -1199,7 +1193,7 @@ int32_t CPDF_Creator::WriteDirectObj(FX_DWORD objnum,
}
}
}
- if (m_File.AppendString(FX_BSTRC("]")) < 0) {
+ if (m_File.AppendString("]") < 0) {
return -1;
}
m_Offset += 1;
@@ -1209,7 +1203,7 @@ int32_t CPDF_Creator::WriteDirectObj(FX_DWORD objnum,
if (m_pCryptoHandler == NULL || pObj == m_pEncryptDict) {
return PDF_CreatorAppendObject(pObj, &m_File, m_Offset);
}
- if (m_File.AppendString(FX_BSTRC("<<")) < 0) {
+ if (m_File.AppendString("<<") < 0) {
return -1;
}
m_Offset += 2;
@@ -1220,24 +1214,24 @@ int32_t CPDF_Creator::WriteDirectObj(FX_DWORD objnum,
FX_BOOL bSignValue = FALSE;
CFX_ByteString key;
CPDF_Object* pValue = p->GetNextElement(pos, key);
- if (m_File.AppendString(FX_BSTRC("/")) < 0) {
+ if (m_File.AppendString("/") < 0) {
return -1;
}
if ((len = m_File.AppendString(PDF_NameEncode(key))) < 0) {
return -1;
}
m_Offset += len + 1;
- if (bSignDict && key == FX_BSTRC("Contents")) {
+ if (bSignDict && key == "Contents") {
bSignValue = TRUE;
}
if (pValue->GetObjNum()) {
- if (m_File.AppendString(FX_BSTRC(" ")) < 0) {
+ if (m_File.AppendString(" ") < 0) {
return -1;
}
if ((len = m_File.AppendDWord(pValue->GetObjNum())) < 0) {
return -1;
}
- if (m_File.AppendString(FX_BSTRC(" 0 R ")) < 0) {
+ if (m_File.AppendString(" 0 R ") < 0) {
return -1;
}
m_Offset += len + 6;
@@ -1247,7 +1241,7 @@ int32_t CPDF_Creator::WriteDirectObj(FX_DWORD objnum,
}
}
}
- if (m_File.AppendString(FX_BSTRC(">>")) < 0) {
+ if (m_File.AppendString(">>") < 0) {
return -1;
}
m_Offset += 2;
@@ -1298,7 +1292,7 @@ int32_t CPDF_Creator::WriteOldIndirectObject(FX_DWORD objnum) {
if (len < 0) {
return -1;
}
- if (m_File.AppendString(FX_BSTRC(" 0 obj ")) < 0) {
+ if (m_File.AppendString(" 0 obj ") < 0) {
return -1;
}
m_Offset += len + 7;
@@ -1306,7 +1300,7 @@ int32_t CPDF_Creator::WriteOldIndirectObject(FX_DWORD objnum) {
return -1;
}
m_Offset += size;
- if (m_File.AppendString(FX_BSTRC("\r\nendobj\r\n")) < 0) {
+ if (m_File.AppendString("\r\nendobj\r\n") < 0) {
return -1;
}
m_Offset += 10;
@@ -1490,7 +1484,7 @@ int32_t CPDF_Creator::WriteDoc_Stage1(IFX_Pause* pPause) {
m_dwFlags &= ~FPDFCREATE_INCREMENTAL;
}
CPDF_Dictionary* pDict = m_pDocument->GetRoot();
- m_pMetadata = pDict ? pDict->GetElementValue(FX_BSTRC("Metadata")) : NULL;
+ m_pMetadata = pDict ? pDict->GetElementValue("Metadata") : NULL;
if (m_dwFlags & FPDFCREATE_OBJECTSTREAM) {
m_pXRefStream = new CPDF_XRefStream;
m_pXRefStream->Start();
@@ -1503,7 +1497,7 @@ int32_t CPDF_Creator::WriteDoc_Stage1(IFX_Pause* pPause) {
}
if (m_iStage == 10) {
if ((m_dwFlags & FPDFCREATE_INCREMENTAL) == 0) {
- if (m_File.AppendString(FX_BSTRC("%PDF-1.")) < 0) {
+ if (m_File.AppendString("%PDF-1.") < 0) {
return -1;
}
m_Offset += 7;
@@ -1518,8 +1512,7 @@ int32_t CPDF_Creator::WriteDoc_Stage1(IFX_Pause* pPause) {
return -1;
}
m_Offset += len;
- if ((len = m_File.AppendString(FX_BSTRC("\r\n%\xA1\xB3\xC5\xD7\r\n"))) <
- 0) {
+ if ((len = m_File.AppendString("\r\n%\xA1\xB3\xC5\xD7\r\n")) < 0) {
return -1;
}
m_Offset += len;
@@ -1641,15 +1634,15 @@ int32_t CPDF_Creator::WriteDoc_Stage3(IFX_Pause* pPause) {
m_pParser->GetLastXRefOffset() == 0) {
CFX_ByteString str;
str = m_ObjectOffset.GetPtrAt(1)
- ? FX_BSTRC("xref\r\n")
- : FX_BSTRC("xref\r\n0 1\r\n0000000000 65536 f\r\n");
+ ? "xref\r\n"
+ : "xref\r\n0 1\r\n0000000000 65536 f\r\n";
if (m_File.AppendString(str) < 0) {
return -1;
}
m_Pos = (void*)(uintptr_t)1;
m_iStage = 81;
} else {
- if (m_File.AppendString(FX_BSTRC("xref\r\n")) < 0) {
+ if (m_File.AppendString("xref\r\n") < 0) {
return -1;
}
m_Pos = (void*)(uintptr_t)0;
@@ -1780,14 +1773,14 @@ int32_t CPDF_Creator::WriteDoc_Stage4(IFX_Pause* pPause) {
FX_BOOL bXRefStream =
(m_dwFlags & FPDFCREATE_INCREMENTAL) != 0 && m_pParser->IsXRefStream();
if (!bXRefStream) {
- if (m_File.AppendString(FX_BSTRC("trailer\r\n<<")) < 0) {
+ if (m_File.AppendString("trailer\r\n<<") < 0) {
return -1;
}
} else {
if (m_File.AppendDWord(m_pDocument->m_LastObjNum + 1) < 0) {
return -1;
}
- if (m_File.AppendString(FX_BSTRC(" 0 obj <<")) < 0) {
+ if (m_File.AppendString(" 0 obj <<") < 0) {
return -1;
}
}
@@ -1797,27 +1790,25 @@ int32_t CPDF_Creator::WriteDoc_Stage4(IFX_Pause* pPause) {
while (pos) {
CFX_ByteString key;
CPDF_Object* pValue = p->GetNextElement(pos, key);
- if (key == FX_BSTRC("Encrypt") || key == FX_BSTRC("Size") ||
- key == FX_BSTRC("Filter") || key == FX_BSTRC("Index") ||
- key == FX_BSTRC("Length") || key == FX_BSTRC("Prev") ||
- key == FX_BSTRC("W") || key == FX_BSTRC("XRefStm") ||
- key == FX_BSTRC("ID")) {
+ if (key == "Encrypt" || key == "Size" || key == "Filter" ||
+ key == "Index" || key == "Length" || key == "Prev" || key == "W" ||
+ key == "XRefStm" || key == "ID") {
continue;
}
- if (m_File.AppendString((FX_BSTRC("/"))) < 0) {
+ if (m_File.AppendString(("/")) < 0) {
return -1;
}
if (m_File.AppendString(PDF_NameEncode(key)) < 0) {
return -1;
}
if (pValue->GetObjNum()) {
- if (m_File.AppendString(FX_BSTRC(" ")) < 0) {
+ if (m_File.AppendString(" ") < 0) {
return -1;
}
if (m_File.AppendDWord(pValue->GetObjNum()) < 0) {
return -1;
}
- if (m_File.AppendString(FX_BSTRC(" 0 R ")) < 0) {
+ if (m_File.AppendString(" 0 R ") < 0) {
return -1;
}
} else {
@@ -1828,46 +1819,46 @@ int32_t CPDF_Creator::WriteDoc_Stage4(IFX_Pause* pPause) {
}
}
} else {
- if (m_File.AppendString(FX_BSTRC("\r\n/Root ")) < 0) {
+ if (m_File.AppendString("\r\n/Root ") < 0) {
return -1;
}
if (m_File.AppendDWord(m_pDocument->m_pRootDict->GetObjNum()) < 0) {
return -1;
}
- if (m_File.AppendString(FX_BSTRC(" 0 R\r\n")) < 0) {
+ if (m_File.AppendString(" 0 R\r\n") < 0) {
return -1;
}
if (m_pDocument->m_pInfoDict) {
- if (m_File.AppendString(FX_BSTRC("/Info ")) < 0) {
+ if (m_File.AppendString("/Info ") < 0) {
return -1;
}
if (m_File.AppendDWord(m_pDocument->m_pInfoDict->GetObjNum()) < 0) {
return -1;
}
- if (m_File.AppendString(FX_BSTRC(" 0 R\r\n")) < 0) {
+ if (m_File.AppendString(" 0 R\r\n") < 0) {
return -1;
}
}
}
if (m_pEncryptDict) {
- if (m_File.AppendString(FX_BSTRC("/Encrypt")) < 0) {
+ if (m_File.AppendString("/Encrypt") < 0) {
return -1;
}
FX_DWORD dwObjNum = m_pEncryptDict->GetObjNum();
if (dwObjNum == 0) {
dwObjNum = m_pDocument->GetLastObjNum() + 1;
}
- if (m_File.AppendString(FX_BSTRC(" ")) < 0) {
+ if (m_File.AppendString(" ") < 0) {
return -1;
}
if (m_File.AppendDWord(dwObjNum) < 0) {
return -1;
}
- if (m_File.AppendString(FX_BSTRC(" 0 R ")) < 0) {
+ if (m_File.AppendString(" 0 R ") < 0) {
return -1;
}
}
- if (m_File.AppendString(FX_BSTRC("/Size ")) < 0) {
+ if (m_File.AppendString("/Size ") < 0) {
return -1;
}
if (m_File.AppendDWord(m_dwLastObjNum + (bXRefStream ? 2 : 1)) < 0) {
@@ -1876,7 +1867,7 @@ int32_t CPDF_Creator::WriteDoc_Stage4(IFX_Pause* pPause) {
if ((m_dwFlags & FPDFCREATE_INCREMENTAL) != 0) {
FX_FILESIZE prev = m_pParser->GetLastXRefOffset();
if (prev) {
- if (m_File.AppendString(FX_BSTRC("/Prev ")) < 0) {
+ if (m_File.AppendString("/Prev ") < 0) {
return -1;
}
FX_CHAR offset_buf[20];
@@ -1888,7 +1879,7 @@ int32_t CPDF_Creator::WriteDoc_Stage4(IFX_Pause* pPause) {
}
}
if (m_pIDArray) {
- if (m_File.AppendString((FX_BSTRC("/ID"))) < 0) {
+ if (m_File.AppendString(("/ID")) < 0) {
return -1;
}
FX_FILESIZE offset = 0;
@@ -1897,11 +1888,11 @@ int32_t CPDF_Creator::WriteDoc_Stage4(IFX_Pause* pPause) {
}
}
if (!bXRefStream) {
- if (m_File.AppendString(FX_BSTRC(">>")) < 0) {
+ if (m_File.AppendString(">>") < 0) {
return -1;
}
} else {
- if (m_File.AppendString(FX_BSTRC("/W[0 4 1]/Index[")) < 0) {
+ if (m_File.AppendString("/W[0 4 1]/Index[") < 0) {
return -1;
}
if ((m_dwFlags & FPDFCREATE_INCREMENTAL) != 0 && m_pParser &&
@@ -1914,17 +1905,17 @@ int32_t CPDF_Creator::WriteDoc_Stage4(IFX_Pause* pPause) {
if (m_File.AppendDWord(i) < 0) {
return -1;
}
- if (m_File.AppendString(FX_BSTRC(" 1 ")) < 0) {
+ if (m_File.AppendString(" 1 ") < 0) {
return -1;
}
}
- if (m_File.AppendString(FX_BSTRC("]/Length ")) < 0) {
+ if (m_File.AppendString("]/Length ") < 0) {
return -1;
}
if (m_File.AppendDWord(m_dwLastObjNum * 5) < 0) {
return -1;
}
- if (m_File.AppendString(FX_BSTRC(">>stream\r\n")) < 0) {
+ if (m_File.AppendString(">>stream\r\n") < 0) {
return -1;
}
for (i = 0; i < m_dwLastObjNum; i++) {
@@ -1942,17 +1933,17 @@ int32_t CPDF_Creator::WriteDoc_Stage4(IFX_Pause* pPause) {
if (m_File.AppendDWord(objnum) < 0) {
return -1;
}
- if (m_File.AppendString(FX_BSTRC(" 1 ")) < 0) {
+ if (m_File.AppendString(" 1 ") < 0) {
return -1;
}
}
- if (m_File.AppendString(FX_BSTRC("]/Length ")) < 0) {
+ if (m_File.AppendString("]/Length ") < 0) {
return -1;
}
if (m_File.AppendDWord(count * 5) < 0) {
return -1;
}
- if (m_File.AppendString(FX_BSTRC(">>stream\r\n")) < 0) {
+ if (m_File.AppendString(">>stream\r\n") < 0) {
return -1;
}
for (i = 0; i < count; i++) {
@@ -1961,12 +1952,12 @@ int32_t CPDF_Creator::WriteDoc_Stage4(IFX_Pause* pPause) {
_OutPutIndex(&m_File, offset);
}
}
- if (m_File.AppendString(FX_BSTRC("\r\nendstream")) < 0) {
+ if (m_File.AppendString("\r\nendstream") < 0) {
return -1;
}
}
}
- if (m_File.AppendString(FX_BSTRC("\r\nstartxref\r\n")) < 0) {
+ if (m_File.AppendString("\r\nstartxref\r\n") < 0) {
return -1;
}
FX_CHAR offset_buf[20];
@@ -1975,7 +1966,7 @@ int32_t CPDF_Creator::WriteDoc_Stage4(IFX_Pause* pPause) {
if (m_File.AppendBlock(offset_buf, FXSYS_strlen(offset_buf)) < 0) {
return -1;
}
- if (m_File.AppendString(FX_BSTRC("\r\n%%EOF\r\n")) < 0) {
+ if (m_File.AppendString("\r\n%%EOF\r\n") < 0) {
return -1;
}
m_File.Flush();
@@ -2049,7 +2040,7 @@ void CPDF_Creator::InitID(FX_BOOL bDefault) {
}
m_pIDArray->Add(m_pIDArray->GetElement(0)->Clone());
if (m_pEncryptDict && !pOldIDArray && m_pParser && bNewId) {
- if (m_pEncryptDict->GetString(FX_BSTRC("Filter")) == FX_BSTRC("Standard")) {
+ if (m_pEncryptDict->GetString("Filter") == "Standard") {
CPDF_StandardSecurityHandler handler;
CFX_ByteString user_pass = m_pParser->GetPassword();
FX_DWORD flag = PDF_ENCRYPT_CONTENT;
diff --git a/core/src/fpdfapi/fpdf_edit/fpdf_edit_doc.cpp b/core/src/fpdfapi/fpdf_edit/fpdf_edit_doc.cpp
index b3891d78dd..5467cfdaec 100644
--- a/core/src/fpdfapi/fpdf_edit/fpdf_edit_doc.cpp
+++ b/core/src/fpdfapi/fpdf_edit/fpdf_edit_doc.cpp
@@ -296,7 +296,7 @@ CPDF_Font* CPDF_Document::AddWindowsFont(LOGFONTA* pLogFont,
} else {
flags |= PDFFONT_NONSYMBOLIC;
}
- pBaseDict->SetAtName(FX_BSTRC("Encoding"), "WinAnsiEncoding");
+ pBaseDict->SetAtName("Encoding", "WinAnsiEncoding");
} else {
flags |= PDFFONT_NONSYMBOLIC;
int i;
@@ -307,21 +307,21 @@ CPDF_Font* CPDF_Document::AddWindowsFont(LOGFONTA* pLogFont,
}
if (i < sizeof g_FX_CharsetUnicodes / sizeof(FX_CharsetUnicodes)) {
CPDF_Dictionary* pEncoding = new CPDF_Dictionary;
- pEncoding->SetAtName(FX_BSTRC("BaseEncoding"), "WinAnsiEncoding");
+ pEncoding->SetAtName("BaseEncoding", "WinAnsiEncoding");
CPDF_Array* pArray = new CPDF_Array;
pArray->AddInteger(128);
const FX_WCHAR* pUnicodes = g_FX_CharsetUnicodes[i].m_pUnicodes;
for (int j = 0; j < 128; j++) {
CFX_ByteString name = PDF_AdobeNameFromUnicode(pUnicodes[j]);
if (name.IsEmpty()) {
- pArray->AddName(FX_BSTRC(".notdef"));
+ pArray->AddName(".notdef");
} else {
pArray->AddName(name);
}
}
- pEncoding->SetAt(FX_BSTRC("Differences"), pArray);
+ pEncoding->SetAt("Differences", pArray);
AddIndirectObject(pEncoding);
- pBaseDict->SetAtReference(FX_BSTRC("Encoding"), this, pEncoding);
+ pBaseDict->SetAtReference("Encoding", this, pEncoding);
}
}
if (pLogFont->lfWeight > FW_MEDIUM && pLogFont->lfItalic) {
@@ -633,7 +633,7 @@ CPDF_Font* CPDF_Document::AddMacFont(CTFontRef pFont,
} else {
flags |= PDFFONT_NONSYMBOLIC;
}
- pBaseDict->SetAtName(FX_BSTRC("Encoding"), "WinAnsiEncoding");
+ pBaseDict->SetAtName("Encoding", "WinAnsiEncoding");
} else {
flags |= PDFFONT_NONSYMBOLIC;
size_t i;
@@ -647,21 +647,21 @@ CPDF_Font* CPDF_Document::AddMacFont(CTFontRef pFont,
}
if (i < sizeof g_FX_CharsetUnicodes / sizeof(FX_CharsetUnicodes)) {
CPDF_Dictionary* pEncoding = new CPDF_Dictionary;
- pEncoding->SetAtName(FX_BSTRC("BaseEncoding"), "WinAnsiEncoding");
+ pEncoding->SetAtName("BaseEncoding", "WinAnsiEncoding");
CPDF_Array* pArray = new CPDF_Array;
pArray->AddInteger(128);
const FX_WCHAR* pUnicodes = g_FX_CharsetUnicodes[i].m_pUnicodes;
for (int j = 0; j < 128; j++) {
CFX_ByteString name = PDF_AdobeNameFromUnicode(pUnicodes[j]);
if (name.IsEmpty()) {
- pArray->AddName(FX_BSTRC(".notdef"));
+ pArray->AddName(".notdef");
} else {
pArray->AddName(name);
}
}
- pEncoding->SetAt(FX_BSTRC("Differences"), pArray);
+ pEncoding->SetAt("Differences", pArray);
AddIndirectObject(pEncoding);
- pBaseDict->SetAtReference(FX_BSTRC("Encoding"), this, pEncoding);
+ pBaseDict->SetAtReference("Encoding", this, pEncoding);
}
}
if (weight > 0.0 && trait & kCTFontItalicTrait) {
@@ -864,7 +864,7 @@ CPDF_Font* CPDF_Document::AddFont(CFX_Font* pFont, int charset, FX_BOOL bVert) {
} else {
flags |= PDFFONT_NONSYMBOLIC;
}
- pBaseDict->SetAtName(FX_BSTRC("Encoding"), "WinAnsiEncoding");
+ pBaseDict->SetAtName("Encoding", "WinAnsiEncoding");
for (charcode = 128; charcode <= 255; charcode++) {
int glyph_index = pEncoding->GlyphFromCharCode(charcode);
int char_width = pFont->GetGlyphWidth(glyph_index);
@@ -880,14 +880,14 @@ CPDF_Font* CPDF_Document::AddFont(CFX_Font* pFont, int charset, FX_BOOL bVert) {
}
if (i < sizeof g_FX_CharsetUnicodes / sizeof(FX_CharsetUnicodes)) {
CPDF_Dictionary* pEncodingDict = new CPDF_Dictionary;
- pEncodingDict->SetAtName(FX_BSTRC("BaseEncoding"), "WinAnsiEncoding");
+ pEncodingDict->SetAtName("BaseEncoding", "WinAnsiEncoding");
CPDF_Array* pArray = new CPDF_Array;
pArray->AddInteger(128);
const FX_WCHAR* pUnicodes = g_FX_CharsetUnicodes[i].m_pUnicodes;
for (int j = 0; j < 128; j++) {
CFX_ByteString name = PDF_AdobeNameFromUnicode(pUnicodes[j]);
if (name.IsEmpty()) {
- pArray->AddName(FX_BSTRC(".notdef"));
+ pArray->AddName(".notdef");
} else {
pArray->AddName(name);
}
@@ -895,9 +895,9 @@ CPDF_Font* CPDF_Document::AddFont(CFX_Font* pFont, int charset, FX_BOOL bVert) {
int char_width = pFont->GetGlyphWidth(glyph_index);
pWidths->AddInteger(char_width);
}
- pEncodingDict->SetAt(FX_BSTRC("Differences"), pArray);
+ pEncodingDict->SetAt("Differences", pArray);
AddIndirectObject(pEncodingDict);
- pBaseDict->SetAtReference(FX_BSTRC("Encoding"), this, pEncodingDict);
+ pBaseDict->SetAtReference("Encoding", this, pEncodingDict);
}
}
if (pFont->IsBold() && pFont->IsItalic()) {
@@ -1025,7 +1025,7 @@ static int InsertDeletePDFPage(CPDF_Document* pDoc,
int nKids = pKidList->GetCount();
for (int i = 0; i < nKids; i++) {
CPDF_Dictionary* pKid = pKidList->GetDict(i);
- if (pKid->GetString("Type") == FX_BSTRC("Page")) {
+ if (pKid->GetString("Type") == "Page") {
if (nPagesToGo == 0) {
if (bInsert) {
pKidList->InsertAt(i, new CPDF_Reference(pDoc, pPage->GetObjNum()));
@@ -1070,7 +1070,7 @@ static int InsertNewPage(CPDF_Document* pDoc,
if (!pRoot) {
return -1;
}
- CPDF_Dictionary* pPages = pRoot->GetDict(FX_BSTRC("Pages"));
+ CPDF_Dictionary* pPages = pRoot->GetDict("Pages");
if (!pPages) {
return -1;
}
@@ -1079,14 +1079,14 @@ static int InsertNewPage(CPDF_Document* pDoc,
return -1;
}
if (iPage == nPages) {
- CPDF_Array* pPagesList = pPages->GetArray(FX_BSTRC("Kids"));
+ CPDF_Array* pPagesList = pPages->GetArray("Kids");
if (!pPagesList) {
pPagesList = new CPDF_Array;
- pPages->SetAt(FX_BSTRC("Kids"), pPagesList);
+ pPages->SetAt("Kids", pPagesList);
}
pPagesList->Add(pPageDict, pDoc);
- pPages->SetAtInteger(FX_BSTRC("Count"), nPages + 1);
- pPageDict->SetAtReference(FX_BSTRC("Parent"), pDoc, pPages->GetObjNum());
+ pPages->SetAtInteger("Count", nPages + 1);
+ pPageDict->SetAtReference("Parent", pDoc, pPages->GetObjNum());
} else {
CFX_ArrayTemplate<CPDF_Dictionary*> stack;
stack.Add(pPages);
diff --git a/core/src/fpdfapi/fpdf_edit/fpdf_edit_image.cpp b/core/src/fpdfapi/fpdf_edit/fpdf_edit_image.cpp
index 33af620dab..ccb184c6cf 100644
--- a/core/src/fpdfapi/fpdf_edit/fpdf_edit_image.cpp
+++ b/core/src/fpdfapi/fpdf_edit/fpdf_edit_image.cpp
@@ -38,7 +38,7 @@ CPDF_Dictionary* CPDF_Image::InitJPEG(uint8_t* pData, FX_DWORD size) {
pDecode->AddInteger(1);
pDecode->AddInteger(0);
}
- pDict->SetAt(FX_BSTRC("Decode"), pDecode);
+ pDict->SetAt("Decode", pDecode);
}
pDict->SetAtName("ColorSpace", csname);
pDict->SetAtInteger("BitsPerComponent", bits);
@@ -115,10 +115,10 @@ void CPDF_Image::SetImage(const CFX_DIBitmap* pBitmap,
FX_BOOL bUseMatte =
pParam && pParam->pMatteColor && (pBitmap->GetFormat() == FXDIB_Argb);
CPDF_Dictionary* pDict = new CPDF_Dictionary;
- pDict->SetAtName(FX_BSTRC("Type"), FX_BSTRC("XObject"));
- pDict->SetAtName(FX_BSTRC("Subtype"), FX_BSTRC("Image"));
- pDict->SetAtInteger(FX_BSTRC("Width"), BitmapWidth);
- pDict->SetAtInteger(FX_BSTRC("Height"), BitmapHeight);
+ pDict->SetAtName("Type", "XObject");
+ pDict->SetAtName("Subtype", "Image");
+ pDict->SetAtInteger("Width", BitmapWidth);
+ pDict->SetAtInteger("Height", BitmapHeight);
uint8_t* dest_buf = NULL;
FX_STRSIZE dest_pitch = 0, dest_size = 0, opType = -1;
if (bpp == 1) {
@@ -130,17 +130,17 @@ void CPDF_Image::SetImage(const CFX_DIBitmap* pBitmap,
ArgbDecode(pBitmap->GetPaletteArgb(1), set_a, set_r, set_g, set_b);
}
if (set_a == 0 || reset_a == 0) {
- pDict->SetAt(FX_BSTRC("ImageMask"), new CPDF_Boolean(TRUE));
+ pDict->SetAt("ImageMask", new CPDF_Boolean(TRUE));
if (reset_a == 0) {
CPDF_Array* pArray = new CPDF_Array;
pArray->AddInteger(1);
pArray->AddInteger(0);
- pDict->SetAt(FX_BSTRC("Decode"), pArray);
+ pDict->SetAt("Decode", pArray);
}
} else {
CPDF_Array* pCS = new CPDF_Array;
- pCS->AddName(FX_BSTRC("Indexed"));
- pCS->AddName(FX_BSTRC("DeviceRGB"));
+ pCS->AddName("Indexed");
+ pCS->AddName("DeviceRGB");
pCS->AddInteger(1);
CFX_ByteString ct;
FX_CHAR* pBuf = ct.GetBuffer(6);
@@ -152,9 +152,9 @@ void CPDF_Image::SetImage(const CFX_DIBitmap* pBitmap,
pBuf[5] = (FX_CHAR)set_b;
ct.ReleaseBuffer(6);
pCS->Add(CPDF_String::Create(ct, TRUE));
- pDict->SetAt(FX_BSTRC("ColorSpace"), pCS);
+ pDict->SetAt("ColorSpace", pCS);
}
- pDict->SetAtInteger(FX_BSTRC("BitsPerComponent"), 1);
+ pDict->SetAtInteger("BitsPerComponent", 1);
dest_pitch = (BitmapWidth + 7) / 8;
if ((iCompress & 0x03) == PDF_IMAGE_NO_COMPRESS) {
opType = 1;
@@ -166,8 +166,8 @@ void CPDF_Image::SetImage(const CFX_DIBitmap* pBitmap,
if (iPalette > 0) {
CPDF_Array* pCS = new CPDF_Array;
m_pDocument->AddIndirectObject(pCS);
- pCS->AddName(FX_BSTRC("Indexed"));
- pCS->AddName(FX_BSTRC("DeviceRGB"));
+ pCS->AddName("Indexed");
+ pCS->AddName("DeviceRGB");
pCS->AddInteger(iPalette - 1);
uint8_t* pColorTable = FX_Alloc2D(uint8_t, iPalette, 3);
uint8_t* ptr = pColorTable;
@@ -182,11 +182,11 @@ void CPDF_Image::SetImage(const CFX_DIBitmap* pBitmap,
new CPDF_Stream(pColorTable, iPalette * 3, new CPDF_Dictionary);
m_pDocument->AddIndirectObject(pCTS);
pCS->AddReference(m_pDocument, pCTS);
- pDict->SetAtReference(FX_BSTRC("ColorSpace"), m_pDocument, pCS);
+ pDict->SetAtReference("ColorSpace", m_pDocument, pCS);
} else {
- pDict->SetAtName(FX_BSTRC("ColorSpace"), FX_BSTRC("DeviceGray"));
+ pDict->SetAtName("ColorSpace", "DeviceGray");
}
- pDict->SetAtInteger(FX_BSTRC("BitsPerComponent"), 8);
+ pDict->SetAtInteger("BitsPerComponent", 8);
if ((iCompress & 0x03) == PDF_IMAGE_NO_COMPRESS) {
dest_pitch = BitmapWidth;
opType = 1;
@@ -194,8 +194,8 @@ void CPDF_Image::SetImage(const CFX_DIBitmap* pBitmap,
opType = 0;
}
} else {
- pDict->SetAtName(FX_BSTRC("ColorSpace"), FX_BSTRC("DeviceRGB"));
- pDict->SetAtInteger(FX_BSTRC("BitsPerComponent"), 8);
+ pDict->SetAtName("ColorSpace", "DeviceRGB");
+ pDict->SetAtInteger("BitsPerComponent", 8);
if ((iCompress & 0x03) == PDF_IMAGE_NO_COMPRESS) {
dest_pitch = BitmapWidth * 3;
opType = 2;
@@ -221,12 +221,12 @@ void CPDF_Image::SetImage(const CFX_DIBitmap* pBitmap,
uint8_t* mask_buf = NULL;
FX_STRSIZE mask_size = 0;
CPDF_Dictionary* pMaskDict = new CPDF_Dictionary;
- pMaskDict->SetAtName(FX_BSTRC("Type"), FX_BSTRC("XObject"));
- pMaskDict->SetAtName(FX_BSTRC("Subtype"), FX_BSTRC("Image"));
- pMaskDict->SetAtInteger(FX_BSTRC("Width"), maskWidth);
- pMaskDict->SetAtInteger(FX_BSTRC("Height"), maskHeight);
- pMaskDict->SetAtName(FX_BSTRC("ColorSpace"), FX_BSTRC("DeviceGray"));
- pMaskDict->SetAtInteger(FX_BSTRC("BitsPerComponent"), 8);
+ pMaskDict->SetAtName("Type", "XObject");
+ pMaskDict->SetAtName("Subtype", "Image");
+ pMaskDict->SetAtInteger("Width", maskWidth);
+ pMaskDict->SetAtInteger("Height", maskHeight);
+ pMaskDict->SetAtName("ColorSpace", "DeviceGray");
+ pMaskDict->SetAtInteger("BitsPerComponent", 8);
if (pMaskBitmap->GetBPP() == 8 &&
(iCompress & PDF_IMAGE_MASK_LOSSY_COMPRESS) != 0) {
_DCTEncodeBitmap(pMaskDict, pMaskBitmap, pParam ? pParam->nQuality : 75,
@@ -242,7 +242,7 @@ void CPDF_Image::SetImage(const CFX_DIBitmap* pBitmap,
maskWidth);
}
}
- pMaskDict->SetAtInteger(FX_BSTRC("Length"), mask_size);
+ pMaskDict->SetAtInteger("Length", mask_size);
if (bUseMatte) {
int a, r, g, b;
ArgbDecode(*(pParam->pMatteColor), a, r, g, b);
@@ -250,11 +250,11 @@ void CPDF_Image::SetImage(const CFX_DIBitmap* pBitmap,
pMatte->AddInteger(r);
pMatte->AddInteger(g);
pMatte->AddInteger(b);
- pMaskDict->SetAt(FX_BSTRC("Matte"), pMatte);
+ pMaskDict->SetAt("Matte", pMatte);
}
CPDF_Stream* pMaskStream = new CPDF_Stream(mask_buf, mask_size, pMaskDict);
m_pDocument->AddIndirectObject(pMaskStream);
- pDict->SetAtReference(FX_BSTRC("SMask"), m_pDocument, pMaskStream);
+ pDict->SetAtReference("SMask", m_pDocument, pMaskStream);
if (bDeleteMask) {
delete pMaskBitmap;
}
diff --git a/core/src/fpdfapi/fpdf_font/fpdf_font.cpp b/core/src/fpdfapi/fpdf_font/fpdf_font.cpp
index 64d6cdce92..b515d90a7f 100644
--- a/core/src/fpdfapi/fpdf_font/fpdf_font.cpp
+++ b/core/src/fpdfapi/fpdf_font/fpdf_font.cpp
@@ -141,13 +141,13 @@ FX_BOOL CPDF_Font::IsVertWriting() const {
CFX_ByteString CPDF_Font::GetFontTypeName() const {
switch (m_FontType) {
case PDFFONT_TYPE1:
- return FX_BSTRC("Type1");
+ return "Type1";
case PDFFONT_TRUETYPE:
- return FX_BSTRC("TrueType");
+ return "TrueType";
case PDFFONT_TYPE3:
- return FX_BSTRC("Type3");
+ return "Type3";
case PDFFONT_CIDFONT:
- return FX_BSTRC("Type0");
+ return "Type0";
}
return CFX_ByteString();
}
@@ -220,11 +220,11 @@ CFX_ByteString CPDF_Font::EncodeString(const CFX_WideString& str) const {
}
void CPDF_Font::LoadFontDescriptor(CPDF_Dictionary* pFontDesc) {
- m_Flags = pFontDesc->GetInteger(FX_BSTRC("Flags"), PDFFONT_NONSYMBOLIC);
+ m_Flags = pFontDesc->GetInteger("Flags", PDFFONT_NONSYMBOLIC);
int ItalicAngle = 0;
FX_BOOL bExistItalicAngle = FALSE;
- if (pFontDesc->KeyExist(FX_BSTRC("ItalicAngle"))) {
- ItalicAngle = pFontDesc->GetInteger(FX_BSTRC("ItalicAngle"));
+ if (pFontDesc->KeyExist("ItalicAngle")) {
+ ItalicAngle = pFontDesc->GetInteger("ItalicAngle");
bExistItalicAngle = TRUE;
}
if (ItalicAngle < 0) {
@@ -232,22 +232,22 @@ void CPDF_Font::LoadFontDescriptor(CPDF_Dictionary* pFontDesc) {
m_ItalicAngle = ItalicAngle;
}
FX_BOOL bExistStemV = FALSE;
- if (pFontDesc->KeyExist(FX_BSTRC("StemV"))) {
- m_StemV = pFontDesc->GetInteger(FX_BSTRC("StemV"));
+ if (pFontDesc->KeyExist("StemV")) {
+ m_StemV = pFontDesc->GetInteger("StemV");
bExistStemV = TRUE;
}
FX_BOOL bExistAscent = FALSE;
- if (pFontDesc->KeyExist(FX_BSTRC("Ascent"))) {
- m_Ascent = pFontDesc->GetInteger(FX_BSTRC("Ascent"));
+ if (pFontDesc->KeyExist("Ascent")) {
+ m_Ascent = pFontDesc->GetInteger("Ascent");
bExistAscent = TRUE;
}
FX_BOOL bExistDescent = FALSE;
- if (pFontDesc->KeyExist(FX_BSTRC("Descent"))) {
- m_Descent = pFontDesc->GetInteger(FX_BSTRC("Descent"));
+ if (pFontDesc->KeyExist("Descent")) {
+ m_Descent = pFontDesc->GetInteger("Descent");
bExistDescent = TRUE;
}
FX_BOOL bExistCapHeight = FALSE;
- if (pFontDesc->KeyExist(FX_BSTRC("CapHeight"))) {
+ if (pFontDesc->KeyExist("CapHeight")) {
bExistCapHeight = TRUE;
}
if (bExistItalicAngle && bExistAscent && bExistCapHeight && bExistDescent &&
@@ -257,7 +257,7 @@ void CPDF_Font::LoadFontDescriptor(CPDF_Dictionary* pFontDesc) {
if (m_Descent > 10) {
m_Descent = -m_Descent;
}
- CPDF_Array* pBBox = pFontDesc->GetArray(FX_BSTRC("FontBBox"));
+ CPDF_Array* pBBox = pFontDesc->GetArray("FontBBox");
if (pBBox) {
m_FontBBox.left = pBBox->GetInteger(0);
m_FontBBox.bottom = pBBox->GetInteger(1);
@@ -265,11 +265,11 @@ void CPDF_Font::LoadFontDescriptor(CPDF_Dictionary* pFontDesc) {
m_FontBBox.top = pBBox->GetInteger(3);
}
- CPDF_Stream* pFontFile = pFontDesc->GetStream(FX_BSTRC("FontFile"));
+ CPDF_Stream* pFontFile = pFontDesc->GetStream("FontFile");
if (!pFontFile)
- pFontFile = pFontDesc->GetStream(FX_BSTRC("FontFile2"));
+ pFontFile = pFontDesc->GetStream("FontFile2");
if (!pFontFile)
- pFontFile = pFontDesc->GetStream(FX_BSTRC("FontFile3"));
+ pFontFile = pFontDesc->GetStream("FontFile3");
if (!pFontFile)
return;
@@ -350,7 +350,7 @@ void CPDF_Font::CheckFontMetrics() {
}
void CPDF_Font::LoadUnicodeMap() {
m_bToUnicodeLoaded = TRUE;
- CPDF_Stream* pStream = m_pFontDict->GetStream(FX_BSTRC("ToUnicode"));
+ CPDF_Stream* pStream = m_pFontDict->GetStream("ToUnicode");
if (pStream == NULL) {
return;
}
@@ -391,10 +391,10 @@ CPDF_Font* CPDF_Font::GetStockFont(CPDF_Document* pDoc,
return pFont;
}
CPDF_Dictionary* pDict = CPDF_Dictionary::Create();
- pDict->SetAtName(FX_BSTRC("Type"), FX_BSTRC("Font"));
- pDict->SetAtName(FX_BSTRC("Subtype"), FX_BSTRC("Type1"));
- pDict->SetAtName(FX_BSTRC("BaseFont"), fontname);
- pDict->SetAtName(FX_BSTRC("Encoding"), FX_BSTRC("WinAnsiEncoding"));
+ pDict->SetAtName("Type", "Font");
+ pDict->SetAtName("Subtype", "Type1");
+ pDict->SetAtName("BaseFont", fontname);
+ pDict->SetAtName("Encoding", "WinAnsiEncoding");
pFont = CPDF_Font::CreateFontF(NULL, pDict);
pFontGlobals->Set(pDoc, font_id, pFont);
return pFont;
@@ -406,15 +406,15 @@ const uint8_t ChineseFontNames[][5] = {{0xCB, 0xCE, 0xCC, 0xE5, 0x00},
{0xD0, 0xC2, 0xCB, 0xCE, 0x00}};
CPDF_Font* CPDF_Font::CreateFontF(CPDF_Document* pDoc,
CPDF_Dictionary* pFontDict) {
- CFX_ByteString type = pFontDict->GetString(FX_BSTRC("Subtype"));
+ CFX_ByteString type = pFontDict->GetString("Subtype");
CPDF_Font* pFont;
- if (type == FX_BSTRC("TrueType")) {
+ if (type == "TrueType") {
{
#if _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_ || \
_FXM_PLATFORM_ == _FXM_PLATFORM_LINUX_ || \
_FXM_PLATFORM_ == _FXM_PLATFORM_ANDROID_ || \
_FXM_PLATFORM_ == _FXM_PLATFORM_APPLE_
- CFX_ByteString basefont = pFontDict->GetString(FX_BSTRC("BaseFont"));
+ CFX_ByteString basefont = pFontDict->GetString("BaseFont");
CFX_ByteString tag = basefont.Left(4);
int i;
int count = sizeof(ChineseFontNames) / sizeof(ChineseFontNames[0]);
@@ -424,9 +424,8 @@ CPDF_Font* CPDF_Font::CreateFontF(CPDF_Document* pDoc,
}
}
if (i < count) {
- CPDF_Dictionary* pFontDesc =
- pFontDict->GetDict(FX_BSTRC("FontDescriptor"));
- if (pFontDesc == NULL || !pFontDesc->KeyExist(FX_BSTRC("FontFile2"))) {
+ CPDF_Dictionary* pFontDesc = pFontDict->GetDict("FontDescriptor");
+ if (pFontDesc == NULL || !pFontDesc->KeyExist("FontFile2")) {
pFont = new CPDF_CIDFont;
pFont->m_pFontDict = pFontDict;
pFont->m_pDocument = pDoc;
@@ -440,9 +439,9 @@ CPDF_Font* CPDF_Font::CreateFontF(CPDF_Document* pDoc,
#endif
}
pFont = new CPDF_TrueTypeFont;
- } else if (type == FX_BSTRC("Type3")) {
+ } else if (type == "Type3") {
pFont = new CPDF_Type3Font;
- } else if (type == FX_BSTRC("Type0")) {
+ } else if (type == "Type0") {
pFont = new CPDF_CIDFont;
} else {
pFont = new CPDF_Type1Font;
@@ -459,10 +458,10 @@ FX_BOOL CPDF_Font::Load() {
if (m_pFontDict == NULL) {
return FALSE;
}
- CFX_ByteString type = m_pFontDict->GetString(FX_BSTRC("Subtype"));
- m_BaseFont = m_pFontDict->GetString(FX_BSTRC("BaseFont"));
- if (type == FX_BSTRC("MMType1")) {
- type = FX_BSTRC("Type1");
+ CFX_ByteString type = m_pFontDict->GetString("Subtype");
+ m_BaseFont = m_pFontDict->GetString("BaseFont");
+ if (type == "MMType1") {
+ type = "Type1";
}
return _Load();
}
@@ -588,10 +587,10 @@ void CPDF_ToUnicodeMap::Load(CPDF_Stream* pStream) {
if (word.IsEmpty()) {
break;
}
- if (word == FX_BSTRC("beginbfchar")) {
+ if (word == "beginbfchar") {
while (1) {
word = parser.GetWord();
- if (word.IsEmpty() || word == FX_BSTRC("endbfchar")) {
+ if (word.IsEmpty() || word == "endbfchar") {
break;
}
FX_DWORD srccode = StringToCode(word);
@@ -609,11 +608,11 @@ void CPDF_ToUnicodeMap::Load(CPDF_Stream* pStream) {
m_MultiCharBuf << destcode;
}
}
- } else if (word == FX_BSTRC("beginbfrange")) {
+ } else if (word == "beginbfrange") {
while (1) {
CFX_ByteString low, high;
low = parser.GetWord();
- if (low.IsEmpty() || low == FX_BSTRC("endbfrange")) {
+ if (low.IsEmpty() || low == "endbfrange") {
break;
}
high = parser.GetWord();
@@ -624,7 +623,7 @@ void CPDF_ToUnicodeMap::Load(CPDF_Stream* pStream) {
break;
}
CFX_ByteString start = parser.GetWord();
- if (start == FX_BSTRC("[")) {
+ if (start == "[") {
for (FX_DWORD code = lowcode; code <= highcode; code++) {
CFX_ByteString dest = parser.GetWord();
CFX_WideString destcode = StringToWideString(dest);
@@ -666,13 +665,13 @@ void CPDF_ToUnicodeMap::Load(CPDF_Stream* pStream) {
}
}
}
- } else if (word == FX_BSTRC("/Adobe-Korea1-UCS2")) {
+ } else if (word == "/Adobe-Korea1-UCS2") {
cid_set = CIDSET_KOREA1;
- } else if (word == FX_BSTRC("/Adobe-Japan1-UCS2")) {
+ } else if (word == "/Adobe-Japan1-UCS2") {
cid_set = CIDSET_JAPAN1;
- } else if (word == FX_BSTRC("/Adobe-CNS1-UCS2")) {
+ } else if (word == "/Adobe-CNS1-UCS2") {
cid_set = CIDSET_CNS1;
- } else if (word == FX_BSTRC("/Adobe-GB1-UCS2")) {
+ } else if (word == "/Adobe-GB1-UCS2") {
cid_set = CIDSET_GB1;
}
}
@@ -687,13 +686,13 @@ void CPDF_ToUnicodeMap::Load(CPDF_Stream* pStream) {
}
static FX_BOOL GetPredefinedEncoding(int& basemap,
const CFX_ByteString& value) {
- if (value == FX_BSTRC("WinAnsiEncoding")) {
+ if (value == "WinAnsiEncoding") {
basemap = PDFFONT_ENCODING_WINANSI;
- } else if (value == FX_BSTRC("MacRomanEncoding")) {
+ } else if (value == "MacRomanEncoding") {
basemap = PDFFONT_ENCODING_MACROMAN;
- } else if (value == FX_BSTRC("MacExpertEncoding")) {
+ } else if (value == "MacExpertEncoding") {
basemap = PDFFONT_ENCODING_MACEXPERT;
- } else if (value == FX_BSTRC("PDFDocEncoding")) {
+ } else if (value == "PDFDocEncoding") {
basemap = PDFFONT_ENCODING_PDFDOC;
} else {
return FALSE;
@@ -706,7 +705,7 @@ void CPDF_Font::LoadPDFEncoding(CPDF_Object* pEncoding,
FX_BOOL bEmbedded,
FX_BOOL bTrueType) {
if (pEncoding == NULL) {
- if (m_BaseFont == FX_BSTRC("Symbol")) {
+ if (m_BaseFont == "Symbol") {
iBaseEncoding = bTrueType ? PDFFONT_ENCODING_MS_SYMBOL
: PDFFONT_ENCODING_ADOBE_SYMBOL;
} else if (!bEmbedded && iBaseEncoding == PDFFONT_ENCODING_BUILTIN) {
@@ -719,15 +718,15 @@ void CPDF_Font::LoadPDFEncoding(CPDF_Object* pEncoding,
iBaseEncoding == PDFFONT_ENCODING_ZAPFDINGBATS) {
return;
}
- if ((m_Flags & PDFFONT_SYMBOLIC) && m_BaseFont == FX_BSTRC("Symbol")) {
+ if ((m_Flags & PDFFONT_SYMBOLIC) && m_BaseFont == "Symbol") {
if (!bTrueType) {
iBaseEncoding = PDFFONT_ENCODING_ADOBE_SYMBOL;
}
return;
}
CFX_ByteString bsEncoding = pEncoding->GetString();
- if (bsEncoding.Compare(FX_BSTRC("MacExpertEncoding")) == 0) {
- bsEncoding = FX_BSTRC("WinAnsiEncoding");
+ if (bsEncoding.Compare("MacExpertEncoding") == 0) {
+ bsEncoding = "WinAnsiEncoding";
}
GetPredefinedEncoding(iBaseEncoding, bsEncoding);
return;
@@ -739,16 +738,16 @@ void CPDF_Font::LoadPDFEncoding(CPDF_Object* pEncoding,
if (iBaseEncoding != PDFFONT_ENCODING_ADOBE_SYMBOL &&
iBaseEncoding != PDFFONT_ENCODING_ZAPFDINGBATS) {
- CFX_ByteString bsEncoding = pDict->GetString(FX_BSTRC("BaseEncoding"));
- if (bsEncoding.Compare(FX_BSTRC("MacExpertEncoding")) == 0 && bTrueType) {
- bsEncoding = FX_BSTRC("WinAnsiEncoding");
+ CFX_ByteString bsEncoding = pDict->GetString("BaseEncoding");
+ if (bsEncoding.Compare("MacExpertEncoding") == 0 && bTrueType) {
+ bsEncoding = "WinAnsiEncoding";
}
GetPredefinedEncoding(iBaseEncoding, bsEncoding);
}
if ((!bEmbedded || bTrueType) && iBaseEncoding == PDFFONT_ENCODING_BUILTIN) {
iBaseEncoding = PDFFONT_ENCODING_STANDARD;
}
- CPDF_Array* pDiffs = pDict->GetArray(FX_BSTRC("Differences"));
+ CPDF_Array* pDiffs = pDict->GetArray("Differences");
if (pDiffs == NULL) {
return;
}
@@ -889,23 +888,23 @@ const FX_CHAR* GetAdobeCharName(int iBaseEncoding,
return name;
}
FX_BOOL CPDF_SimpleFont::LoadCommon() {
- CPDF_Dictionary* pFontDesc = m_pFontDict->GetDict(FX_BSTRC("FontDescriptor"));
+ CPDF_Dictionary* pFontDesc = m_pFontDict->GetDict("FontDescriptor");
if (pFontDesc) {
LoadFontDescriptor(pFontDesc);
}
- CPDF_Array* pWidthArray = m_pFontDict->GetArray(FX_BSTRC("Widths"));
+ CPDF_Array* pWidthArray = m_pFontDict->GetArray("Widths");
int width_start = 0, width_end = -1;
m_bUseFontWidth = TRUE;
if (pWidthArray) {
m_bUseFontWidth = FALSE;
- if (pFontDesc && pFontDesc->KeyExist(FX_BSTRC("MissingWidth"))) {
- int MissingWidth = pFontDesc->GetInteger(FX_BSTRC("MissingWidth"));
+ if (pFontDesc && pFontDesc->KeyExist("MissingWidth")) {
+ int MissingWidth = pFontDesc->GetInteger("MissingWidth");
for (int i = 0; i < 256; i++) {
m_CharWidth[i] = MissingWidth;
}
}
- width_start = m_pFontDict->GetInteger(FX_BSTRC("FirstChar"), 0);
- width_end = m_pFontDict->GetInteger(FX_BSTRC("LastChar"), 0);
+ width_start = m_pFontDict->GetInteger("FirstChar", 0);
+ width_end = m_pFontDict->GetInteger("LastChar", 0);
if (width_start >= 0 && width_start <= 255) {
if (width_end <= 0 ||
width_end >= width_start + (int)pWidthArray->GetCount()) {
@@ -929,7 +928,7 @@ FX_BOOL CPDF_SimpleFont::LoadCommon() {
if (!(m_Flags & PDFFONT_SYMBOLIC)) {
m_BaseEncoding = PDFFONT_ENCODING_STANDARD;
}
- CPDF_Object* pEncoding = m_pFontDict->GetElementValue(FX_BSTRC("Encoding"));
+ CPDF_Object* pEncoding = m_pFontDict->GetElementValue("Encoding");
LoadPDFEncoding(pEncoding, m_BaseEncoding, m_pCharNames, m_pFontFile != NULL,
m_Font.IsTTFont());
LoadGlyphMap();
@@ -990,10 +989,9 @@ CPDF_Type1Font::CPDF_Type1Font() : CPDF_SimpleFont(PDFFONT_TYPE1) {
FX_BOOL CPDF_Type1Font::_Load() {
m_Base14Font = PDF_GetStandardFontName(&m_BaseFont);
if (m_Base14Font >= 0) {
- CPDF_Dictionary* pFontDesc =
- m_pFontDict->GetDict(FX_BSTRC("FontDescriptor"));
- if (pFontDesc && pFontDesc->KeyExist(FX_BSTRC("Flags"))) {
- m_Flags = pFontDesc->GetInteger(FX_BSTRC("Flags"));
+ CPDF_Dictionary* pFontDesc = m_pFontDict->GetDict("FontDescriptor");
+ if (pFontDesc && pFontDesc->KeyExist("Flags")) {
+ m_Flags = pFontDesc->GetInteger("Flags");
} else {
m_Flags = m_Base14Font >= 12 ? PDFFONT_SYMBOLIC : PDFFONT_NONSYMBOLIC;
}
@@ -1407,7 +1405,7 @@ CPDF_Object* CPDF_FontEncoding::Realize() {
return NULL;
}
CPDF_Dictionary* pDict = CPDF_Dictionary::Create();
- pDict->SetAtName(FX_BSTRC("BaseEncoding"), FX_BSTRC("WinAnsiEncoding"));
+ pDict->SetAtName("BaseEncoding", "WinAnsiEncoding");
const FX_WORD* pStandard =
PDF_UnicodesForPredefinedCharSet(PDFFONT_ENCODING_WINANSI);
CPDF_Array* pDiff = CPDF_Array::Create();
@@ -1418,7 +1416,7 @@ CPDF_Object* CPDF_FontEncoding::Realize() {
pDiff->Add(CPDF_Number::Create(i));
pDiff->Add(CPDF_Name::Create(PDF_AdobeNameFromUnicode(m_Unicodes[i])));
}
- pDict->SetAt(FX_BSTRC("Differences"), pDiff);
+ pDict->SetAt("Differences", pDiff);
return pDict;
}
CPDF_TrueTypeFont::CPDF_TrueTypeFont() : CPDF_SimpleFont(PDFFONT_TRUETYPE) {}
@@ -1459,7 +1457,7 @@ void CPDF_TrueTypeFont::LoadGlyphMap() {
(m_Flags & PDFFONT_NONSYMBOLIC)) {
if (!FXFT_Has_Glyph_Names(m_Font.GetFace()) &&
(!m_Font.GetFace()->num_charmaps || !m_Font.GetFace()->charmaps)) {
- int nStartChar = m_pFontDict->GetInteger(FX_BSTRC("FirstChar"));
+ int nStartChar = m_pFontDict->GetInteger("FirstChar");
if (nStartChar < 0 || nStartChar > 255)
return;
@@ -1484,7 +1482,7 @@ void CPDF_TrueTypeFont::LoadGlyphMap() {
bMacRoman = !bMSSymbol && FT_UseTTCharmap(m_Font.GetFace(), 1, 0);
}
}
- FX_BOOL bToUnicode = m_pFontDict->KeyExist(FX_BSTRC("ToUnicode"));
+ FX_BOOL bToUnicode = m_pFontDict->KeyExist("ToUnicode");
for (int charcode = 0; charcode < 256; charcode++) {
const FX_CHAR* name =
GetAdobeCharName(baseEncoding, m_pCharNames, charcode);
@@ -1635,15 +1633,15 @@ CPDF_Type3Font::~CPDF_Type3Font() {
}
FX_BOOL CPDF_Type3Font::_Load() {
- m_pFontResources = m_pFontDict->GetDict(FX_BSTRC("Resources"));
- CPDF_Array* pMatrix = m_pFontDict->GetArray(FX_BSTRC("FontMatrix"));
+ m_pFontResources = m_pFontDict->GetDict("Resources");
+ CPDF_Array* pMatrix = m_pFontDict->GetArray("FontMatrix");
FX_FLOAT xscale = 1.0f, yscale = 1.0f;
if (pMatrix) {
m_FontMatrix = pMatrix->GetMatrix();
xscale = m_FontMatrix.a;
yscale = m_FontMatrix.d;
}
- CPDF_Array* pBBox = m_pFontDict->GetArray(FX_BSTRC("FontBBox"));
+ CPDF_Array* pBBox = m_pFontDict->GetArray("FontBBox");
if (pBBox) {
m_FontBBox.left = (int32_t)(FXSYS_Mul(pBBox->GetNumber(0), xscale) * 1000);
m_FontBBox.bottom =
@@ -1651,8 +1649,8 @@ FX_BOOL CPDF_Type3Font::_Load() {
m_FontBBox.right = (int32_t)(FXSYS_Mul(pBBox->GetNumber(2), xscale) * 1000);
m_FontBBox.top = (int32_t)(FXSYS_Mul(pBBox->GetNumber(3), yscale) * 1000);
}
- int StartChar = m_pFontDict->GetInteger(FX_BSTRC("FirstChar"));
- CPDF_Array* pWidthArray = m_pFontDict->GetArray(FX_BSTRC("Widths"));
+ int StartChar = m_pFontDict->GetInteger("FirstChar");
+ CPDF_Array* pWidthArray = m_pFontDict->GetArray("Widths");
if (pWidthArray && (StartChar >= 0 && StartChar < 256)) {
FX_DWORD count = pWidthArray->GetCount();
if (count > 256) {
@@ -1666,8 +1664,8 @@ FX_BOOL CPDF_Type3Font::_Load() {
FXSYS_round(FXSYS_Mul(pWidthArray->GetNumber(i), xscale) * 1000);
}
}
- m_pCharProcs = m_pFontDict->GetDict(FX_BSTRC("CharProcs"));
- CPDF_Object* pEncoding = m_pFontDict->GetElementValue(FX_BSTRC("Encoding"));
+ m_pCharProcs = m_pFontDict->GetDict("CharProcs");
+ CPDF_Object* pEncoding = m_pFontDict->GetElementValue("Encoding");
if (pEncoding) {
LoadPDFEncoding(pEncoding, m_BaseEncoding, m_pCharNames, FALSE, FALSE);
if (m_pCharNames) {
diff --git a/core/src/fpdfapi/fpdf_font/fpdf_font_cid.cpp b/core/src/fpdfapi/fpdf_font/fpdf_font_cid.cpp
index 1434c9d336..89004fee55 100644
--- a/core/src/fpdfapi/fpdf_font/fpdf_font_cid.cpp
+++ b/core/src/fpdfapi/fpdf_font/fpdf_font_cid.cpp
@@ -605,27 +605,26 @@ void CPDF_CMapParser::ParseWord(const CFX_ByteStringC& word) {
if (word.IsEmpty()) {
return;
}
- if (word == FX_BSTRC("begincidchar")) {
+ if (word == "begincidchar") {
m_Status = 1;
m_CodeSeq = 0;
- } else if (word == FX_BSTRC("begincidrange")) {
+ } else if (word == "begincidrange") {
m_Status = 2;
m_CodeSeq = 0;
- } else if (word == FX_BSTRC("endcidrange") ||
- word == FX_BSTRC("endcidchar")) {
+ } else if (word == "endcidrange" || word == "endcidchar") {
m_Status = 0;
- } else if (word == FX_BSTRC("/WMode")) {
+ } else if (word == "/WMode") {
m_Status = 6;
- } else if (word == FX_BSTRC("/Registry")) {
+ } else if (word == "/Registry") {
m_Status = 3;
- } else if (word == FX_BSTRC("/Ordering")) {
+ } else if (word == "/Ordering") {
m_Status = 4;
- } else if (word == FX_BSTRC("/Supplement")) {
+ } else if (word == "/Supplement") {
m_Status = 5;
- } else if (word == FX_BSTRC("begincodespacerange")) {
+ } else if (word == "begincodespacerange") {
m_Status = 7;
m_CodeSeq = 0;
- } else if (word == FX_BSTRC("usecmap")) {
+ } else if (word == "usecmap") {
} else if (m_Status == 1 || m_Status == 2) {
m_CodePoints[m_CodeSeq] = CMap_GetCode(word);
m_CodeSeq++;
@@ -669,7 +668,7 @@ void CPDF_CMapParser::ParseWord(const CFX_ByteStringC& word) {
m_pCMap->m_bVertical = CMap_GetCode(word);
m_Status = 0;
} else if (m_Status == 7) {
- if (word == FX_BSTRC("endcodespacerange")) {
+ if (word == "endcodespacerange") {
int nSegs = m_CodeRanges.GetSize();
if (nSegs > 1) {
m_pCMap->m_CodingScheme = CPDF_CMap::MixedFourBytes;
@@ -779,15 +778,14 @@ FX_BOOL CPDF_CMap::LoadPredefined(CPDF_CMapManager* pMgr,
const FX_CHAR* pName,
FX_BOOL bPromptCJK) {
m_PredefinedCMap = pName;
- if (m_PredefinedCMap == FX_BSTRC("Identity-H") ||
- m_PredefinedCMap == FX_BSTRC("Identity-V")) {
+ if (m_PredefinedCMap == "Identity-H" || m_PredefinedCMap == "Identity-V") {
m_Coding = CIDCODING_CID;
m_bVertical = pName[9] == 'V';
m_bLoaded = TRUE;
return TRUE;
}
CFX_ByteString cmapid = m_PredefinedCMap;
- m_bVertical = cmapid.Right(1) == FX_BSTRC("V");
+ m_bVertical = cmapid.Right(1) == "V";
if (cmapid.GetLength() > 2) {
cmapid = cmapid.Left(cmapid.GetLength() - 2);
}
@@ -1155,10 +1153,10 @@ FX_DWORD CPDF_CIDFont::_CharCodeFromUnicode(FX_WCHAR unicode) const {
}
FX_BOOL CPDF_CIDFont::_Load() {
- if (m_pFontDict->GetString(FX_BSTRC("Subtype")) == FX_BSTRC("TrueType")) {
+ if (m_pFontDict->GetString("Subtype") == "TrueType") {
return LoadGB2312();
}
- CPDF_Array* pFonts = m_pFontDict->GetArray(FX_BSTRC("DescendantFonts"));
+ CPDF_Array* pFonts = m_pFontDict->GetArray("DescendantFonts");
if (pFonts == NULL) {
return FALSE;
}
@@ -1169,7 +1167,7 @@ FX_BOOL CPDF_CIDFont::_Load() {
if (pCIDFontDict == NULL) {
return FALSE;
}
- m_BaseFont = pCIDFontDict->GetString(FX_BSTRC("BaseFont"));
+ m_BaseFont = pCIDFontDict->GetString("BaseFont");
if ((m_BaseFont.Compare("CourierStd") == 0 ||
m_BaseFont.Compare("CourierStd-Bold") == 0 ||
m_BaseFont.Compare("CourierStd-BoldOblique") == 0 ||
@@ -1177,17 +1175,16 @@ FX_BOOL CPDF_CIDFont::_Load() {
!IsEmbedded()) {
m_bAdobeCourierStd = TRUE;
}
- CPDF_Dictionary* pFontDesc =
- pCIDFontDict->GetDict(FX_BSTRC("FontDescriptor"));
+ CPDF_Dictionary* pFontDesc = pCIDFontDict->GetDict("FontDescriptor");
if (pFontDesc) {
LoadFontDescriptor(pFontDesc);
}
- CPDF_Object* pEncoding = m_pFontDict->GetElementValue(FX_BSTRC("Encoding"));
+ CPDF_Object* pEncoding = m_pFontDict->GetElementValue("Encoding");
if (pEncoding == NULL) {
return FALSE;
}
- CFX_ByteString subtype = pCIDFontDict->GetString(FX_BSTRC("Subtype"));
- m_bType1 = (subtype == FX_BSTRC("CIDFontType0"));
+ CFX_ByteString subtype = pCIDFontDict->GetString("Subtype");
+ m_bType1 = (subtype == "CIDFontType0");
if (pEncoding->IsName()) {
CFX_ByteString cmap = pEncoding->GetString();
@@ -1209,11 +1206,9 @@ FX_BOOL CPDF_CIDFont::_Load() {
}
m_Charset = m_pCMap->m_Charset;
if (m_Charset == CIDSET_UNKNOWN) {
- CPDF_Dictionary* pCIDInfo =
- pCIDFontDict->GetDict(FX_BSTRC("CIDSystemInfo"));
+ CPDF_Dictionary* pCIDInfo = pCIDFontDict->GetDict("CIDSystemInfo");
if (pCIDInfo) {
- m_Charset =
- CharsetFromOrdering(pCIDInfo->GetString(FX_BSTRC("Ordering")));
+ m_Charset = CharsetFromOrdering(pCIDInfo->GetString("Ordering"));
}
}
if (m_Charset != CIDSET_UNKNOWN)
@@ -1224,7 +1219,7 @@ FX_BOOL CPDF_CIDFont::_Load() {
->m_CMapManager.GetCID2UnicodeMap(
m_Charset,
m_pFontFile == NULL && (m_pCMap->m_Coding == CIDCODING_CID ||
- pCIDFontDict->KeyExist(FX_BSTRC("W"))));
+ pCIDFontDict->KeyExist("W")));
if (m_Font.GetFace()) {
if (m_bType1) {
FXFT_Select_Charmap(m_Font.GetFace(), FXFT_ENCODING_UNICODE);
@@ -1232,8 +1227,8 @@ FX_BOOL CPDF_CIDFont::_Load() {
FT_UseCIDCharmap(m_Font.GetFace(), m_pCMap->m_Coding);
}
}
- m_DefaultWidth = pCIDFontDict->GetInteger(FX_BSTRC("DW"), 1000);
- CPDF_Array* pWidthArray = pCIDFontDict->GetArray(FX_BSTRC("W"));
+ m_DefaultWidth = pCIDFontDict->GetInteger("DW", 1000);
+ CPDF_Array* pWidthArray = pCIDFontDict->GetArray("W");
if (pWidthArray) {
LoadMetricsArray(pWidthArray, m_WidthList, 1);
}
@@ -1242,13 +1237,12 @@ FX_BOOL CPDF_CIDFont::_Load() {
}
if (1) {
if (m_pFontFile || (GetSubstFont()->m_SubstFlags & FXFONT_SUBST_EXACT)) {
- CPDF_Object* pmap =
- pCIDFontDict->GetElementValue(FX_BSTRC("CIDToGIDMap"));
+ CPDF_Object* pmap = pCIDFontDict->GetElementValue("CIDToGIDMap");
if (pmap) {
if (CPDF_Stream* pStream = pmap->AsStream()) {
m_pCIDToGIDMap = new CPDF_StreamAcc;
m_pCIDToGIDMap->LoadAllData(pStream, FALSE);
- } else if (pmap->GetString() == FX_BSTRC("Identity")) {
+ } else if (pmap->GetString() == "Identity") {
#if _FXM_PLATFORM_ == _FXM_PLATFORM_APPLE_
if (m_pFontFile) {
m_bCIDIsGID = TRUE;
@@ -1262,11 +1256,11 @@ FX_BOOL CPDF_CIDFont::_Load() {
}
CheckFontMetrics();
if (IsVertWriting()) {
- pWidthArray = pCIDFontDict->GetArray(FX_BSTRC("W2"));
+ pWidthArray = pCIDFontDict->GetArray("W2");
if (pWidthArray) {
LoadMetricsArray(pWidthArray, m_VertMetrics, 3);
}
- CPDF_Array* pDefaultArray = pCIDFontDict->GetArray(FX_BSTRC("DW2"));
+ CPDF_Array* pDefaultArray = pCIDFontDict->GetArray("DW2");
if (pDefaultArray) {
m_DefaultVY = pDefaultArray->GetInteger(0);
m_DefaultW1 = pDefaultArray->GetInteger(1);
@@ -1693,8 +1687,8 @@ FX_FLOAT CPDF_CIDFont::CIDTransformToFloat(uint8_t ch) {
}
FX_BOOL CPDF_CIDFont::LoadGB2312() {
- m_BaseFont = m_pFontDict->GetString(FX_BSTRC("BaseFont"));
- CPDF_Dictionary* pFontDesc = m_pFontDict->GetDict(FX_BSTRC("FontDescriptor"));
+ m_BaseFont = m_pFontDict->GetString("BaseFont");
+ CPDF_Dictionary* pFontDesc = m_pFontDict->GetDict("FontDescriptor");
if (pFontDesc) {
LoadFontDescriptor(pFontDesc);
}
@@ -1703,7 +1697,7 @@ FX_BOOL CPDF_CIDFont::LoadGB2312() {
m_pCMap = CPDF_ModuleMgr::Get()
->GetPageModule()
->GetFontGlobals()
- ->m_CMapManager.GetPredefinedCMap(FX_BSTRC("GBK-EUC-H"), FALSE);
+ ->m_CMapManager.GetPredefinedCMap("GBK-EUC-H", FALSE);
m_pCID2UnicodeMap = CPDF_ModuleMgr::Get()
->GetPageModule()
->GetFontGlobals()
diff --git a/core/src/fpdfapi/fpdf_page/fpdf_page.cpp b/core/src/fpdfapi/fpdf_page/fpdf_page.cpp
index 45b796ce86..f37dd770ca 100644
--- a/core/src/fpdfapi/fpdf_page/fpdf_page.cpp
+++ b/core/src/fpdfapi/fpdf_page/fpdf_page.cpp
@@ -761,18 +761,18 @@ void CPDF_PageObjects::LoadTransInfo() {
if (m_pFormDict == NULL) {
return;
}
- CPDF_Dictionary* pGroup = m_pFormDict->GetDict(FX_BSTRC("Group"));
+ CPDF_Dictionary* pGroup = m_pFormDict->GetDict("Group");
if (pGroup == NULL) {
return;
}
- if (pGroup->GetString(FX_BSTRC("S")) != FX_BSTRC("Transparency")) {
+ if (pGroup->GetString("S") != "Transparency") {
return;
}
m_Transparency |= PDFTRANS_GROUP;
- if (pGroup->GetInteger(FX_BSTRC("I"))) {
+ if (pGroup->GetInteger("I")) {
m_Transparency |= PDFTRANS_ISOLATED;
}
- if (pGroup->GetInteger(FX_BSTRC("K"))) {
+ if (pGroup->GetInteger("K")) {
m_Transparency |= PDFTRANS_KNOCKOUT;
}
}
@@ -805,10 +805,10 @@ void CPDF_Page::Load(CPDF_Document* pDocument,
m_pPageResources = m_pResources = NULL;
return;
}
- CPDF_Object* pageAttr = GetPageAttr(FX_BSTRC("Resources"));
+ CPDF_Object* pageAttr = GetPageAttr("Resources");
m_pResources = pageAttr ? pageAttr->GetDict() : NULL;
m_pPageResources = m_pResources;
- CPDF_Object* pRotate = GetPageAttr(FX_BSTRC("Rotate"));
+ CPDF_Object* pRotate = GetPageAttr("Rotate");
int rotate = 0;
if (pRotate) {
rotate = pRotate->GetInteger() / 90 % 4;
@@ -816,7 +816,7 @@ void CPDF_Page::Load(CPDF_Document* pDocument,
if (rotate < 0) {
rotate += 4;
}
- CPDF_Array* pMediaBox = ToArray(GetPageAttr(FX_BSTRC("MediaBox")));
+ CPDF_Array* pMediaBox = ToArray(GetPageAttr("MediaBox"));
CFX_FloatRect mediabox;
if (pMediaBox) {
mediabox = pMediaBox->GetRect();
@@ -826,7 +826,7 @@ void CPDF_Page::Load(CPDF_Document* pDocument,
mediabox = CFX_FloatRect(0, 0, 612, 792);
}
- CPDF_Array* pCropBox = ToArray(GetPageAttr(FX_BSTRC("CropBox")));
+ CPDF_Array* pCropBox = ToArray(GetPageAttr("CropBox"));
if (pCropBox) {
m_BBox = pCropBox->GetRect();
m_BBox.Normalize();
@@ -889,7 +889,7 @@ CPDF_Object* FPDFAPI_GetPageAttr(CPDF_Dictionary* pPageDict,
if (pObj) {
return pObj;
}
- CPDF_Dictionary* pParent = pPageDict->GetDict(FX_BSTRC("Parent"));
+ CPDF_Dictionary* pParent = pPageDict->GetDict("Parent");
if (!pParent || pParent == pPageDict) {
return NULL;
}
@@ -910,7 +910,7 @@ CPDF_Form::CPDF_Form(CPDF_Document* pDoc,
m_pDocument = pDoc;
m_pFormStream = pFormStream;
m_pFormDict = pFormStream ? pFormStream->GetDict() : NULL;
- m_pResources = m_pFormDict->GetDict(FX_BSTRC("Resources"));
+ m_pResources = m_pFormDict->GetDict("Resources");
m_pPageResources = pPageResources;
if (m_pResources == NULL) {
m_pResources = pParentResources;
diff --git a/core/src/fpdfapi/fpdf_page/fpdf_page_colors.cpp b/core/src/fpdfapi/fpdf_page/fpdf_page_colors.cpp
index 934d102564..8deeb66deb 100644
--- a/core/src/fpdfapi/fpdf_page/fpdf_page_colors.cpp
+++ b/core/src/fpdfapi/fpdf_page/fpdf_page_colors.cpp
@@ -332,16 +332,16 @@ FX_BOOL CPDF_CalGray::v_Load(CPDF_Document* pDoc, CPDF_Array* pArray) {
if (!pDict)
return FALSE;
- CPDF_Array* pParam = pDict->GetArray(FX_BSTRC("WhitePoint"));
+ CPDF_Array* pParam = pDict->GetArray("WhitePoint");
int i;
for (i = 0; i < 3; i++) {
m_WhitePoint[i] = pParam ? pParam->GetNumber(i) : 0;
}
- pParam = pDict->GetArray(FX_BSTRC("BlackPoint"));
+ pParam = pDict->GetArray("BlackPoint");
for (i = 0; i < 3; i++) {
m_BlackPoint[i] = pParam ? pParam->GetNumber(i) : 0;
}
- m_Gamma = pDict->GetNumber(FX_BSTRC("Gamma"));
+ m_Gamma = pDict->GetNumber("Gamma");
if (m_Gamma == 0) {
m_Gamma = 1.0f;
}
@@ -408,16 +408,16 @@ FX_BOOL CPDF_CalRGB::v_Load(CPDF_Document* pDoc, CPDF_Array* pArray) {
if (!pDict)
return FALSE;
- CPDF_Array* pParam = pDict->GetArray(FX_BSTRC("WhitePoint"));
+ CPDF_Array* pParam = pDict->GetArray("WhitePoint");
int i;
for (i = 0; i < 3; i++) {
m_WhitePoint[i] = pParam ? pParam->GetNumber(i) : 0;
}
- pParam = pDict->GetArray(FX_BSTRC("BlackPoint"));
+ pParam = pDict->GetArray("BlackPoint");
for (i = 0; i < 3; i++) {
m_BlackPoint[i] = pParam ? pParam->GetNumber(i) : 0;
}
- pParam = pDict->GetArray(FX_BSTRC("Gamma"));
+ pParam = pDict->GetArray("Gamma");
if (pParam) {
m_bGamma = TRUE;
for (i = 0; i < 3; i++) {
@@ -426,7 +426,7 @@ FX_BOOL CPDF_CalRGB::v_Load(CPDF_Document* pDoc, CPDF_Array* pArray) {
} else {
m_bGamma = FALSE;
}
- pParam = pDict->GetArray(FX_BSTRC("Matrix"));
+ pParam = pDict->GetArray("Matrix");
if (pParam) {
m_bMatrix = TRUE;
for (i = 0; i < 9; i++) {
@@ -528,16 +528,16 @@ FX_BOOL CPDF_LabCS::v_Load(CPDF_Document* pDoc, CPDF_Array* pArray) {
if (!pDict) {
return FALSE;
}
- CPDF_Array* pParam = pDict->GetArray(FX_BSTRC("WhitePoint"));
+ CPDF_Array* pParam = pDict->GetArray("WhitePoint");
int i;
for (i = 0; i < 3; i++) {
m_WhitePoint[i] = pParam ? pParam->GetNumber(i) : 0;
}
- pParam = pDict->GetArray(FX_BSTRC("BlackPoint"));
+ pParam = pDict->GetArray("BlackPoint");
for (i = 0; i < 3; i++) {
m_BlackPoint[i] = pParam ? pParam->GetNumber(i) : 0;
}
- pParam = pDict->GetArray(FX_BSTRC("Range"));
+ pParam = pDict->GetArray("Range");
const FX_FLOAT def_ranges[4] = {-100 * 1.0f, 100 * 1.0f, -100 * 1.0f,
100 * 1.0f};
for (i = 0; i < 4; i++) {
@@ -701,7 +701,7 @@ FX_BOOL CPDF_ICCBasedCS::v_Load(CPDF_Document* pDoc, CPDF_Array* pArray) {
CPDF_Dictionary* pDict = pStream->GetDict();
if (m_pProfile->m_pTransform == NULL) { // No valid ICC profile or using sRGB
CPDF_Object* pAlterCSObj =
- pDict ? pDict->GetElementValue(FX_BSTRC("Alternate")) : NULL;
+ pDict ? pDict->GetElementValue("Alternate") : NULL;
if (pAlterCSObj) {
CPDF_ColorSpace* pAlterCS = CPDF_ColorSpace::Load(pDoc, pAlterCSObj);
if (pAlterCS) {
@@ -712,8 +712,7 @@ FX_BOOL CPDF_ICCBasedCS::v_Load(CPDF_Document* pDoc, CPDF_Array* pArray) {
m_bOwn = TRUE;
} else { // No valid alternative colorspace
pAlterCS->ReleaseCS();
- int32_t nDictComponents =
- pDict ? pDict->GetInteger(FX_BSTRC("N")) : 0;
+ int32_t nDictComponents = pDict ? pDict->GetInteger("N") : 0;
if (nDictComponents != 1 && nDictComponents != 3 &&
nDictComponents != 4) {
return FALSE;
@@ -741,7 +740,7 @@ FX_BOOL CPDF_ICCBasedCS::v_Load(CPDF_Document* pDoc, CPDF_Array* pArray) {
}
}
}
- CPDF_Array* pRanges = pDict->GetArray(FX_BSTRC("Range"));
+ CPDF_Array* pRanges = pDict->GetArray("Range");
m_pRanges = FX_Alloc2D(FX_FLOAT, m_nComponents, 2);
for (int i = 0; i < m_nComponents * 2; i++) {
if (pRanges) {
@@ -1049,7 +1048,7 @@ void CPDF_SeparationCS::GetDefaultValue(int iComponent,
}
FX_BOOL CPDF_SeparationCS::v_Load(CPDF_Document* pDoc, CPDF_Array* pArray) {
CFX_ByteString name = pArray->GetString(1);
- if (name == FX_BSTRC("None")) {
+ if (name == "None") {
m_Type = None;
} else {
m_Type = Colorant;
@@ -1189,16 +1188,16 @@ CPDF_ColorSpace* CPDF_ColorSpace::GetStockCS(int family) {
;
}
CPDF_ColorSpace* _CSFromName(const CFX_ByteString& name) {
- if (name == FX_BSTRC("DeviceRGB") || name == FX_BSTRC("RGB")) {
+ if (name == "DeviceRGB" || name == "RGB") {
return CPDF_ColorSpace::GetStockCS(PDFCS_DEVICERGB);
}
- if (name == FX_BSTRC("DeviceGray") || name == FX_BSTRC("G")) {
+ if (name == "DeviceGray" || name == "G") {
return CPDF_ColorSpace::GetStockCS(PDFCS_DEVICEGRAY);
}
- if (name == FX_BSTRC("DeviceCMYK") || name == FX_BSTRC("CMYK")) {
+ if (name == "DeviceCMYK" || name == "CMYK") {
return CPDF_ColorSpace::GetStockCS(PDFCS_DEVICECMYK);
}
- if (name == FX_BSTRC("Pattern")) {
+ if (name == "Pattern") {
return CPDF_ColorSpace::GetStockCS(PDFCS_PATTERN);
}
return NULL;
diff --git a/core/src/fpdfapi/fpdf_page/fpdf_page_doc.cpp b/core/src/fpdfapi/fpdf_page/fpdf_page_doc.cpp
index 44d1dc47b6..0199809a45 100644
--- a/core/src/fpdfapi/fpdf_page/fpdf_page_doc.cpp
+++ b/core/src/fpdfapi/fpdf_page/fpdf_page_doc.cpp
@@ -263,7 +263,7 @@ CPDF_Font* CPDF_DocPageData::GetStandardFont(const CFX_ByteStringC& fontName,
continue;
if (pFont->GetFontType() != PDFFONT_TYPE1)
continue;
- if (pFont->GetFontDict()->KeyExist(FX_BSTRC("Widths")))
+ if (pFont->GetFontDict()->KeyExist("Widths"))
continue;
CPDF_Type1Font* pT1Font = pFont->GetType1Font();
@@ -274,11 +274,11 @@ CPDF_Font* CPDF_DocPageData::GetStandardFont(const CFX_ByteStringC& fontName,
}
CPDF_Dictionary* pDict = new CPDF_Dictionary;
- pDict->SetAtName(FX_BSTRC("Type"), FX_BSTRC("Font"));
- pDict->SetAtName(FX_BSTRC("Subtype"), FX_BSTRC("Type1"));
- pDict->SetAtName(FX_BSTRC("BaseFont"), fontName);
+ pDict->SetAtName("Type", "Font");
+ pDict->SetAtName("Subtype", "Type1");
+ pDict->SetAtName("BaseFont", fontName);
if (pEncoding) {
- pDict->SetAt(FX_BSTRC("Encoding"), pEncoding->Realize());
+ pDict->SetAt("Encoding", pEncoding->Realize());
}
m_pPDFDoc->AddIndirectObject(pDict);
CPDF_Font* pFont = CPDF_Font::CreateFontF(m_pPDFDoc, pDict);
@@ -317,7 +317,7 @@ CPDF_ColorSpace* CPDF_DocPageData::GetColorSpace(
CFX_ByteString name = pCSObj->GetConstString();
CPDF_ColorSpace* pCS = _CSFromName(name);
if (!pCS && pResources) {
- CPDF_Dictionary* pList = pResources->GetDict(FX_BSTRC("ColorSpace"));
+ CPDF_Dictionary* pList = pResources->GetDict("ColorSpace");
if (pList) {
pCSObj = pList->GetElementValue(name);
return GetColorSpace(pCSObj, nullptr);
@@ -326,20 +326,20 @@ CPDF_ColorSpace* CPDF_DocPageData::GetColorSpace(
if (!pCS || !pResources)
return pCS;
- CPDF_Dictionary* pColorSpaces = pResources->GetDict(FX_BSTRC("ColorSpace"));
+ CPDF_Dictionary* pColorSpaces = pResources->GetDict("ColorSpace");
if (!pColorSpaces)
return pCS;
CPDF_Object* pDefaultCS = nullptr;
switch (pCS->GetFamily()) {
case PDFCS_DEVICERGB:
- pDefaultCS = pColorSpaces->GetElementValue(FX_BSTRC("DefaultRGB"));
+ pDefaultCS = pColorSpaces->GetElementValue("DefaultRGB");
break;
case PDFCS_DEVICEGRAY:
- pDefaultCS = pColorSpaces->GetElementValue(FX_BSTRC("DefaultGray"));
+ pDefaultCS = pColorSpaces->GetElementValue("DefaultGray");
break;
case PDFCS_DEVICECMYK:
- pDefaultCS = pColorSpaces->GetElementValue(FX_BSTRC("DefaultCMYK"));
+ pDefaultCS = pColorSpaces->GetElementValue("DefaultCMYK");
break;
}
return pDefaultCS ? GetColorSpace(pDefaultCS, nullptr) : pCS;
@@ -423,7 +423,7 @@ CPDF_Pattern* CPDF_DocPageData::GetPattern(CPDF_Object* pPatternObj,
} else {
CPDF_Dictionary* pDict = pPatternObj ? pPatternObj->GetDict() : nullptr;
if (pDict) {
- int type = pDict->GetInteger(FX_BSTRC("PatternType"));
+ int type = pDict->GetInteger("PatternType");
if (type == 1) {
pPattern = new CPDF_TilingPattern(m_pPDFDoc, pPatternObj, matrix);
} else if (type == 2) {
@@ -553,9 +553,9 @@ CPDF_StreamAcc* CPDF_DocPageData::GetFontFileStreamAcc(
return it->second->AddRef();
CPDF_Dictionary* pFontDict = pFontStream->GetDict();
- int32_t org_size = pFontDict->GetInteger(FX_BSTRC("Length1")) +
- pFontDict->GetInteger(FX_BSTRC("Length2")) +
- pFontDict->GetInteger(FX_BSTRC("Length3"));
+ int32_t org_size = pFontDict->GetInteger("Length1") +
+ pFontDict->GetInteger("Length2") +
+ pFontDict->GetInteger("Length3");
if (org_size < 0)
org_size = 0;
diff --git a/core/src/fpdfapi/fpdf_page/fpdf_page_func.cpp b/core/src/fpdfapi/fpdf_page/fpdf_page_func.cpp
index 81d31a7eae..5f9d038626 100644
--- a/core/src/fpdfapi/fpdf_page/fpdf_page_func.cpp
+++ b/core/src/fpdfapi/fpdf_page/fpdf_page_func.cpp
@@ -177,7 +177,7 @@ const struct _PDF_PSOpName {
FX_BOOL CPDF_PSEngine::Parse(const FX_CHAR* string, int size) {
CPDF_SimpleParser parser((uint8_t*)string, size);
CFX_ByteStringC word = parser.GetWord();
- if (word != FX_BSTRC("{")) {
+ if (word != "{") {
return FALSE;
}
return m_MainProc.Parse(parser);
@@ -188,10 +188,10 @@ FX_BOOL CPDF_PSProc::Parse(CPDF_SimpleParser& parser) {
if (word.IsEmpty()) {
return FALSE;
}
- if (word == FX_BSTRC("}")) {
+ if (word == "}") {
return TRUE;
}
- if (word == FX_BSTRC("{")) {
+ if (word == "{") {
CPDF_PSProc* pProc = new CPDF_PSProc;
m_Operators.Add((void*)PSOP_PROC);
m_Operators.Add(pProc);
@@ -500,10 +500,10 @@ FX_BOOL CPDF_SampledFunc::v_Init(CPDF_Object* pObj) {
return false;
CPDF_Dictionary* pDict = pStream->GetDict();
- CPDF_Array* pSize = pDict->GetArray(FX_BSTRC("Size"));
- CPDF_Array* pEncode = pDict->GetArray(FX_BSTRC("Encode"));
- CPDF_Array* pDecode = pDict->GetArray(FX_BSTRC("Decode"));
- m_nBitsPerSample = pDict->GetInteger(FX_BSTRC("BitsPerSample"));
+ CPDF_Array* pSize = pDict->GetArray("Size");
+ CPDF_Array* pEncode = pDict->GetArray("Encode");
+ CPDF_Array* pDecode = pDict->GetArray("Decode");
+ m_nBitsPerSample = pDict->GetInteger("BitsPerSample");
if (m_nBitsPerSample > 32) {
return FALSE;
}
@@ -515,7 +515,7 @@ FX_BOOL CPDF_SampledFunc::v_Init(CPDF_Object* pObj) {
for (int i = 0; i < m_nInputs; i++) {
m_pEncodeInfo[i].sizes = pSize ? pSize->GetInteger(i) : 0;
if (!pSize && i == 0) {
- m_pEncodeInfo[i].sizes = pDict->GetInteger(FX_BSTRC("Size"));
+ m_pEncodeInfo[i].sizes = pDict->GetInteger("Size");
}
nTotalSampleBits *= m_pEncodeInfo[i].sizes;
if (pEncode) {
@@ -686,21 +686,21 @@ FX_BOOL CPDF_ExpIntFunc::v_Init(CPDF_Object* pObj) {
if (pDict == NULL) {
return FALSE;
}
- CPDF_Array* pArray0 = pDict->GetArray(FX_BSTRC("C0"));
+ CPDF_Array* pArray0 = pDict->GetArray("C0");
if (m_nOutputs == 0) {
m_nOutputs = 1;
if (pArray0) {
m_nOutputs = pArray0->GetCount();
}
}
- CPDF_Array* pArray1 = pDict->GetArray(FX_BSTRC("C1"));
+ CPDF_Array* pArray1 = pDict->GetArray("C1");
m_pBeginValues = FX_Alloc2D(FX_FLOAT, m_nOutputs, 2);
m_pEndValues = FX_Alloc2D(FX_FLOAT, m_nOutputs, 2);
for (int i = 0; i < m_nOutputs; i++) {
m_pBeginValues[i] = pArray0 ? pArray0->GetFloat(i) : 0.0f;
m_pEndValues[i] = pArray1 ? pArray1->GetFloat(i) : 1.0f;
}
- m_Exponent = pDict->GetFloat(FX_BSTRC("N"));
+ m_Exponent = pDict->GetFloat("N");
m_nOrigOutputs = m_nOutputs;
if (m_nOutputs && m_nInputs > INT_MAX / m_nOutputs) {
return FALSE;
@@ -754,7 +754,7 @@ FX_BOOL CPDF_StitchFunc::v_Init(CPDF_Object* pObj) {
if (m_nInputs != kRequiredNumInputs) {
return FALSE;
}
- CPDF_Array* pArray = pDict->GetArray(FX_BSTRC("Functions"));
+ CPDF_Array* pArray = pDict->GetArray("Functions");
if (!pArray) {
return FALSE;
}
@@ -788,7 +788,7 @@ FX_BOOL CPDF_StitchFunc::v_Init(CPDF_Object* pObj) {
}
m_pBounds = FX_Alloc(FX_FLOAT, nSubs + 1);
m_pBounds[0] = m_pDomains[0];
- pArray = pDict->GetArray(FX_BSTRC("Bounds"));
+ pArray = pDict->GetArray("Bounds");
if (!pArray) {
return FALSE;
}
@@ -797,7 +797,7 @@ FX_BOOL CPDF_StitchFunc::v_Init(CPDF_Object* pObj) {
}
m_pBounds[nSubs] = m_pDomains[1];
m_pEncode = FX_Alloc2D(FX_FLOAT, nSubs, 2);
- pArray = pDict->GetArray(FX_BSTRC("Encode"));
+ pArray = pDict->GetArray("Encode");
if (!pArray) {
return FALSE;
}
@@ -829,9 +829,9 @@ CPDF_Function* CPDF_Function::Load(CPDF_Object* pFuncObj) {
CPDF_Function* pFunc = NULL;
int type;
if (CPDF_Stream* pStream = pFuncObj->AsStream()) {
- type = pStream->GetDict()->GetInteger(FX_BSTRC("FunctionType"));
+ type = pStream->GetDict()->GetInteger("FunctionType");
} else if (CPDF_Dictionary* pDict = pFuncObj->AsDictionary()) {
- type = pDict->GetInteger(FX_BSTRC("FunctionType"));
+ type = pDict->GetInteger("FunctionType");
} else {
return NULL;
}
@@ -864,7 +864,7 @@ FX_BOOL CPDF_Function::Init(CPDF_Object* pObj) {
CPDF_Stream* pStream = pObj->AsStream();
CPDF_Dictionary* pDict = pStream ? pStream->GetDict() : pObj->AsDictionary();
- CPDF_Array* pDomains = pDict->GetArray(FX_BSTRC("Domain"));
+ CPDF_Array* pDomains = pDict->GetArray("Domain");
if (!pDomains)
return FALSE;
@@ -876,7 +876,7 @@ FX_BOOL CPDF_Function::Init(CPDF_Object* pObj) {
for (int i = 0; i < m_nInputs * 2; i++) {
m_pDomains[i] = pDomains->GetFloat(i);
}
- CPDF_Array* pRanges = pDict->GetArray(FX_BSTRC("Range"));
+ CPDF_Array* pRanges = pDict->GetArray("Range");
m_nOutputs = 0;
if (pRanges) {
m_nOutputs = pRanges->GetCount() / 2;
diff --git a/core/src/fpdfapi/fpdf_page/fpdf_page_graph_state.cpp b/core/src/fpdfapi/fpdf_page/fpdf_page_graph_state.cpp
index 3852a4852a..63f957a838 100644
--- a/core/src/fpdfapi/fpdf_page/fpdf_page_graph_state.cpp
+++ b/core/src/fpdfapi/fpdf_page/fpdf_page_graph_state.cpp
@@ -507,7 +507,7 @@ void CPDF_AllStates::ProcessExtGS(CPDF_Dictionary* pGS,
break;
}
case FXBSTR_ID('T', 'R', 0, 0):
- if (pGS->KeyExist(FX_BSTRC("TR2"))) {
+ if (pGS->KeyExist("TR2")) {
continue;
}
case FXBSTR_ID('T', 'R', '2', 0):
@@ -542,7 +542,7 @@ void CPDF_AllStates::ProcessExtGS(CPDF_Dictionary* pGS,
break;
case FXBSTR_ID('O', 'P', 0, 0):
pGeneralState->m_StrokeOP = pObject->GetInteger();
- if (!pGS->KeyExist(FX_BSTRC("op"))) {
+ if (!pGS->KeyExist("op")) {
pGeneralState->m_FillOP = pObject->GetInteger();
}
break;
@@ -553,14 +553,14 @@ void CPDF_AllStates::ProcessExtGS(CPDF_Dictionary* pGS,
pGeneralState->m_OPMode = pObject->GetInteger();
break;
case FXBSTR_ID('B', 'G', 0, 0):
- if (pGS->KeyExist(FX_BSTRC("BG2"))) {
+ if (pGS->KeyExist("BG2")) {
continue;
}
case FXBSTR_ID('B', 'G', '2', 0):
pGeneralState->m_pBG = pObject;
break;
case FXBSTR_ID('U', 'C', 'R', 0):
- if (pGS->KeyExist(FX_BSTRC("UCR2"))) {
+ if (pGS->KeyExist("UCR2")) {
continue;
}
case FXBSTR_ID('U', 'C', 'R', '2'):
@@ -608,8 +608,7 @@ CPDF_ContentMarkItem::~CPDF_ContentMarkItem() {
FX_BOOL CPDF_ContentMarkItem::HasMCID() const {
if (m_pParam &&
(m_ParamType == DirectDict || m_ParamType == PropertiesDict)) {
- return ToDictionary(static_cast<CPDF_Object*>(m_pParam))
- ->KeyExist(FX_BSTRC("MCID"));
+ return ToDictionary(static_cast<CPDF_Object*>(m_pParam))->KeyExist("MCID");
}
return FALSE;
}
@@ -626,8 +625,8 @@ int CPDF_ContentMarkData::GetMCID() const {
type == CPDF_ContentMarkItem::DirectDict) {
CPDF_Dictionary* pDict =
ToDictionary(static_cast<CPDF_Object*>(m_Marks[i].GetParam()));
- if (pDict->KeyExist(FX_BSTRC("MCID"))) {
- return pDict->GetInteger(FX_BSTRC("MCID"));
+ if (pDict->KeyExist("MCID")) {
+ return pDict->GetInteger("MCID");
}
}
}
diff --git a/core/src/fpdfapi/fpdf_page/fpdf_page_image.cpp b/core/src/fpdfapi/fpdf_page/fpdf_page_image.cpp
index 775bd91d16..edcb3cab2d 100644
--- a/core/src/fpdfapi/fpdf_page/fpdf_page_image.cpp
+++ b/core/src/fpdfapi/fpdf_page/fpdf_page_image.cpp
@@ -88,11 +88,10 @@ FX_BOOL CPDF_Image::LoadImageF(CPDF_Stream* pStream, FX_BOOL bInline) {
if (m_bInline) {
m_pInlineDict = ToDictionary(pDict->Clone());
}
- m_pOC = pDict->GetDict(FX_BSTRC("OC"));
- m_bIsMask = !pDict->KeyExist(FX_BSTRC("ColorSpace")) ||
- pDict->GetInteger(FX_BSTRC("ImageMask"));
- m_bInterpolate = pDict->GetInteger(FX_BSTRC("Interpolate"));
- m_Height = pDict->GetInteger(FX_BSTRC("Height"));
- m_Width = pDict->GetInteger(FX_BSTRC("Width"));
+ m_pOC = pDict->GetDict("OC");
+ m_bIsMask = !pDict->KeyExist("ColorSpace") || pDict->GetInteger("ImageMask");
+ m_bInterpolate = pDict->GetInteger("Interpolate");
+ m_Height = pDict->GetInteger("Height");
+ m_Width = pDict->GetInteger("Width");
return TRUE;
}
diff --git a/core/src/fpdfapi/fpdf_page/fpdf_page_parser.cpp b/core/src/fpdfapi/fpdf_page/fpdf_page_parser.cpp
index 21fddead33..1df0c605e4 100644
--- a/core/src/fpdfapi/fpdf_page/fpdf_page_parser.cpp
+++ b/core/src/fpdfapi/fpdf_page/fpdf_page_parser.cpp
@@ -415,7 +415,7 @@ void CPDF_StreamContentParser::Handle_BeginMarkedContent_Dictionary() {
}
FX_BOOL bDirect = TRUE;
if (pProperty->IsName()) {
- pProperty = FindResourceObj(FX_BSTRC("Properties"), pProperty->GetString());
+ pProperty = FindResourceObj("Properties", pProperty->GetString());
if (!pProperty)
return;
bDirect = FALSE;
@@ -680,9 +680,9 @@ void CPDF_StreamContentParser::Handle_ExecuteXObject() {
if (!m_pResources)
return;
- CPDF_Dictionary* pList = m_pResources->GetDict(FX_BSTRC("XObject"));
+ CPDF_Dictionary* pList = m_pResources->GetDict("XObject");
if (!pList && m_pPageResources && m_pResources != m_pPageResources)
- pList = m_pPageResources->GetDict(FX_BSTRC("XObject"));
+ pList = m_pPageResources->GetDict("XObject");
if (!pList)
return;
CPDF_Reference* pRes = ToReference(pList->GetElement(name));
@@ -694,24 +694,23 @@ void CPDF_StreamContentParser::Handle_ExecuteXObject() {
return;
}
- CPDF_Stream* pXObject = ToStream(FindResourceObj(FX_BSTRC("XObject"), name));
+ CPDF_Stream* pXObject = ToStream(FindResourceObj("XObject", name));
if (!pXObject) {
m_bResourceMissing = TRUE;
return;
}
- CFX_ByteStringC type =
- pXObject->GetDict()
- ? pXObject->GetDict()->GetConstString(FX_BSTRC("Subtype"))
- : CFX_ByteStringC();
- if (type == FX_BSTRC("Image")) {
+ CFX_ByteStringC type = pXObject->GetDict()
+ ? pXObject->GetDict()->GetConstString("Subtype")
+ : CFX_ByteStringC();
+ if (type == "Image") {
if (m_Options.m_bTextOnly) {
return;
}
CPDF_ImageObject* pObj = AddImage(pXObject, NULL, FALSE);
m_LastImageName = name;
m_pLastImage = pObj->m_pImage;
- } else if (type == FX_BSTRC("Form")) {
+ } else if (type == "Form") {
AddForm(pXObject);
} else {
return;
@@ -719,15 +718,14 @@ void CPDF_StreamContentParser::Handle_ExecuteXObject() {
}
void CPDF_StreamContentParser::AddForm(CPDF_Stream* pStream) {
if (!m_Options.m_bSeparateForm) {
- CPDF_Dictionary* pResources =
- pStream->GetDict()->GetDict(FX_BSTRC("Resources"));
- CFX_Matrix form_matrix = pStream->GetDict()->GetMatrix(FX_BSTRC("Matrix"));
+ CPDF_Dictionary* pResources = pStream->GetDict()->GetDict("Resources");
+ CFX_Matrix form_matrix = pStream->GetDict()->GetMatrix("Matrix");
form_matrix.Concat(m_pCurStates->m_CTM);
- CPDF_Array* pBBox = pStream->GetDict()->GetArray(FX_BSTRC("BBox"));
+ CPDF_Array* pBBox = pStream->GetDict()->GetArray("BBox");
CFX_FloatRect form_bbox;
CPDF_Path ClipPath;
if (pBBox) {
- form_bbox = pStream->GetDict()->GetRect(FX_BSTRC("BBox"));
+ form_bbox = pStream->GetDict()->GetRect("BBox");
ClipPath.New();
ClipPath.AppendRect(form_bbox.left, form_bbox.bottom, form_bbox.right,
form_bbox.top);
@@ -860,8 +858,7 @@ void CPDF_StreamContentParser::Handle_SetGray_Stroke() {
}
void CPDF_StreamContentParser::Handle_SetExtendGraphState() {
CFX_ByteString name = GetString(0);
- CPDF_Dictionary* pGS =
- ToDictionary(FindResourceObj(FX_BSTRC("ExtGState"), name));
+ CPDF_Dictionary* pGS = ToDictionary(FindResourceObj("ExtGState", name));
if (!pGS) {
m_bResourceMissing = TRUE;
return;
@@ -1192,11 +1189,10 @@ CPDF_Object* CPDF_StreamContentParser::FindResourceObj(
return pRes;
}
CPDF_Font* CPDF_StreamContentParser::FindFont(const CFX_ByteString& name) {
- CPDF_Dictionary* pFontDict =
- ToDictionary(FindResourceObj(FX_BSTRC("Font"), name));
+ CPDF_Dictionary* pFontDict = ToDictionary(FindResourceObj("Font", name));
if (!pFontDict) {
m_bResourceMissing = TRUE;
- return CPDF_Font::GetStockFont(m_pDocument, FX_BSTRC("Helvetica"));
+ return CPDF_Font::GetStockFont(m_pDocument, "Helvetica");
}
CPDF_Font* pFont = m_pDocument->LoadFont(pFontDict);
@@ -1208,26 +1204,25 @@ CPDF_Font* CPDF_StreamContentParser::FindFont(const CFX_ByteString& name) {
}
CPDF_ColorSpace* CPDF_StreamContentParser::FindColorSpace(
const CFX_ByteString& name) {
- if (name == FX_BSTRC("Pattern")) {
+ if (name == "Pattern") {
return CPDF_ColorSpace::GetStockCS(PDFCS_PATTERN);
}
- if (name == FX_BSTRC("DeviceGray") || name == FX_BSTRC("DeviceCMYK") ||
- name == FX_BSTRC("DeviceRGB")) {
+ if (name == "DeviceGray" || name == "DeviceCMYK" || name == "DeviceRGB") {
CFX_ByteString defname = "Default";
defname += name.Mid(7);
- CPDF_Object* pDefObj = FindResourceObj(FX_BSTRC("ColorSpace"), defname);
+ CPDF_Object* pDefObj = FindResourceObj("ColorSpace", defname);
if (pDefObj == NULL) {
- if (name == FX_BSTRC("DeviceGray")) {
+ if (name == "DeviceGray") {
return CPDF_ColorSpace::GetStockCS(PDFCS_DEVICEGRAY);
}
- if (name == FX_BSTRC("DeviceRGB")) {
+ if (name == "DeviceRGB") {
return CPDF_ColorSpace::GetStockCS(PDFCS_DEVICERGB);
}
return CPDF_ColorSpace::GetStockCS(PDFCS_DEVICECMYK);
}
return m_pDocument->LoadColorSpace(pDefObj);
}
- CPDF_Object* pCSObj = FindResourceObj(FX_BSTRC("ColorSpace"), name);
+ CPDF_Object* pCSObj = FindResourceObj("ColorSpace", name);
if (pCSObj == NULL) {
m_bResourceMissing = TRUE;
return NULL;
@@ -1236,8 +1231,8 @@ CPDF_ColorSpace* CPDF_StreamContentParser::FindColorSpace(
}
CPDF_Pattern* CPDF_StreamContentParser::FindPattern(const CFX_ByteString& name,
FX_BOOL bShading) {
- CPDF_Object* pPattern = FindResourceObj(
- bShading ? FX_BSTRC("Shading") : FX_BSTRC("Pattern"), name);
+ CPDF_Object* pPattern =
+ FindResourceObj(bShading ? "Shading" : "Pattern", name);
if (!pPattern || (!pPattern->IsDictionary() && !pPattern->IsStream())) {
m_bResourceMissing = TRUE;
return NULL;
diff --git a/core/src/fpdfapi/fpdf_page/fpdf_page_parser_old.cpp b/core/src/fpdfapi/fpdf_page/fpdf_page_parser_old.cpp
index d862225ec6..0bf044101c 100644
--- a/core/src/fpdfapi/fpdf_page/fpdf_page_parser_old.cpp
+++ b/core/src/fpdfapi/fpdf_page/fpdf_page_parser_old.cpp
@@ -81,7 +81,7 @@ void CPDF_StreamContentParser::Handle_BeginImage() {
if (type == CPDF_StreamParser::Keyword) {
CFX_ByteString bsKeyword(m_pSyntax->GetWordBuf(),
m_pSyntax->GetWordSize());
- if (bsKeyword != FX_BSTRC("ID")) {
+ if (bsKeyword != "ID") {
m_pSyntax->SetPos(savePos);
pDict->Release();
return;
@@ -104,16 +104,15 @@ void CPDF_StreamContentParser::Handle_BeginImage() {
}
_PDF_ReplaceAbbr(pDict);
CPDF_Object* pCSObj = NULL;
- if (pDict->KeyExist(FX_BSTRC("ColorSpace"))) {
- pCSObj = pDict->GetElementValue(FX_BSTRC("ColorSpace"));
+ if (pDict->KeyExist("ColorSpace")) {
+ pCSObj = pDict->GetElementValue("ColorSpace");
if (pCSObj->IsName()) {
CFX_ByteString name = pCSObj->GetString();
- if (name != FX_BSTRC("DeviceRGB") && name != FX_BSTRC("DeviceGray") &&
- name != FX_BSTRC("DeviceCMYK")) {
- pCSObj = FindResourceObj(FX_BSTRC("ColorSpace"), name);
+ if (name != "DeviceRGB" && name != "DeviceGray" && name != "DeviceCMYK") {
+ pCSObj = FindResourceObj("ColorSpace", name);
if (pCSObj && !pCSObj->GetObjNum()) {
pCSObj = pCSObj->Clone();
- pDict->SetAt(FX_BSTRC("ColorSpace"), pCSObj);
+ pDict->SetAt("ColorSpace", pCSObj);
}
}
}
@@ -141,7 +140,7 @@ void CPDF_StreamContentParser::Handle_BeginImage() {
}
return;
}
- pDict->SetAtName(FX_BSTRC("Subtype"), FX_BSTRC("Image"));
+ pDict->SetAtName("Subtype", "Image");
CPDF_ImageObject* pImgObj = AddImage(pStream, NULL, TRUE);
if (!pImgObj) {
if (pStream) {
@@ -290,33 +289,33 @@ FX_DWORD PDF_DecodeInlineStream(const uint8_t* src_buf,
CPDF_Dictionary* pParam,
uint8_t*& dest_buf,
FX_DWORD& dest_size) {
- if (decoder == FX_BSTRC("CCITTFaxDecode") || decoder == FX_BSTRC("CCF")) {
+ if (decoder == "CCITTFaxDecode" || decoder == "CCF") {
ICodec_ScanlineDecoder* pDecoder =
FPDFAPI_CreateFaxDecoder(src_buf, limit, width, height, pParam);
return _DecodeAllScanlines(pDecoder, dest_buf, dest_size);
}
- if (decoder == FX_BSTRC("ASCII85Decode") || decoder == FX_BSTRC("A85")) {
+ if (decoder == "ASCII85Decode" || decoder == "A85") {
return A85Decode(src_buf, limit, dest_buf, dest_size);
}
- if (decoder == FX_BSTRC("ASCIIHexDecode") || decoder == FX_BSTRC("AHx")) {
+ if (decoder == "ASCIIHexDecode" || decoder == "AHx") {
return HexDecode(src_buf, limit, dest_buf, dest_size);
}
- if (decoder == FX_BSTRC("FlateDecode") || decoder == FX_BSTRC("Fl")) {
+ if (decoder == "FlateDecode" || decoder == "Fl") {
return FPDFAPI_FlateOrLZWDecode(FALSE, src_buf, limit, pParam, dest_size,
dest_buf, dest_size);
}
- if (decoder == FX_BSTRC("LZWDecode") || decoder == FX_BSTRC("LZW")) {
+ if (decoder == "LZWDecode" || decoder == "LZW") {
return FPDFAPI_FlateOrLZWDecode(TRUE, src_buf, limit, pParam, 0, dest_buf,
dest_size);
}
- if (decoder == FX_BSTRC("DCTDecode") || decoder == FX_BSTRC("DCT")) {
+ if (decoder == "DCTDecode" || decoder == "DCT") {
ICodec_ScanlineDecoder* pDecoder =
CPDF_ModuleMgr::Get()->GetJpegModule()->CreateDecoder(
src_buf, limit, width, height, 0,
- pParam ? pParam->GetInteger(FX_BSTRC("ColorTransform"), 1) : 1);
+ pParam ? pParam->GetInteger("ColorTransform", 1) : 1);
return _DecodeAllScanlines(pDecoder, dest_buf, dest_size);
}
- if (decoder == FX_BSTRC("RunLengthDecode") || decoder == FX_BSTRC("RL")) {
+ if (decoder == "RunLengthDecode" || decoder == "RL") {
return RunLengthDecode(src_buf, limit, dest_buf, dest_size);
}
dest_size = 0;
@@ -335,23 +334,23 @@ CPDF_Stream* CPDF_StreamParser::ReadInlineStream(CPDF_Document* pDoc,
CFX_ByteString Decoder;
CPDF_Dictionary* pParam = nullptr;
- CPDF_Object* pFilter = pDict->GetElementValue(FX_BSTRC("Filter"));
+ CPDF_Object* pFilter = pDict->GetElementValue("Filter");
if (pFilter) {
if (CPDF_Array* pArray = pFilter->AsArray()) {
Decoder = pArray->GetString(0);
- CPDF_Array* pParams = pDict->GetArray(FX_BSTRC("DecodeParms"));
+ CPDF_Array* pParams = pDict->GetArray("DecodeParms");
if (pParams)
pParam = pParams->GetDict(0);
} else {
Decoder = pFilter->GetString();
- pParam = pDict->GetDict(FX_BSTRC("DecodeParms"));
+ pParam = pDict->GetDict("DecodeParms");
}
}
- FX_DWORD width = pDict->GetInteger(FX_BSTRC("Width"));
- FX_DWORD height = pDict->GetInteger(FX_BSTRC("Height"));
+ FX_DWORD width = pDict->GetInteger("Width");
+ FX_DWORD height = pDict->GetInteger("Height");
FX_DWORD OrigSize = 0;
if (pCSObj != NULL) {
- FX_DWORD bpc = pDict->GetInteger(FX_BSTRC("BitsPerComponent"));
+ FX_DWORD bpc = pDict->GetInteger("BitsPerComponent");
FX_DWORD nComponents = 1;
CPDF_ColorSpace* pCS = pDoc->LoadColorSpace(pCSObj);
if (pCS == NULL) {
@@ -409,12 +408,12 @@ CPDF_Stream* CPDF_StreamParser::ReadInlineStream(CPDF_Document* pDoc,
dwStreamSize = dwDestSize;
if (CPDF_Array* pArray = pFilter->AsArray()) {
pArray->RemoveAt(0);
- CPDF_Array* pParams = pDict->GetArray(FX_BSTRC("DecodeParms"));
+ CPDF_Array* pParams = pDict->GetArray("DecodeParms");
if (pParams)
pParams->RemoveAt(0);
} else {
- pDict->RemoveAt(FX_BSTRC("Filter"));
- pDict->RemoveAt(FX_BSTRC("DecodeParms"));
+ pDict->RemoveAt("Filter");
+ pDict->RemoveAt("DecodeParms");
}
} else {
FX_Free(pData);
@@ -443,7 +442,7 @@ CPDF_Stream* CPDF_StreamParser::ReadInlineStream(CPDF_Document* pDoc,
m_Pos += dwStreamSize;
}
}
- pDict->SetAtInteger(FX_BSTRC("Length"), (int)dwStreamSize);
+ pDict->SetAtInteger("Length", (int)dwStreamSize);
return new CPDF_Stream(pData, dwStreamSize, pDict);
}
@@ -938,8 +937,7 @@ void CPDF_ContentParser::Start(CPDF_Page* pPage, CPDF_ParseOptions* pOptions) {
m_Status = ToBeContinued;
m_InternalStage = PAGEPARSE_STAGE_GETCONTENT;
m_CurrentOffset = 0;
- CPDF_Object* pContent =
- pPage->m_pFormDict->GetElementValue(FX_BSTRC("Contents"));
+ CPDF_Object* pContent = pPage->m_pFormDict->GetElementValue("Contents");
if (pContent == NULL) {
m_Status = Done;
return;
@@ -969,11 +967,11 @@ void CPDF_ContentParser::Start(CPDF_Form* pForm,
m_pType3Char = pType3Char;
m_pObjects = pForm;
m_bForm = TRUE;
- CFX_Matrix form_matrix = pForm->m_pFormDict->GetMatrix(FX_BSTRC("Matrix"));
+ CFX_Matrix form_matrix = pForm->m_pFormDict->GetMatrix("Matrix");
if (pGraphicStates) {
form_matrix.Concat(pGraphicStates->m_CTM);
}
- CPDF_Array* pBBox = pForm->m_pFormDict->GetArray(FX_BSTRC("BBox"));
+ CPDF_Array* pBBox = pForm->m_pFormDict->GetArray("BBox");
CFX_FloatRect form_bbox;
CPDF_Path ClipPath;
if (pBBox) {
@@ -990,8 +988,7 @@ void CPDF_ContentParser::Start(CPDF_Form* pForm,
form_bbox.Transform(pParentMatrix);
}
}
- CPDF_Dictionary* pResources =
- pForm->m_pFormDict->GetDict(FX_BSTRC("Resources"));
+ CPDF_Dictionary* pResources = pForm->m_pFormDict->GetDict("Resources");
m_pParser = new CPDF_StreamContentParser(
pForm->m_pDocument, pForm->m_pPageResources, pForm->m_pResources,
pParentMatrix, pForm, pResources, &form_bbox, pOptions, pGraphicStates,
@@ -1058,8 +1055,7 @@ void CPDF_ContentParser::Continue(IFX_Pause* pPause) {
m_InternalStage = PAGEPARSE_STAGE_PARSE;
m_CurrentOffset = 0;
} else {
- CPDF_Array* pContent =
- m_pObjects->m_pFormDict->GetArray(FX_BSTRC("Contents"));
+ CPDF_Array* pContent = m_pObjects->m_pFormDict->GetArray("Contents");
m_pStreamArray[m_CurrentOffset] = new CPDF_StreamAcc;
CPDF_Stream* pStreamObj = ToStream(
pContent ? pContent->GetElementValue(m_CurrentOffset) : nullptr);
diff --git a/core/src/fpdfapi/fpdf_page/fpdf_page_pattern.cpp b/core/src/fpdfapi/fpdf_page/fpdf_page_pattern.cpp
index 77e375bcc0..e1a7493a2f 100644
--- a/core/src/fpdfapi/fpdf_page/fpdf_page_pattern.cpp
+++ b/core/src/fpdfapi/fpdf_page/fpdf_page_pattern.cpp
@@ -45,8 +45,8 @@ CPDF_TilingPattern::CPDF_TilingPattern(CPDF_Document* pDoc,
m_pDocument = pDoc;
CPDF_Dictionary* pDict = m_pPatternObj->GetDict();
ASSERT(pDict != NULL);
- m_Pattern2Form = pDict->GetMatrix(FX_BSTRC("Matrix"));
- m_bColored = pDict->GetInteger(FX_BSTRC("PaintType")) == 1;
+ m_Pattern2Form = pDict->GetMatrix("Matrix");
+ m_bColored = pDict->GetInteger("PaintType") == 1;
if (parentMatrix) {
m_Pattern2Form.Concat(*parentMatrix);
}
@@ -64,9 +64,9 @@ FX_BOOL CPDF_TilingPattern::Load() {
if (!pDict)
return FALSE;
- m_bColored = pDict->GetInteger(FX_BSTRC("PaintType")) == 1;
- m_XStep = (FX_FLOAT)FXSYS_fabs(pDict->GetNumber(FX_BSTRC("XStep")));
- m_YStep = (FX_FLOAT)FXSYS_fabs(pDict->GetNumber(FX_BSTRC("YStep")));
+ m_bColored = pDict->GetInteger("PaintType") == 1;
+ m_XStep = (FX_FLOAT)FXSYS_fabs(pDict->GetNumber("XStep"));
+ m_YStep = (FX_FLOAT)FXSYS_fabs(pDict->GetNumber("YStep"));
CPDF_Stream* pStream = m_pPatternObj->AsStream();
if (!pStream)
@@ -74,7 +74,7 @@ FX_BOOL CPDF_TilingPattern::Load() {
m_pForm = new CPDF_Form(m_pDocument, NULL, pStream);
m_pForm->ParseContent(NULL, &m_ParentMatrix, NULL, NULL);
- m_BBox = pDict->GetRect(FX_BSTRC("BBox"));
+ m_BBox = pDict->GetRect("BBox");
return TRUE;
}
CPDF_ShadingPattern::CPDF_ShadingPattern(CPDF_Document* pDoc,
@@ -89,8 +89,8 @@ CPDF_ShadingPattern::CPDF_ShadingPattern(CPDF_Document* pDoc,
if (!bShading) {
CPDF_Dictionary* pDict = m_pPatternObj->GetDict();
ASSERT(pDict != NULL);
- m_Pattern2Form = pDict->GetMatrix(FX_BSTRC("Matrix"));
- m_pShadingObj = pDict->GetElementValue(FX_BSTRC("Shading"));
+ m_Pattern2Form = pDict->GetMatrix("Matrix");
+ m_pShadingObj = pDict->GetElementValue("Shading");
if (parentMatrix) {
m_Pattern2Form.Concat(*parentMatrix);
}
@@ -137,7 +137,7 @@ FX_BOOL CPDF_ShadingPattern::Load() {
delete m_pFunctions[i];
m_nFuncs = 0;
}
- CPDF_Object* pFunc = pShadingDict->GetElementValue(FX_BSTRC("Function"));
+ CPDF_Object* pFunc = pShadingDict->GetElementValue("Function");
if (pFunc) {
if (CPDF_Array* pArray = pFunc->AsArray()) {
m_nFuncs = std::min<int>(pArray->GetCount(), 4);
@@ -150,7 +150,7 @@ FX_BOOL CPDF_ShadingPattern::Load() {
m_nFuncs = 1;
}
}
- CPDF_Object* pCSObj = pShadingDict->GetElementValue(FX_BSTRC("ColorSpace"));
+ CPDF_Object* pCSObj = pShadingDict->GetElementValue("ColorSpace");
if (pCSObj == NULL) {
return FALSE;
}
@@ -160,8 +160,7 @@ FX_BOOL CPDF_ShadingPattern::Load() {
m_pCountedCS = pDocPageData->FindColorSpacePtr(m_pCS->GetArray());
}
- m_ShadingType =
- ToShadingType(pShadingDict->GetInteger(FX_BSTRC("ShadingType")));
+ m_ShadingType = ToShadingType(pShadingDict->GetInteger("ShadingType"));
// We expect to have a stream if our shading type is a mesh.
if (IsMeshShading() && !ToStream(m_pShadingObj))
@@ -183,9 +182,9 @@ FX_BOOL CPDF_MeshStream::Load(CPDF_Stream* pShadingStream,
m_nFuncs = nFuncs;
m_pCS = pCS;
CPDF_Dictionary* pDict = pShadingStream->GetDict();
- m_nCoordBits = pDict->GetInteger(FX_BSTRC("BitsPerCoordinate"));
- m_nCompBits = pDict->GetInteger(FX_BSTRC("BitsPerComponent"));
- m_nFlagBits = pDict->GetInteger(FX_BSTRC("BitsPerFlag"));
+ m_nCoordBits = pDict->GetInteger("BitsPerCoordinate");
+ m_nCompBits = pDict->GetInteger("BitsPerComponent");
+ m_nFlagBits = pDict->GetInteger("BitsPerFlag");
if (!m_nCoordBits || !m_nCompBits) {
return FALSE;
}
@@ -199,7 +198,7 @@ FX_BOOL CPDF_MeshStream::Load(CPDF_Stream* pShadingStream,
}
m_CoordMax = m_nCoordBits == 32 ? -1 : (1 << m_nCoordBits) - 1;
m_CompMax = (1 << m_nCompBits) - 1;
- CPDF_Array* pDecode = pDict->GetArray(FX_BSTRC("Decode"));
+ CPDF_Array* pDecode = pDict->GetArray("Decode");
if (pDecode == NULL || pDecode->GetCount() != 4 + m_nComps * 2) {
return FALSE;
}
diff --git a/core/src/fpdfapi/fpdf_parser/fpdf_parser_decode.cpp b/core/src/fpdfapi/fpdf_parser/fpdf_parser_decode.cpp
index dbd5f311a6..5fbdcc634c 100644
--- a/core/src/fpdfapi/fpdf_parser/fpdf_parser_decode.cpp
+++ b/core/src/fpdfapi/fpdf_parser/fpdf_parser_decode.cpp
@@ -231,12 +231,12 @@ ICodec_ScanlineDecoder* FPDFAPI_CreateFaxDecoder(
int Columns = 1728;
int Rows = 0;
if (pParams) {
- K = pParams->GetInteger(FX_BSTRC("K"));
- EndOfLine = pParams->GetInteger(FX_BSTRC("EndOfLine"));
- ByteAlign = pParams->GetInteger(FX_BSTRC("EncodedByteAlign"));
- BlackIs1 = pParams->GetInteger(FX_BSTRC("BlackIs1"));
- Columns = pParams->GetInteger(FX_BSTRC("Columns"), 1728);
- Rows = pParams->GetInteger(FX_BSTRC("Rows"));
+ K = pParams->GetInteger("K");
+ EndOfLine = pParams->GetInteger("EndOfLine");
+ ByteAlign = pParams->GetInteger("EncodedByteAlign");
+ BlackIs1 = pParams->GetInteger("BlackIs1");
+ Columns = pParams->GetInteger("Columns", 1728);
+ Rows = pParams->GetInteger("Rows");
if (Rows > USHRT_MAX) {
Rows = 0;
}
@@ -280,10 +280,10 @@ ICodec_ScanlineDecoder* FPDFAPI_CreateFlateDecoder(
int predictor = 0;
int Colors = 0, BitsPerComponent = 0, Columns = 0;
if (pParams) {
- predictor = pParams->GetInteger(FX_BSTRC("Predictor"));
- Colors = pParams->GetInteger(FX_BSTRC("Colors"), 1);
- BitsPerComponent = pParams->GetInteger(FX_BSTRC("BitsPerComponent"), 8);
- Columns = pParams->GetInteger(FX_BSTRC("Columns"), 1);
+ predictor = pParams->GetInteger("Predictor");
+ Colors = pParams->GetInteger("Colors", 1);
+ BitsPerComponent = pParams->GetInteger("BitsPerComponent", 8);
+ Columns = pParams->GetInteger("Columns", 1);
if (!CheckFlateDecodeParams(Colors, BitsPerComponent, Columns)) {
return NULL;
}
@@ -303,11 +303,11 @@ FX_DWORD FPDFAPI_FlateOrLZWDecode(FX_BOOL bLZW,
FX_BOOL bEarlyChange = TRUE;
int Colors = 0, BitsPerComponent = 0, Columns = 0;
if (pParams) {
- predictor = pParams->GetInteger(FX_BSTRC("Predictor"));
- bEarlyChange = pParams->GetInteger(FX_BSTRC("EarlyChange"), 1);
- Colors = pParams->GetInteger(FX_BSTRC("Colors"), 1);
- BitsPerComponent = pParams->GetInteger(FX_BSTRC("BitsPerComponent"), 8);
- Columns = pParams->GetInteger(FX_BSTRC("Columns"), 1);
+ predictor = pParams->GetInteger("Predictor");
+ bEarlyChange = pParams->GetInteger("EarlyChange", 1);
+ Colors = pParams->GetInteger("Colors", 1);
+ BitsPerComponent = pParams->GetInteger("BitsPerComponent", 8);
+ Columns = pParams->GetInteger("Columns", 1);
if (!CheckFlateDecodeParams(Colors, BitsPerComponent, Columns)) {
return (FX_DWORD)-1;
}
@@ -327,13 +327,12 @@ FX_BOOL PDF_DataDecode(const uint8_t* src_buf,
FX_BOOL bImageAcc)
{
- CPDF_Object* pDecoder =
- pDict ? pDict->GetElementValue(FX_BSTRC("Filter")) : nullptr;
+ CPDF_Object* pDecoder = pDict ? pDict->GetElementValue("Filter") : nullptr;
if (!pDecoder || (!pDecoder->IsArray() && !pDecoder->IsName()))
return FALSE;
CPDF_Object* pParams =
- pDict ? pDict->GetElementValue(FX_BSTRC("DecodeParms")) : nullptr;
+ pDict ? pDict->GetElementValue("DecodeParms") : nullptr;
CFX_ByteStringArray DecoderList;
CFX_ArrayTemplate<CPDF_Object*> ParamList;
if (CPDF_Array* pDecoders = pDecoder->AsArray()) {
@@ -361,9 +360,9 @@ FX_BOOL PDF_DataDecode(const uint8_t* src_buf,
uint8_t* new_buf = nullptr;
FX_DWORD new_size = (FX_DWORD)-1;
int offset = -1;
- if (decoder == FX_BSTRC("FlateDecode") || decoder == FX_BSTRC("Fl")) {
+ if (decoder == "FlateDecode" || decoder == "Fl") {
if (bImageAcc && i == DecoderList.GetSize() - 1) {
- ImageEncoding = FX_BSTRC("FlateDecode");
+ ImageEncoding = "FlateDecode";
dest_buf = (uint8_t*)last_buf;
dest_size = last_size;
pImageParms = pParam;
@@ -371,32 +370,29 @@ FX_BOOL PDF_DataDecode(const uint8_t* src_buf,
}
offset = FPDFAPI_FlateOrLZWDecode(FALSE, last_buf, last_size, pParam,
estimated_size, new_buf, new_size);
- } else if (decoder == FX_BSTRC("LZWDecode") || decoder == FX_BSTRC("LZW")) {
+ } else if (decoder == "LZWDecode" || decoder == "LZW") {
offset = FPDFAPI_FlateOrLZWDecode(TRUE, last_buf, last_size, pParam,
estimated_size, new_buf, new_size);
- } else if (decoder == FX_BSTRC("ASCII85Decode") ||
- decoder == FX_BSTRC("A85")) {
+ } else if (decoder == "ASCII85Decode" || decoder == "A85") {
offset = A85Decode(last_buf, last_size, new_buf, new_size);
- } else if (decoder == FX_BSTRC("ASCIIHexDecode") ||
- decoder == FX_BSTRC("AHx")) {
+ } else if (decoder == "ASCIIHexDecode" || decoder == "AHx") {
offset = HexDecode(last_buf, last_size, new_buf, new_size);
- } else if (decoder == FX_BSTRC("RunLengthDecode") ||
- decoder == FX_BSTRC("RL")) {
+ } else if (decoder == "RunLengthDecode" || decoder == "RL") {
if (bImageAcc && i == DecoderList.GetSize() - 1) {
- ImageEncoding = FX_BSTRC("RunLengthDecode");
+ ImageEncoding = "RunLengthDecode";
dest_buf = (uint8_t*)last_buf;
dest_size = last_size;
pImageParms = pParam;
return TRUE;
}
offset = RunLengthDecode(last_buf, last_size, new_buf, new_size);
- } else if (decoder == FX_BSTRC("Crypt")) {
+ } else if (decoder == "Crypt") {
continue;
} else {
// If we get here, assume it's an image decoder.
- if (decoder == FX_BSTRC("DCT")) {
+ if (decoder == "DCT") {
decoder = "DCTDecode";
- } else if (decoder == FX_BSTRC("CCF")) {
+ } else if (decoder == "CCF") {
decoder = "CCITTFaxDecode";
}
ImageEncoding = decoder;
@@ -533,10 +529,10 @@ CFX_ByteString PDF_EncodeString(const CFX_ByteString& src, FX_BOOL bHex) {
if (ch == ')' || ch == '\\' || ch == '(') {
result.AppendChar('\\');
} else if (ch == 0x0a) {
- result << FX_BSTRC("\\n");
+ result << "\\n";
continue;
} else if (ch == 0x0d) {
- result << FX_BSTRC("\\r");
+ result << "\\r";
continue;
}
result.AppendChar(ch);
diff --git a/core/src/fpdfapi/fpdf_parser/fpdf_parser_document.cpp b/core/src/fpdfapi/fpdf_parser/fpdf_parser_document.cpp
index 2e38837137..2d7c4b0eec 100644
--- a/core/src/fpdfapi/fpdf_parser/fpdf_parser_document.cpp
+++ b/core/src/fpdfapi/fpdf_parser/fpdf_parser_document.cpp
@@ -69,16 +69,16 @@ void CPDF_Document::LoadAsynDoc(CPDF_Dictionary* pLinearized) {
m_ID2 = pIDArray->GetString(1);
}
FX_DWORD dwPageCount = 0;
- CPDF_Object* pCount = pLinearized->GetElement(FX_BSTRC("N"));
+ CPDF_Object* pCount = pLinearized->GetElement("N");
if (ToNumber(pCount))
dwPageCount = pCount->GetInteger();
m_PageList.SetSize(dwPageCount);
- CPDF_Object* pNo = pLinearized->GetElement(FX_BSTRC("P"));
+ CPDF_Object* pNo = pLinearized->GetElement("P");
if (ToNumber(pNo))
m_dwFirstPageNo = pNo->GetInteger();
- CPDF_Object* pObjNum = pLinearized->GetElement(FX_BSTRC("O"));
+ CPDF_Object* pObjNum = pLinearized->GetElement("O");
if (ToNumber(pObjNum))
m_dwFirstPageObjNum = pObjNum->GetInteger();
}
@@ -99,7 +99,7 @@ CPDF_Dictionary* CPDF_Document::_FindPDFPage(CPDF_Dictionary* pPages,
int iPage,
int nPagesToGo,
int level) {
- CPDF_Array* pKidList = pPages->GetArray(FX_BSTRC("Kids"));
+ CPDF_Array* pKidList = pPages->GetArray("Kids");
if (pKidList == NULL) {
if (nPagesToGo == 0) {
return pPages;
@@ -119,14 +119,14 @@ CPDF_Dictionary* CPDF_Document::_FindPDFPage(CPDF_Dictionary* pPages,
if (pKid == pPages) {
continue;
}
- if (!pKid->KeyExist(FX_BSTRC("Kids"))) {
+ if (!pKid->KeyExist("Kids")) {
if (nPagesToGo == 0) {
return pKid;
}
m_PageList.SetAt(iPage - nPagesToGo, pKid->GetObjNum());
nPagesToGo--;
} else {
- int nPages = pKid->GetInteger(FX_BSTRC("Count"));
+ int nPages = pKid->GetInteger("Count");
if (nPagesToGo < nPages) {
return _FindPDFPage(pKid, iPage, nPagesToGo, level + 1);
}
@@ -156,7 +156,7 @@ CPDF_Dictionary* CPDF_Document::GetPage(int iPage) {
if (!pRoot)
return nullptr;
- CPDF_Dictionary* pPages = pRoot->GetDict(FX_BSTRC("Pages"));
+ CPDF_Dictionary* pPages = pRoot->GetDict("Pages");
if (!pPages)
return nullptr;
@@ -173,15 +173,15 @@ int CPDF_Document::_FindPageIndex(CPDF_Dictionary* pNode,
FX_DWORD objnum,
int& index,
int level) {
- if (pNode->KeyExist(FX_BSTRC("Kids"))) {
- CPDF_Array* pKidList = pNode->GetArray(FX_BSTRC("Kids"));
+ if (pNode->KeyExist("Kids")) {
+ CPDF_Array* pKidList = pNode->GetArray("Kids");
if (pKidList == NULL) {
return -1;
}
if (level >= FX_MAX_PAGE_LEVEL) {
return -1;
}
- FX_DWORD count = pNode->GetInteger(FX_BSTRC("Count"));
+ FX_DWORD count = pNode->GetInteger("Count");
if (count <= skip_count) {
skip_count -= count;
index += count;
@@ -240,7 +240,7 @@ int CPDF_Document::GetPageIndex(FX_DWORD objnum) {
if (pRoot == NULL) {
return -1;
}
- CPDF_Dictionary* pPages = pRoot->GetDict(FX_BSTRC("Pages"));
+ CPDF_Dictionary* pPages = pRoot->GetDict("Pages");
if (pPages == NULL) {
return -1;
}
@@ -254,11 +254,11 @@ static int _CountPages(CPDF_Dictionary* pPages, int level) {
if (level > 128) {
return 0;
}
- int count = pPages->GetInteger(FX_BSTRC("Count"));
+ int count = pPages->GetInteger("Count");
if (count > 0 && count < FPDF_PAGE_MAX_NUM) {
return count;
}
- CPDF_Array* pKidList = pPages->GetArray(FX_BSTRC("Kids"));
+ CPDF_Array* pKidList = pPages->GetArray("Kids");
if (pKidList == NULL) {
return 0;
}
@@ -268,13 +268,13 @@ static int _CountPages(CPDF_Dictionary* pPages, int level) {
if (pKid == NULL) {
continue;
}
- if (!pKid->KeyExist(FX_BSTRC("Kids"))) {
+ if (!pKid->KeyExist("Kids")) {
count++;
} else {
count += _CountPages(pKid, level + 1);
}
}
- pPages->SetAtInteger(FX_BSTRC("Count"), count);
+ pPages->SetAtInteger("Count", count);
return count;
}
int CPDF_Document::_GetPageCount() const {
@@ -282,11 +282,11 @@ int CPDF_Document::_GetPageCount() const {
if (pRoot == NULL) {
return 0;
}
- CPDF_Dictionary* pPages = pRoot->GetDict(FX_BSTRC("Pages"));
+ CPDF_Dictionary* pPages = pRoot->GetDict("Pages");
if (pPages == NULL) {
return 0;
}
- if (!pPages->KeyExist(FX_BSTRC("Kids"))) {
+ if (!pPages->KeyExist("Kids")) {
return 1;
}
return _CountPages(pPages, 0);
@@ -299,7 +299,7 @@ FX_BOOL CPDF_Document::IsContentUsedElsewhere(FX_DWORD objnum,
continue;
}
CPDF_Object* pContents =
- pPageDict ? pPageDict->GetElement(FX_BSTRC("Contents")) : NULL;
+ pPageDict ? pPageDict->GetElement("Contents") : NULL;
if (pContents == NULL) {
continue;
}
@@ -333,9 +333,7 @@ FX_BOOL CPDF_Document::IsFormStream(FX_DWORD objnum, FX_BOOL& bForm) const {
CPDF_Object* pObj;
if (m_IndirectObjs.Lookup((void*)(uintptr_t)objnum, (void*&)pObj)) {
CPDF_Stream* pStream = pObj->AsStream();
- bForm = pStream &&
- pStream->GetDict()->GetString(FX_BSTRC("Subtype")) ==
- FX_BSTRC("Form");
+ bForm = pStream && pStream->GetDict()->GetString("Subtype") == "Form";
return TRUE;
}
}
diff --git a/core/src/fpdfapi/fpdf_parser/fpdf_parser_encrypt.cpp b/core/src/fpdfapi/fpdf_parser/fpdf_parser_encrypt.cpp
index 363864e588..d2379fea6c 100644
--- a/core/src/fpdfapi/fpdf_parser/fpdf_parser_encrypt.cpp
+++ b/core/src/fpdfapi/fpdf_parser/fpdf_parser_encrypt.cpp
@@ -21,7 +21,7 @@ void CalcEncryptKey(CPDF_Dictionary* pEncrypt,
int keylen,
FX_BOOL bIgnoreMeta,
CPDF_Array* pIdArray) {
- int revision = pEncrypt->GetInteger(FX_BSTRC("R"));
+ int revision = pEncrypt->GetInteger("R");
uint8_t passcode[32];
for (FX_DWORD i = 0; i < 32; i++) {
passcode[i] = i < pass_size ? password[i] : defpasscode[i - pass_size];
@@ -29,16 +29,16 @@ void CalcEncryptKey(CPDF_Dictionary* pEncrypt,
uint8_t md5[100];
CRYPT_MD5Start(md5);
CRYPT_MD5Update(md5, passcode, 32);
- CFX_ByteString okey = pEncrypt->GetString(FX_BSTRC("O"));
+ CFX_ByteString okey = pEncrypt->GetString("O");
CRYPT_MD5Update(md5, (uint8_t*)okey.c_str(), okey.GetLength());
- FX_DWORD perm = pEncrypt->GetInteger(FX_BSTRC("P"));
+ FX_DWORD perm = pEncrypt->GetInteger("P");
CRYPT_MD5Update(md5, (uint8_t*)&perm, 4);
if (pIdArray) {
CFX_ByteString id = pIdArray->GetString(0);
CRYPT_MD5Update(md5, (uint8_t*)id.c_str(), id.GetLength());
}
if (!bIgnoreMeta && revision >= 3 &&
- !pEncrypt->GetInteger(FX_BSTRC("EncryptMetadata"), 1)) {
+ !pEncrypt->GetInteger("EncryptMetadata", 1)) {
FX_DWORD tag = (FX_DWORD)-1;
CRYPT_MD5Update(md5, (uint8_t*)&tag, 4);
}
@@ -110,15 +110,15 @@ static FX_BOOL _LoadCryptInfo(CPDF_Dictionary* pEncryptDict,
const CFX_ByteStringC& name,
int& cipher,
int& keylen) {
- int Version = pEncryptDict->GetInteger(FX_BSTRC("V"));
+ int Version = pEncryptDict->GetInteger("V");
cipher = FXCIPHER_RC4;
keylen = 0;
if (Version >= 4) {
- CPDF_Dictionary* pCryptFilters = pEncryptDict->GetDict(FX_BSTRC("CF"));
+ CPDF_Dictionary* pCryptFilters = pEncryptDict->GetDict("CF");
if (pCryptFilters == NULL) {
return FALSE;
}
- if (name == FX_BSTRC("Identity")) {
+ if (name == "Identity") {
cipher = FXCIPHER_NONE;
} else {
CPDF_Dictionary* pDefFilter = pCryptFilters->GetDict(name);
@@ -127,26 +127,24 @@ static FX_BOOL _LoadCryptInfo(CPDF_Dictionary* pEncryptDict,
}
int nKeyBits = 0;
if (Version == 4) {
- nKeyBits = pDefFilter->GetInteger(FX_BSTRC("Length"), 0);
+ nKeyBits = pDefFilter->GetInteger("Length", 0);
if (nKeyBits == 0) {
- nKeyBits = pEncryptDict->GetInteger(FX_BSTRC("Length"), 128);
+ nKeyBits = pEncryptDict->GetInteger("Length", 128);
}
} else {
- nKeyBits = pEncryptDict->GetInteger(FX_BSTRC("Length"), 256);
+ nKeyBits = pEncryptDict->GetInteger("Length", 256);
}
if (nKeyBits < 40) {
nKeyBits *= 8;
}
keylen = nKeyBits / 8;
- CFX_ByteString cipher_name = pDefFilter->GetString(FX_BSTRC("CFM"));
- if (cipher_name == FX_BSTRC("AESV2") ||
- cipher_name == FX_BSTRC("AESV3")) {
+ CFX_ByteString cipher_name = pDefFilter->GetString("CFM");
+ if (cipher_name == "AESV2" || cipher_name == "AESV3") {
cipher = FXCIPHER_AES;
}
}
} else {
- keylen =
- Version > 1 ? pEncryptDict->GetInteger(FX_BSTRC("Length"), 40) / 8 : 5;
+ keylen = Version > 1 ? pEncryptDict->GetInteger("Length", 40) / 8 : 5;
}
if (keylen > 32 || keylen < 0) {
return FALSE;
@@ -156,14 +154,14 @@ static FX_BOOL _LoadCryptInfo(CPDF_Dictionary* pEncryptDict,
FX_BOOL CPDF_StandardSecurityHandler::LoadDict(CPDF_Dictionary* pEncryptDict) {
m_pEncryptDict = pEncryptDict;
m_bOwner = FALSE;
- m_Version = pEncryptDict->GetInteger(FX_BSTRC("V"));
- m_Revision = pEncryptDict->GetInteger(FX_BSTRC("R"));
- m_Permissions = pEncryptDict->GetInteger(FX_BSTRC("P"), -1);
+ m_Version = pEncryptDict->GetInteger("V");
+ m_Revision = pEncryptDict->GetInteger("R");
+ m_Permissions = pEncryptDict->GetInteger("P", -1);
if (m_Version < 4) {
return _LoadCryptInfo(pEncryptDict, CFX_ByteString(), m_Cipher, m_KeyLen);
}
- CFX_ByteString stmf_name = pEncryptDict->GetString(FX_BSTRC("StmF"));
- CFX_ByteString strf_name = pEncryptDict->GetString(FX_BSTRC("StrF"));
+ CFX_ByteString stmf_name = pEncryptDict->GetString("StmF");
+ CFX_ByteString strf_name = pEncryptDict->GetString("StrF");
if (stmf_name != strf_name) {
return FALSE;
}
@@ -178,13 +176,13 @@ FX_BOOL CPDF_StandardSecurityHandler::LoadDict(CPDF_Dictionary* pEncryptDict,
int& key_len) {
m_pEncryptDict = pEncryptDict;
m_bOwner = FALSE;
- m_Version = pEncryptDict->GetInteger(FX_BSTRC("V"));
- m_Revision = pEncryptDict->GetInteger(FX_BSTRC("R"));
- m_Permissions = pEncryptDict->GetInteger(FX_BSTRC("P"), -1);
+ m_Version = pEncryptDict->GetInteger("V");
+ m_Revision = pEncryptDict->GetInteger("R");
+ m_Permissions = pEncryptDict->GetInteger("P", -1);
CFX_ByteString strf_name, stmf_name;
if (m_Version >= 4) {
- stmf_name = pEncryptDict->GetString(FX_BSTRC("StmF"));
- strf_name = pEncryptDict->GetString(FX_BSTRC("StrF"));
+ stmf_name = pEncryptDict->GetString("StmF");
+ strf_name = pEncryptDict->GetString("StrF");
if (stmf_name != strf_name) {
return FALSE;
}
@@ -303,15 +301,13 @@ FX_BOOL CPDF_StandardSecurityHandler::AES256_CheckPassword(
FX_DWORD size,
FX_BOOL bOwner,
uint8_t* key) {
- CFX_ByteString okey = m_pEncryptDict
- ? m_pEncryptDict->GetString(FX_BSTRC("O"))
- : CFX_ByteString();
+ CFX_ByteString okey =
+ m_pEncryptDict ? m_pEncryptDict->GetString("O") : CFX_ByteString();
if (okey.GetLength() < 48) {
return FALSE;
}
- CFX_ByteString ukey = m_pEncryptDict
- ? m_pEncryptDict->GetString(FX_BSTRC("U"))
- : CFX_ByteString();
+ CFX_ByteString ukey =
+ m_pEncryptDict ? m_pEncryptDict->GetString("U") : CFX_ByteString();
if (ukey.GetLength() < 48) {
return FALSE;
}
@@ -348,10 +344,9 @@ FX_BOOL CPDF_StandardSecurityHandler::AES256_CheckPassword(
}
CRYPT_SHA256Finish(sha, digest);
}
- CFX_ByteString ekey =
- m_pEncryptDict
- ? m_pEncryptDict->GetString(bOwner ? FX_BSTRC("OE") : FX_BSTRC("UE"))
- : CFX_ByteString();
+ CFX_ByteString ekey = m_pEncryptDict
+ ? m_pEncryptDict->GetString(bOwner ? "OE" : "UE")
+ : CFX_ByteString();
if (ekey.GetLength() < 32) {
return FALSE;
}
@@ -363,7 +358,7 @@ FX_BOOL CPDF_StandardSecurityHandler::AES256_CheckPassword(
CRYPT_AESDecrypt(aes, key, ekey, 32);
CRYPT_AESSetKey(aes, 16, key, 32, FALSE);
CRYPT_AESSetIV(aes, iv);
- CFX_ByteString perms = m_pEncryptDict->GetString(FX_BSTRC("Perms"));
+ CFX_ByteString perms = m_pEncryptDict->GetString("Perms");
if (perms.IsEmpty()) {
return FALSE;
}
@@ -421,9 +416,8 @@ FX_BOOL CPDF_StandardSecurityHandler::CheckUserPassword(
int32_t key_len) {
CalcEncryptKey(m_pEncryptDict, password, pass_size, key, key_len,
bIgnoreEncryptMeta, m_pParser->GetIDArray());
- CFX_ByteString ukey = m_pEncryptDict
- ? m_pEncryptDict->GetString(FX_BSTRC("U"))
- : CFX_ByteString();
+ CFX_ByteString ukey =
+ m_pEncryptDict ? m_pEncryptDict->GetString("U") : CFX_ByteString();
if (ukey.GetLength() < 16) {
return FALSE;
}
@@ -471,7 +465,7 @@ CFX_ByteString CPDF_StandardSecurityHandler::GetUserPassword(
const uint8_t* owner_pass,
FX_DWORD pass_size,
int32_t key_len) {
- CFX_ByteString okey = m_pEncryptDict->GetString(FX_BSTRC("O"));
+ CFX_ByteString okey = m_pEncryptDict->GetString("O");
uint8_t passcode[32];
FX_DWORD i;
for (i = 0; i < 32; i++) {
@@ -530,7 +524,7 @@ FX_BOOL CPDF_StandardSecurityHandler::CheckOwnerPassword(
key_len);
}
FX_BOOL CPDF_StandardSecurityHandler::IsMetadataEncrypted() {
- return m_pEncryptDict->GetBoolean(FX_BSTRC("EncryptMetadata"), TRUE);
+ return m_pEncryptDict->GetBoolean("EncryptMetadata", TRUE);
}
CPDF_SecurityHandler* FPDF_CreateStandardSecurityHandler() {
return new CPDF_StandardSecurityHandler;
@@ -563,10 +557,9 @@ void CPDF_StandardSecurityHandler::OnCreate(CPDF_Dictionary* pEncryptDict,
if (bDefault) {
AES256_SetPassword(pEncryptDict, owner_pass, owner_size, TRUE,
m_EncryptKey);
- AES256_SetPerms(
- pEncryptDict, m_Permissions,
- pEncryptDict->GetBoolean(FX_BSTRC("EncryptMetadata"), TRUE),
- m_EncryptKey);
+ AES256_SetPerms(pEncryptDict, m_Permissions,
+ pEncryptDict->GetBoolean("EncryptMetadata", TRUE),
+ m_EncryptKey);
}
return;
}
@@ -599,7 +592,7 @@ void CPDF_StandardSecurityHandler::OnCreate(CPDF_Dictionary* pEncryptDict,
CRYPT_ArcFourCryptBlock(passcode, 32, tempkey, key_len);
}
}
- pEncryptDict->SetAtString(FX_BSTRC("O"), CFX_ByteString(passcode, 32));
+ pEncryptDict->SetAtString("O", CFX_ByteString(passcode, 32));
}
CalcEncryptKey(m_pEncryptDict, (uint8_t*)user_pass, user_size, m_EncryptKey,
key_len, FALSE, pIdArray);
@@ -607,7 +600,7 @@ void CPDF_StandardSecurityHandler::OnCreate(CPDF_Dictionary* pEncryptDict,
uint8_t tempbuf[32];
FXSYS_memcpy(tempbuf, defpasscode, 32);
CRYPT_ArcFourCryptBlock(tempbuf, 32, m_EncryptKey, key_len);
- pEncryptDict->SetAtString(FX_BSTRC("U"), CFX_ByteString(tempbuf, 32));
+ pEncryptDict->SetAtString("U", CFX_ByteString(tempbuf, 32));
} else {
uint8_t md5[100];
CRYPT_MD5Start(md5);
@@ -627,7 +620,7 @@ void CPDF_StandardSecurityHandler::OnCreate(CPDF_Dictionary* pEncryptDict,
CRYPT_ArcFourCryptBlock(digest, 16, tempkey, key_len);
}
CRYPT_MD5Generate(digest, 16, digest + 16);
- pEncryptDict->SetAtString(FX_BSTRC("U"), CFX_ByteString(digest, 32));
+ pEncryptDict->SetAtString("U", CFX_ByteString(digest, 32));
}
}
void CPDF_StandardSecurityHandler::OnCreate(CPDF_Dictionary* pEncryptDict,
@@ -659,7 +652,7 @@ void CPDF_StandardSecurityHandler::AES256_SetPassword(
CRYPT_SHA1Update(sha, (uint8_t*)"hello", 5);
uint8_t digest[20];
CRYPT_SHA1Finish(sha, digest);
- CFX_ByteString ukey = pEncryptDict->GetString(FX_BSTRC("U"));
+ CFX_ByteString ukey = pEncryptDict->GetString("U");
uint8_t digest1[48];
if (m_Revision >= 6) {
Revision6_Hash(password, size, digest,
@@ -674,8 +667,7 @@ void CPDF_StandardSecurityHandler::AES256_SetPassword(
CRYPT_SHA256Finish(sha, digest1);
}
FXSYS_memcpy(digest1 + 32, digest, 16);
- pEncryptDict->SetAtString(bOwner ? FX_BSTRC("O") : FX_BSTRC("U"),
- CFX_ByteString(digest1, 48));
+ pEncryptDict->SetAtString(bOwner ? "O" : "U", CFX_ByteString(digest1, 48));
if (m_Revision >= 6) {
Revision6_Hash(password, size, digest + 8,
(bOwner ? (const uint8_t*)ukey : NULL), digest1);
@@ -695,8 +687,7 @@ void CPDF_StandardSecurityHandler::AES256_SetPassword(
CRYPT_AESSetIV(aes, iv);
CRYPT_AESEncrypt(aes, digest1, key, 32);
FX_Free(aes);
- pEncryptDict->SetAtString(bOwner ? FX_BSTRC("OE") : FX_BSTRC("UE"),
- CFX_ByteString(digest1, 32));
+ pEncryptDict->SetAtString(bOwner ? "OE" : "UE", CFX_ByteString(digest1, 32));
}
void CPDF_StandardSecurityHandler::AES256_SetPerms(
CPDF_Dictionary* pEncryptDict,
@@ -723,7 +714,7 @@ void CPDF_StandardSecurityHandler::AES256_SetPerms(
CRYPT_AESSetIV(aes, iv);
CRYPT_AESEncrypt(aes, buf1, buf, 16);
FX_Free(aes);
- pEncryptDict->SetAtString(FX_BSTRC("Perms"), CFX_ByteString(buf1, 16));
+ pEncryptDict->SetAtString("Perms", CFX_ByteString(buf1, 16));
}
void CPDF_StandardCryptoHandler::CryptBlock(FX_BOOL bEncrypt,
FX_DWORD objnum,
diff --git a/core/src/fpdfapi/fpdf_parser/fpdf_parser_fdf.cpp b/core/src/fpdfapi/fpdf_parser/fpdf_parser_fdf.cpp
index d22711c6e4..f61036aef6 100644
--- a/core/src/fpdfapi/fpdf_parser/fpdf_parser_fdf.cpp
+++ b/core/src/fpdfapi/fpdf_parser/fpdf_parser_fdf.cpp
@@ -21,7 +21,7 @@ CFDF_Document* CFDF_Document::CreateNewDoc() {
pDoc->m_pRootDict = new CPDF_Dictionary;
pDoc->AddIndirectObject(pDoc->m_pRootDict);
CPDF_Dictionary* pFDFDict = new CPDF_Dictionary;
- pDoc->m_pRootDict->SetAt(FX_BSTRC("FDF"), pFDFDict);
+ pDoc->m_pRootDict->SetAt("FDF", pFDFDict);
return pDoc;
}
CFDF_Document* CFDF_Document::ParseFile(IFX_FileRead* pFile, FX_BOOL bOwnFile) {
@@ -55,7 +55,7 @@ void CFDF_Document::ParseStream(IFX_FileRead* pFile, FX_BOOL bOwnFile) {
break;
}
word = parser.GetNextWord(bNumber);
- if (word != FX_BSTRC("obj")) {
+ if (word != "obj") {
break;
}
CPDF_Object* pObj = parser.GetObject(this, objnum, 0, 0);
@@ -64,16 +64,16 @@ void CFDF_Document::ParseStream(IFX_FileRead* pFile, FX_BOOL bOwnFile) {
}
InsertIndirectObject(objnum, pObj);
word = parser.GetNextWord(bNumber);
- if (word != FX_BSTRC("endobj")) {
+ if (word != "endobj") {
break;
}
} else {
- if (word != FX_BSTRC("trailer")) {
+ if (word != "trailer") {
break;
}
if (CPDF_Dictionary* pMainDict =
ToDictionary(parser.GetObject(this, 0, 0, 0))) {
- m_pRootDict = pMainDict->GetDict(FX_BSTRC("Root"));
+ m_pRootDict = pMainDict->GetDict("Root");
pMainDict->Release();
}
break;
@@ -84,27 +84,25 @@ FX_BOOL CFDF_Document::WriteBuf(CFX_ByteTextBuf& buf) const {
if (m_pRootDict == NULL) {
return FALSE;
}
- buf << FX_BSTRC("%FDF-1.2\r\n");
+ buf << "%FDF-1.2\r\n";
FX_POSITION pos = m_IndirectObjs.GetStartPosition();
while (pos) {
size_t objnum;
CPDF_Object* pObj;
m_IndirectObjs.GetNextAssoc(pos, (void*&)objnum, (void*&)pObj);
- buf << (FX_DWORD)objnum << FX_BSTRC(" 0 obj\r\n") << pObj
- << FX_BSTRC("\r\nendobj\r\n\r\n");
+ buf << (FX_DWORD)objnum << " 0 obj\r\n" << pObj << "\r\nendobj\r\n\r\n";
}
- buf << FX_BSTRC("trailer\r\n<</Root ") << m_pRootDict->GetObjNum()
- << FX_BSTRC(" 0 R>>\r\n%%EOF\r\n");
+ buf << "trailer\r\n<</Root " << m_pRootDict->GetObjNum()
+ << " 0 R>>\r\n%%EOF\r\n";
return TRUE;
}
CFX_WideString CFDF_Document::GetWin32Path() const {
- CPDF_Dictionary* pDict =
- m_pRootDict ? m_pRootDict->GetDict(FX_BSTRC("FDF")) : NULL;
- CPDF_Object* pFileSpec = pDict ? pDict->GetElementValue(FX_BSTRC("F")) : NULL;
+ CPDF_Dictionary* pDict = m_pRootDict ? m_pRootDict->GetDict("FDF") : NULL;
+ CPDF_Object* pFileSpec = pDict ? pDict->GetElementValue("F") : NULL;
if (!pFileSpec)
return CFX_WideString();
if (pFileSpec->IsString())
- return FPDF_FileSpec_GetWin32Path(m_pRootDict->GetDict(FX_BSTRC("FDF")));
+ return FPDF_FileSpec_GetWin32Path(m_pRootDict->GetDict("FDF"));
return FPDF_FileSpec_GetWin32Path(pFileSpec);
}
static CFX_WideString ChangeSlash(const FX_WCHAR* str) {
@@ -141,9 +139,9 @@ void FPDF_FileSpec_SetWin32Path(CPDF_Object* pFileSpec,
if (pFileSpec->IsString()) {
pFileSpec->SetString(CFX_ByteString::FromUnicode(result));
} else if (CPDF_Dictionary* pFileDict = pFileSpec->AsDictionary()) {
- pFileDict->SetAtString(FX_BSTRC("F"), CFX_ByteString::FromUnicode(result));
- pFileDict->SetAtString(FX_BSTRC("UF"), PDF_EncodeText(result));
- pFileDict->RemoveAt(FX_BSTRC("FS"));
+ pFileDict->SetAtString("F", CFX_ByteString::FromUnicode(result));
+ pFileDict->SetAtString("UF", PDF_EncodeText(result));
+ pFileDict->RemoveAt("FS");
}
}
CFX_WideString FPDF_FileSpec_GetWin32Path(const CPDF_Object* pFileSpec) {
@@ -151,15 +149,15 @@ CFX_WideString FPDF_FileSpec_GetWin32Path(const CPDF_Object* pFileSpec) {
if (!pFileSpec) {
wsFileName = CFX_WideString();
} else if (const CPDF_Dictionary* pDict = pFileSpec->AsDictionary()) {
- wsFileName = pDict->GetUnicodeText(FX_BSTRC("UF"));
+ wsFileName = pDict->GetUnicodeText("UF");
if (wsFileName.IsEmpty()) {
- wsFileName = CFX_WideString::FromLocal(pDict->GetString(FX_BSTRC("F")));
+ wsFileName = CFX_WideString::FromLocal(pDict->GetString("F"));
}
- if (pDict->GetString(FX_BSTRC("FS")) == FX_BSTRC("URL")) {
+ if (pDict->GetString("FS") == "URL") {
return wsFileName;
}
- if (wsFileName.IsEmpty() && pDict->KeyExist(FX_BSTRC("DOS"))) {
- wsFileName = CFX_WideString::FromLocal(pDict->GetString(FX_BSTRC("DOS")));
+ if (wsFileName.IsEmpty() && pDict->KeyExist("DOS")) {
+ wsFileName = CFX_WideString::FromLocal(pDict->GetString("DOS"));
}
} else {
wsFileName = CFX_WideString::FromLocal(pFileSpec->GetString());
diff --git a/core/src/fpdfapi/fpdf_parser/fpdf_parser_objects.cpp b/core/src/fpdfapi/fpdf_parser/fpdf_parser_objects.cpp
index fe20a92a5b..857e19c28f 100644
--- a/core/src/fpdfapi/fpdf_parser/fpdf_parser_objects.cpp
+++ b/core/src/fpdfapi/fpdf_parser/fpdf_parser_objects.cpp
@@ -164,7 +164,7 @@ void CPDF_Object::SetString(const CFX_ByteString& str) {
ASSERT(this != NULL);
switch (m_Type) {
case PDFOBJ_BOOLEAN:
- AsBoolean()->m_bValue = (str == FX_BSTRC("true"));
+ AsBoolean()->m_bValue = (str == "true");
return;
case PDFOBJ_NUMBER:
AsNumber()->SetString(str);
@@ -863,7 +863,7 @@ void CPDF_Stream::InitStream(uint8_t* pData,
}
m_dwSize = size;
if (m_pDict) {
- m_pDict->SetAtInteger(FX_BSTRC("Length"), size);
+ m_pDict->SetAtInteger("Length", size);
}
}
void CPDF_Stream::SetData(const uint8_t* pData,
@@ -885,10 +885,10 @@ void CPDF_Stream::SetData(const uint8_t* pData,
m_dwSize = size;
if (!m_pDict)
m_pDict = new CPDF_Dictionary;
- m_pDict->SetAtInteger(FX_BSTRC("Length"), size);
+ m_pDict->SetAtInteger("Length", size);
if (!bCompressed) {
- m_pDict->RemoveAt(FX_BSTRC("Filter"));
- m_pDict->RemoveAt(FX_BSTRC("DecodeParms"));
+ m_pDict->RemoveAt("Filter");
+ m_pDict->RemoveAt("DecodeParms");
}
}
FX_BOOL CPDF_Stream::ReadRawData(FX_FILESIZE offset,
@@ -907,7 +907,7 @@ void CPDF_Stream::InitStreamFromFile(IFX_FileRead* pFile,
m_pFile = pFile;
m_dwSize = (FX_DWORD)pFile->GetSize();
if (m_pDict) {
- m_pDict->SetAtInteger(FX_BSTRC("Length"), m_dwSize);
+ m_pDict->SetAtInteger("Length", m_dwSize);
}
}
@@ -996,7 +996,7 @@ void CPDF_StreamAcc::LoadAllData(const CPDF_Stream* pStream,
m_pStream = pStream;
if (pStream->IsMemoryBased() &&
- (!pStream->GetDict()->KeyExist(FX_BSTRC("Filter")) || bRawAccess)) {
+ (!pStream->GetDict()->KeyExist("Filter") || bRawAccess)) {
m_dwSize = pStream->m_dwSize;
m_pData = (uint8_t*)pStream->m_pDataBuf;
return;
@@ -1015,7 +1015,7 @@ void CPDF_StreamAcc::LoadAllData(const CPDF_Stream* pStream,
}
uint8_t* pDecryptedData = pSrcData;
FX_DWORD dwDecryptedSize = dwSrcSize;
- if (!pStream->GetDict()->KeyExist(FX_BSTRC("Filter")) || bRawAccess) {
+ if (!pStream->GetDict()->KeyExist("Filter") || bRawAccess) {
m_pData = pDecryptedData;
m_dwSize = dwDecryptedSize;
} else {
diff --git a/core/src/fpdfapi/fpdf_parser/fpdf_parser_parser.cpp b/core/src/fpdfapi/fpdf_parser/fpdf_parser_parser.cpp
index c2a856cb50..61a25d565b 100644
--- a/core/src/fpdfapi/fpdf_parser/fpdf_parser_parser.cpp
+++ b/core/src/fpdfapi/fpdf_parser/fpdf_parser_parser.cpp
@@ -22,7 +22,7 @@
namespace {
struct SearchTagRecord {
- const uint8_t* m_pTag;
+ const char* m_pTag;
FX_DWORD m_Len;
FX_DWORD m_Offset;
};
@@ -68,11 +68,11 @@ FX_DWORD GetVarInt(const uint8_t* p, int32_t n) {
}
int32_t GetStreamNCount(CPDF_StreamAcc* pObjStream) {
- return pObjStream->GetDict()->GetInteger(FX_BSTRC("N"));
+ return pObjStream->GetDict()->GetInteger("N");
}
int32_t GetStreamFirst(CPDF_StreamAcc* pObjStream) {
- return pObjStream->GetDict()->GetInteger(FX_BSTRC("First"));
+ return pObjStream->GetDict()->GetInteger("First");
}
bool CanReadFromBitStream(const CFX_BitStream* hStream,
@@ -89,14 +89,14 @@ using ScopedFileStream =
nonstd::unique_ptr<IFX_FileStream, ReleaseDeleter<IFX_FileStream>>;
FX_BOOL IsSignatureDict(const CPDF_Dictionary* pDict) {
- CPDF_Object* pType = pDict->GetElementValue(FX_BSTRC("Type"));
+ CPDF_Object* pType = pDict->GetElementValue("Type");
if (!pType) {
- pType = pDict->GetElementValue(FX_BSTRC("FT"));
+ pType = pDict->GetElementValue("FT");
if (!pType) {
return FALSE;
}
}
- if (pType->GetString() == FX_BSTRC("Sig")) {
+ if (pType->GetString() == "Sig") {
return TRUE;
}
return FALSE;
@@ -201,7 +201,7 @@ FX_DWORD CPDF_Parser::StartParse(IFX_FileRead* pFileAccess,
m_pDocument = new CPDF_Document(this);
FX_BOOL bXRefRebuilt = FALSE;
- if (m_Syntax.SearchWord(FX_BSTRC("startxref"), TRUE, FALSE, 4096)) {
+ if (m_Syntax.SearchWord("startxref", TRUE, FALSE, 4096)) {
FX_FILESIZE startxref_offset = m_Syntax.SavePos();
void* pResult = FXSYS_bsearch(&startxref_offset, m_SortedOffset.GetData(),
m_SortedOffset.GetSize(), sizeof(FX_FILESIZE),
@@ -264,7 +264,7 @@ FX_DWORD CPDF_Parser::StartParse(IFX_FileRead* pFileAccess,
}
if (m_pSecurityHandler && !m_pSecurityHandler->IsMetadataEncrypted()) {
CPDF_Reference* pMetadata =
- ToReference(m_pDocument->GetRoot()->GetElement(FX_BSTRC("Metadata")));
+ ToReference(m_pDocument->GetRoot()->GetElement("Metadata"));
if (pMetadata)
m_Syntax.m_MetadataObjnum = pMetadata->GetRefObjNum();
}
@@ -276,7 +276,7 @@ FX_DWORD CPDF_Parser::SetEncryptHandler() {
if (m_pTrailer == NULL) {
return PDFPARSE_ERROR_FORMAT;
}
- CPDF_Object* pEncryptObj = m_pTrailer->GetElement(FX_BSTRC("Encrypt"));
+ CPDF_Object* pEncryptObj = m_pTrailer->GetElement("Encrypt");
if (pEncryptObj) {
if (CPDF_Dictionary* pEncryptDict = pEncryptObj->AsDictionary()) {
SetEncryptDictionary(pEncryptDict);
@@ -301,10 +301,10 @@ FX_DWORD CPDF_Parser::SetEncryptHandler() {
}
m_Syntax.SetEncrypt(pCryptoHandler.release());
} else if (m_pEncryptDict) {
- CFX_ByteString filter = m_pEncryptDict->GetString(FX_BSTRC("Filter"));
+ CFX_ByteString filter = m_pEncryptDict->GetString("Filter");
nonstd::unique_ptr<CPDF_SecurityHandler> pSecurityHandler;
FX_DWORD err = PDFPARSE_ERROR_HANDLER;
- if (filter == FX_BSTRC("Standard")) {
+ if (filter == "Standard") {
pSecurityHandler.reset(FPDF_CreateStandardSecurityHandler());
err = PDFPARSE_ERROR_PASSWORD;
}
@@ -351,7 +351,7 @@ FX_BOOL CPDF_Parser::LoadAllCrossRefV4(FX_FILESIZE xrefpos) {
if (m_pTrailer == NULL) {
return FALSE;
}
- int32_t xrefsize = GetDirectInteger(m_pTrailer, FX_BSTRC("Size"));
+ int32_t xrefsize = GetDirectInteger(m_pTrailer, "Size");
if (xrefsize <= 0 || xrefsize > (1 << 20)) {
return FALSE;
}
@@ -359,11 +359,11 @@ FX_BOOL CPDF_Parser::LoadAllCrossRefV4(FX_FILESIZE xrefpos) {
m_V5Type.SetSize(xrefsize);
CFX_FileSizeArray CrossRefList, XRefStreamList;
CrossRefList.Add(xrefpos);
- XRefStreamList.Add(GetDirectInteger(m_pTrailer, FX_BSTRC("XRefStm")));
- if (!CheckDirectType(m_pTrailer, FX_BSTRC("Prev"), PDFOBJ_NUMBER)) {
+ XRefStreamList.Add(GetDirectInteger(m_pTrailer, "XRefStm"));
+ if (!CheckDirectType(m_pTrailer, "Prev", PDFOBJ_NUMBER)) {
return FALSE;
}
- FX_FILESIZE newxrefpos = GetDirectInteger(m_pTrailer, FX_BSTRC("Prev"));
+ FX_FILESIZE newxrefpos = GetDirectInteger(m_pTrailer, "Prev");
if (newxrefpos == xrefpos) {
return FALSE;
}
@@ -376,15 +376,15 @@ FX_BOOL CPDF_Parser::LoadAllCrossRefV4(FX_FILESIZE xrefpos) {
if (!pDict)
return FALSE;
- if (!CheckDirectType(pDict.get(), FX_BSTRC("Prev"), PDFOBJ_NUMBER))
+ if (!CheckDirectType(pDict.get(), "Prev", PDFOBJ_NUMBER))
return FALSE;
- newxrefpos = GetDirectInteger(pDict.get(), FX_BSTRC("Prev"));
+ newxrefpos = GetDirectInteger(pDict.get(), "Prev");
if (newxrefpos == xrefpos)
return FALSE;
xrefpos = newxrefpos;
- XRefStreamList.InsertAt(0, pDict->GetInteger(FX_BSTRC("XRefStm")));
+ XRefStreamList.InsertAt(0, pDict->GetInteger("XRefStm"));
m_Trailers.Add(pDict.release());
}
for (int32_t i = 0; i < CrossRefList.GetSize(); i++) {
@@ -402,14 +402,14 @@ FX_BOOL CPDF_Parser::LoadLinearizedAllCrossRefV4(FX_FILESIZE xrefpos,
if (m_pTrailer == NULL) {
return FALSE;
}
- int32_t xrefsize = GetDirectInteger(m_pTrailer, FX_BSTRC("Size"));
+ int32_t xrefsize = GetDirectInteger(m_pTrailer, "Size");
if (xrefsize == 0) {
return FALSE;
}
CFX_FileSizeArray CrossRefList, XRefStreamList;
CrossRefList.Add(xrefpos);
- XRefStreamList.Add(GetDirectInteger(m_pTrailer, FX_BSTRC("XRefStm")));
- xrefpos = GetDirectInteger(m_pTrailer, FX_BSTRC("Prev"));
+ XRefStreamList.Add(GetDirectInteger(m_pTrailer, "XRefStm"));
+ xrefpos = GetDirectInteger(m_pTrailer, "Prev");
while (xrefpos) {
CrossRefList.InsertAt(0, xrefpos);
LoadCrossRefV4(xrefpos, 0, TRUE, FALSE);
@@ -417,8 +417,8 @@ FX_BOOL CPDF_Parser::LoadLinearizedAllCrossRefV4(FX_FILESIZE xrefpos,
if (pDict == NULL) {
return FALSE;
}
- xrefpos = GetDirectInteger(pDict, FX_BSTRC("Prev"));
- XRefStreamList.InsertAt(0, pDict->GetInteger(FX_BSTRC("XRefStm")));
+ xrefpos = GetDirectInteger(pDict, "Prev");
+ XRefStreamList.InsertAt(0, pDict->GetInteger("XRefStm"));
m_Trailers.Add(pDict);
}
for (int32_t i = 1; i < CrossRefList.GetSize(); i++)
@@ -500,7 +500,7 @@ bool CPDF_Parser::LoadCrossRefV4(FX_FILESIZE pos,
FX_BOOL bSkip,
FX_BOOL bFirst) {
m_Syntax.RestorePos(pos);
- if (m_Syntax.GetKeyword() != FX_BSTRC("xref"))
+ if (m_Syntax.GetKeyword() != "xref")
return false;
if (!FindPosInOffsets(pos))
@@ -786,13 +786,12 @@ FX_BOOL CPDF_Parser::RebuildCrossRef() {
m_pDocument, obj_pos, objnum, NULL, &obj_end);
if (CPDF_Stream* pStream = ToStream(pObject)) {
if (CPDF_Dictionary* pDict = pStream->GetDict()) {
- if ((pDict->KeyExist(FX_BSTRC("Type"))) &&
- (pDict->GetString(FX_BSTRC("Type")) ==
- FX_BSTRC("XRef") &&
- pDict->KeyExist(FX_BSTRC("Size")))) {
- CPDF_Object* pRoot = pDict->GetElement(FX_BSTRC("Root"));
+ if ((pDict->KeyExist("Type")) &&
+ (pDict->GetString("Type") == "XRef" &&
+ pDict->KeyExist("Size"))) {
+ CPDF_Object* pRoot = pDict->GetElement("Root");
if (pRoot && pRoot->GetDict() &&
- pRoot->GetDict()->GetElement(FX_BSTRC("Pages"))) {
+ pRoot->GetDict()->GetElement("Pages")) {
if (m_pTrailer)
m_pTrailer->Release();
m_pTrailer = ToDictionary(pDict->Clone());
@@ -802,7 +801,7 @@ FX_BOOL CPDF_Parser::RebuildCrossRef() {
}
FX_FILESIZE offset = 0;
m_Syntax.RestorePos(obj_pos);
- offset = m_Syntax.FindTag(FX_BSTRC("obj"), 0);
+ offset = m_Syntax.FindTag("obj", 0);
if (offset == -1) {
offset = 0;
} else {
@@ -853,8 +852,7 @@ FX_BOOL CPDF_Parser::RebuildCrossRef() {
if (CPDF_Dictionary* pTrailer =
pStream ? pStream->GetDict() : pObj->AsDictionary()) {
if (m_pTrailer) {
- CPDF_Object* pRoot =
- pTrailer->GetElement(FX_BSTRC("Root"));
+ CPDF_Object* pRoot = pTrailer->GetElement("Root");
CPDF_Reference* pRef = ToReference(pRoot);
if (!pRoot ||
(pRef &&
@@ -888,7 +886,7 @@ FX_BOOL CPDF_Parser::RebuildCrossRef() {
}
FX_FILESIZE dwSavePos = m_Syntax.SavePos();
CFX_ByteString strWord = m_Syntax.GetKeyword();
- if (!strWord.Compare(FX_BSTRC("startxref"))) {
+ if (!strWord.Compare("startxref")) {
FX_BOOL bNumber = FALSE;
CFX_ByteString bsOffset = m_Syntax.GetNextWord(bNumber);
if (bNumber) {
@@ -1010,8 +1008,8 @@ FX_BOOL CPDF_Parser::LoadCrossRefV5(FX_FILESIZE* pos, FX_BOOL bMainXRef) {
if (!pStream)
return FALSE;
- *pos = pStream->GetDict()->GetInteger(FX_BSTRC("Prev"));
- int32_t size = pStream->GetDict()->GetInteger(FX_BSTRC("Size"));
+ *pos = pStream->GetDict()->GetInteger("Prev");
+ int32_t size = pStream->GetDict()->GetInteger("Size");
if (size < 0) {
pStream->Release();
return FALSE;
@@ -1026,7 +1024,7 @@ FX_BOOL CPDF_Parser::LoadCrossRefV5(FX_FILESIZE* pos, FX_BOOL bMainXRef) {
m_Trailers.Add(ToDictionary(pStream->GetDict()->Clone()));
}
std::vector<std::pair<int32_t, int32_t> > arrIndex;
- CPDF_Array* pArray = pStream->GetDict()->GetArray(FX_BSTRC("Index"));
+ CPDF_Array* pArray = pStream->GetDict()->GetArray("Index");
if (pArray) {
FX_DWORD nPairSize = pArray->GetCount() / 2;
for (FX_DWORD i = 0; i < nPairSize; i++) {
@@ -1044,7 +1042,7 @@ FX_BOOL CPDF_Parser::LoadCrossRefV5(FX_FILESIZE* pos, FX_BOOL bMainXRef) {
if (arrIndex.size() == 0) {
arrIndex.push_back(std::make_pair(0, size));
}
- pArray = pStream->GetDict()->GetArray(FX_BSTRC("W"));
+ pArray = pStream->GetDict()->GetArray("W");
if (pArray == NULL) {
pStream->Release();
return FALSE;
@@ -1139,24 +1137,24 @@ FX_BOOL CPDF_Parser::LoadCrossRefV5(FX_FILESIZE* pos, FX_BOOL bMainXRef) {
return TRUE;
}
CPDF_Array* CPDF_Parser::GetIDArray() {
- CPDF_Object* pID = m_pTrailer ? m_pTrailer->GetElement(FX_BSTRC("ID")) : NULL;
+ CPDF_Object* pID = m_pTrailer ? m_pTrailer->GetElement("ID") : NULL;
if (!pID)
return nullptr;
if (CPDF_Reference* pRef = pID->AsReference()) {
pID = ParseIndirectObject(nullptr, pRef->GetRefObjNum());
- m_pTrailer->SetAt(FX_BSTRC("ID"), pID);
+ m_pTrailer->SetAt("ID", pID);
}
return ToArray(pID);
}
FX_DWORD CPDF_Parser::GetRootObjNum() {
- CPDF_Reference* pRef = ToReference(
- m_pTrailer ? m_pTrailer->GetElement(FX_BSTRC("Root")) : nullptr);
+ CPDF_Reference* pRef =
+ ToReference(m_pTrailer ? m_pTrailer->GetElement("Root") : nullptr);
return pRef ? pRef->GetRefObjNum() : 0;
}
FX_DWORD CPDF_Parser::GetInfoObjNum() {
- CPDF_Reference* pRef = ToReference(
- m_pTrailer ? m_pTrailer->GetElement(FX_BSTRC("Info")) : nullptr);
+ CPDF_Reference* pRef =
+ ToReference(m_pTrailer ? m_pTrailer->GetElement("Info") : nullptr);
return pRef ? pRef->GetRefObjNum() : 0;
}
FX_BOOL CPDF_Parser::IsFormStream(FX_DWORD objnum, FX_BOOL& bForm) {
@@ -1184,7 +1182,7 @@ FX_BOOL CPDF_Parser::IsFormStream(FX_DWORD objnum, FX_BOOL& bForm) {
FX_FILESIZE size = ((FX_FILESIZE*)pResult)[1] - pos;
FX_FILESIZE SavedPos = m_Syntax.SavePos();
m_Syntax.RestorePos(pos);
- bForm = m_Syntax.SearchMultiWord(FX_BSTRC("/Form\0stream"), TRUE, size) == 0;
+ bForm = m_Syntax.SearchMultiWord("/Form\0stream", TRUE, size) == 0;
m_Syntax.RestorePos(SavedPos);
return TRUE;
}
@@ -1337,7 +1335,7 @@ void CPDF_Parser::GetIndirectBinary(FX_DWORD objnum,
m_Syntax.RestorePos(SavedPos);
return;
}
- if (m_Syntax.GetKeyword() != FX_BSTRC("obj")) {
+ if (m_Syntax.GetKeyword() != "obj") {
m_Syntax.RestorePos(SavedPos);
return;
}
@@ -1353,11 +1351,11 @@ void CPDF_Parser::GetIndirectBinary(FX_DWORD objnum,
if (nextoff != pos) {
m_Syntax.RestorePos(nextoff);
word = m_Syntax.GetNextWord(bIsNumber);
- if (word == FX_BSTRC("xref")) {
+ if (word == "xref") {
bNextOffValid = TRUE;
} else if (bIsNumber) {
word = m_Syntax.GetNextWord(bIsNumber);
- if (bIsNumber && m_Syntax.GetKeyword() == FX_BSTRC("obj")) {
+ if (bIsNumber && m_Syntax.GetKeyword() == "obj") {
bNextOffValid = TRUE;
}
}
@@ -1365,7 +1363,7 @@ void CPDF_Parser::GetIndirectBinary(FX_DWORD objnum,
if (!bNextOffValid) {
m_Syntax.RestorePos(pos);
while (1) {
- if (m_Syntax.GetKeyword() == FX_BSTRC("endobj")) {
+ if (m_Syntax.GetKeyword() == "endobj") {
break;
}
if (m_Syntax.SavePos() == m_Syntax.m_FileLen) {
@@ -1406,7 +1404,7 @@ CPDF_Object* CPDF_Parser::ParseIndirectObjectAt(CPDF_IndirectObjects* pObjList,
return NULL;
}
FX_DWORD parser_gennum = FXSYS_atoi(word);
- if (m_Syntax.GetKeyword() != FX_BSTRC("obj")) {
+ if (m_Syntax.GetKeyword() != "obj") {
m_Syntax.RestorePos(SavedPos);
return NULL;
}
@@ -1414,7 +1412,7 @@ CPDF_Object* CPDF_Parser::ParseIndirectObjectAt(CPDF_IndirectObjects* pObjList,
m_Syntax.GetObject(pObjList, objnum, parser_gennum, pContext);
m_Syntax.SavePos();
CFX_ByteString bsWord = m_Syntax.GetKeyword();
- if (bsWord == FX_BSTRC("endobj")) {
+ if (bsWord == "endobj") {
m_Syntax.SavePos();
}
m_Syntax.RestorePos(SavedPos);
@@ -1451,7 +1449,7 @@ CPDF_Object* CPDF_Parser::ParseIndirectObjectAtByStrict(
return NULL;
}
FX_DWORD gennum = FXSYS_atoi(word);
- if (m_Syntax.GetKeyword() != FX_BSTRC("obj")) {
+ if (m_Syntax.GetKeyword() != "obj") {
m_Syntax.RestorePos(SavedPos);
return NULL;
}
@@ -1465,7 +1463,7 @@ CPDF_Object* CPDF_Parser::ParseIndirectObjectAtByStrict(
}
CPDF_Dictionary* CPDF_Parser::LoadTrailerV4() {
- if (m_Syntax.GetKeyword() != FX_BSTRC("trailer"))
+ if (m_Syntax.GetKeyword() != "trailer")
return nullptr;
nonstd::unique_ptr<CPDF_Object, ReleaseDeleter<CPDF_Object>> pObj(
@@ -1480,11 +1478,10 @@ FX_DWORD CPDF_Parser::GetPermissions(FX_BOOL bCheckRevision) {
return (FX_DWORD)-1;
}
FX_DWORD dwPermission = m_pSecurityHandler->GetPermissions();
- if (m_pEncryptDict &&
- m_pEncryptDict->GetString(FX_BSTRC("Filter")) == FX_BSTRC("Standard")) {
+ if (m_pEncryptDict && m_pEncryptDict->GetString("Filter") == "Standard") {
dwPermission &= 0xFFFFFFFC;
dwPermission |= 0xFFFFF0C0;
- if (bCheckRevision && m_pEncryptDict->GetInteger(FX_BSTRC("R")) == 2) {
+ if (bCheckRevision && m_pEncryptDict->GetInteger("R") == 2) {
dwPermission &= 0xFFFFF0FF;
}
}
@@ -1519,7 +1516,7 @@ FX_BOOL CPDF_Parser::IsLinearizedFile(IFX_FileRead* pFileAccess,
return FALSE;
}
FX_DWORD gennum = FXSYS_atoi(word);
- if (m_Syntax.GetKeyword() != FX_BSTRC("obj")) {
+ if (m_Syntax.GetKeyword() != "obj") {
m_Syntax.RestorePos(SavedPos);
return FALSE;
}
@@ -1529,10 +1526,10 @@ FX_BOOL CPDF_Parser::IsLinearizedFile(IFX_FileRead* pFileAccess,
}
CPDF_Dictionary* pDict = m_pLinearized->GetDict();
- if (pDict && pDict->GetElement(FX_BSTRC("Linearized"))) {
+ if (pDict && pDict->GetElement("Linearized")) {
m_Syntax.GetNextWord(bIsNumber);
- CPDF_Object* pLen = pDict->GetElement(FX_BSTRC("L"));
+ CPDF_Object* pLen = pDict->GetElement("L");
if (!pLen) {
m_pLinearized->Release();
m_pLinearized = NULL;
@@ -1542,10 +1539,10 @@ FX_BOOL CPDF_Parser::IsLinearizedFile(IFX_FileRead* pFileAccess,
return FALSE;
}
- if (CPDF_Number* pNo = ToNumber(pDict->GetElement(FX_BSTRC("P"))))
+ if (CPDF_Number* pNo = ToNumber(pDict->GetElement("P")))
m_dwFirstPageNo = pNo->GetInteger();
- if (CPDF_Number* pTable = ToNumber(pDict->GetElement(FX_BSTRC("T"))))
+ if (CPDF_Number* pTable = ToNumber(pDict->GetElement("T")))
m_LastXRefOffset = pTable->GetInteger();
return TRUE;
@@ -1588,7 +1585,7 @@ FX_DWORD CPDF_Parser::StartAsynParse(IFX_FileRead* pFileAccess,
if (m_pTrailer == NULL) {
return FALSE;
}
- int32_t xrefsize = GetDirectInteger(m_pTrailer, FX_BSTRC("Size"));
+ int32_t xrefsize = GetDirectInteger(m_pTrailer, "Size");
if (xrefsize > 0) {
m_CrossRef.SetSize(xrefsize);
m_V5Type.SetSize(xrefsize);
@@ -1629,8 +1626,8 @@ FX_DWORD CPDF_Parser::StartAsynParse(IFX_FileRead* pFileAccess,
}
}
if (m_pSecurityHandler && m_pSecurityHandler->IsMetadataEncrypted()) {
- if (CPDF_Reference* pMetadata = ToReference(
- m_pDocument->GetRoot()->GetElement(FX_BSTRC("Metadata"))))
+ if (CPDF_Reference* pMetadata =
+ ToReference(m_pDocument->GetRoot()->GetElement("Metadata")))
m_Syntax.m_MetadataObjnum = pMetadata->GetRefObjNum();
}
return PDFPARSE_ERROR_SUCCESS;
@@ -2044,7 +2041,7 @@ CPDF_Object* CPDF_SyntaxParser::GetObject(CPDF_IndirectObjects* pObjList,
CFX_ByteString nextword = GetNextWord(bIsNumber);
if (bIsNumber) {
CFX_ByteString nextword2 = GetNextWord(bIsNumber);
- if (nextword2 == FX_BSTRC("R")) {
+ if (nextword2 == "R") {
FX_DWORD objnum = FXSYS_atoi(word);
if (bTypeOnly)
return (CPDF_Object*)PDFOBJ_REFERENCE;
@@ -2056,17 +2053,17 @@ CPDF_Object* CPDF_SyntaxParser::GetObject(CPDF_IndirectObjects* pObjList,
return (CPDF_Object*)PDFOBJ_NUMBER;
return CPDF_Number::Create(word);
}
- if (word == FX_BSTRC("true") || word == FX_BSTRC("false")) {
+ if (word == "true" || word == "false") {
if (bTypeOnly)
return (CPDF_Object*)PDFOBJ_BOOLEAN;
- return CPDF_Boolean::Create(word == FX_BSTRC("true"));
+ return CPDF_Boolean::Create(word == "true");
}
- if (word == FX_BSTRC("null")) {
+ if (word == "null") {
if (bTypeOnly)
return (CPDF_Object*)PDFOBJ_NULL;
return CPDF_Null::Create();
}
- if (word == FX_BSTRC("(")) {
+ if (word == "(") {
if (bTypeOnly)
return (CPDF_Object*)PDFOBJ_STRING;
CFX_ByteString str = ReadString();
@@ -2075,7 +2072,7 @@ CPDF_Object* CPDF_SyntaxParser::GetObject(CPDF_IndirectObjects* pObjList,
}
return CPDF_String::Create(str, FALSE);
}
- if (word == FX_BSTRC("<")) {
+ if (word == "<") {
if (bTypeOnly)
return (CPDF_Object*)PDFOBJ_STRING;
CFX_ByteString str = ReadHexString();
@@ -2084,7 +2081,7 @@ CPDF_Object* CPDF_SyntaxParser::GetObject(CPDF_IndirectObjects* pObjList,
}
return CPDF_String::Create(str, TRUE);
}
- if (word == FX_BSTRC("[")) {
+ if (word == "[") {
if (bTypeOnly)
return (CPDF_Object*)PDFOBJ_ARRAY;
CPDF_Array* pArray = CPDF_Array::Create();
@@ -2099,7 +2096,7 @@ CPDF_Object* CPDF_SyntaxParser::GetObject(CPDF_IndirectObjects* pObjList,
return CPDF_Name::Create(
PDF_NameDecode(CFX_ByteStringC(m_WordBuffer + 1, m_WordSize - 1)));
}
- if (word == FX_BSTRC("<<")) {
+ if (word == "<<") {
if (bTypeOnly)
return (CPDF_Object*)PDFOBJ_DICTIONARY;
@@ -2117,10 +2114,10 @@ CPDF_Object* CPDF_SyntaxParser::GetObject(CPDF_IndirectObjects* pObjList,
return nullptr;
FX_FILESIZE SavedPos = m_Pos - key.GetLength();
- if (key == FX_BSTRC(">>"))
+ if (key == ">>")
break;
- if (key == FX_BSTRC("endobj")) {
+ if (key == "endobj") {
m_Pos = SavedPos;
break;
}
@@ -2132,7 +2129,7 @@ CPDF_Object* CPDF_SyntaxParser::GetObject(CPDF_IndirectObjects* pObjList,
if (key.IsEmpty())
continue;
- if (key == FX_BSTRC("/Contents"))
+ if (key == "/Contents")
dwSignValuePos = m_Pos;
CPDF_Object* pObj = GetObject(pObjList, objnum, gennum);
@@ -2153,7 +2150,7 @@ CPDF_Object* CPDF_SyntaxParser::GetObject(CPDF_IndirectObjects* pObjList,
FX_FILESIZE dwSavePos = m_Pos;
m_Pos = dwSignValuePos;
CPDF_Object* pObj = GetObject(pObjList, objnum, gennum, NULL, FALSE);
- pDict->SetAt(FX_BSTRC("Contents"), pObj);
+ pDict->SetAt("Contents", pObj);
m_Pos = dwSavePos;
}
if (pContext) {
@@ -2165,14 +2162,14 @@ CPDF_Object* CPDF_SyntaxParser::GetObject(CPDF_IndirectObjects* pObjList,
FX_FILESIZE SavedPos = m_Pos;
FX_BOOL bIsNumber;
CFX_ByteString nextword = GetNextWord(bIsNumber);
- if (nextword != FX_BSTRC("stream")) {
+ if (nextword != "stream") {
m_Pos = SavedPos;
return pDict.release();
}
return ReadStream(pDict.release(), pContext, objnum, gennum);
}
- if (word == FX_BSTRC(">>")) {
+ if (word == ">>") {
m_Pos = SavedPos;
return nullptr;
}
@@ -2205,7 +2202,7 @@ CPDF_Object* CPDF_SyntaxParser::GetObjectByStrict(
CFX_ByteString nextword = GetNextWord(bIsNumber);
if (bIsNumber) {
CFX_ByteString nextword2 = GetNextWord(bIsNumber);
- if (nextword2 == FX_BSTRC("R")) {
+ if (nextword2 == "R") {
if (bTypeOnly)
return (CPDF_Object*)PDFOBJ_REFERENCE;
FX_DWORD objnum = FXSYS_atoi(word);
@@ -2217,17 +2214,17 @@ CPDF_Object* CPDF_SyntaxParser::GetObjectByStrict(
return (CPDF_Object*)PDFOBJ_NUMBER;
return CPDF_Number::Create(word);
}
- if (word == FX_BSTRC("true") || word == FX_BSTRC("false")) {
+ if (word == "true" || word == "false") {
if (bTypeOnly)
return (CPDF_Object*)PDFOBJ_BOOLEAN;
- return CPDF_Boolean::Create(word == FX_BSTRC("true"));
+ return CPDF_Boolean::Create(word == "true");
}
- if (word == FX_BSTRC("null")) {
+ if (word == "null") {
if (bTypeOnly)
return (CPDF_Object*)PDFOBJ_NULL;
return CPDF_Null::Create();
}
- if (word == FX_BSTRC("(")) {
+ if (word == "(") {
if (bTypeOnly)
return (CPDF_Object*)PDFOBJ_STRING;
CFX_ByteString str = ReadString();
@@ -2235,7 +2232,7 @@ CPDF_Object* CPDF_SyntaxParser::GetObjectByStrict(
m_pCryptoHandler->Decrypt(objnum, gennum, str);
return CPDF_String::Create(str, FALSE);
}
- if (word == FX_BSTRC("<")) {
+ if (word == "<") {
if (bTypeOnly)
return (CPDF_Object*)PDFOBJ_STRING;
CFX_ByteString str = ReadHexString();
@@ -2243,7 +2240,7 @@ CPDF_Object* CPDF_SyntaxParser::GetObjectByStrict(
m_pCryptoHandler->Decrypt(objnum, gennum, str);
return CPDF_String::Create(str, TRUE);
}
- if (word == FX_BSTRC("[")) {
+ if (word == "[") {
if (bTypeOnly)
return (CPDF_Object*)PDFOBJ_ARRAY;
nonstd::unique_ptr<CPDF_Array, ReleaseDeleter<CPDF_Array>> pArray(
@@ -2258,7 +2255,7 @@ CPDF_Object* CPDF_SyntaxParser::GetObjectByStrict(
return CPDF_Name::Create(
PDF_NameDecode(CFX_ByteStringC(m_WordBuffer + 1, m_WordSize - 1)));
}
- if (word == FX_BSTRC("<<")) {
+ if (word == "<<") {
if (bTypeOnly)
return (CPDF_Object*)PDFOBJ_DICTIONARY;
if (pContext)
@@ -2273,10 +2270,10 @@ CPDF_Object* CPDF_SyntaxParser::GetObjectByStrict(
if (key.IsEmpty())
return nullptr;
- if (key == FX_BSTRC(">>"))
+ if (key == ">>")
break;
- if (key == FX_BSTRC("endobj")) {
+ if (key == "endobj") {
m_Pos = SavedPos;
break;
}
@@ -2306,14 +2303,14 @@ CPDF_Object* CPDF_SyntaxParser::GetObjectByStrict(
FX_FILESIZE SavedPos = m_Pos;
FX_BOOL bIsNumber;
CFX_ByteString nextword = GetNextWord(bIsNumber);
- if (nextword != FX_BSTRC("stream")) {
+ if (nextword != "stream") {
m_Pos = SavedPos;
return pDict.release();
}
return ReadStream(pDict.release(), pContext, objnum, gennum);
}
- if (word == FX_BSTRC(">>")) {
+ if (word == ">>") {
m_Pos = SavedPos;
return nullptr;
}
@@ -2339,7 +2336,7 @@ CPDF_Stream* CPDF_SyntaxParser::ReadStream(CPDF_Dictionary* pDict,
PARSE_CONTEXT* pContext,
FX_DWORD objnum,
FX_DWORD gennum) {
- CPDF_Object* pLenObj = pDict->GetElement(FX_BSTRC("Length"));
+ CPDF_Object* pLenObj = pDict->GetElement("Length");
FX_FILESIZE len = -1;
CPDF_Reference* pLenObjRef = ToReference(pLenObj);
@@ -2354,8 +2351,9 @@ CPDF_Stream* CPDF_SyntaxParser::ReadStream(CPDF_Dictionary* pDict,
if (pContext) {
pContext->m_DataStart = streamStartPos;
}
- const unsigned int ENDSTREAM_LEN = sizeof("endstream") - 1;
- const unsigned int ENDOBJ_LEN = sizeof("endobj") - 1;
+
+ const CFX_ByteStringC kEndStreamStr("endstream");
+ const CFX_ByteStringC kEndObjStr("endobj");
CPDF_CryptoHandler* pCryptoHandler =
objnum == (FX_DWORD)m_MetadataObjnum ? nullptr : m_pCryptoHandler.get();
if (!pCryptoHandler) {
@@ -2367,13 +2365,15 @@ CPDF_Stream* CPDF_SyntaxParser::ReadStream(CPDF_Dictionary* pDict,
m_Pos = pos.ValueOrDie();
}
m_Pos += ReadEOLMarkers(m_Pos);
- FXSYS_memset(m_WordBuffer, 0, ENDSTREAM_LEN + 1);
+ FXSYS_memset(m_WordBuffer, 0, kEndStreamStr.GetLength() + 1);
GetNextWord();
// Earlier version of PDF specification doesn't require EOL marker before
// 'endstream' keyword. If keyword 'endstream' follows the bytes in
// specified length, it signals the end of stream.
- if (FXSYS_memcmp(m_WordBuffer, "endstream", ENDSTREAM_LEN) == 0)
+ if (FXSYS_memcmp(m_WordBuffer, kEndStreamStr.GetPtr(),
+ kEndStreamStr.GetLength()) == 0) {
bSearchForKeyword = FALSE;
+ }
}
if (bSearchForKeyword) {
// If len is not available, len needs to be calculated
@@ -2381,30 +2381,30 @@ CPDF_Stream* CPDF_SyntaxParser::ReadStream(CPDF_Dictionary* pDict,
m_Pos = streamStartPos;
FX_FILESIZE endStreamOffset = 0;
while (endStreamOffset >= 0) {
- endStreamOffset = FindTag(FX_BSTRC("endstream"), 0);
+ endStreamOffset = FindTag(kEndStreamStr, 0);
if (endStreamOffset < 0) {
// Can't find any "endstream".
break;
}
- if (IsWholeWord(m_Pos - ENDSTREAM_LEN, m_FileLen,
- FX_BSTRC("endstream").GetPtr(), ENDSTREAM_LEN, TRUE)) {
+ if (IsWholeWord(m_Pos - kEndStreamStr.GetLength(), m_FileLen,
+ kEndStreamStr, TRUE)) {
// Stop searching when the keyword "endstream" is found.
- endStreamOffset = m_Pos - streamStartPos - ENDSTREAM_LEN;
+ endStreamOffset = m_Pos - streamStartPos - kEndStreamStr.GetLength();
break;
}
}
m_Pos = streamStartPos;
FX_FILESIZE endObjOffset = 0;
while (endObjOffset >= 0) {
- endObjOffset = FindTag(FX_BSTRC("endobj"), 0);
+ endObjOffset = FindTag(kEndObjStr, 0);
if (endObjOffset < 0) {
// Can't find any "endobj".
break;
}
- if (IsWholeWord(m_Pos - ENDOBJ_LEN, m_FileLen,
- FX_BSTRC("endobj").GetPtr(), ENDOBJ_LEN, TRUE)) {
+ if (IsWholeWord(m_Pos - kEndObjStr.GetLength(), m_FileLen, kEndObjStr,
+ TRUE)) {
// Stop searching when the keyword "endobj" is found.
- endObjOffset = m_Pos - streamStartPos - ENDOBJ_LEN;
+ endObjOffset = m_Pos - streamStartPos - kEndObjStr.GetLength();
break;
}
}
@@ -2436,7 +2436,7 @@ CPDF_Stream* CPDF_SyntaxParser::ReadStream(CPDF_Dictionary* pDict,
pDict->Release();
return nullptr;
}
- pDict->SetAtInteger(FX_BSTRC("Length"), len);
+ pDict->SetAtInteger("Length", len);
}
m_Pos = streamStartPos;
}
@@ -2465,11 +2465,12 @@ CPDF_Stream* CPDF_SyntaxParser::ReadStream(CPDF_Dictionary* pDict,
pContext->m_DataEnd = pContext->m_DataStart + len;
}
streamStartPos = m_Pos;
- FXSYS_memset(m_WordBuffer, 0, ENDOBJ_LEN + 1);
+ FXSYS_memset(m_WordBuffer, 0, kEndObjStr.GetLength() + 1);
GetNextWord();
int numMarkers = ReadEOLMarkers(m_Pos);
- if (m_WordSize == ENDOBJ_LEN && numMarkers != 0 &&
- FXSYS_memcmp(m_WordBuffer, "endobj", ENDOBJ_LEN) == 0) {
+ if (m_WordSize == kEndObjStr.GetLength() && numMarkers != 0 &&
+ FXSYS_memcmp(m_WordBuffer, kEndObjStr.GetPtr(), kEndObjStr.GetLength()) ==
+ 0) {
m_Pos = streamStartPos;
}
return pStream;
@@ -2495,11 +2496,12 @@ int32_t CPDF_SyntaxParser::GetDirectNum() {
m_WordBuffer[m_WordSize] = 0;
return FXSYS_atoi((const FX_CHAR*)m_WordBuffer);
}
-FX_BOOL CPDF_SyntaxParser::IsWholeWord(FX_FILESIZE startpos,
- FX_FILESIZE limit,
- const uint8_t* tag,
- FX_DWORD taglen,
- FX_BOOL checkKeyword) {
+
+bool CPDF_SyntaxParser::IsWholeWord(FX_FILESIZE startpos,
+ FX_FILESIZE limit,
+ const CFX_ByteStringC& tag,
+ FX_BOOL checkKeyword) {
+ const FX_DWORD taglen = tag.GetLength();
bool bCheckLeft = !PDFCharIsDelimiter(tag[0]) && !PDFCharIsWhitespace(tag[0]);
bool bCheckRight = !PDFCharIsDelimiter(tag[taglen - 1]) &&
!PDFCharIsWhitespace(tag[taglen - 1]);
@@ -2508,18 +2510,19 @@ FX_BOOL CPDF_SyntaxParser::IsWholeWord(FX_FILESIZE startpos,
GetCharAt(startpos + (int32_t)taglen, ch)) {
if (PDFCharIsNumeric(ch) || PDFCharIsOther(ch) ||
(checkKeyword && PDFCharIsDelimiter(ch))) {
- return FALSE;
+ return false;
}
}
if (bCheckLeft && startpos > 0 && GetCharAt(startpos - 1, ch)) {
if (PDFCharIsNumeric(ch) || PDFCharIsOther(ch) ||
(checkKeyword && PDFCharIsDelimiter(ch))) {
- return FALSE;
+ return false;
}
}
- return TRUE;
+ return true;
}
+
FX_BOOL CPDF_SyntaxParser::SearchWord(const CFX_ByteStringC& tag,
FX_BOOL bWholeWord,
FX_BOOL bForward,
@@ -2570,8 +2573,7 @@ FX_BOOL CPDF_SyntaxParser::SearchWord(const CFX_ByteStringC& tag,
}
}
FX_FILESIZE startpos = bForward ? pos - taglen + 1 : pos;
- if (!bWholeWord ||
- IsWholeWord(startpos, limit, tag.GetPtr(), taglen, FALSE)) {
+ if (!bWholeWord || IsWholeWord(startpos, limit, tag, FALSE)) {
m_Pos = startpos;
return TRUE;
}
@@ -2608,7 +2610,7 @@ int32_t CPDF_SyntaxParser::SearchMultiWord(const CFX_ByteStringC& tags,
if (tags[i] == 0) {
FX_DWORD len = i - start;
max_len = std::max(len, max_len);
- patterns[itag].m_pTag = tags.GetPtr() + start;
+ patterns[itag].m_pTag = tags.GetCStr() + start;
patterns[itag].m_Len = len;
patterns[itag].m_Offset = 0;
start = i + 1;
@@ -2634,7 +2636,8 @@ int32_t CPDF_SyntaxParser::SearchMultiWord(const CFX_ByteStringC& tags,
continue;
if (!bWholeWord ||
- IsWholeWord(pos - pat.m_Len, limit, pat.m_pTag, pat.m_Len, FALSE)) {
+ IsWholeWord(pos - pat.m_Len, limit,
+ CFX_ByteStringC(pat.m_pTag, pat.m_Len), FALSE)) {
return i;
}
@@ -3322,7 +3325,7 @@ FX_BOOL CPDF_DataAvail::CheckRoot(IFX_DownloadHints* pHints) {
m_docStatus = PDF_DATAAVAIL_ERROR;
return FALSE;
}
- CPDF_Reference* pRef = ToReference(pDict->GetElement(FX_BSTRC("Pages")));
+ CPDF_Reference* pRef = ToReference(pDict->GetElement("Pages"));
if (!pRef) {
m_docStatus = PDF_DATAAVAIL_ERROR;
return FALSE;
@@ -3330,7 +3333,7 @@ FX_BOOL CPDF_DataAvail::CheckRoot(IFX_DownloadHints* pHints) {
m_PagesObjNum = pRef->GetRefObjNum();
CPDF_Reference* pAcroFormRef =
- ToReference(m_pRoot->GetDict()->GetElement(FX_BSTRC("AcroForm")));
+ ToReference(m_pRoot->GetDict()->GetElement("AcroForm"));
if (pAcroFormRef) {
m_bHaveAcroForm = TRUE;
m_dwAcroFormObjNum = pAcroFormRef->GetRefObjNum();
@@ -3347,7 +3350,7 @@ FX_BOOL CPDF_DataAvail::CheckRoot(IFX_DownloadHints* pHints) {
FX_BOOL CPDF_DataAvail::PreparePageItem() {
CPDF_Dictionary* pRoot = m_pDocument->GetRoot();
CPDF_Reference* pRef =
- ToReference(pRoot ? pRoot->GetElement(FX_BSTRC("Pages")) : nullptr);
+ ToReference(pRoot ? pRoot->GetElement("Pages") : nullptr);
if (!pRef) {
m_docStatus = PDF_DATAAVAIL_ERROR;
return FALSE;
@@ -3395,8 +3398,8 @@ FX_BOOL CPDF_DataAvail::CheckPage(IFX_DownloadHints* pHints) {
pObj->Release();
continue;
}
- CFX_ByteString type = pObj->GetDict()->GetString(FX_BSTRC("Type"));
- if (type == FX_BSTRC("Pages")) {
+ CFX_ByteString type = pObj->GetDict()->GetString("Type");
+ if (type == "Pages") {
m_PagesArray.Add(pObj);
continue;
}
@@ -3437,7 +3440,7 @@ FX_BOOL CPDF_DataAvail::GetPageKids(CPDF_Parser* pParser, CPDF_Object* pPages) {
return FALSE;
}
CPDF_Dictionary* pDict = pPages->GetDict();
- CPDF_Object* pKids = pDict ? pDict->GetElement(FX_BSTRC("Kids")) : NULL;
+ CPDF_Object* pKids = pDict ? pDict->GetElement("Kids") : NULL;
if (!pKids) {
return TRUE;
}
@@ -3504,17 +3507,17 @@ FX_BOOL CPDF_DataAvail::CheckHeader(IFX_DownloadHints* pHints) {
}
FX_BOOL CPDF_DataAvail::CheckFirstPage(IFX_DownloadHints* pHints) {
CPDF_Dictionary* pDict = m_pLinearized->GetDict();
- CPDF_Object* pEndOffSet = pDict ? pDict->GetElement(FX_BSTRC("E")) : NULL;
+ CPDF_Object* pEndOffSet = pDict ? pDict->GetElement("E") : NULL;
if (!pEndOffSet) {
m_docStatus = PDF_DATAAVAIL_ERROR;
return FALSE;
}
- CPDF_Object* pXRefOffset = pDict ? pDict->GetElement(FX_BSTRC("T")) : NULL;
+ CPDF_Object* pXRefOffset = pDict ? pDict->GetElement("T") : NULL;
if (!pXRefOffset) {
m_docStatus = PDF_DATAAVAIL_ERROR;
return FALSE;
}
- CPDF_Object* pFileLen = pDict ? pDict->GetElement(FX_BSTRC("L")) : NULL;
+ CPDF_Object* pFileLen = pDict ? pDict->GetElement("L") : NULL;
if (!pFileLen) {
m_docStatus = PDF_DATAAVAIL_ERROR;
return FALSE;
@@ -3587,17 +3590,16 @@ FX_BOOL CPDF_DataAvail::CheckHintTables(IFX_DownloadHints* pHints) {
m_docStatus = PDF_DATAAVAIL_ERROR;
return FALSE;
}
- if (!pDict->KeyExist(FX_BSTRC("H")) || !pDict->KeyExist(FX_BSTRC("O")) ||
- !pDict->KeyExist(FX_BSTRC("N"))) {
+ if (!pDict->KeyExist("H") || !pDict->KeyExist("O") || !pDict->KeyExist("N")) {
m_docStatus = PDF_DATAAVAIL_ERROR;
return FALSE;
}
- int nPageCount = pDict->GetElementValue(FX_BSTRC("N"))->GetInteger();
+ int nPageCount = pDict->GetElementValue("N")->GetInteger();
if (nPageCount <= 1) {
m_docStatus = PDF_DATAAVAIL_DONE;
return TRUE;
}
- CPDF_Array* pHintStreamRange = pDict->GetArray(FX_BSTRC("H"));
+ CPDF_Array* pHintStreamRange = pDict->GetArray("H");
FX_FILESIZE szHSStart =
pHintStreamRange->GetElementValue(0)
? pHintStreamRange->GetElementValue(0)->GetInteger()
@@ -3644,7 +3646,7 @@ CPDF_Object* CPDF_DataAvail::ParseIndirectObjectAt(
return NULL;
}
FX_DWORD gennum = FXSYS_atoi(word);
- if (m_syntaxParser.GetKeyword() != FX_BSTRC("obj")) {
+ if (m_syntaxParser.GetKeyword() != "obj") {
m_syntaxParser.RestorePos(SavedPos);
return NULL;
}
@@ -3699,8 +3701,8 @@ FX_BOOL CPDF_DataAvail::IsLinearizedFile(uint8_t* pData, FX_DWORD dwLen) {
}
CPDF_Dictionary* pDict = m_pLinearized->GetDict();
- if (pDict && pDict->GetElement(FX_BSTRC("Linearized"))) {
- CPDF_Object* pLen = pDict->GetElement(FX_BSTRC("L"));
+ if (pDict && pDict->GetElement("Linearized")) {
+ CPDF_Object* pLen = pDict->GetElement("L");
if (!pLen) {
return FALSE;
}
@@ -3709,7 +3711,7 @@ FX_BOOL CPDF_DataAvail::IsLinearizedFile(uint8_t* pData, FX_DWORD dwLen) {
}
m_bLinearized = TRUE;
- if (CPDF_Number* pNo = ToNumber(pDict->GetElement(FX_BSTRC("P"))))
+ if (CPDF_Number* pNo = ToNumber(pDict->GetElement("P")))
m_dwFirstPageNo = pNo->GetInteger();
return TRUE;
@@ -3725,7 +3727,7 @@ FX_BOOL CPDF_DataAvail::CheckEnd(IFX_DownloadHints* pHints) {
ScopedFileStream file(FX_CreateMemoryStream(buffer, (size_t)dwSize, FALSE));
m_syntaxParser.InitParser(file.get(), 0);
m_syntaxParser.RestorePos(dwSize - 1);
- if (m_syntaxParser.SearchWord(FX_BSTRC("startxref"), TRUE, FALSE, dwSize)) {
+ if (m_syntaxParser.SearchWord("startxref", TRUE, FALSE, dwSize)) {
FX_BOOL bNumber;
m_syntaxParser.GetNextWord(bNumber);
CFX_ByteString xrefpos_str = m_syntaxParser.GetNextWord(bNumber);
@@ -3773,12 +3775,11 @@ int32_t CPDF_DataAvail::CheckCrossRefStream(IFX_DownloadHints* pHints,
return 0;
}
CPDF_Dictionary* pDict = pObj->GetDict();
- CPDF_Name* pName =
- ToName(pDict ? pDict->GetElement(FX_BSTRC("Type")) : nullptr);
+ CPDF_Name* pName = ToName(pDict ? pDict->GetElement("Type") : nullptr);
if (pName) {
- if (pName->GetString() == FX_BSTRC("XRef")) {
+ if (pName->GetString() == "XRef") {
m_Pos += m_parser.m_Syntax.SavePos();
- xref_offset = pObj->GetDict()->GetInteger(FX_BSTRC("Prev"));
+ xref_offset = pObj->GetDict()->GetInteger("Prev");
pObj->Release();
return 1;
}
@@ -4013,9 +4014,9 @@ FX_BOOL CPDF_DataAvail::CheckTrailer(IFX_DownloadHints* pHints) {
return TRUE;
}
- FX_DWORD xrefpos = GetDirectInteger(pTrailerDict, FX_BSTRC("Prev"));
+ FX_DWORD xrefpos = GetDirectInteger(pTrailerDict, "Prev");
if (xrefpos) {
- m_dwPrevXRefOffset = GetDirectInteger(pTrailerDict, FX_BSTRC("XRefStm"));
+ m_dwPrevXRefOffset = GetDirectInteger(pTrailerDict, "XRefStm");
if (m_dwPrevXRefOffset) {
m_docStatus = PDF_DATAAVAIL_LOADALLFILE;
} else {
@@ -4127,10 +4128,10 @@ FX_BOOL CPDF_DataAvail::CheckUnkownPageNode(FX_DWORD dwPageNo,
}
pPageNode->m_dwPageNo = dwPageNo;
CPDF_Dictionary* pDict = pPage->GetDict();
- CFX_ByteString type = pDict->GetString(FX_BSTRC("Type"));
- if (type == FX_BSTRC("Pages")) {
+ CFX_ByteString type = pDict->GetString("Type");
+ if (type == "Pages") {
pPageNode->m_type = PDF_PAGENODE_PAGES;
- CPDF_Object* pKids = pDict->GetElement(FX_BSTRC("Kids"));
+ CPDF_Object* pKids = pDict->GetElement("Kids");
if (!pKids) {
m_docStatus = PDF_DATAAVAIL_PAGE;
return TRUE;
@@ -4157,7 +4158,7 @@ FX_BOOL CPDF_DataAvail::CheckUnkownPageNode(FX_DWORD dwPageNo,
default:
break;
}
- } else if (type == FX_BSTRC("Page")) {
+ } else if (type == "Page") {
pPageNode->m_type = PDF_PAGENODE_PAGE;
} else {
pPage->Release();
@@ -4250,11 +4251,11 @@ FX_BOOL CPDF_DataAvail::CheckPageCount(IFX_DownloadHints* pHints) {
m_docStatus = PDF_DATAAVAIL_ERROR;
return FALSE;
}
- if (!pPagesDict->KeyExist(FX_BSTRC("Kids"))) {
+ if (!pPagesDict->KeyExist("Kids")) {
pPages->Release();
return TRUE;
}
- int count = pPagesDict->GetInteger(FX_BSTRC("Count"));
+ int count = pPagesDict->GetInteger("Count");
if (count > 0) {
pPages->Release();
return TRUE;
@@ -4324,7 +4325,7 @@ FX_BOOL CPDF_DataAvail::CheckPageAnnots(int32_t iPage,
if (!pPageDict) {
return TRUE;
}
- CPDF_Object* pAnnots = pPageDict->GetElement(FX_BSTRC("Annots"));
+ CPDF_Object* pAnnots = pPageDict->GetElement("Annots");
if (!pAnnots) {
return TRUE;
}
@@ -4533,7 +4534,7 @@ void CPDF_DataAvail::GetLinearizedMainXRefInfo(FX_FILESIZE* pPos,
int CPDF_DataAvail::GetPageCount() const {
if (m_pLinearized) {
CPDF_Dictionary* pDict = m_pLinearized->GetDict();
- CPDF_Object* pObj = pDict ? pDict->GetElementValue(FX_BSTRC("N")) : nullptr;
+ CPDF_Object* pObj = pDict ? pDict->GetElementValue("N") : nullptr;
return pObj ? pObj->GetInteger() : 0;
}
return m_pDocument ? m_pDocument->GetPageCount() : 0;
@@ -4544,7 +4545,7 @@ CPDF_Dictionary* CPDF_DataAvail::GetPage(int index) {
}
if (m_pLinearized) {
CPDF_Dictionary* pDict = m_pLinearized->GetDict();
- CPDF_Object* pObj = pDict ? pDict->GetElementValue(FX_BSTRC("P")) : nullptr;
+ CPDF_Object* pObj = pDict ? pDict->GetElementValue("P") : nullptr;
int pageNum = pObj ? pObj->GetInteger() : 0;
if (m_pHintTables && index != pageNum) {
FX_FILESIZE szPageStartPos = 0;
@@ -4577,7 +4578,7 @@ IPDF_DataAvail::DocFormStatus CPDF_DataAvail::IsFormAvail(
if (!pRoot) {
return FormAvailable;
}
- CPDF_Object* pAcroForm = pRoot->GetElement(FX_BSTRC("AcroForm"));
+ CPDF_Object* pAcroForm = pRoot->GetElement("AcroForm");
if (!pAcroForm) {
return FormNotExist;
}
@@ -4697,7 +4698,7 @@ FX_BOOL CPDF_HintTables::ReadPageHintTable(CFX_BitStream* hStream) {
FX_DWORD dwSharedNumeratorBits = hStream->GetBits(16);
// Item 13: Skip Item 13 which has 16 bits.
hStream->SkipBits(16);
- CPDF_Object* pPageNum = m_pLinearizedDict->GetElementValue(FX_BSTRC("N"));
+ CPDF_Object* pPageNum = m_pLinearizedDict->GetElementValue("N");
int nPages = pPageNum ? pPageNum->GetInteger() : 0;
if (nPages < 1)
return FALSE;
@@ -4727,12 +4728,11 @@ FX_BOOL CPDF_HintTables::ReadPageHintTable(CFX_BitStream* hStream) {
return FALSE;
dwPageLenArray.Add(safePageLen.ValueOrDie());
}
- CPDF_Object* pOffsetE = m_pLinearizedDict->GetElementValue(FX_BSTRC("E"));
+ CPDF_Object* pOffsetE = m_pLinearizedDict->GetElementValue("E");
int nOffsetE = pOffsetE ? pOffsetE->GetInteger() : -1;
if (nOffsetE < 0)
return FALSE;
- CPDF_Object* pFirstPageNum =
- m_pLinearizedDict->GetElementValue(FX_BSTRC("P"));
+ CPDF_Object* pFirstPageNum = m_pLinearizedDict->GetElementValue("P");
int nFirstPageNum = pFirstPageNum ? pFirstPageNum->GetInteger() : 0;
for (int i = 0; i < nPages; ++i) {
if (i == nFirstPageNum) {
@@ -4836,8 +4836,7 @@ FX_BOOL CPDF_HintTables::ReadSharedObjHintTable(CFX_BitStream* hStream,
// Item 7: The number of bits needed to represent the difference between the
// greatest and least length of a shared object group, in bytes.
FX_DWORD dwDeltaGroupLen = hStream->GetBits(16);
- CPDF_Object* pFirstPageObj =
- m_pLinearizedDict->GetElementValue(FX_BSTRC("O"));
+ CPDF_Object* pFirstPageObj = m_pLinearizedDict->GetElementValue("O");
int nFirstPageObjNum = pFirstPageObj ? pFirstPageObj->GetInteger() : -1;
if (nFirstPageObjNum < 0)
return FALSE;
@@ -4899,11 +4898,9 @@ FX_BOOL CPDF_HintTables::GetPagePos(int index,
return FALSE;
szPageStartPos = m_szPageOffsetArray[index];
szPageLength = GetItemLength(index, m_szPageOffsetArray);
- CPDF_Object* pFirstPageNum =
- m_pLinearizedDict->GetElementValue(FX_BSTRC("P"));
+ CPDF_Object* pFirstPageNum = m_pLinearizedDict->GetElementValue("P");
int nFirstPageNum = pFirstPageNum ? pFirstPageNum->GetInteger() : 0;
- CPDF_Object* pFirstPageObjNum =
- m_pLinearizedDict->GetElementValue(FX_BSTRC("O"));
+ CPDF_Object* pFirstPageObjNum = m_pLinearizedDict->GetElementValue("O");
if (!pFirstPageObjNum)
return FALSE;
int nFirstPageObjNum = pFirstPageObjNum->GetInteger();
@@ -4923,8 +4920,7 @@ FX_BOOL CPDF_HintTables::GetPagePos(int index,
int32_t CPDF_HintTables::CheckPage(int index, IFX_DownloadHints* pHints) {
if (!m_pLinearizedDict || !pHints)
return IPDF_DataAvail::DataError;
- CPDF_Object* pFirstAvailPage =
- m_pLinearizedDict->GetElementValue(FX_BSTRC("P"));
+ CPDF_Object* pFirstAvailPage = m_pLinearizedDict->GetElementValue("P");
int nFirstAvailPage = pFirstAvailPage ? pFirstAvailPage->GetInteger() : 0;
if (index == nFirstAvailPage)
return IPDF_DataAvail::DataAvailable;
@@ -4939,8 +4935,7 @@ int32_t CPDF_HintTables::CheckPage(int index, IFX_DownloadHints* pHints) {
for (int i = 0; i < index; ++i) {
offset += m_dwNSharedObjsArray[i];
}
- CPDF_Object* pFirstPageObj =
- m_pLinearizedDict->GetElementValue(FX_BSTRC("O"));
+ CPDF_Object* pFirstPageObj = m_pLinearizedDict->GetElementValue("O");
int nFirstPageObjNum = pFirstPageObj ? pFirstPageObj->GetInteger() : -1;
if (nFirstPageObjNum < 0)
return FALSE; // TODO(thestig): Fix this and the return type.
@@ -4968,7 +4963,7 @@ FX_BOOL CPDF_HintTables::LoadHintStream(CPDF_Stream* pHintStream) {
if (!pHintStream || !m_pLinearizedDict)
return FALSE;
CPDF_Dictionary* pDict = pHintStream->GetDict();
- CPDF_Object* pOffset = pDict ? pDict->GetElement(FX_BSTRC("S")) : nullptr;
+ CPDF_Object* pOffset = pDict ? pDict->GetElement("S") : nullptr;
if (!pOffset || pOffset->GetType() != PDFOBJ_NUMBER)
return FALSE;
int shared_hint_table_offset = pOffset->GetInteger();
@@ -4992,7 +4987,7 @@ FX_BOOL CPDF_HintTables::LoadHintStream(CPDF_Stream* pHintStream) {
int CPDF_HintTables::ReadPrimaryHintStreamOffset() const {
if (!m_pLinearizedDict)
return -1;
- CPDF_Array* pRange = m_pLinearizedDict->GetArray(FX_BSTRC("H"));
+ CPDF_Array* pRange = m_pLinearizedDict->GetArray("H");
if (!pRange)
return -1;
CPDF_Object* pStreamOffset = pRange->GetElementValue(0);
@@ -5003,7 +4998,7 @@ int CPDF_HintTables::ReadPrimaryHintStreamOffset() const {
int CPDF_HintTables::ReadPrimaryHintStreamLength() const {
if (!m_pLinearizedDict)
return -1;
- CPDF_Array* pRange = m_pLinearizedDict->GetArray(FX_BSTRC("H"));
+ CPDF_Array* pRange = m_pLinearizedDict->GetArray("H");
if (!pRange)
return -1;
CPDF_Object* pStreamLen = pRange->GetElementValue(1);
diff --git a/core/src/fpdfapi/fpdf_parser/fpdf_parser_utility.cpp b/core/src/fpdfapi/fpdf_parser/fpdf_parser_utility.cpp
index 9729bab942..121b2f4a04 100644
--- a/core/src/fpdfapi/fpdf_parser/fpdf_parser_utility.cpp
+++ b/core/src/fpdfapi/fpdf_parser/fpdf_parser_utility.cpp
@@ -345,12 +345,12 @@ CFX_ByteString PDF_NameEncode(const CFX_ByteString& orig) {
}
CFX_ByteTextBuf& operator<<(CFX_ByteTextBuf& buf, const CPDF_Object* pObj) {
if (pObj == NULL) {
- buf << FX_BSTRC(" null");
+ buf << " null";
return buf;
}
switch (pObj->GetType()) {
case PDFOBJ_NULL:
- buf << FX_BSTRC(" null");
+ buf << " null";
break;
case PDFOBJ_BOOLEAN:
case PDFOBJ_NUMBER:
@@ -361,51 +361,51 @@ CFX_ByteTextBuf& operator<<(CFX_ByteTextBuf& buf, const CPDF_Object* pObj) {
break;
case PDFOBJ_NAME: {
CFX_ByteString str = pObj->GetString();
- buf << FX_BSTRC("/") << PDF_NameEncode(str);
+ buf << "/" << PDF_NameEncode(str);
break;
}
case PDFOBJ_REFERENCE: {
- buf << " " << pObj->AsReference()->GetRefObjNum() << FX_BSTRC(" 0 R ");
+ buf << " " << pObj->AsReference()->GetRefObjNum() << " 0 R ";
break;
}
case PDFOBJ_ARRAY: {
const CPDF_Array* p = pObj->AsArray();
- buf << FX_BSTRC("[");
+ buf << "[";
for (FX_DWORD i = 0; i < p->GetCount(); i++) {
CPDF_Object* pElement = p->GetElement(i);
if (pElement->GetObjNum()) {
- buf << " " << pElement->GetObjNum() << FX_BSTRC(" 0 R");
+ buf << " " << pElement->GetObjNum() << " 0 R";
} else {
buf << pElement;
}
}
- buf << FX_BSTRC("]");
+ buf << "]";
break;
}
case PDFOBJ_DICTIONARY: {
const CPDF_Dictionary* p = pObj->AsDictionary();
- buf << FX_BSTRC("<<");
+ buf << "<<";
FX_POSITION pos = p->GetStartPos();
while (pos) {
CFX_ByteString key;
CPDF_Object* pValue = p->GetNextElement(pos, key);
- buf << FX_BSTRC("/") << PDF_NameEncode(key);
+ buf << "/" << PDF_NameEncode(key);
if (pValue && pValue->GetObjNum()) {
- buf << " " << pValue->GetObjNum() << FX_BSTRC(" 0 R ");
+ buf << " " << pValue->GetObjNum() << " 0 R ";
} else {
buf << pValue;
}
}
- buf << FX_BSTRC(">>");
+ buf << ">>";
break;
}
case PDFOBJ_STREAM: {
const CPDF_Stream* p = pObj->AsStream();
- buf << p->GetDict() << FX_BSTRC("stream\r\n");
+ buf << p->GetDict() << "stream\r\n";
CPDF_StreamAcc acc;
acc.LoadAllData(p, TRUE);
buf.AppendBlock(acc.GetData(), acc.GetSize());
- buf << FX_BSTRC("\r\nendstream");
+ buf << "\r\nendstream";
break;
}
default:
diff --git a/core/src/fpdfapi/fpdf_render/fpdf_render.cpp b/core/src/fpdfapi/fpdf_render/fpdf_render.cpp
index faf6afe7f6..d7c3b6e6e8 100644
--- a/core/src/fpdfapi/fpdf_render/fpdf_render.cpp
+++ b/core/src/fpdfapi/fpdf_render/fpdf_render.cpp
@@ -444,8 +444,7 @@ void CPDF_RenderStatus::DrawObjWithBackground(const CPDF_PageObject* pObj,
if (pObj->m_Type == PDFPAGE_FORM) {
CPDF_FormObject* pFormObj = (CPDF_FormObject*)pObj;
if (pFormObj->m_pForm && pFormObj->m_pForm->m_pFormDict) {
- pFormResource =
- pFormObj->m_pForm->m_pFormDict->GetDict(FX_BSTRC("Resources"));
+ pFormResource = pFormObj->m_pForm->m_pFormDict->GetDict("Resources");
}
}
CPDF_RenderStatus status;
@@ -457,8 +456,7 @@ void CPDF_RenderStatus::DrawObjWithBackground(const CPDF_PageObject* pObj,
}
FX_BOOL CPDF_RenderStatus::ProcessForm(CPDF_FormObject* pFormObj,
const CFX_Matrix* pObj2Device) {
- CPDF_Dictionary* pOC =
- pFormObj->m_pForm->m_pFormDict->GetDict(FX_BSTRC("OC"));
+ CPDF_Dictionary* pOC = pFormObj->m_pForm->m_pFormDict->GetDict("OC");
if (pOC && m_Options.m_pOCContext &&
!m_Options.m_pOCContext->CheckOCGVisible(pOC)) {
return TRUE;
@@ -467,7 +465,7 @@ FX_BOOL CPDF_RenderStatus::ProcessForm(CPDF_FormObject* pFormObj,
matrix.Concat(*pObj2Device);
CPDF_Dictionary* pResources = NULL;
if (pFormObj->m_pForm && pFormObj->m_pForm->m_pFormDict) {
- pResources = pFormObj->m_pForm->m_pFormDict->GetDict(FX_BSTRC("Resources"));
+ pResources = pFormObj->m_pForm->m_pFormDict->GetDict("Resources");
}
CPDF_RenderStatus status;
status.Initialize(m_pContext, m_pDevice, NULL, m_pStopObj, this, pFormObj,
@@ -731,9 +729,7 @@ FX_BOOL CPDF_RenderStatus::ProcessTransparency(const CPDF_PageObject* pPageObj,
pGeneralState ? ToDictionary(pGeneralState->m_pSoftMask) : NULL;
if (pSMaskDict) {
if (pPageObj->m_Type == PDFPAGE_IMAGE &&
- ((CPDF_ImageObject*)pPageObj)
- ->m_pImage->GetDict()
- ->KeyExist(FX_BSTRC("SMask"))) {
+ ((CPDF_ImageObject*)pPageObj)->m_pImage->GetDict()->KeyExist("SMask")) {
pSMaskDict = NULL;
}
}
@@ -775,7 +771,7 @@ FX_BOOL CPDF_RenderStatus::ProcessTransparency(const CPDF_PageObject* pPageObj,
CPDF_Object* pCSObj = ((CPDF_ImageObject*)pPageObj)
->m_pImage->GetStream()
->GetDict()
- ->GetElementValue(FX_BSTRC("ColorSpace"));
+ ->GetElementValue("ColorSpace");
CPDF_ColorSpace* pColorSpace =
pDocument->LoadColorSpace(pCSObj, pPageResources);
if (pColorSpace) {
@@ -1414,7 +1410,7 @@ FX_BOOL IPDF_OCContext::CheckObjectVisible(const CPDF_PageObject* pObj) {
int nItems = pData->CountItems();
for (int i = 0; i < nItems; i++) {
CPDF_ContentMarkItem& item = pData->GetItem(i);
- if (item.GetName() == FX_BSTRC("OC") &&
+ if (item.GetName() == "OC" &&
item.GetParamType() == CPDF_ContentMarkItem::PropertiesDict) {
CPDF_Dictionary* pOCG =
ToDictionary(static_cast<CPDF_Object*>(item.GetParam()));
diff --git a/core/src/fpdfapi/fpdf_render/fpdf_render_image.cpp b/core/src/fpdfapi/fpdf_render/fpdf_render_image.cpp
index 81efc956a2..1d1c392af5 100644
--- a/core/src/fpdfapi/fpdf_render/fpdf_render_image.cpp
+++ b/core/src/fpdfapi/fpdf_render/fpdf_render_image.cpp
@@ -409,19 +409,17 @@ FX_BOOL CPDF_ImageRenderer::StartRenderDIBSource() {
if (m_pRenderStatus->m_pDevice->GetDeviceClass() != FXDC_DISPLAY) {
CPDF_Object* pFilters =
m_pImageObject->m_pImage->GetStream()->GetDict()->GetElementValue(
- FX_BSTRC("Filter"));
+ "Filter");
if (pFilters) {
if (pFilters->IsName()) {
CFX_ByteStringC bsDecodeType = pFilters->GetConstString();
- if (bsDecodeType == FX_BSTRC("DCTDecode") ||
- bsDecodeType == FX_BSTRC("JPXDecode")) {
+ if (bsDecodeType == "DCTDecode" || bsDecodeType == "JPXDecode") {
m_Flags |= FXRENDER_IMAGE_LOSSY;
}
} else if (CPDF_Array* pArray = pFilters->AsArray()) {
for (FX_DWORD i = 0; i < pArray->GetCount(); i++) {
CFX_ByteStringC bsDecodeType = pArray->GetConstString(i);
- if (bsDecodeType == FX_BSTRC("DCTDecode") ||
- bsDecodeType == FX_BSTRC("JPXDecode")) {
+ if (bsDecodeType == "DCTDecode" || bsDecodeType == "JPXDecode") {
m_Flags |= FXRENDER_IMAGE_LOSSY;
break;
}
@@ -455,7 +453,7 @@ FX_BOOL CPDF_ImageRenderer::StartRenderDIBSource() {
CPDF_Dictionary* pPageResources = pPage ? pPage->m_pPageResources : NULL;
CPDF_Object* pCSObj =
m_pImageObject->m_pImage->GetStream()->GetDict()->GetElementValue(
- FX_BSTRC("ColorSpace"));
+ "ColorSpace");
CPDF_ColorSpace* pColorSpace =
pDocument->LoadColorSpace(pCSObj, pPageResources);
if (pColorSpace) {
@@ -925,17 +923,17 @@ FX_BOOL CPDF_QuickStretcher::Start(CPDF_ImageObject* pImageObj,
m_ClipLeft = result_rect.left - image_rect.left;
m_ClipTop = result_rect.top - image_rect.top;
CPDF_Dictionary* pDict = pImageObj->m_pImage->GetDict();
- if (pDict->GetInteger(FX_BSTRC("BitsPerComponent")) != 8) {
+ if (pDict->GetInteger("BitsPerComponent") != 8) {
return FALSE;
}
- if (pDict->KeyExist(FX_BSTRC("SMask")) || pDict->KeyExist(FX_BSTRC("Mask"))) {
+ if (pDict->KeyExist("SMask") || pDict->KeyExist("Mask")) {
return FALSE;
}
- m_SrcWidth = pDict->GetInteger(FX_BSTRC("Width"));
- m_SrcHeight = pDict->GetInteger(FX_BSTRC("Height"));
+ m_SrcWidth = pDict->GetInteger("Width");
+ m_SrcHeight = pDict->GetInteger("Height");
m_pCS = NULL;
m_Bpp = 3;
- CPDF_Object* pCSObj = pDict->GetElementValue(FX_BSTRC("ColorSpace"));
+ CPDF_Object* pCSObj = pDict->GetElementValue("ColorSpace");
if (pCSObj == NULL) {
return FALSE;
}
@@ -956,13 +954,12 @@ FX_BOOL CPDF_QuickStretcher::Start(CPDF_ImageObject* pImageObj,
TRUE);
m_pDecoder = NULL;
if (!m_StreamAcc.GetImageDecoder().IsEmpty()) {
- if (m_StreamAcc.GetImageDecoder() == FX_BSTRC("DCTDecode")) {
+ if (m_StreamAcc.GetImageDecoder() == "DCTDecode") {
const CPDF_Dictionary* pParam = m_StreamAcc.GetImageParam();
m_pDecoder = CPDF_ModuleMgr::Get()->GetJpegModule()->CreateDecoder(
m_StreamAcc.GetData(), m_StreamAcc.GetSize(), m_SrcWidth, m_SrcHeight,
- m_Bpp,
- pParam ? pParam->GetInteger(FX_BSTRC("ColorTransform"), 1) : 1);
- } else if (m_StreamAcc.GetImageDecoder() == FX_BSTRC("FlateDecode")) {
+ m_Bpp, pParam ? pParam->GetInteger("ColorTransform", 1) : 1);
+ } else if (m_StreamAcc.GetImageDecoder() == "FlateDecode") {
m_pDecoder = FPDFAPI_CreateFlateDecoder(
m_StreamAcc.GetData(), m_StreamAcc.GetSize(), m_SrcWidth, m_SrcHeight,
m_Bpp, 8, m_StreamAcc.GetImageParam());
@@ -1049,13 +1046,13 @@ CFX_DIBitmap* CPDF_RenderStatus::LoadSMask(CPDF_Dictionary* pSMaskDict,
int width = pClipRect->right - pClipRect->left;
int height = pClipRect->bottom - pClipRect->top;
FX_BOOL bLuminosity = FALSE;
- bLuminosity = pSMaskDict->GetConstString(FX_BSTRC("S")) != FX_BSTRC("Alpha");
- CPDF_Stream* pGroup = pSMaskDict->GetStream(FX_BSTRC("G"));
+ bLuminosity = pSMaskDict->GetConstString("S") != "Alpha";
+ CPDF_Stream* pGroup = pSMaskDict->GetStream("G");
if (pGroup == NULL) {
return NULL;
}
nonstd::unique_ptr<CPDF_Function> pFunc;
- CPDF_Object* pFuncObj = pSMaskDict->GetElementValue(FX_BSTRC("TR"));
+ CPDF_Object* pFuncObj = pSMaskDict->GetElementValue("TR");
if (pFuncObj && (pFuncObj->IsDictionary() || pFuncObj->IsStream()))
pFunc.reset(CPDF_Function::Load(pFuncObj));
@@ -1079,13 +1076,12 @@ CFX_DIBitmap* CPDF_RenderStatus::LoadSMask(CPDF_Dictionary* pSMaskDict,
CPDF_Object* pCSObj = NULL;
CPDF_ColorSpace* pCS = NULL;
if (bLuminosity) {
- CPDF_Array* pBC = pSMaskDict->GetArray(FX_BSTRC("BC"));
+ CPDF_Array* pBC = pSMaskDict->GetArray("BC");
FX_ARGB back_color = 0xff000000;
if (pBC) {
CPDF_Dictionary* pDict = pGroup->GetDict();
- if (pDict && pDict->GetDict(FX_BSTRC("Group")))
- pCSObj =
- pDict->GetDict(FX_BSTRC("Group"))->GetElementValue(FX_BSTRC("CS"));
+ if (pDict && pDict->GetDict("Group"))
+ pCSObj = pDict->GetDict("Group")->GetElementValue("CS");
else
pCSObj = NULL;
pCS = m_pContext->m_pDocument->LoadColorSpace(pCSObj);
@@ -1119,7 +1115,7 @@ CFX_DIBitmap* CPDF_RenderStatus::LoadSMask(CPDF_Dictionary* pSMaskDict,
}
CPDF_Dictionary* pFormResource = NULL;
if (form.m_pFormDict) {
- pFormResource = form.m_pFormDict->GetDict(FX_BSTRC("Resources"));
+ pFormResource = form.m_pFormDict->GetDict("Resources");
}
CPDF_RenderOptions options;
options.m_ColorMode = bLuminosity ? RENDER_COLOR_NORMAL : RENDER_COLOR_ALPHA;
diff --git a/core/src/fpdfapi/fpdf_render/fpdf_render_loadimage.cpp b/core/src/fpdfapi/fpdf_render/fpdf_render_loadimage.cpp
index 675f361422..70d2340c22 100644
--- a/core/src/fpdfapi/fpdf_render/fpdf_render_loadimage.cpp
+++ b/core/src/fpdfapi/fpdf_render/fpdf_render_loadimage.cpp
@@ -221,8 +221,8 @@ FX_BOOL CPDF_DIBSource::Load(CPDF_Document* pDoc,
return FALSE;
}
m_pStream = pStream;
- m_Width = m_pDict->GetInteger(FX_BSTRC("Width"));
- m_Height = m_pDict->GetInteger(FX_BSTRC("Height"));
+ m_Width = m_pDict->GetInteger("Width");
+ m_Height = m_pDict->GetInteger("Height");
if (m_Width <= 0 || m_Height <= 0 || m_Width > kMaxImageDimension ||
m_Height > kMaxImageDimension) {
return FALSE;
@@ -341,8 +341,8 @@ int CPDF_DIBSource::StartLoadDIBSource(CPDF_Document* pDoc,
m_pStream = pStream;
m_bStdCS = bStdCS;
m_bHasMask = bHasMask;
- m_Width = m_pDict->GetInteger(FX_BSTRC("Width"));
- m_Height = m_pDict->GetInteger(FX_BSTRC("Height"));
+ m_Width = m_pDict->GetInteger("Width");
+ m_Height = m_pDict->GetInteger("Height");
if (m_Width <= 0 || m_Height <= 0 || m_Width > kMaxImageDimension ||
m_Height > kMaxImageDimension) {
return 0;
@@ -397,7 +397,7 @@ int CPDF_DIBSource::ContinueLoadDIBSource(IFX_Pause* pPause) {
FXCODEC_STATUS ret;
if (m_Status == 1) {
const CFX_ByteString& decoder = m_pStreamAcc->GetImageDecoder();
- if (decoder == FX_BSTRC("JPXDecode")) {
+ if (decoder == "JPXDecode") {
return 0;
}
ICodec_Jbig2Module* pJbig2Module = CPDF_ModuleMgr::Get()->GetJbig2Module();
@@ -405,7 +405,7 @@ int CPDF_DIBSource::ContinueLoadDIBSource(IFX_Pause* pPause) {
m_pJbig2Context = pJbig2Module->CreateJbig2Context();
if (m_pStreamAcc->GetImageParam()) {
CPDF_Stream* pGlobals =
- m_pStreamAcc->GetImageParam()->GetStream(FX_BSTRC("JBIG2Globals"));
+ m_pStreamAcc->GetImageParam()->GetStream("JBIG2Globals");
if (pGlobals) {
m_pGlobalStream = new CPDF_StreamAcc;
m_pGlobalStream->LoadAllData(pGlobals, FALSE);
@@ -487,7 +487,7 @@ bool CPDF_DIBSource::LoadColorInfo(const CPDF_Dictionary* pFormResources,
filter = pArray->GetString(pArray->GetCount() - 1);
}
- if (filter == FX_BSTRC("JPXDecode")) {
+ if (filter == "JPXDecode") {
m_bDoBpcCheck = FALSE;
return true;
}
@@ -536,7 +536,7 @@ DIB_COMP_DATA* CPDF_DIBSource::GetDecodeAndMaskArray(FX_BOOL& bDefaultDecode,
}
DIB_COMP_DATA* pCompData = FX_Alloc(DIB_COMP_DATA, m_nComponents);
int max_data = (1 << m_bpc) - 1;
- CPDF_Array* pDecode = m_pDict->GetArray(FX_BSTRC("Decode"));
+ CPDF_Array* pDecode = m_pDict->GetArray("Decode");
if (pDecode) {
for (FX_DWORD i = 0; i < m_nComponents; i++) {
pCompData[i].m_DecodeMin = pDecode->GetNumber(i * 2);
@@ -563,8 +563,8 @@ DIB_COMP_DATA* CPDF_DIBSource::GetDecodeAndMaskArray(FX_BOOL& bDefaultDecode,
(pCompData[i].m_DecodeStep - pCompData[i].m_DecodeMin) / max_data;
}
}
- if (!m_pDict->KeyExist(FX_BSTRC("SMask"))) {
- CPDF_Object* pMask = m_pDict->GetElementValue(FX_BSTRC("Mask"));
+ if (!m_pDict->KeyExist("SMask")) {
+ CPDF_Object* pMask = m_pDict->GetElementValue("Mask");
if (pMask == NULL) {
return pCompData;
}
@@ -607,10 +607,10 @@ int CPDF_DIBSource::CreateDecoder() {
const uint8_t* src_data = m_pStreamAcc->GetData();
FX_DWORD src_size = m_pStreamAcc->GetSize();
const CPDF_Dictionary* pParams = m_pStreamAcc->GetImageParam();
- if (decoder == FX_BSTRC("CCITTFaxDecode")) {
+ if (decoder == "CCITTFaxDecode") {
m_pDecoder = FPDFAPI_CreateFaxDecoder(src_data, src_size, m_Width, m_Height,
pParams);
- } else if (decoder == FX_BSTRC("DCTDecode")) {
+ } else if (decoder == "DCTDecode") {
m_pDecoder = CPDF_ModuleMgr::Get()->GetJpegModule()->CreateDecoder(
src_data, src_size, m_Width, m_Height, m_nComponents,
pParams ? pParams->GetInteger("ColorTransform", 1) : 1);
@@ -637,13 +637,13 @@ int CPDF_DIBSource::CreateDecoder() {
src_data, src_size, m_Width, m_Height, m_nComponents, bTransform);
}
}
- } else if (decoder == FX_BSTRC("FlateDecode")) {
+ } else if (decoder == "FlateDecode") {
m_pDecoder = FPDFAPI_CreateFlateDecoder(
src_data, src_size, m_Width, m_Height, m_nComponents, m_bpc, pParams);
- } else if (decoder == FX_BSTRC("JPXDecode")) {
+ } else if (decoder == "JPXDecode") {
LoadJpxBitmap();
return m_pCachedBitmap ? 1 : 0;
- } else if (decoder == FX_BSTRC("JBIG2Decode")) {
+ } else if (decoder == "JBIG2Decode") {
m_pCachedBitmap.reset(new CFX_DIBitmap);
if (!m_pCachedBitmap->Create(
m_Width, m_Height, m_bImageMask ? FXDIB_1bppMask : FXDIB_1bppRgb)) {
@@ -652,7 +652,7 @@ int CPDF_DIBSource::CreateDecoder() {
}
m_Status = 1;
return 2;
- } else if (decoder == FX_BSTRC("RunLengthDecode")) {
+ } else if (decoder == "RunLengthDecode") {
m_pDecoder = CPDF_ModuleMgr::Get()
->GetCodecModule()
->GetBasicModule()
@@ -760,9 +760,9 @@ void CPDF_DIBSource::LoadJpxBitmap() {
}
CPDF_DIBSource* CPDF_DIBSource::LoadMask(FX_DWORD& MatteColor) {
MatteColor = 0xFFFFFFFF;
- CPDF_Stream* pSoftMask = m_pDict->GetStream(FX_BSTRC("SMask"));
+ CPDF_Stream* pSoftMask = m_pDict->GetStream("SMask");
if (pSoftMask) {
- CPDF_Array* pMatte = pSoftMask->GetDict()->GetArray(FX_BSTRC("Matte"));
+ CPDF_Array* pMatte = pSoftMask->GetDict()->GetArray("Matte");
if (pMatte && m_pColorSpace &&
(FX_DWORD)m_pColorSpace->CountComponents() <= m_nComponents) {
FX_FLOAT* pColor = FX_Alloc(FX_FLOAT, m_nComponents);
@@ -778,17 +778,16 @@ CPDF_DIBSource* CPDF_DIBSource::LoadMask(FX_DWORD& MatteColor) {
return LoadMaskDIB(pSoftMask);
}
- if (CPDF_Stream* pStream =
- ToStream(m_pDict->GetElementValue(FX_BSTRC("Mask"))))
+ if (CPDF_Stream* pStream = ToStream(m_pDict->GetElementValue("Mask")))
return LoadMaskDIB(pStream);
return nullptr;
}
int CPDF_DIBSource::StratLoadMask() {
m_MatteColor = 0XFFFFFFFF;
- m_pMaskStream = m_pDict->GetStream(FX_BSTRC("SMask"));
+ m_pMaskStream = m_pDict->GetStream("SMask");
if (m_pMaskStream) {
- CPDF_Array* pMatte = m_pMaskStream->GetDict()->GetArray(FX_BSTRC("Matte"));
+ CPDF_Array* pMatte = m_pMaskStream->GetDict()->GetArray("Matte");
if (pMatte != NULL && m_pColorSpace &&
(FX_DWORD)m_pColorSpace->CountComponents() <= m_nComponents) {
FX_FLOAT R, G, B;
@@ -804,7 +803,7 @@ int CPDF_DIBSource::StratLoadMask() {
return StartLoadMaskDIB();
}
- m_pMaskStream = ToStream(m_pDict->GetElementValue(FX_BSTRC("Mask")));
+ m_pMaskStream = ToStream(m_pDict->GetElementValue("Mask"));
return m_pMaskStream ? StartLoadMaskDIB() : 1;
}
int CPDF_DIBSource::ContinueLoadMaskDIB(IFX_Pause* pPause) {
diff --git a/core/src/fpdfapi/fpdf_render/fpdf_render_pattern.cpp b/core/src/fpdfapi/fpdf_render/fpdf_render_pattern.cpp
index 193c2ae05a..8b6c0d1fd1 100644
--- a/core/src/fpdfapi/fpdf_render/fpdf_render_pattern.cpp
+++ b/core/src/fpdfapi/fpdf_render/fpdf_render_pattern.cpp
@@ -20,7 +20,7 @@ static void DrawAxialShading(CFX_DIBitmap* pBitmap,
CPDF_ColorSpace* pCS,
int alpha) {
ASSERT(pBitmap->GetFormat() == FXDIB_Argb);
- CPDF_Array* pCoords = pDict->GetArray(FX_BSTRC("Coords"));
+ CPDF_Array* pCoords = pDict->GetArray("Coords");
if (pCoords == NULL) {
return;
}
@@ -29,13 +29,13 @@ static void DrawAxialShading(CFX_DIBitmap* pBitmap,
FX_FLOAT end_x = pCoords->GetNumber(2);
FX_FLOAT end_y = pCoords->GetNumber(3);
FX_FLOAT t_min = 0, t_max = 1.0f;
- CPDF_Array* pArray = pDict->GetArray(FX_BSTRC("Domain"));
+ CPDF_Array* pArray = pDict->GetArray("Domain");
if (pArray) {
t_min = pArray->GetNumber(0);
t_max = pArray->GetNumber(1);
}
FX_BOOL bStartExtend = FALSE, bEndExtend = FALSE;
- pArray = pDict->GetArray(FX_BSTRC("Extend"));
+ pArray = pDict->GetArray("Extend");
if (pArray) {
bStartExtend = pArray->GetInteger(0);
bEndExtend = pArray->GetInteger(1);
@@ -111,7 +111,7 @@ static void DrawRadialShading(CFX_DIBitmap* pBitmap,
CPDF_ColorSpace* pCS,
int alpha) {
ASSERT(pBitmap->GetFormat() == FXDIB_Argb);
- CPDF_Array* pCoords = pDict->GetArray(FX_BSTRC("Coords"));
+ CPDF_Array* pCoords = pDict->GetArray("Coords");
if (pCoords == NULL) {
return;
}
@@ -124,13 +124,13 @@ static void DrawRadialShading(CFX_DIBitmap* pBitmap,
CFX_Matrix matrix;
matrix.SetReverse(*pObject2Bitmap);
FX_FLOAT t_min = 0, t_max = 1.0f;
- CPDF_Array* pArray = pDict->GetArray(FX_BSTRC("Domain"));
+ CPDF_Array* pArray = pDict->GetArray("Domain");
if (pArray) {
t_min = pArray->GetNumber(0);
t_max = pArray->GetNumber(1);
}
FX_BOOL bStartExtend = FALSE, bEndExtend = FALSE;
- pArray = pDict->GetArray(FX_BSTRC("Extend"));
+ pArray = pDict->GetArray("Extend");
if (pArray) {
bStartExtend = pArray->GetInteger(0);
bEndExtend = pArray->GetInteger(1);
@@ -249,7 +249,7 @@ static void DrawFuncShading(CFX_DIBitmap* pBitmap,
CPDF_ColorSpace* pCS,
int alpha) {
ASSERT(pBitmap->GetFormat() == FXDIB_Argb);
- CPDF_Array* pDomain = pDict->GetArray(FX_BSTRC("Domain"));
+ CPDF_Array* pDomain = pDict->GetArray("Domain");
FX_FLOAT xmin = 0, ymin = 0, xmax = 1.0f, ymax = 1.0f;
if (pDomain) {
xmin = pDomain->GetNumber(0);
@@ -257,7 +257,7 @@ static void DrawFuncShading(CFX_DIBitmap* pBitmap,
ymin = pDomain->GetNumber(2);
ymax = pDomain->GetNumber(3);
}
- CFX_Matrix mtDomain2Target = pDict->GetMatrix(FX_BSTRC("Matrix"));
+ CFX_Matrix mtDomain2Target = pDict->GetMatrix("Matrix");
CFX_Matrix matrix, reverse_matrix;
matrix.SetReverse(*pObject2Bitmap);
reverse_matrix.SetReverse(mtDomain2Target);
@@ -839,9 +839,9 @@ void CPDF_RenderStatus::DrawShading(CPDF_ShadingPattern* pPattern,
}
FX_ARGB background = 0;
if (!pPattern->m_bShadingObj &&
- pPattern->m_pShadingObj->GetDict()->KeyExist(FX_BSTRC("Background"))) {
+ pPattern->m_pShadingObj->GetDict()->KeyExist("Background")) {
CPDF_Array* pBackColor =
- pPattern->m_pShadingObj->GetDict()->GetArray(FX_BSTRC("Background"));
+ pPattern->m_pShadingObj->GetDict()->GetArray("Background");
if (pBackColor &&
pBackColor->GetCount() >= (FX_DWORD)pColorSpace->CountComponents()) {
CFX_FixedBufGrow<FX_FLOAT, 16> comps(pColorSpace->CountComponents());
@@ -854,8 +854,8 @@ void CPDF_RenderStatus::DrawShading(CPDF_ShadingPattern* pPattern,
(int32_t)(B * 255));
}
}
- if (pDict->KeyExist(FX_BSTRC("BBox"))) {
- CFX_FloatRect rect = pDict->GetRect(FX_BSTRC("BBox"));
+ if (pDict->KeyExist("BBox")) {
+ CFX_FloatRect rect = pDict->GetRect("BBox");
rect.Transform(pMatrix);
clip_rect.Intersect(rect.GetOutterRect());
}
@@ -1064,8 +1064,7 @@ void CPDF_RenderStatus::DrawTilingPattern(CPDF_TilingPattern* pPattern,
}
CPDF_Dictionary* pFormResource = NULL;
if (pPattern->m_pForm->m_pFormDict) {
- pFormResource =
- pPattern->m_pForm->m_pFormDict->GetDict(FX_BSTRC("Resources"));
+ pFormResource = pPattern->m_pForm->m_pFormDict->GetDict("Resources");
}
for (int col = min_col; col <= max_col; col++)
for (int row = min_row; row <= max_row; row++) {
diff --git a/core/src/fpdfapi/fpdf_render/fpdf_render_text.cpp b/core/src/fpdfapi/fpdf_render/fpdf_render_text.cpp
index 227a208080..3a56058295 100644
--- a/core/src/fpdfapi/fpdf_render/fpdf_render_text.cpp
+++ b/core/src/fpdfapi/fpdf_render/fpdf_render_text.cpp
@@ -411,8 +411,7 @@ FX_BOOL CPDF_RenderStatus::ProcessType3Text(const CPDF_TextObject* textobj,
Options.m_Flags &= ~RENDER_FORCE_DOWNSAMPLE;
CPDF_Dictionary* pFormResource = NULL;
if (pType3Char->m_pForm && pType3Char->m_pForm->m_pFormDict) {
- pFormResource =
- pType3Char->m_pForm->m_pFormDict->GetDict(FX_BSTRC("Resources"));
+ pFormResource = pType3Char->m_pForm->m_pFormDict->GetDict("Resources");
}
if (fill_alpha == 255) {
CPDF_RenderStatus status;
diff --git a/core/src/fpdfdoc/doc_action.cpp b/core/src/fpdfdoc/doc_action.cpp
index 01fb064e47..3ad746067d 100644
--- a/core/src/fpdfdoc/doc_action.cpp
+++ b/core/src/fpdfdoc/doc_action.cpp
@@ -19,7 +19,7 @@ CPDF_Dest CPDF_Action::GetDest(CPDF_Document* pDoc) const {
return CPDF_Dest();
}
if (pDest->IsString() || pDest->IsName()) {
- CPDF_NameTree name_tree(pDoc, FX_BSTRC("Dests"));
+ CPDF_NameTree name_tree(pDoc, "Dests");
CFX_ByteStringC name = pDest->GetString();
return CPDF_Dest(name_tree.LookupNamedDest(pDoc, name));
}
@@ -58,9 +58,9 @@ CFX_WideString CPDF_Action::GetFilePath() const {
CFX_WideString path;
if (pFile == NULL) {
if (type == "Launch") {
- CPDF_Dictionary* pWinDict = m_pDict->GetDict(FX_BSTRC("Win"));
+ CPDF_Dictionary* pWinDict = m_pDict->GetDict("Win");
if (pWinDict) {
- return CFX_WideString::FromLocal(pWinDict->GetString(FX_BSTRC("F")));
+ return CFX_WideString::FromLocal(pWinDict->GetString("F"));
}
}
return path;
@@ -81,7 +81,7 @@ CFX_ByteString CPDF_Action::GetURI(CPDF_Document* pDoc) const {
CPDF_Dictionary* pRoot = pDoc->GetRoot();
CPDF_Dictionary* pURI = pRoot->GetDict("URI");
if (pURI != NULL) {
- if (csURI.Find(FX_BSTRC(":"), 0) < 1) {
+ if (csURI.Find(":", 0) < 1) {
csURI = pURI->GetString("Base") + csURI;
}
}
@@ -189,10 +189,10 @@ CPDF_Dictionary* CPDF_Action::GetAnnot() const {
return nullptr;
}
CFX_ByteString csType = m_pDict->GetString("S");
- if (csType == FX_BSTRC("Rendition")) {
+ if (csType == "Rendition") {
return m_pDict->GetDict("AN");
}
- if (csType == FX_BSTRC("Movie")) {
+ if (csType == "Movie") {
return m_pDict->GetDict("Annotation");
}
return nullptr;
@@ -202,21 +202,21 @@ int32_t CPDF_Action::GetOperationType() const {
return 0;
}
CFX_ByteString csType = m_pDict->GetString("S");
- if (csType == FX_BSTRC("Rendition")) {
+ if (csType == "Rendition") {
return m_pDict->GetInteger("OP");
}
- if (csType == FX_BSTRC("Movie")) {
+ if (csType == "Movie") {
CFX_ByteString csOP = m_pDict->GetString("Operation");
- if (csOP == FX_BSTRC("Play")) {
+ if (csOP == "Play") {
return 0;
}
- if (csOP == FX_BSTRC("Stop")) {
+ if (csOP == "Stop") {
return 1;
}
- if (csOP == FX_BSTRC("Pause")) {
+ if (csOP == "Pause") {
return 2;
}
- if (csOP == FX_BSTRC("Resume")) {
+ if (csOP == "Resume") {
return 3;
}
}
@@ -299,13 +299,13 @@ CPDF_DocJSActions::CPDF_DocJSActions(CPDF_Document* pDoc) : m_pDocument(pDoc) {}
int CPDF_DocJSActions::CountJSActions() const {
ASSERT(m_pDocument != NULL);
- CPDF_NameTree name_tree(m_pDocument, FX_BSTRC("JavaScript"));
+ CPDF_NameTree name_tree(m_pDocument, "JavaScript");
return name_tree.GetCount();
}
CPDF_Action CPDF_DocJSActions::GetJSAction(int index,
CFX_ByteString& csName) const {
ASSERT(m_pDocument != NULL);
- CPDF_NameTree name_tree(m_pDocument, FX_BSTRC("JavaScript"));
+ CPDF_NameTree name_tree(m_pDocument, "JavaScript");
CPDF_Object* pAction = name_tree.LookupValue(index, csName);
if (!ToDictionary(pAction)) {
return CPDF_Action();
@@ -314,7 +314,7 @@ CPDF_Action CPDF_DocJSActions::GetJSAction(int index,
}
CPDF_Action CPDF_DocJSActions::GetJSAction(const CFX_ByteString& csName) const {
ASSERT(m_pDocument != NULL);
- CPDF_NameTree name_tree(m_pDocument, FX_BSTRC("JavaScript"));
+ CPDF_NameTree name_tree(m_pDocument, "JavaScript");
CPDF_Object* pAction = name_tree.LookupValue(csName);
if (!ToDictionary(pAction)) {
return CPDF_Action();
@@ -323,6 +323,6 @@ CPDF_Action CPDF_DocJSActions::GetJSAction(const CFX_ByteString& csName) const {
}
int CPDF_DocJSActions::FindJSAction(const CFX_ByteString& csName) const {
ASSERT(m_pDocument != NULL);
- CPDF_NameTree name_tree(m_pDocument, FX_BSTRC("JavaScript"));
+ CPDF_NameTree name_tree(m_pDocument, "JavaScript");
return name_tree.GetIndex(csName);
}
diff --git a/core/src/fpdfdoc/doc_annot.cpp b/core/src/fpdfdoc/doc_annot.cpp
index 26ea45fd9d..cacd650dde 100644
--- a/core/src/fpdfdoc/doc_annot.cpp
+++ b/core/src/fpdfdoc/doc_annot.cpp
@@ -34,8 +34,7 @@ CPDF_AnnotList::CPDF_AnnotList(CPDF_Page* pPage)
pDict = pAnnots->GetDict(i);
}
m_AnnotList.push_back(new CPDF_Annot(pDict, this));
- if (bRegenerateAP &&
- pDict->GetConstString(FX_BSTRC("Subtype")) == FX_BSTRC("Widget") &&
+ if (bRegenerateAP && pDict->GetConstString("Subtype") == "Widget" &&
CPDF_InterForm::UpdatingAPEnabled()) {
FPDF_GenerateAP(m_pDocument, pDict);
}
@@ -74,7 +73,7 @@ void CPDF_AnnotList::DisplayPass(const CPDF_Page* pPage,
IPDF_OCContext* pOCContext = pOptions->m_pOCContext;
CPDF_Dictionary* pAnnotDict = pAnnot->GetAnnotDict();
if (pOCContext && pAnnotDict &&
- !pOCContext->CheckOCGVisible(pAnnotDict->GetDict(FX_BSTRC("OC")))) {
+ !pOCContext->CheckOCGVisible(pAnnotDict->GetDict("OC"))) {
continue;
}
}
@@ -119,7 +118,7 @@ void CPDF_AnnotList::DisplayAnnots(const CPDF_Page* pPage,
CPDF_Annot::CPDF_Annot(CPDF_Dictionary* pDict, CPDF_AnnotList* pList)
: m_pAnnotDict(pDict),
m_pList(pList),
- m_sSubtype(m_pAnnotDict->GetConstString(FX_BSTRC("Subtype"))) {}
+ m_sSubtype(m_pAnnotDict->GetConstString("Subtype")) {}
CPDF_Annot::~CPDF_Annot() {
ClearCachedAP();
}
@@ -168,13 +167,13 @@ CPDF_Stream* FPDFDOC_GetAnnotAP(CPDF_Dictionary* pAnnotDict,
if (CPDF_Dictionary* pDict = psub->AsDictionary()) {
CFX_ByteString as = pAnnotDict->GetString("AS");
if (as.IsEmpty()) {
- CFX_ByteString value = pAnnotDict->GetString(FX_BSTRC("V"));
+ CFX_ByteString value = pAnnotDict->GetString("V");
if (value.IsEmpty()) {
- CPDF_Dictionary* pDict = pAnnotDict->GetDict(FX_BSTRC("Parent"));
- value = pDict ? pDict->GetString(FX_BSTRC("V")) : CFX_ByteString();
+ CPDF_Dictionary* pDict = pAnnotDict->GetDict("Parent");
+ value = pDict ? pDict->GetString("V") : CFX_ByteString();
}
if (value.IsEmpty() || !pDict->KeyExist(value))
- as = FX_BSTRC("Off");
+ as = "Off";
else
as = value;
}
@@ -208,8 +207,8 @@ static CPDF_Form* FPDFDOC_Annot_GetMatrix(const CPDF_Page* pPage,
if (!pForm) {
return NULL;
}
- CFX_FloatRect form_bbox = pForm->m_pFormDict->GetRect(FX_BSTRC("BBox"));
- CFX_Matrix form_matrix = pForm->m_pFormDict->GetMatrix(FX_BSTRC("Matrix"));
+ CFX_FloatRect form_bbox = pForm->m_pFormDict->GetRect("BBox");
+ CFX_Matrix form_matrix = pForm->m_pFormDict->GetMatrix("Matrix");
form_matrix.TransformRect(form_bbox);
CPDF_Rect arect;
pAnnot->GetRect(arect);
diff --git a/core/src/fpdfdoc/doc_ap.cpp b/core/src/fpdfdoc/doc_ap.cpp
index bbac32f404..effe587090 100644
--- a/core/src/fpdfdoc/doc_ap.cpp
+++ b/core/src/fpdfdoc/doc_ap.cpp
@@ -11,8 +11,7 @@
#include "pdf_vt.h"
FX_BOOL FPDF_GenerateAP(CPDF_Document* pDoc, CPDF_Dictionary* pAnnotDict) {
- if (!pAnnotDict ||
- pAnnotDict->GetConstString("Subtype") != FX_BSTRC("Widget")) {
+ if (!pAnnotDict || pAnnotDict->GetConstString("Subtype") != "Widget") {
return FALSE;
}
CFX_ByteString field_type = FPDF_GetFieldAttr(pAnnotDict, "FT")->GetString();
@@ -292,16 +291,16 @@ static FX_BOOL GenerateWidgetAP(CPDF_Document* pDoc,
CPVT_Color crText = ParseColor(DA);
FX_BOOL bUseFormRes = FALSE;
CPDF_Dictionary* pFontDict = NULL;
- CPDF_Dictionary* pDRDict = pAnnotDict->GetDict(FX_BSTRC("DR"));
+ CPDF_Dictionary* pDRDict = pAnnotDict->GetDict("DR");
if (pDRDict == NULL) {
- pDRDict = pFormDict->GetDict(FX_BSTRC("DR"));
+ pDRDict = pFormDict->GetDict("DR");
bUseFormRes = TRUE;
}
CPDF_Dictionary* pDRFontDict = NULL;
if (pDRDict && (pDRFontDict = pDRDict->GetDict("Font"))) {
pFontDict = pDRFontDict->GetDict(sFontName.Mid(1));
if (!pFontDict && !bUseFormRes) {
- pDRDict = pFormDict->GetDict(FX_BSTRC("DR"));
+ pDRDict = pFormDict->GetDict("DR");
pDRFontDict = pDRDict->GetDict("Font");
if (pDRFontDict) {
pFontDict = pDRFontDict->GetDict(sFontName.Mid(1));
@@ -316,10 +315,10 @@ static FX_BOOL GenerateWidgetAP(CPDF_Document* pDoc,
if (pFontDict == NULL) {
return FALSE;
}
- pFontDict->SetAtName(FX_BSTRC("Type"), "Font");
- pFontDict->SetAtName(FX_BSTRC("Subtype"), "Type1");
- pFontDict->SetAtName(FX_BSTRC("BaseFont"), "Helvetica");
- pFontDict->SetAtName(FX_BSTRC("Encoding"), "WinAnsiEncoding");
+ pFontDict->SetAtName("Type", "Font");
+ pFontDict->SetAtName("Subtype", "Type1");
+ pFontDict->SetAtName("BaseFont", "Helvetica");
+ pFontDict->SetAtName("Encoding", "WinAnsiEncoding");
pDoc->AddIndirectObject(pFontDict);
pDRFontDict->SetAtReference(sFontName.Mid(1), pDoc, pFontDict);
}
diff --git a/core/src/fpdfdoc/doc_basic.cpp b/core/src/fpdfdoc/doc_basic.cpp
index 4da182814d..904ccf7c1f 100644
--- a/core/src/fpdfdoc/doc_basic.cpp
+++ b/core/src/fpdfdoc/doc_basic.cpp
@@ -63,8 +63,8 @@ CFX_ByteString CPDF_Dest::GetRemoteName() {
}
CPDF_NameTree::CPDF_NameTree(CPDF_Document* pDoc,
const CFX_ByteStringC& category) {
- if (pDoc->GetRoot() && pDoc->GetRoot()->GetDict(FX_BSTRC("Names")))
- m_pRoot = pDoc->GetRoot()->GetDict(FX_BSTRC("Names"))->GetDict(category);
+ if (pDoc->GetRoot() && pDoc->GetRoot()->GetDict("Names"))
+ m_pRoot = pDoc->GetRoot()->GetDict("Names")->GetDict(category);
else
m_pRoot = NULL;
}
@@ -76,7 +76,7 @@ static CPDF_Object* SearchNameNode(CPDF_Dictionary* pNode,
if (nLevel > nMaxRecursion) {
return NULL;
}
- CPDF_Array* pLimits = pNode->GetArray(FX_BSTRC("Limits"));
+ CPDF_Array* pLimits = pNode->GetArray("Limits");
if (pLimits != NULL) {
CFX_ByteString csLeft = pLimits->GetString(0);
CFX_ByteString csRight = pLimits->GetString(1);
@@ -89,7 +89,7 @@ static CPDF_Object* SearchNameNode(CPDF_Dictionary* pNode,
return NULL;
}
}
- CPDF_Array* pNames = pNode->GetArray(FX_BSTRC("Names"));
+ CPDF_Array* pNames = pNode->GetArray("Names");
if (pNames) {
FX_DWORD dwCount = pNames->GetCount() / 2;
for (FX_DWORD i = 0; i < dwCount; i++) {
@@ -111,7 +111,7 @@ static CPDF_Object* SearchNameNode(CPDF_Dictionary* pNode,
nIndex += dwCount;
return NULL;
}
- CPDF_Array* pKids = pNode->GetArray(FX_BSTRC("Kids"));
+ CPDF_Array* pKids = pNode->GetArray("Kids");
if (pKids == NULL) {
return NULL;
}
@@ -137,7 +137,7 @@ static CPDF_Object* SearchNameNode(CPDF_Dictionary* pNode,
if (nLevel > nMaxRecursion) {
return NULL;
}
- CPDF_Array* pNames = pNode->GetArray(FX_BSTRC("Names"));
+ CPDF_Array* pNames = pNode->GetArray("Names");
if (pNames) {
int nCount = pNames->GetCount() / 2;
if (nIndex >= nCurIndex + nCount) {
@@ -150,7 +150,7 @@ static CPDF_Object* SearchNameNode(CPDF_Dictionary* pNode,
csName = pNames->GetString((nIndex - nCurIndex) * 2);
return pNames->GetElementValue((nIndex - nCurIndex) * 2 + 1);
}
- CPDF_Array* pKids = pNode->GetArray(FX_BSTRC("Kids"));
+ CPDF_Array* pKids = pNode->GetArray("Kids");
if (pKids == NULL) {
return NULL;
}
@@ -171,11 +171,11 @@ static int CountNames(CPDF_Dictionary* pNode, int nLevel = 0) {
if (nLevel > nMaxRecursion) {
return 0;
}
- CPDF_Array* pNames = pNode->GetArray(FX_BSTRC("Names"));
+ CPDF_Array* pNames = pNode->GetArray("Names");
if (pNames) {
return pNames->GetCount() / 2;
}
- CPDF_Array* pKids = pNode->GetArray(FX_BSTRC("Kids"));
+ CPDF_Array* pKids = pNode->GetArray("Kids");
if (pKids == NULL) {
return 0;
}
@@ -224,7 +224,7 @@ CPDF_Array* CPDF_NameTree::LookupNamedDest(CPDF_Document* pDoc,
const CFX_ByteStringC& sName) {
CPDF_Object* pValue = LookupValue(sName);
if (!pValue) {
- CPDF_Dictionary* pDests = pDoc->GetRoot()->GetDict(FX_BSTRC("Dests"));
+ CPDF_Dictionary* pDests = pDoc->GetRoot()->GetDict("Dests");
if (!pDests)
return nullptr;
pValue = pDests->GetElementValue(sName);
@@ -234,7 +234,7 @@ CPDF_Array* CPDF_NameTree::LookupNamedDest(CPDF_Document* pDoc,
if (CPDF_Array* pArray = pValue->AsArray())
return pArray;
if (CPDF_Dictionary* pDict = pValue->AsDictionary())
- return pDict->GetArray(FX_BSTRC("D"));
+ return pDict->GetArray("D");
return nullptr;
}
#if _FXM_PLATFORM_ == _FXM_PLATFORM_APPLE_ || \
@@ -304,23 +304,20 @@ FX_BOOL CPDF_FileSpec::GetFileName(CFX_WideString& csFileName) const {
return FALSE;
}
if (CPDF_Dictionary* pDict = m_pObj->AsDictionary()) {
- csFileName = pDict->GetUnicodeText(FX_BSTRC("UF"));
+ csFileName = pDict->GetUnicodeText("UF");
if (csFileName.IsEmpty()) {
- csFileName = CFX_WideString::FromLocal(pDict->GetString(FX_BSTRC("F")));
+ csFileName = CFX_WideString::FromLocal(pDict->GetString("F"));
}
- if (pDict->GetString(FX_BSTRC("FS")) == FX_BSTRC("URL")) {
+ if (pDict->GetString("FS") == "URL") {
return TRUE;
}
if (csFileName.IsEmpty()) {
- if (pDict->KeyExist(FX_BSTRC("DOS"))) {
- csFileName =
- CFX_WideString::FromLocal(pDict->GetString(FX_BSTRC("DOS")));
- } else if (pDict->KeyExist(FX_BSTRC("Mac"))) {
- csFileName =
- CFX_WideString::FromLocal(pDict->GetString(FX_BSTRC("Mac")));
- } else if (pDict->KeyExist(FX_BSTRC("Unix"))) {
- csFileName =
- CFX_WideString::FromLocal(pDict->GetString(FX_BSTRC("Unix")));
+ if (pDict->KeyExist("DOS")) {
+ csFileName = CFX_WideString::FromLocal(pDict->GetString("DOS"));
+ } else if (pDict->KeyExist("Mac")) {
+ csFileName = CFX_WideString::FromLocal(pDict->GetString("Mac"));
+ } else if (pDict->KeyExist("Unix")) {
+ csFileName = CFX_WideString::FromLocal(pDict->GetString("Unix"));
} else {
return FALSE;
}
@@ -334,12 +331,12 @@ FX_BOOL CPDF_FileSpec::GetFileName(CFX_WideString& csFileName) const {
CPDF_FileSpec::CPDF_FileSpec() {
m_pObj = CPDF_Dictionary::Create();
if (CPDF_Dictionary* pDict = ToDictionary(m_pObj)) {
- pDict->SetAtName(FX_BSTRC("Type"), FX_BSTRC("Filespec"));
+ pDict->SetAtName("Type", "Filespec");
}
}
FX_BOOL CPDF_FileSpec::IsURL() const {
if (CPDF_Dictionary* pDict = ToDictionary(m_pObj)) {
- return pDict->GetString(FX_BSTRC("FS")) == FX_BSTRC("URL");
+ return pDict->GetString("FS") == "URL";
}
return FALSE;
}
@@ -385,8 +382,8 @@ CPDF_Stream* CPDF_FileSpec::GetFileStream() const {
return nullptr;
if (CPDF_Stream* pStream = m_pObj->AsStream())
return pStream;
- if (CPDF_Dictionary* pEF = m_pObj->AsDictionary()->GetDict(FX_BSTRC("EF")))
- return pEF->GetStream(FX_BSTRC("F"));
+ if (CPDF_Dictionary* pEF = m_pObj->AsDictionary()->GetDict("EF"))
+ return pEF->GetStream("F");
return nullptr;
}
static void FPDFDOC_FILESPEC_SetFileName(CPDF_Object* pObj,
@@ -402,8 +399,8 @@ static void FPDFDOC_FILESPEC_SetFileName(CPDF_Object* pObj,
if (pObj->IsString()) {
pObj->SetString(CFX_ByteString::FromUnicode(wsStr));
} else if (CPDF_Dictionary* pDict = pObj->AsDictionary()) {
- pDict->SetAtString(FX_BSTRC("F"), CFX_ByteString::FromUnicode(wsStr));
- pDict->SetAtString(FX_BSTRC("UF"), PDF_EncodeText(wsStr));
+ pDict->SetAtString("F", CFX_ByteString::FromUnicode(wsStr));
+ pDict->SetAtString("UF", PDF_EncodeText(wsStr));
}
}
void CPDF_FileSpec::SetFileName(const CFX_WideStringC& wsFileName,
@@ -411,7 +408,7 @@ void CPDF_FileSpec::SetFileName(const CFX_WideStringC& wsFileName,
ASSERT(m_pObj != NULL);
if (bURL) {
if (CPDF_Dictionary* pDict = m_pObj->AsDictionary()) {
- pDict->SetAtName(FX_BSTRC("FS"), "URL");
+ pDict->SetAtName("FS", "URL");
}
}
FPDFDOC_FILESPEC_SetFileName(m_pObj, wsFileName, bURL);
@@ -480,7 +477,7 @@ CFX_WideString CPDF_PageLabel::GetLabel(int nPage) const {
if (pPDFRoot == NULL) {
return wsLabel;
}
- CPDF_Dictionary* pLabels = pPDFRoot->GetDict(FX_BSTRC("PageLabels"));
+ CPDF_Dictionary* pLabels = pPDFRoot->GetDict("PageLabels");
CPDF_NumberTree numberTree(pLabels);
CPDF_Object* pValue = NULL;
int n = nPage;
@@ -494,11 +491,11 @@ CFX_WideString CPDF_PageLabel::GetLabel(int nPage) const {
if (pValue != NULL) {
pValue = pValue->GetDirect();
if (CPDF_Dictionary* pLabel = pValue->AsDictionary()) {
- if (pLabel->KeyExist(FX_BSTRC("P"))) {
- wsLabel += pLabel->GetUnicodeText(FX_BSTRC("P"));
+ if (pLabel->KeyExist("P")) {
+ wsLabel += pLabel->GetUnicodeText("P");
}
- CFX_ByteString bsNumberingStyle = pLabel->GetString(FX_BSTRC("S"), NULL);
- int nLabelNum = nPage - n + pLabel->GetInteger(FX_BSTRC("St"), 1);
+ CFX_ByteString bsNumberingStyle = pLabel->GetString("S", NULL);
+ int nLabelNum = nPage - n + pLabel->GetInteger("St", 1);
CFX_WideString wsNumPortion =
_GetLabelNumPortion(nLabelNum, bsNumberingStyle);
wsLabel += wsNumPortion;
diff --git a/core/src/fpdfdoc/doc_bookmark.cpp b/core/src/fpdfdoc/doc_bookmark.cpp
index 84b5a8b730..c59b1955a8 100644
--- a/core/src/fpdfdoc/doc_bookmark.cpp
+++ b/core/src/fpdfdoc/doc_bookmark.cpp
@@ -75,7 +75,7 @@ CPDF_Dest CPDF_Bookmark::GetDest(CPDF_Document* pDocument) const {
if (!pDest)
return CPDF_Dest();
if (pDest->IsString() || pDest->IsName()) {
- CPDF_NameTree name_tree(pDocument, FX_BSTRC("Dests"));
+ CPDF_NameTree name_tree(pDocument, "Dests");
CFX_ByteStringC name = pDest->GetString();
return CPDF_Dest(name_tree.LookupNamedDest(pDocument, name));
}
diff --git a/core/src/fpdfdoc/doc_form.cpp b/core/src/fpdfdoc/doc_form.cpp
index 2397d6b74a..26857dd2af 100644
--- a/core/src/fpdfdoc/doc_form.cpp
+++ b/core/src/fpdfdoc/doc_form.cpp
@@ -904,7 +904,7 @@ void CPDF_InterForm::LoadField(CPDF_Dictionary* pFieldDict, int nLevel) {
}
}
FX_BOOL CPDF_InterForm::HasXFAForm() const {
- return m_pFormDict && m_pFormDict->GetArray(FX_BSTRC("XFA")) != NULL;
+ return m_pFormDict && m_pFormDict->GetArray("XFA") != NULL;
}
void CPDF_InterForm::FixPageFields(const CPDF_Page* pPage) {
ASSERT(pPage != NULL);
@@ -912,20 +912,20 @@ void CPDF_InterForm::FixPageFields(const CPDF_Page* pPage) {
if (pPageDict == NULL) {
return;
}
- CPDF_Array* pAnnots = pPageDict->GetArray(FX_BSTRC("Annots"));
+ CPDF_Array* pAnnots = pPageDict->GetArray("Annots");
if (pAnnots == NULL) {
return;
}
int iAnnotCount = pAnnots->GetCount();
for (int i = 0; i < iAnnotCount; i++) {
CPDF_Dictionary* pAnnot = pAnnots->GetDict(i);
- if (pAnnot != NULL && pAnnot->GetString(FX_BSTRC("Subtype")) == "Widget") {
+ if (pAnnot != NULL && pAnnot->GetString("Subtype") == "Widget") {
LoadField(pAnnot);
}
}
}
CPDF_FormField* CPDF_InterForm::AddTerminalField(CPDF_Dictionary* pFieldDict) {
- if (!pFieldDict->KeyExist(FX_BSTRC("T"))) {
+ if (!pFieldDict->KeyExist("T")) {
return NULL;
}
CPDF_Dictionary* pDict = pFieldDict;
@@ -937,25 +937,24 @@ CPDF_FormField* CPDF_InterForm::AddTerminalField(CPDF_Dictionary* pFieldDict) {
pField = m_pFieldTree->GetField(csWName);
if (pField == NULL) {
CPDF_Dictionary* pParent = pFieldDict;
- if (!pFieldDict->KeyExist(FX_BSTRC("T")) &&
- pFieldDict->GetString(FX_BSTRC("Subtype")) == FX_BSTRC("Widget")) {
- pParent = pFieldDict->GetDict(FX_BSTRC("Parent"));
+ if (!pFieldDict->KeyExist("T") &&
+ pFieldDict->GetString("Subtype") == "Widget") {
+ pParent = pFieldDict->GetDict("Parent");
if (!pParent) {
pParent = pFieldDict;
}
}
- if (pParent && pParent != pFieldDict &&
- !pParent->KeyExist(FX_BSTRC("FT"))) {
- if (pFieldDict->KeyExist(FX_BSTRC("FT"))) {
- CPDF_Object* pFTValue = pFieldDict->GetElementValue(FX_BSTRC("FT"));
+ if (pParent && pParent != pFieldDict && !pParent->KeyExist("FT")) {
+ if (pFieldDict->KeyExist("FT")) {
+ CPDF_Object* pFTValue = pFieldDict->GetElementValue("FT");
if (pFTValue) {
- pParent->SetAt(FX_BSTRC("FT"), pFTValue->Clone());
+ pParent->SetAt("FT", pFTValue->Clone());
}
}
- if (pFieldDict->KeyExist(FX_BSTRC("Ff"))) {
- CPDF_Object* pFfValue = pFieldDict->GetElementValue(FX_BSTRC("Ff"));
+ if (pFieldDict->KeyExist("Ff")) {
+ CPDF_Object* pFfValue = pFieldDict->GetElementValue("Ff");
if (pFfValue) {
- pParent->SetAt(FX_BSTRC("Ff"), pFfValue->Clone());
+ pParent->SetAt("Ff", pFfValue->Clone());
}
}
}
@@ -1058,9 +1057,8 @@ CFDF_Document* CPDF_InterForm::ExportToFDF(
if (!pdf_path.IsEmpty()) {
if (bSimpleFileSpec) {
CFX_WideString wsFilePath = FILESPEC_EncodeFileName(pdf_path);
- pMainDict->SetAtString(FX_BSTRC("F"),
- CFX_ByteString::FromUnicode(wsFilePath));
- pMainDict->SetAtString(FX_BSTRC("UF"), PDF_EncodeText(wsFilePath));
+ pMainDict->SetAtString("F", CFX_ByteString::FromUnicode(wsFilePath));
+ pMainDict->SetAtString("UF", PDF_EncodeText(wsFilePath));
} else {
CPDF_FileSpec filespec;
filespec.SetFileName(pdf_path);
@@ -1231,7 +1229,7 @@ FX_BOOL CPDF_InterForm::ImportFromFDF(const CFDF_Document* pFDF,
if (pFields == NULL) {
return FALSE;
}
- m_bsEncoding = pMainDict->GetString(FX_BSTRC("Encoding"));
+ m_bsEncoding = pMainDict->GetString("Encoding");
if (bNotify && m_pFormNotify != NULL) {
int iRet = m_pFormNotify->BeforeFormImportData(this);
if (iRet < 0) {
diff --git a/core/src/fpdfdoc/doc_formcontrol.cpp b/core/src/fpdfdoc/doc_formcontrol.cpp
index 9bdf13bf85..0d2f9905d9 100644
--- a/core/src/fpdfdoc/doc_formcontrol.cpp
+++ b/core/src/fpdfdoc/doc_formcontrol.cpp
@@ -191,7 +191,7 @@ CPDF_FormControl::HighlightingMode CPDF_FormControl::GetHighlightingMode() {
}
CPDF_ApSettings CPDF_FormControl::GetMK() const {
- return CPDF_ApSettings(m_pWidgetDict ? m_pWidgetDict->GetDict(FX_BSTRC("MK"))
+ return CPDF_ApSettings(m_pWidgetDict ? m_pWidgetDict->GetDict("MK")
: nullptr);
}
@@ -330,7 +330,7 @@ bool CPDF_ApSettings::HasMKEntry(const CFX_ByteStringC& csEntry) const {
}
int CPDF_ApSettings::GetRotation() const {
- return m_pDict ? m_pDict->GetInteger(FX_BSTRC("R")) : 0;
+ return m_pDict ? m_pDict->GetInteger("R") : 0;
}
FX_ARGB CPDF_ApSettings::GetColor(int& iColorType,
@@ -421,10 +421,9 @@ CPDF_Stream* CPDF_ApSettings::GetIcon(const CFX_ByteStringC& csEntry) const {
}
CPDF_IconFit CPDF_ApSettings::GetIconFit() const {
- return m_pDict ? m_pDict->GetDict(FX_BSTRC("IF")) : nullptr;
+ return m_pDict ? m_pDict->GetDict("IF") : nullptr;
}
int CPDF_ApSettings::GetTextPosition() const {
- return m_pDict ? m_pDict->GetInteger(FX_BSTRC("TP"), TEXTPOS_CAPTION)
- : TEXTPOS_CAPTION;
+ return m_pDict ? m_pDict->GetInteger("TP", TEXTPOS_CAPTION) : TEXTPOS_CAPTION;
}
diff --git a/core/src/fpdfdoc/doc_link.cpp b/core/src/fpdfdoc/doc_link.cpp
index 37e4fe358b..b7ddb7e61c 100644
--- a/core/src/fpdfdoc/doc_link.cpp
+++ b/core/src/fpdfdoc/doc_link.cpp
@@ -77,7 +77,7 @@ CPDF_Dest CPDF_Link::GetDest(CPDF_Document* pDoc) {
return CPDF_Dest();
if (pDest->IsString() || pDest->IsName()) {
- CPDF_NameTree name_tree(pDoc, FX_BSTRC("Dests"));
+ CPDF_NameTree name_tree(pDoc, "Dests");
CFX_ByteStringC name = pDest->GetString();
return CPDF_Dest(name_tree.LookupNamedDest(pDoc, name));
}
diff --git a/core/src/fpdfdoc/doc_metadata.cpp b/core/src/fpdfdoc/doc_metadata.cpp
index c9550a8c16..f25007351b 100644
--- a/core/src/fpdfdoc/doc_metadata.cpp
+++ b/core/src/fpdfdoc/doc_metadata.cpp
@@ -12,7 +12,7 @@ CPDF_Metadata::CPDF_Metadata(CPDF_Document* pDoc) {
if (!pRoot)
return;
- CPDF_Stream* pStream = pRoot->GetStream(FX_BSTRC("Metadata"));
+ CPDF_Stream* pStream = pRoot->GetStream("Metadata");
if (!pStream)
return;
diff --git a/core/src/fpdfdoc/doc_ocg.cpp b/core/src/fpdfdoc/doc_ocg.cpp
index 7f9c6774df..4e0e1c5a31 100644
--- a/core/src/fpdfdoc/doc_ocg.cpp
+++ b/core/src/fpdfdoc/doc_ocg.cpp
@@ -21,12 +21,11 @@ static int32_t FPDFDOC_OCG_FindGroup(const CPDF_Object* pObject,
}
return pObject->GetDict() == pGroupDict ? 0 : -1;
}
-static FX_BOOL FPDFDOC_OCG_HasIntent(
- const CPDF_Dictionary* pDict,
- const CFX_ByteStringC& csElement,
- const CFX_ByteStringC& csDef = FX_BSTRC("")) {
+static FX_BOOL FPDFDOC_OCG_HasIntent(const CPDF_Dictionary* pDict,
+ const CFX_ByteStringC& csElement,
+ const CFX_ByteStringC& csDef = "") {
FXSYS_assert(pDict != NULL);
- CPDF_Object* pIntent = pDict->GetElementValue(FX_BSTRC("Intent"));
+ CPDF_Object* pIntent = pDict->GetElementValue("Intent");
if (pIntent == NULL) {
return csElement == csDef;
}
@@ -35,32 +34,31 @@ static FX_BOOL FPDFDOC_OCG_HasIntent(
FX_DWORD dwCount = pArray->GetCount();
for (FX_DWORD i = 0; i < dwCount; i++) {
bsIntent = pArray->GetString(i);
- if (bsIntent == FX_BSTRC("All") || bsIntent == csElement)
+ if (bsIntent == "All" || bsIntent == csElement)
return TRUE;
}
return FALSE;
}
bsIntent = pIntent->GetString();
- return bsIntent == FX_BSTRC("All") || bsIntent == csElement;
+ return bsIntent == "All" || bsIntent == csElement;
}
static CPDF_Dictionary* FPDFDOC_OCG_GetConfig(CPDF_Document* pDoc,
const CPDF_Dictionary* pOCGDict,
const CFX_ByteStringC& bsState) {
FXSYS_assert(pDoc && pOCGDict);
- CPDF_Dictionary* pOCProperties =
- pDoc->GetRoot()->GetDict(FX_BSTRC("OCProperties"));
+ CPDF_Dictionary* pOCProperties = pDoc->GetRoot()->GetDict("OCProperties");
if (!pOCProperties) {
return NULL;
}
- CPDF_Array* pOCGs = pOCProperties->GetArray(FX_BSTRC("OCGs"));
+ CPDF_Array* pOCGs = pOCProperties->GetArray("OCGs");
if (!pOCGs) {
return NULL;
}
if (FPDFDOC_OCG_FindGroup(pOCGs, pOCGDict) < 0) {
return NULL;
}
- CPDF_Dictionary* pConfig = pOCProperties->GetDict(FX_BSTRC("D"));
- CPDF_Array* pConfigs = pOCProperties->GetArray(FX_BSTRC("Configs"));
+ CPDF_Dictionary* pConfig = pOCProperties->GetDict("D");
+ CPDF_Array* pConfigs = pOCProperties->GetArray("Configs");
if (pConfigs) {
CPDF_Dictionary* pFind;
int32_t iCount = pConfigs->GetCount();
@@ -69,7 +67,7 @@ static CPDF_Dictionary* FPDFDOC_OCG_GetConfig(CPDF_Document* pDoc,
if (!pFind) {
continue;
}
- if (!FPDFDOC_OCG_HasIntent(pFind, FX_BSTRC("View"), FX_BSTRC("View"))) {
+ if (!FPDFDOC_OCG_HasIntent(pFind, "View", "View")) {
continue;
}
pConfig = pFind;
@@ -80,13 +78,13 @@ static CPDF_Dictionary* FPDFDOC_OCG_GetConfig(CPDF_Document* pDoc,
}
static CFX_ByteString FPDFDOC_OCG_GetUsageTypeString(
CPDF_OCContext::UsageType eType) {
- CFX_ByteString csState = FX_BSTRC("View");
+ CFX_ByteString csState = "View";
if (eType == CPDF_OCContext::Design) {
- csState = FX_BSTRC("Design");
+ csState = "Design";
} else if (eType == CPDF_OCContext::Print) {
- csState = FX_BSTRC("Print");
+ csState = "Print";
} else if (eType == CPDF_OCContext::Export) {
- csState = FX_BSTRC("Export");
+ csState = "Export";
}
return csState;
}
@@ -107,33 +105,32 @@ FX_BOOL CPDF_OCContext::LoadOCGStateFromConfig(const CFX_ByteStringC& csConfig,
return TRUE;
}
bValidConfig = TRUE;
- FX_BOOL bState = pConfig->GetString(FX_BSTRC("BaseState"), FX_BSTRC("ON")) !=
- FX_BSTRC("OFF");
- CPDF_Array* pArray = pConfig->GetArray(FX_BSTRC("ON"));
+ FX_BOOL bState = pConfig->GetString("BaseState", "ON") != "OFF";
+ CPDF_Array* pArray = pConfig->GetArray("ON");
if (pArray) {
if (FPDFDOC_OCG_FindGroup(pArray, pOCGDict) >= 0) {
bState = TRUE;
}
}
- pArray = pConfig->GetArray(FX_BSTRC("OFF"));
+ pArray = pConfig->GetArray("OFF");
if (pArray) {
if (FPDFDOC_OCG_FindGroup(pArray, pOCGDict) >= 0) {
bState = FALSE;
}
}
- pArray = pConfig->GetArray(FX_BSTRC("AS"));
+ pArray = pConfig->GetArray("AS");
if (pArray) {
- CFX_ByteString csFind = csConfig + FX_BSTRC("State");
+ CFX_ByteString csFind = csConfig + "State";
int32_t iCount = pArray->GetCount();
for (int32_t i = 0; i < iCount; i++) {
CPDF_Dictionary* pUsage = pArray->GetDict(i);
if (!pUsage) {
continue;
}
- if (pUsage->GetString(FX_BSTRC("Event"), FX_BSTRC("View")) != csConfig) {
+ if (pUsage->GetString("Event", "View") != csConfig) {
continue;
}
- CPDF_Array* pOCGs = pUsage->GetArray(FX_BSTRC("OCGs"));
+ CPDF_Array* pOCGs = pUsage->GetArray("OCGs");
if (!pOCGs) {
continue;
}
@@ -144,29 +141,29 @@ FX_BOOL CPDF_OCContext::LoadOCGStateFromConfig(const CFX_ByteStringC& csConfig,
if (!pState) {
continue;
}
- bState = pState->GetString(csFind) != FX_BSTRC("OFF");
+ bState = pState->GetString(csFind) != "OFF";
}
}
return bState;
}
FX_BOOL CPDF_OCContext::LoadOCGState(const CPDF_Dictionary* pOCGDict) const {
- if (!FPDFDOC_OCG_HasIntent(pOCGDict, FX_BSTRC("View"), FX_BSTRC("View"))) {
+ if (!FPDFDOC_OCG_HasIntent(pOCGDict, "View", "View")) {
return TRUE;
}
CFX_ByteString csState = FPDFDOC_OCG_GetUsageTypeString(m_eUsageType);
- CPDF_Dictionary* pUsage = pOCGDict->GetDict(FX_BSTRC("Usage"));
+ CPDF_Dictionary* pUsage = pOCGDict->GetDict("Usage");
if (pUsage) {
CPDF_Dictionary* pState = pUsage->GetDict(csState);
if (pState) {
- CFX_ByteString csFind = csState + FX_BSTRC("State");
+ CFX_ByteString csFind = csState + "State";
if (pState->KeyExist(csFind)) {
- return pState->GetString(csFind) != FX_BSTRC("OFF");
+ return pState->GetString(csFind) != "OFF";
}
}
- if (csState != FX_BSTRC("View")) {
- pState = pUsage->GetDict(FX_BSTRC("View"));
- if (pState && pState->KeyExist(FX_BSTRC("ViewState"))) {
- return pState->GetString(FX_BSTRC("ViewState")) != FX_BSTRC("OFF");
+ if (csState != "View") {
+ pState = pUsage->GetDict("View");
+ if (pState && pState->KeyExist("ViewState")) {
+ return pState->GetString("ViewState") != "OFF";
}
}
}
@@ -199,7 +196,7 @@ FX_BOOL CPDF_OCContext::GetOCGVE(CPDF_Array* pExpression,
int32_t iCount = pExpression->GetCount();
CPDF_Object* pOCGObj;
CFX_ByteString csOperator = pExpression->GetString(0);
- if (csOperator == FX_BSTRC("Not")) {
+ if (csOperator == "Not") {
pOCGObj = pExpression->GetElementValue(1);
if (!pOCGObj)
return FALSE;
@@ -209,7 +206,7 @@ FX_BOOL CPDF_OCContext::GetOCGVE(CPDF_Array* pExpression,
return !GetOCGVE(pArray, bFromConfig, nLevel + 1);
return FALSE;
}
- if (csOperator == FX_BSTRC("Or") || csOperator == FX_BSTRC("And")) {
+ if (csOperator == "Or" || csOperator == "And") {
FX_BOOL bValue = FALSE;
for (int32_t i = 1; i < iCount; i++) {
pOCGObj = pExpression->GetElementValue(1);
@@ -225,7 +222,7 @@ FX_BOOL CPDF_OCContext::GetOCGVE(CPDF_Array* pExpression,
if (i == 1) {
bValue = bItem;
} else {
- if (csOperator == FX_BSTRC("Or")) {
+ if (csOperator == "Or") {
bValue = bValue || bItem;
} else {
bValue = bValue && bItem;
@@ -239,12 +236,12 @@ FX_BOOL CPDF_OCContext::GetOCGVE(CPDF_Array* pExpression,
FX_BOOL CPDF_OCContext::LoadOCMDState(const CPDF_Dictionary* pOCMDDict,
FX_BOOL bFromConfig) {
FXSYS_assert(pOCMDDict != NULL);
- CPDF_Array* pVE = pOCMDDict->GetArray(FX_BSTRC("VE"));
+ CPDF_Array* pVE = pOCMDDict->GetArray("VE");
if (pVE != NULL) {
return GetOCGVE(pVE, bFromConfig);
}
- CFX_ByteString csP = pOCMDDict->GetString(FX_BSTRC("P"), FX_BSTRC("AnyOn"));
- CPDF_Object* pOCGObj = pOCMDDict->GetElementValue(FX_BSTRC("OCGs"));
+ CFX_ByteString csP = pOCMDDict->GetString("P", "AnyOn");
+ CPDF_Object* pOCGObj = pOCMDDict->GetElementValue("OCGs");
if (!pOCGObj)
return TRUE;
if (const CPDF_Dictionary* pDict = pOCGObj->AsDictionary())
@@ -255,7 +252,7 @@ FX_BOOL CPDF_OCContext::LoadOCMDState(const CPDF_Dictionary* pOCMDDict,
return TRUE;
FX_BOOL bState = FALSE;
- if (csP == FX_BSTRC("AllOn") || csP == FX_BSTRC("AllOff")) {
+ if (csP == "AllOn" || csP == "AllOff") {
bState = TRUE;
}
int32_t iCount = pArray->GetCount();
@@ -265,11 +262,9 @@ FX_BOOL CPDF_OCContext::LoadOCMDState(const CPDF_Dictionary* pOCMDDict,
if (pItemDict)
bItem = bFromConfig ? LoadOCGState(pItemDict) : GetOCGVisible(pItemDict);
- if ((csP == FX_BSTRC("AnyOn") && bItem) ||
- (csP == FX_BSTRC("AnyOff") && !bItem))
+ if ((csP == "AnyOn" && bItem) || (csP == "AnyOff" && !bItem))
return TRUE;
- if ((csP == FX_BSTRC("AllOn") && !bItem) ||
- (csP == FX_BSTRC("AllOff") && bItem))
+ if ((csP == "AllOn" && !bItem) || (csP == "AllOff" && bItem))
return FALSE;
}
return bState;
@@ -278,9 +273,8 @@ FX_BOOL CPDF_OCContext::CheckOCGVisible(const CPDF_Dictionary* pOCGDict) {
if (!pOCGDict) {
return TRUE;
}
- CFX_ByteString csType =
- pOCGDict->GetString(FX_BSTRC("Type"), FX_BSTRC("OCG"));
- if (csType == FX_BSTRC("OCG")) {
+ CFX_ByteString csType = pOCGDict->GetString("Type", "OCG");
+ if (csType == "OCG") {
return GetOCGVisible(pOCGDict);
}
return LoadOCMDState(pOCGDict, FALSE);
diff --git a/core/src/fpdfdoc/doc_tagged.cpp b/core/src/fpdfdoc/doc_tagged.cpp
index 2a3cfb9707..7869834dd9 100644
--- a/core/src/fpdfdoc/doc_tagged.cpp
+++ b/core/src/fpdfdoc/doc_tagged.cpp
@@ -12,8 +12,8 @@
const int nMaxRecursion = 32;
static FX_BOOL IsTagged(const CPDF_Document* pDoc) {
CPDF_Dictionary* pCatalog = pDoc->GetRoot();
- CPDF_Dictionary* pMarkInfo = pCatalog->GetDict(FX_BSTRC("MarkInfo"));
- return pMarkInfo != NULL && pMarkInfo->GetInteger(FX_BSTRC("Marked"));
+ CPDF_Dictionary* pMarkInfo = pCatalog->GetDict("MarkInfo");
+ return pMarkInfo != NULL && pMarkInfo->GetInteger("Marked");
}
CPDF_StructTree* CPDF_StructTree::LoadPage(const CPDF_Document* pDoc,
const CPDF_Dictionary* pPageDict) {
@@ -34,11 +34,11 @@ CPDF_StructTree* CPDF_StructTree::LoadDoc(const CPDF_Document* pDoc) {
}
CPDF_StructTreeImpl::CPDF_StructTreeImpl(const CPDF_Document* pDoc) {
CPDF_Dictionary* pCatalog = pDoc->GetRoot();
- m_pTreeRoot = pCatalog->GetDict(FX_BSTRC("StructTreeRoot"));
+ m_pTreeRoot = pCatalog->GetDict("StructTreeRoot");
if (m_pTreeRoot == NULL) {
return;
}
- m_pRoleMap = m_pTreeRoot->GetDict(FX_BSTRC("RoleMap"));
+ m_pRoleMap = m_pTreeRoot->GetDict("RoleMap");
}
CPDF_StructTreeImpl::~CPDF_StructTreeImpl() {
for (int i = 0; i < m_Kids.GetSize(); i++)
@@ -51,7 +51,7 @@ void CPDF_StructTreeImpl::LoadDocTree() {
if (!m_pTreeRoot)
return;
- CPDF_Object* pKids = m_pTreeRoot->GetElementValue(FX_BSTRC("K"));
+ CPDF_Object* pKids = m_pTreeRoot->GetElementValue("K");
if (!pKids)
return;
if (CPDF_Dictionary* pDict = pKids->AsDictionary()) {
@@ -76,7 +76,7 @@ void CPDF_StructTreeImpl::LoadPageTree(const CPDF_Dictionary* pPageDict) {
if (!m_pTreeRoot)
return;
- CPDF_Object* pKids = m_pTreeRoot->GetElementValue(FX_BSTRC("K"));
+ CPDF_Object* pKids = m_pTreeRoot->GetElementValue("K");
if (!pKids)
return;
@@ -94,12 +94,12 @@ void CPDF_StructTreeImpl::LoadPageTree(const CPDF_Dictionary* pPageDict) {
m_Kids[i] = NULL;
}
CFX_MapPtrToPtr element_map;
- CPDF_Dictionary* pParentTree = m_pTreeRoot->GetDict(FX_BSTRC("ParentTree"));
+ CPDF_Dictionary* pParentTree = m_pTreeRoot->GetDict("ParentTree");
if (pParentTree == NULL) {
return;
}
CPDF_NumberTree parent_tree(pParentTree);
- int parents_id = pPageDict->GetInteger(FX_BSTRC("StructParents"), -1);
+ int parents_id = pPageDict->GetInteger("StructParents", -1);
if (parents_id >= 0) {
CPDF_Array* pParentArray = ToArray(parent_tree.LookupValue(parents_id));
if (!pParentArray)
@@ -126,9 +126,8 @@ CPDF_StructElementImpl* CPDF_StructTreeImpl::AddPageNode(CPDF_Dictionary* pDict,
}
pElement = new CPDF_StructElementImpl(this, NULL, pDict);
map.SetAt(pDict, pElement);
- CPDF_Dictionary* pParent = pDict->GetDict(FX_BSTRC("P"));
- if (pParent == NULL ||
- pParent->GetString(FX_BSTRC("Type")) == FX_BSTRC("StructTreeRoot")) {
+ CPDF_Dictionary* pParent = pDict->GetDict("P");
+ if (pParent == NULL || pParent->GetString("Type") == "StructTreeRoot") {
if (!AddTopLevelNode(pDict, pElement)) {
pElement->Release();
map.RemoveKey(pDict);
@@ -156,7 +155,7 @@ CPDF_StructElementImpl* CPDF_StructTreeImpl::AddPageNode(CPDF_Dictionary* pDict,
}
FX_BOOL CPDF_StructTreeImpl::AddTopLevelNode(CPDF_Dictionary* pDict,
CPDF_StructElementImpl* pElement) {
- CPDF_Object* pObj = m_pTreeRoot->GetElementValue(FX_BSTRC("K"));
+ CPDF_Object* pObj = m_pTreeRoot->GetElementValue("K");
if (!pObj) {
return FALSE;
}
@@ -196,7 +195,7 @@ CPDF_StructElementImpl::CPDF_StructElementImpl(CPDF_StructTreeImpl* pTree,
: m_RefCount(0) {
m_pTree = pTree;
m_pDict = pDict;
- m_Type = pDict->GetString(FX_BSTRC("S"));
+ m_Type = pDict->GetString("S");
if (pTree->m_pRoleMap) {
CFX_ByteString mapped = pTree->m_pRoleMap->GetString(m_Type);
if (!mapped.IsEmpty()) {
@@ -224,12 +223,12 @@ void CPDF_StructElementImpl::Release() {
}
}
void CPDF_StructElementImpl::LoadKids(CPDF_Dictionary* pDict) {
- CPDF_Object* pObj = pDict->GetElement(FX_BSTRC("Pg"));
+ CPDF_Object* pObj = pDict->GetElement("Pg");
FX_DWORD PageObjNum = 0;
if (CPDF_Reference* pRef = ToReference(pObj))
PageObjNum = pRef->GetRefObjNum();
- CPDF_Object* pKids = pDict->GetElementValue(FX_BSTRC("K"));
+ CPDF_Object* pKids = pDict->GetElementValue("K");
if (!pKids)
return;
@@ -265,30 +264,28 @@ void CPDF_StructElementImpl::LoadKid(FX_DWORD PageObjNum,
if (!pKidDict)
return;
- if (CPDF_Reference* pRef = ToReference(pKidDict->GetElement(FX_BSTRC("Pg"))))
+ if (CPDF_Reference* pRef = ToReference(pKidDict->GetElement("Pg")))
PageObjNum = pRef->GetRefObjNum();
- CFX_ByteString type = pKidDict->GetString(FX_BSTRC("Type"));
- if (type == FX_BSTRC("MCR")) {
+ CFX_ByteString type = pKidDict->GetString("Type");
+ if (type == "MCR") {
if (m_pTree->m_pPage && m_pTree->m_pPage->GetObjNum() != PageObjNum) {
return;
}
pKid->m_Type = CPDF_StructKid::StreamContent;
- if (CPDF_Reference* pRef =
- ToReference(pKidDict->GetElement(FX_BSTRC("Stm")))) {
+ if (CPDF_Reference* pRef = ToReference(pKidDict->GetElement("Stm"))) {
pKid->m_StreamContent.m_RefObjNum = pRef->GetRefObjNum();
} else {
pKid->m_StreamContent.m_RefObjNum = 0;
}
pKid->m_StreamContent.m_PageObjNum = PageObjNum;
- pKid->m_StreamContent.m_ContentId = pKidDict->GetInteger(FX_BSTRC("MCID"));
- } else if (type == FX_BSTRC("OBJR")) {
+ pKid->m_StreamContent.m_ContentId = pKidDict->GetInteger("MCID");
+ } else if (type == "OBJR") {
if (m_pTree->m_pPage && m_pTree->m_pPage->GetObjNum() != PageObjNum) {
return;
}
pKid->m_Type = CPDF_StructKid::Object;
- if (CPDF_Reference* pObj =
- ToReference(pKidDict->GetElement(FX_BSTRC("Obj")))) {
+ if (CPDF_Reference* pObj = ToReference(pKidDict->GetElement("Obj"))) {
pKid->m_Object.m_RefObjNum = pObj->GetRefObjNum();
} else {
pKid->m_Object.m_RefObjNum = 0;
@@ -326,7 +323,7 @@ static CPDF_Dictionary* FindAttrDict(CPDF_Object* pAttrs,
return pDict;
}
}
- if (pDict && pDict->GetString(FX_BSTRC("O")) == owner)
+ if (pDict && pDict->GetString("O") == owner)
return pDict;
return nullptr;
}
@@ -347,7 +344,7 @@ CPDF_Object* CPDF_StructElementImpl::GetAttr(const CFX_ByteStringC& owner,
}
return m_pParent->GetAttr(owner, name, TRUE, fLevel + 1);
}
- CPDF_Object* pA = m_pDict->GetElementValue(FX_BSTRC("A"));
+ CPDF_Object* pA = m_pDict->GetElementValue("A");
if (pA) {
CPDF_Dictionary* pAttrDict = FindAttrDict(pA, owner);
if (pAttrDict) {
@@ -357,12 +354,11 @@ CPDF_Object* CPDF_StructElementImpl::GetAttr(const CFX_ByteStringC& owner,
}
}
}
- CPDF_Object* pC = m_pDict->GetElementValue(FX_BSTRC("C"));
+ CPDF_Object* pC = m_pDict->GetElementValue("C");
if (!pC)
return nullptr;
- CPDF_Dictionary* pClassMap =
- m_pTree->m_pTreeRoot->GetDict(FX_BSTRC("ClassMap"));
+ CPDF_Dictionary* pClassMap = m_pTree->m_pTreeRoot->GetDict("ClassMap");
if (!pClassMap)
return nullptr;
@@ -370,14 +366,14 @@ CPDF_Object* CPDF_StructElementImpl::GetAttr(const CFX_ByteStringC& owner,
for (FX_DWORD i = 0; i < pArray->GetCount(); i++) {
CFX_ByteString class_name = pArray->GetString(i);
CPDF_Dictionary* pClassDict = pClassMap->GetDict(class_name);
- if (pClassDict && pClassDict->GetString(FX_BSTRC("O")) == owner)
+ if (pClassDict && pClassDict->GetString("O") == owner)
return pClassDict->GetElementValue(name);
}
return nullptr;
}
CFX_ByteString class_name = pC->GetString();
CPDF_Dictionary* pClassDict = pClassMap->GetDict(class_name);
- if (pClassDict && pClassDict->GetString(FX_BSTRC("O")) == owner)
+ if (pClassDict && pClassDict->GetString("O") == owner)
return pClassDict->GetElementValue(name);
return nullptr;
}
diff --git a/core/src/fpdfdoc/doc_viewerPreferences.cpp b/core/src/fpdfdoc/doc_viewerPreferences.cpp
index a6975cc958..05f50c03d0 100644
--- a/core/src/fpdfdoc/doc_viewerPreferences.cpp
+++ b/core/src/fpdfdoc/doc_viewerPreferences.cpp
@@ -11,43 +11,43 @@ CPDF_ViewerPreferences::CPDF_ViewerPreferences(CPDF_Document* pDoc)
CPDF_ViewerPreferences::~CPDF_ViewerPreferences() {}
FX_BOOL CPDF_ViewerPreferences::IsDirectionR2L() const {
CPDF_Dictionary* pDict = m_pDoc->GetRoot();
- pDict = pDict->GetDict(FX_BSTRC("ViewerPreferences"));
+ pDict = pDict->GetDict("ViewerPreferences");
if (!pDict) {
return FALSE;
}
- return FX_BSTRC("R2L") == pDict->GetString(FX_BSTRC("Direction"));
+ return "R2L" == pDict->GetString("Direction");
}
FX_BOOL CPDF_ViewerPreferences::PrintScaling() const {
CPDF_Dictionary* pDict = m_pDoc->GetRoot();
- pDict = pDict->GetDict(FX_BSTRC("ViewerPreferences"));
+ pDict = pDict->GetDict("ViewerPreferences");
if (!pDict) {
return TRUE;
}
- return FX_BSTRC("None") != pDict->GetString(FX_BSTRC("PrintScaling"));
+ return "None" != pDict->GetString("PrintScaling");
}
int32_t CPDF_ViewerPreferences::NumCopies() const {
CPDF_Dictionary* pDict = m_pDoc->GetRoot();
- pDict = pDict->GetDict(FX_BSTRC("ViewerPreferences"));
+ pDict = pDict->GetDict("ViewerPreferences");
if (!pDict) {
return 1;
}
- return pDict->GetInteger(FX_BSTRC("NumCopies"));
+ return pDict->GetInteger("NumCopies");
}
CPDF_Array* CPDF_ViewerPreferences::PrintPageRange() const {
CPDF_Dictionary* pDict = m_pDoc->GetRoot();
CPDF_Array* pRange = NULL;
- pDict = pDict->GetDict(FX_BSTRC("ViewerPreferences"));
+ pDict = pDict->GetDict("ViewerPreferences");
if (!pDict) {
return pRange;
}
- pRange = pDict->GetArray(FX_BSTRC("PrintPageRange"));
+ pRange = pDict->GetArray("PrintPageRange");
return pRange;
}
CFX_ByteString CPDF_ViewerPreferences::Duplex() const {
CPDF_Dictionary* pDict = m_pDoc->GetRoot();
- pDict = pDict->GetDict(FX_BSTRC("ViewerPreferences"));
+ pDict = pDict->GetDict("ViewerPreferences");
if (!pDict) {
- return FX_BSTRC("None");
+ return "None";
}
- return pDict->GetString(FX_BSTRC("Duplex"));
+ return pDict->GetString("Duplex");
}
diff --git a/core/src/fpdftext/fpdf_text_int.cpp b/core/src/fpdftext/fpdf_text_int.cpp
index 314cc0e062..8a359fe9af 100644
--- a/core/src/fpdftext/fpdf_text_int.cpp
+++ b/core/src/fpdftext/fpdf_text_int.cpp
@@ -1289,7 +1289,7 @@ int32_t CPDF_TextPage::PreMarkedContent(PDFTEXT_Obj Obj) {
CFX_ByteString tagStr = (CFX_ByteString)item.GetName();
pDict = ToDictionary(static_cast<CPDF_Object*>(item.GetParam()));
CPDF_String* temp =
- ToString(pDict ? pDict->GetElement(FX_BSTRC("ActualText")) : nullptr);
+ ToString(pDict ? pDict->GetElement("ActualText") : nullptr);
if (temp) {
bExist = TRUE;
actText = temp->GetUnicodeText();
@@ -1359,7 +1359,7 @@ void CPDF_TextPage::ProcessMarkedContent(PDFTEXT_Obj Obj) {
CFX_ByteString tagStr = (CFX_ByteString)item.GetName();
pDict = ToDictionary(static_cast<CPDF_Object*>(item.GetParam()));
CPDF_String* temp =
- ToString(pDict ? pDict->GetElement(FX_BSTRC("ActualText")) : nullptr);
+ ToString(pDict ? pDict->GetElement("ActualText") : nullptr);
if (temp) {
actText = temp->GetUnicodeText();
}
diff --git a/core/src/fxcrt/fx_basic_bstring.cpp b/core/src/fxcrt/fx_basic_bstring.cpp
index 574e57a9a6..7576ab86eb 100644
--- a/core/src/fxcrt/fx_basic_bstring.cpp
+++ b/core/src/fxcrt/fx_basic_bstring.cpp
@@ -981,7 +981,7 @@ void CFX_ByteString::TrimRight(FX_CHAR chTarget) {
TrimRight(CFX_ByteStringC(chTarget));
}
void CFX_ByteString::TrimRight() {
- TrimRight(FX_BSTRC("\x09\x0a\x0b\x0c\x0d\x20"));
+ TrimRight("\x09\x0a\x0b\x0c\x0d\x20");
}
void CFX_ByteString::TrimLeft(const CFX_ByteStringC& lpszTargets) {
if (m_pData == NULL) {
@@ -1018,7 +1018,7 @@ void CFX_ByteString::TrimLeft(FX_CHAR chTarget) {
TrimLeft(CFX_ByteStringC(chTarget));
}
void CFX_ByteString::TrimLeft() {
- TrimLeft(FX_BSTRC("\x09\x0a\x0b\x0c\x0d\x20"));
+ TrimLeft("\x09\x0a\x0b\x0c\x0d\x20");
}
FX_DWORD CFX_ByteString::GetID(FX_STRSIZE start_pos) const {
return CFX_ByteStringC(*this).GetID(start_pos);
diff --git a/core/src/fxcrt/fx_basic_wstring.cpp b/core/src/fxcrt/fx_basic_wstring.cpp
index 220ffbd57d..2e92370461 100644
--- a/core/src/fxcrt/fx_basic_wstring.cpp
+++ b/core/src/fxcrt/fx_basic_wstring.cpp
@@ -288,7 +288,7 @@ CFX_ByteString CFX_WideString::UTF8Encode() const {
}
CFX_ByteString CFX_WideString::UTF16LE_Encode() const {
if (m_pData == NULL) {
- return CFX_ByteString(FX_BSTRC("\0\0"));
+ return CFX_ByteString("\0\0");
}
int len = m_pData->m_nDataLength;
CFX_ByteString result;
diff --git a/core/src/fxcrt/fx_basic_wstring_unittest.cpp b/core/src/fxcrt/fx_basic_wstring_unittest.cpp
index 74410ddda3..ad9bcf6b7f 100644
--- a/core/src/fxcrt/fx_basic_wstring_unittest.cpp
+++ b/core/src/fxcrt/fx_basic_wstring_unittest.cpp
@@ -276,19 +276,17 @@ TEST(fxcrt, WideStringConcatInPlace) {
EXPECT_EQ(L"xxxxxx", not_aliased);
}
-#define ByteStringLiteral(str) CFX_ByteString(FX_BSTRC(str))
-
TEST(fxcrt, WideStringUTF16LE_Encode) {
struct UTF16LEEncodeCase {
CFX_WideString ws;
CFX_ByteString bs;
} utf16le_encode_cases[] = {
- {L"", ByteStringLiteral("\0\0")},
- {L"abc", ByteStringLiteral("a\0b\0c\0\0\0")},
- {L"abcdef", ByteStringLiteral("a\0b\0c\0d\0e\0f\0\0\0")},
- {L"abc\0def", ByteStringLiteral("a\0b\0c\0\0\0")},
- {L"\xaabb\xccdd", ByteStringLiteral("\xbb\xaa\xdd\xcc\0\0")},
- {L"\x3132\x6162", ByteStringLiteral("\x32\x31\x62\x61\0\0")},
+ {L"", CFX_ByteString("\0\0")},
+ {L"abc", CFX_ByteString("a\0b\0c\0\0\0")},
+ {L"abcdef", CFX_ByteString("a\0b\0c\0d\0e\0f\0\0\0")},
+ {L"abc\0def", CFX_ByteString("a\0b\0c\0\0\0")},
+ {L"\xaabb\xccdd", CFX_ByteString("\xbb\xaa\xdd\xcc\0\0")},
+ {L"\x3132\x6162", CFX_ByteString("\x32\x31\x62\x61\0\0")},
};
for (size_t i = 0; i < FX_ArraySize(utf16le_encode_cases); ++i) {
diff --git a/core/src/fxcrt/fx_xml_parser.cpp b/core/src/fxcrt/fx_xml_parser.cpp
index 2d3ff6631e..dcae0c58c0 100644
--- a/core/src/fxcrt/fx_xml_parser.cpp
+++ b/core/src/fxcrt/fx_xml_parser.cpp
@@ -200,15 +200,15 @@ FX_DWORD CXML_Parser::GetCharRef() {
m_dwIndex++;
if (ch == ';') {
CFX_ByteStringC ref = buf.GetByteString();
- if (ref == FX_BSTRC("gt")) {
+ if (ref == "gt") {
code = '>';
- } else if (ref == FX_BSTRC("lt")) {
+ } else if (ref == "lt") {
code = '<';
- } else if (ref == FX_BSTRC("amp")) {
+ } else if (ref == "amp") {
code = '&';
- } else if (ref == FX_BSTRC("apos")) {
+ } else if (ref == "apos") {
code = '\'';
- } else if (ref == FX_BSTRC("quot")) {
+ } else if (ref == "quot") {
code = '"';
}
iState = 10;
@@ -327,12 +327,12 @@ void CXML_Parser::GetTagName(CFX_ByteString& space,
case 1:
if (ch == '?') {
m_dwIndex++;
- SkipLiterals(FX_BSTRC("?>"));
+ SkipLiterals("?>");
iState = 0;
break;
} else if (ch == '!') {
m_dwIndex++;
- SkipLiterals(FX_BSTRC("-->"));
+ SkipLiterals("-->");
iState = 0;
break;
}
@@ -441,7 +441,7 @@ CXML_Element* CXML_Parser::ParseElement(CXML_Element* pParent,
if (ch == '!') {
iState = 2;
} else if (ch == '?') {
- SkipLiterals(FX_BSTRC("?>"));
+ SkipLiterals("?>");
SkipWhiteSpaces();
iState = 0;
} else if (ch == '/') {
@@ -474,12 +474,12 @@ CXML_Element* CXML_Parser::ParseElement(CXML_Element* pParent,
break;
case 2:
if (ch == '[') {
- SkipLiterals(FX_BSTRC("]]>"));
+ SkipLiterals("]]>");
} else if (ch == '-') {
m_dwIndex++;
- SkipLiterals(FX_BSTRC("-->"));
+ SkipLiterals("-->");
} else {
- SkipLiterals(FX_BSTRC(">"));
+ SkipLiterals(">");
}
decoder.Clear();
SkipWhiteSpaces();
@@ -607,9 +607,9 @@ CFX_ByteString CXML_Element::GetNamespaceURI(
const CXML_Element* pElement = this;
do {
if (qName.IsEmpty()) {
- pwsSpace = pElement->m_AttrMap.Lookup(FX_BSTRC(""), FX_BSTRC("xmlns"));
+ pwsSpace = pElement->m_AttrMap.Lookup("", "xmlns");
} else {
- pwsSpace = pElement->m_AttrMap.Lookup(FX_BSTRC("xmlns"), qName);
+ pwsSpace = pElement->m_AttrMap.Lookup("xmlns", qName);
}
if (pwsSpace) {
break;
diff --git a/core/src/fxcrt/fxcrt_platforms.cpp b/core/src/fxcrt/fxcrt_platforms.cpp
index 849e3a8500..190605cb60 100644
--- a/core/src/fxcrt/fxcrt_platforms.cpp
+++ b/core/src/fxcrt/fxcrt_platforms.cpp
@@ -17,11 +17,11 @@ IFXCRT_FileAccess* FXCRT_FileAccess_Create() {
}
void FXCRT_GetFileModeString(FX_DWORD dwModes, CFX_ByteString& bsMode) {
if (dwModes & FX_FILEMODE_ReadOnly) {
- bsMode = FX_BSTRC("rb");
+ bsMode = "rb";
} else if (dwModes & FX_FILEMODE_Truncate) {
- bsMode = FX_BSTRC("w+b");
+ bsMode = "w+b";
} else {
- bsMode = FX_BSTRC("a+b");
+ bsMode = "a+b";
}
}
void FXCRT_GetFileModeString(FX_DWORD dwModes, CFX_WideString& wsMode) {
diff --git a/core/src/fxge/android/fpf_skiafontmgr.cpp b/core/src/fxge/android/fpf_skiafontmgr.cpp
index f74d9ea2b7..254f806fec 100644
--- a/core/src/fxge/android/fpf_skiafontmgr.cpp
+++ b/core/src/fxge/android/fpf_skiafontmgr.cpp
@@ -247,7 +247,7 @@ void CFPF_SkiaFontMgr::LoadSystemFonts() {
if (m_bLoaded) {
return;
}
- ScanPath(FX_BSTRC("/system/fonts"));
+ ScanPath("/system/fonts");
OutputSystemFonts();
m_bLoaded = TRUE;
}
@@ -416,14 +416,13 @@ void CFPF_SkiaFontMgr::ScanPath(const CFX_ByteStringC& path) {
FX_BOOL bFolder = FALSE;
while (FX_GetNextFile(handle, filename, bFolder)) {
if (bFolder) {
- if (filename == FX_BSTRC(".") || filename == FX_BSTRC("..")) {
+ if (filename == "." || filename == "..") {
continue;
}
} else {
CFX_ByteString ext = filename.Right(4);
ext.MakeLower();
- if (ext != FX_BSTRC(".ttf") && ext != FX_BSTRC(".ttc") &&
- ext != FX_BSTRC(".otf")) {
+ if (ext != ".ttf" && ext != ".ttc" && ext != ".otf") {
continue;
}
}
diff --git a/core/src/fxge/ge/fx_ge_fontmap.cpp b/core/src/fxge/ge/fx_ge_fontmap.cpp
index 29a29db6fe..92c9fdcbbe 100644
--- a/core/src/fxge/ge/fx_ge_fontmap.cpp
+++ b/core/src/fxge/ge/fx_ge_fontmap.cpp
@@ -362,7 +362,7 @@ int32_t GetStyleType(const CFX_ByteString& bsStyle, FX_BOOL bRevert) {
}
FX_BOOL CheckSupportThirdPartFont(CFX_ByteString name, int& PitchFamily) {
- if (name == FX_BSTRC("MyriadPro")) {
+ if (name == "MyriadPro") {
PitchFamily &= ~FXFONT_FF_ROMAN;
return TRUE;
}
@@ -854,7 +854,7 @@ FXFT_Face CFX_FontMapper::FindSubstFont(const CFX_ByteString& name,
}
}
PDF_GetStandardFontName(&SubstName);
- if (SubstName == FX_BSTRC("Symbol") && !bTrueType) {
+ if (SubstName == "Symbol" && !bTrueType) {
pSubstFont->m_Family = "Chrome Symbol";
pSubstFont->m_Charset = FXFONT_SYMBOL_CHARSET;
pSubstFont->m_SubstFlags |= FXFONT_SUBST_STANDARD;
@@ -867,7 +867,7 @@ FXFT_Face CFX_FontMapper::FindSubstFont(const CFX_ByteString& name,
m_FoxitFaces[12] = m_pFontMgr->GetFixedFace(pFontData, size, 0);
return m_FoxitFaces[12];
}
- if (SubstName == FX_BSTRC("ZapfDingbats")) {
+ if (SubstName == "ZapfDingbats") {
pSubstFont->m_Family = "Chrome Dingbats";
pSubstFont->m_Charset = FXFONT_SYMBOL_CHARSET;
pSubstFont->m_SubstFlags |= FXFONT_SUBST_STANDARD;
@@ -884,7 +884,7 @@ FXFT_Face CFX_FontMapper::FindSubstFont(const CFX_ByteString& name,
CFX_ByteString family, style;
FX_BOOL bHasComma = FALSE;
FX_BOOL bHasHypen = FALSE;
- int find = SubstName.Find(FX_BSTRC(","), 0);
+ int find = SubstName.Find(",", 0);
if (find >= 0) {
family = SubstName.Left(find);
PDF_GetStandardFontName(&family);
@@ -1107,7 +1107,7 @@ FXFT_Face CFX_FontMapper::FindSubstFont(const CFX_ByteString& name,
if (Charset == FXFONT_SYMBOL_CHARSET) {
#if _FXM_PLATFORM_ == _FXM_PLATFORM_APPLE_ || \
_FXM_PLATFORM_ == _FXM_PLATFORM_ANDROID_
- if (SubstName == FX_BSTRC("Symbol")) {
+ if (SubstName == "Symbol") {
pSubstFont->m_Family = "Chrome Symbol";
pSubstFont->m_SubstFlags |= FXFONT_SUBST_STANDARD;
pSubstFont->m_Charset = FXFONT_SYMBOL_CHARSET;
@@ -1383,14 +1383,13 @@ void CFX_FolderFontInfo::ReportFace(CFX_ByteString& path,
m_pMapper->AddInstalledFont(facename, FXFONT_ANSI_CHARSET);
pInfo->m_Charsets |= CHARSET_FLAG_ANSI;
pInfo->m_Styles = 0;
- if (style.Find(FX_BSTRC("Bold")) > -1) {
+ if (style.Find("Bold") > -1) {
pInfo->m_Styles |= FXFONT_BOLD;
}
- if (style.Find(FX_BSTRC("Italic")) > -1 ||
- style.Find(FX_BSTRC("Oblique")) > -1) {
+ if (style.Find("Italic") > -1 || style.Find("Oblique") > -1) {
pInfo->m_Styles |= FXFONT_ITALIC;
}
- if (facename.Find(FX_BSTRC("Serif")) > -1) {
+ if (facename.Find("Serif") > -1) {
pInfo->m_Styles |= FXFONT_SERIF;
}
m_FontList[facename] = pInfo;
diff --git a/core/src/fxge/ge/fx_ge_ps.cpp b/core/src/fxge/ge/fx_ge_ps.cpp
index bf0c8c1a16..6ce8f4635b 100644
--- a/core/src/fxge/ge/fx_ge_ps.cpp
+++ b/core/src/fxge/ge/fx_ge_ps.cpp
@@ -101,16 +101,16 @@ void CFX_PSRenderer::OutputPath(const CFX_PathData* pPathData,
if (pObject2Device) {
pObject2Device->Transform(x, y);
}
- buf << x << FX_BSTRC(" ") << y;
+ buf << x << " " << y;
switch (flag & FXPT_TYPE) {
case FXPT_MOVETO:
- buf << FX_BSTRC(" m ");
+ buf << " m ";
break;
case FXPT_LINETO:
if (flag & FXPT_CLOSEFIGURE) {
- buf << FX_BSTRC(" l h ");
+ buf << " l h ";
} else {
- buf << FX_BSTRC(" l ");
+ buf << " l ";
}
break;
case FXPT_BEZIERTO: {
@@ -122,12 +122,11 @@ void CFX_PSRenderer::OutputPath(const CFX_PathData* pPathData,
pObject2Device->Transform(x1, y1);
pObject2Device->Transform(x2, y2);
}
- buf << FX_BSTRC(" ") << x1 << FX_BSTRC(" ") << y1 << FX_BSTRC(" ") << x2
- << FX_BSTRC(" ") << y2;
+ buf << " " << x1 << " " << y1 << " " << x2 << " " << y2;
if (flag & FXPT_CLOSEFIGURE) {
- buf << FX_BSTRC(" c h\n");
+ buf << " c h\n";
} else {
- buf << FX_BSTRC(" c\n");
+ buf << " c\n";
}
i += 2;
break;
@@ -159,11 +158,9 @@ void CFX_PSRenderer::SetClip_PathStroke(const CFX_PathData* pPathData,
SetGraphState(pGraphState);
if (pObject2Device) {
CFX_ByteTextBuf buf;
- buf << FX_BSTRC("mx Cm [") << pObject2Device->a << FX_BSTRC(" ")
- << pObject2Device->b << FX_BSTRC(" ") << pObject2Device->c
- << FX_BSTRC(" ") << pObject2Device->d << FX_BSTRC(" ")
- << pObject2Device->e << FX_BSTRC(" ") << pObject2Device->f
- << FX_BSTRC("]cm ");
+ buf << "mx Cm [" << pObject2Device->a << " " << pObject2Device->b << " "
+ << pObject2Device->c << " " << pObject2Device->d << " "
+ << pObject2Device->e << " " << pObject2Device->f << "]cm ";
m_pOutput->OutputPS((const FX_CHAR*)buf.GetBuffer(), buf.GetSize());
}
OutputPath(pPathData, NULL);
@@ -205,11 +202,9 @@ FX_BOOL CFX_PSRenderer::DrawPath(const CFX_PathData* pPathData,
SetGraphState(pGraphState);
if (pObject2Device) {
CFX_ByteTextBuf buf;
- buf << FX_BSTRC("mx Cm [") << pObject2Device->a << FX_BSTRC(" ")
- << pObject2Device->b << FX_BSTRC(" ") << pObject2Device->c
- << FX_BSTRC(" ") << pObject2Device->d << FX_BSTRC(" ")
- << pObject2Device->e << FX_BSTRC(" ") << pObject2Device->f
- << FX_BSTRC("]cm ");
+ buf << "mx Cm [" << pObject2Device->a << " " << pObject2Device->b << " "
+ << pObject2Device->c << " " << pObject2Device->d << " "
+ << pObject2Device->e << " " << pObject2Device->f << "]cm ";
m_pOutput->OutputPS((const FX_CHAR*)buf.GetBuffer(), buf.GetSize());
}
}
@@ -245,29 +240,29 @@ void CFX_PSRenderer::SetGraphState(const CFX_GraphStateData* pGraphState) {
CFX_ByteTextBuf buf;
if (!m_bGraphStateSet ||
m_CurGraphState.m_LineCap != pGraphState->m_LineCap) {
- buf << pGraphState->m_LineCap << FX_BSTRC(" J\n");
+ buf << pGraphState->m_LineCap << " J\n";
}
if (!m_bGraphStateSet ||
m_CurGraphState.m_DashCount != pGraphState->m_DashCount ||
FXSYS_memcmp(m_CurGraphState.m_DashArray, pGraphState->m_DashArray,
sizeof(FX_FLOAT) * m_CurGraphState.m_DashCount)) {
- buf << FX_BSTRC("[");
+ buf << "[";
for (int i = 0; i < pGraphState->m_DashCount; i++) {
- buf << pGraphState->m_DashArray[i] << FX_BSTRC(" ");
+ buf << pGraphState->m_DashArray[i] << " ";
}
- buf << FX_BSTRC("]") << pGraphState->m_DashPhase << FX_BSTRC(" d\n");
+ buf << "]" << pGraphState->m_DashPhase << " d\n";
}
if (!m_bGraphStateSet ||
m_CurGraphState.m_LineJoin != pGraphState->m_LineJoin) {
- buf << pGraphState->m_LineJoin << FX_BSTRC(" j\n");
+ buf << pGraphState->m_LineJoin << " j\n";
}
if (!m_bGraphStateSet ||
m_CurGraphState.m_LineWidth != pGraphState->m_LineWidth) {
- buf << pGraphState->m_LineWidth << FX_BSTRC(" w\n");
+ buf << pGraphState->m_LineWidth << " w\n";
}
if (!m_bGraphStateSet ||
m_CurGraphState.m_MiterLimit != pGraphState->m_MiterLimit) {
- buf << pGraphState->m_MiterLimit << FX_BSTRC(" M\n");
+ buf << pGraphState->m_MiterLimit << " M\n";
}
m_CurGraphState.Copy(*pGraphState);
m_bGraphStateSet = TRUE;
@@ -374,13 +369,11 @@ FX_BOOL CFX_PSRenderer::DrawDIBits(const CFX_DIBSource* pSource,
}
OUTPUT_PS("q\n");
CFX_ByteTextBuf buf;
- buf << FX_BSTRC("[") << pMatrix->a << FX_BSTRC(" ") << pMatrix->b
- << FX_BSTRC(" ") << pMatrix->c << FX_BSTRC(" ") << pMatrix->d
- << FX_BSTRC(" ") << pMatrix->e << FX_BSTRC(" ") << pMatrix->f
- << FX_BSTRC("]cm ");
+ buf << "[" << pMatrix->a << " " << pMatrix->b << " " << pMatrix->c << " "
+ << pMatrix->d << " " << pMatrix->e << " " << pMatrix->f << "]cm ";
int width = pSource->GetWidth();
int height = pSource->GetHeight();
- buf << width << FX_BSTRC(" ") << height;
+ buf << width << " " << height;
if (pSource->GetBPP() == 1 && pSource->GetPalette() == NULL) {
int pitch = (width + 7) / 8;
FX_DWORD src_size = height * pitch;
@@ -395,20 +388,19 @@ FX_BOOL CFX_PSRenderer::DrawDIBits(const CFX_DIBSource* pSource,
if (pSource->IsAlphaMask()) {
SetColor(color, alpha_flag, pIccTransform);
m_bColorSet = FALSE;
- buf << FX_BSTRC(" true[");
+ buf << " true[";
} else {
- buf << FX_BSTRC(" 1[");
+ buf << " 1[";
}
- buf << width << FX_BSTRC(" 0 0 -") << height << FX_BSTRC(" 0 ") << height
- << FX_BSTRC("]currentfile/ASCII85Decode filter ");
+ buf << width << " 0 0 -" << height << " 0 " << height
+ << "]currentfile/ASCII85Decode filter ";
if (output_buf != src_buf)
- buf << FX_BSTRC("<</K -1/EndOfBlock false/Columns ") << width
- << FX_BSTRC("/Rows ") << height
- << FX_BSTRC(">>/CCITTFaxDecode filter ");
+ buf << "<</K -1/EndOfBlock false/Columns " << width << "/Rows " << height
+ << ">>/CCITTFaxDecode filter ";
if (pSource->IsAlphaMask()) {
- buf << FX_BSTRC("iM\n");
+ buf << "iM\n";
} else {
- buf << FX_BSTRC("false 1 colorimage\n");
+ buf << "false 1 colorimage\n";
}
m_pOutput->OutputPS((const FX_CHAR*)buf.GetBuffer(), buf.GetSize());
WritePSBinary(output_buf, output_size);
@@ -489,15 +481,14 @@ FX_BOOL CFX_PSRenderer::DrawDIBits(const CFX_DIBSource* pSource,
delete pConverted;
pConverted = NULL;
}
- buf << FX_BSTRC(" 8[");
- buf << width << FX_BSTRC(" 0 0 -") << height << FX_BSTRC(" 0 ") << height
- << FX_BSTRC("]");
- buf << FX_BSTRC("currentfile/ASCII85Decode filter ");
+ buf << " 8[";
+ buf << width << " 0 0 -" << height << " 0 " << height << "]";
+ buf << "currentfile/ASCII85Decode filter ";
if (filter) {
buf << filter;
}
- buf << FX_BSTRC("false ") << Bpp;
- buf << FX_BSTRC(" colorimage\n");
+ buf << "false " << Bpp;
+ buf << " colorimage\n";
m_pOutput->OutputPS((const FX_CHAR*)buf.GetBuffer(), buf.GetSize());
WritePSBinary(output_buf, output_size);
FX_Free(output_buf);
@@ -528,13 +519,13 @@ void CFX_PSRenderer::SetColor(FX_DWORD color,
if (bCMYK != m_bCmykOutput || !m_bColorSet || m_LastColor != color) {
CFX_ByteTextBuf buf;
if (bCMYK) {
- buf << FXSYS_GetCValue(color) / 255.0 << FX_BSTRC(" ")
- << FXSYS_GetMValue(color) / 255.0 << FX_BSTRC(" ")
- << FXSYS_GetYValue(color) / 255.0 << FX_BSTRC(" ")
- << FXSYS_GetKValue(color) / 255.0 << FX_BSTRC(" k\n");
+ buf << FXSYS_GetCValue(color) / 255.0 << " "
+ << FXSYS_GetMValue(color) / 255.0 << " "
+ << FXSYS_GetYValue(color) / 255.0 << " "
+ << FXSYS_GetKValue(color) / 255.0 << " k\n";
} else {
- buf << FXARGB_R(color) / 255.0 << FX_BSTRC(" ") << FXARGB_G(color) / 255.0
- << FX_BSTRC(" ") << FXARGB_B(color) / 255.0 << FX_BSTRC(" rg\n");
+ buf << FXARGB_R(color) / 255.0 << " " << FXARGB_G(color) / 255.0 << " "
+ << FXARGB_B(color) / 255.0 << " rg\n";
}
if (bCMYK == m_bCmykOutput) {
m_bColorSet = TRUE;
@@ -575,18 +566,16 @@ void CFX_PSRenderer::FindPSFontGlyph(CFX_FaceCache* pFaceCache,
pPSFont->m_nGlyphs = 0;
m_PSFontList.Add(pPSFont);
CFX_ByteTextBuf buf;
- buf << FX_BSTRC(
- "8 dict begin/FontType 3 def/FontMatrix[1 0 0 1 0 0]def\n"
- "/FontBBox[0 0 0 0]def/Encoding 256 array def 0 1 255{Encoding "
- "exch/.notdef put}for\n"
- "/CharProcs 1 dict def CharProcs begin/.notdef {} def end\n"
- "/BuildGlyph{1 0 -10 -10 10 10 setcachedevice exch/CharProcs get exch "
- "2 copy known not{pop/.notdef}if get exec}bind def\n"
- "/BuildChar{1 index/Encoding get exch get 1 index/BuildGlyph get "
- "exec}bind def\n"
- "currentdict end\n");
- buf << FX_BSTRC("/X") << m_PSFontList.GetSize() - 1
- << FX_BSTRC(" exch definefont pop\n");
+ buf << "8 dict begin/FontType 3 def/FontMatrix[1 0 0 1 0 0]def\n"
+ "/FontBBox[0 0 0 0]def/Encoding 256 array def 0 1 255{Encoding "
+ "exch/.notdef put}for\n"
+ "/CharProcs 1 dict def CharProcs begin/.notdef {} def end\n"
+ "/BuildGlyph{1 0 -10 -10 10 10 setcachedevice exch/CharProcs get "
+ "exch 2 copy known not{pop/.notdef}if get exec}bind def\n"
+ "/BuildChar{1 index/Encoding get exch get 1 index/BuildGlyph get "
+ "exec}bind def\n"
+ "currentdict end\n";
+ buf << "/X" << m_PSFontList.GetSize() - 1 << " exch definefont pop\n";
m_pOutput->OutputPS((const FX_CHAR*)buf.GetBuffer(), buf.GetSize());
buf.Clear();
}
@@ -622,35 +611,32 @@ void CFX_PSRenderer::FindPSFontGlyph(CFX_FaceCache* pFaceCache,
TransformedPath.Transform(&matrix);
}
CFX_ByteTextBuf buf;
- buf << FX_BSTRC("/X") << ps_fontnum << FX_BSTRC(" Ff/CharProcs get begin/")
- << ps_glyphindex << FX_BSTRC("{");
- buf << FX_BSTRC("n ");
+ buf << "/X" << ps_fontnum << " Ff/CharProcs get begin/" << ps_glyphindex
+ << "{n ";
for (int p = 0; p < TransformedPath.GetPointCount(); p++) {
FX_FLOAT x = TransformedPath.GetPointX(p), y = TransformedPath.GetPointY(p);
switch (TransformedPath.GetFlag(p) & FXPT_TYPE) {
case FXPT_MOVETO: {
- buf << x << FX_BSTRC(" ") << y << FX_BSTRC(" m\n");
+ buf << x << " " << y << " m\n";
break;
}
case FXPT_LINETO: {
- buf << x << FX_BSTRC(" ") << y << FX_BSTRC(" l\n");
+ buf << x << " " << y << " l\n";
break;
}
case FXPT_BEZIERTO: {
- buf << x << FX_BSTRC(" ") << y << FX_BSTRC(" ")
- << TransformedPath.GetPointX(p + 1) << FX_BSTRC(" ")
- << TransformedPath.GetPointY(p + 1) << FX_BSTRC(" ")
- << TransformedPath.GetPointX(p + 2) << FX_BSTRC(" ")
- << TransformedPath.GetPointY(p + 2) << FX_BSTRC(" c\n");
+ buf << x << " " << y << " " << TransformedPath.GetPointX(p + 1) << " "
+ << TransformedPath.GetPointY(p + 1) << " "
+ << TransformedPath.GetPointX(p + 2) << " "
+ << TransformedPath.GetPointY(p + 2) << " c\n";
p += 2;
break;
}
}
}
- buf << FX_BSTRC("f");
- buf << FX_BSTRC("}bind def end\n");
- buf << FX_BSTRC("/X") << ps_fontnum << FX_BSTRC(" Ff/Encoding get ")
- << ps_glyphindex << FX_BSTRC("/") << ps_glyphindex << FX_BSTRC(" put\n");
+ buf << "f}bind def end\n";
+ buf << "/X" << ps_fontnum << " Ff/Encoding get " << ps_glyphindex << "/"
+ << ps_glyphindex << " put\n";
m_pOutput->OutputPS((const FX_CHAR*)buf.GetBuffer(), buf.GetSize());
}
FX_BOOL CFX_PSRenderer::DrawText(int nChars,
@@ -674,11 +660,9 @@ FX_BOOL CFX_PSRenderer::DrawText(int nChars,
}
SetColor(color, alpha_flag, pIccTransform);
CFX_ByteTextBuf buf;
- buf << FX_BSTRC("q[") << pObject2Device->a << FX_BSTRC(" ")
- << pObject2Device->b << FX_BSTRC(" ") << pObject2Device->c
- << FX_BSTRC(" ") << pObject2Device->d;
- buf << FX_BSTRC(" ") << pObject2Device->e << FX_BSTRC(" ")
- << pObject2Device->f << "]cm\n";
+ buf << "q[" << pObject2Device->a << " " << pObject2Device->b << " "
+ << pObject2Device->c << " " << pObject2Device->d << " "
+ << pObject2Device->e << " " << pObject2Device->f << "]cm\n";
if (pCache == NULL) {
pCache = CFX_GEModule::Get()->GetFontCache();
}
@@ -689,17 +673,15 @@ FX_BOOL CFX_PSRenderer::DrawText(int nChars,
int ps_fontnum, ps_glyphindex;
FindPSFontGlyph(pFaceCache, pFont, pCharPos[i], ps_fontnum, ps_glyphindex);
if (last_fontnum != ps_fontnum) {
- buf << FX_BSTRC("/X") << ps_fontnum << FX_BSTRC(" Ff ") << font_size
- << FX_BSTRC(" Fs Sf ");
+ buf << "/X" << ps_fontnum << " Ff " << font_size << " Fs Sf ";
last_fontnum = ps_fontnum;
}
- buf << pCharPos[i].m_OriginX << FX_BSTRC(" ") << pCharPos[i].m_OriginY
- << FX_BSTRC(" m");
+ buf << pCharPos[i].m_OriginX << " " << pCharPos[i].m_OriginY << " m";
CFX_ByteString hex;
hex.Format("<%02X>", ps_glyphindex);
- buf << hex << FX_BSTRC("Tj\n");
+ buf << hex << "Tj\n";
}
- buf << FX_BSTRC("Q\n");
+ buf << "Q\n";
m_pOutput->OutputPS((const FX_CHAR*)buf.GetBuffer(), buf.GetSize());
return TRUE;
}
diff --git a/fpdfsdk/src/fpdf_ext.cpp b/fpdfsdk/src/fpdf_ext.cpp
index d9f8624249..e7287027bd 100644
--- a/fpdfsdk/src/fpdf_ext.cpp
+++ b/fpdfsdk/src/fpdf_ext.cpp
@@ -96,7 +96,7 @@ FX_BOOL CheckSharedForm(const CXML_Element* pElement, CFX_ByteString cbName) {
CFX_ByteString space, name;
CFX_WideString value;
pElement->GetAttrByIndex(i, space, name, value);
- if (space == FX_BSTRC("xmlns") && name == FX_BSTRC("adhocwf") &&
+ if (space == "xmlns" && name == "adhocwf" &&
value == L"http://ns.adobe.com/AcrobatAdhocWorkflow/1.0/") {
CXML_Element* pVersion = pElement->GetElement("adhocwf", cbName);
if (!pVersion)
diff --git a/fpdfsdk/src/fpdf_transformpage.cpp b/fpdfsdk/src/fpdf_transformpage.cpp
index 05be360088..b465b8387c 100644
--- a/fpdfsdk/src/fpdf_transformpage.cpp
+++ b/fpdfsdk/src/fpdf_transformpage.cpp
@@ -156,9 +156,9 @@ DLLEXPORT FPDF_BOOL STDCALL FPDFPage_TransFormWithClip(FPDF_PAGE page,
}
// Need to transform the patterns as well.
- CPDF_Dictionary* pRes = pPageDic->GetDict(FX_BSTRC("Resources"));
+ CPDF_Dictionary* pRes = pPageDic->GetDict("Resources");
if (pRes) {
- CPDF_Dictionary* pPattenDict = pRes->GetDict(FX_BSTRC("Pattern"));
+ CPDF_Dictionary* pPattenDict = pRes->GetDict("Pattern");
if (pPattenDict) {
FX_POSITION pos = pPattenDict->GetStartPos();
while (pos) {
@@ -175,10 +175,10 @@ DLLEXPORT FPDF_BOOL STDCALL FPDFPage_TransFormWithClip(FPDF_PAGE page,
else
continue;
- CFX_Matrix m = pDict->GetMatrix(FX_BSTRC("Matrix"));
+ CFX_Matrix m = pDict->GetMatrix("Matrix");
CFX_Matrix t = *(CFX_Matrix*)matrix;
m.Concat(t);
- pDict->SetAtMatrix(FX_BSTRC("Matrix"), m);
+ pDict->SetAtMatrix("Matrix", m);
}
}
}
diff --git a/fpdfsdk/src/fpdfdoc.cpp b/fpdfsdk/src/fpdfdoc.cpp
index abe2a32ca4..4bd37a731a 100644
--- a/fpdfsdk/src/fpdfdoc.cpp
+++ b/fpdfsdk/src/fpdfdoc.cpp
@@ -273,7 +273,7 @@ DLLEXPORT FPDF_BOOL STDCALL FPDFLink_Enumerate(FPDF_PAGE page,
ToDictionary(static_cast<CPDF_Object*>(pAnnots->GetElementValue(i)));
if (!pDict)
continue;
- if (pDict->GetString(FX_BSTRC("Subtype")).Equal(FX_BSTRC("Link"))) {
+ if (pDict->GetString("Subtype").Equal("Link")) {
*startPos = i + 1;
*linkAnnot = (FPDF_LINK)pDict;
return TRUE;
@@ -288,7 +288,7 @@ DLLEXPORT FPDF_BOOL STDCALL FPDFLink_GetAnnotRect(FPDF_LINK linkAnnot,
return FALSE;
CPDF_Dictionary* pAnnotDict =
ToDictionary(static_cast<CPDF_Object*>(linkAnnot));
- CPDF_Rect rt = pAnnotDict->GetRect(FX_BSTRC("Rect"));
+ CPDF_Rect rt = pAnnotDict->GetRect("Rect");
rect->left = rt.left;
rect->bottom = rt.bottom;
rect->right = rt.right;
@@ -301,7 +301,7 @@ DLLEXPORT int STDCALL FPDFLink_CountQuadPoints(FPDF_LINK linkAnnot) {
return 0;
CPDF_Dictionary* pAnnotDict =
ToDictionary(static_cast<CPDF_Object*>(linkAnnot));
- CPDF_Array* pArray = pAnnotDict->GetArray(FX_BSTRC("QuadPoints"));
+ CPDF_Array* pArray = pAnnotDict->GetArray("QuadPoints");
if (!pArray)
return 0;
return pArray->GetCount() / 8;
@@ -314,7 +314,7 @@ DLLEXPORT FPDF_BOOL STDCALL FPDFLink_GetQuadPoints(FPDF_LINK linkAnnot,
return FALSE;
CPDF_Dictionary* pAnnotDict =
ToDictionary(static_cast<CPDF_Object*>(linkAnnot));
- CPDF_Array* pArray = pAnnotDict->GetArray(FX_BSTRC("QuadPoints"));
+ CPDF_Array* pArray = pAnnotDict->GetArray("QuadPoints");
if (pArray) {
if (quadIndex < 0 || quadIndex >= (int)pArray->GetCount() / 8 ||
((quadIndex * 8 + 7) >= (int)pArray->GetCount()))
diff --git a/fpdfsdk/src/fpdfformfill.cpp b/fpdfsdk/src/fpdfformfill.cpp
index 95f4f7e780..c8b90303a6 100644
--- a/fpdfsdk/src/fpdfformfill.cpp
+++ b/fpdfsdk/src/fpdfformfill.cpp
@@ -311,7 +311,7 @@ DLLEXPORT void STDCALL FORM_DoDocumentAAction(FPDF_FORMHANDLE hHandle,
if (!pDic)
return;
- CPDF_AAction aa = pDic->GetDict(FX_BSTRC("AA"));
+ CPDF_AAction aa = pDic->GetDict("AA");
if (aa.ActionExist((CPDF_AAction::AActionType)aaType)) {
CPDF_Action action = aa.GetAction((CPDF_AAction::AActionType)aaType);
CPDFSDK_ActionHandler* pActionHandler =
@@ -336,7 +336,7 @@ DLLEXPORT void STDCALL FORM_DoPageAAction(FPDF_PAGE page,
CPDFDoc_Environment* pEnv = pSDKDoc->GetEnv();
CPDFSDK_ActionHandler* pActionHandler = pEnv->GetActionHander();
CPDF_Dictionary* pPageDict = pPDFPage->m_pFormDict;
- CPDF_AAction aa = pPageDict->GetDict(FX_BSTRC("AA"));
+ CPDF_AAction aa = pPageDict->GetDict("AA");
if (FPDFPAGE_AACTION_OPEN == aaType) {
if (aa.ActionExist(CPDF_AAction::OpenPage)) {
CPDF_Action action = aa.GetAction(CPDF_AAction::OpenPage);
diff --git a/fpdfsdk/src/fpdfppo.cpp b/fpdfsdk/src/fpdfppo.cpp
index 507b97b184..513ffc4ade 100644
--- a/fpdfsdk/src/fpdfppo.cpp
+++ b/fpdfsdk/src/fpdfppo.cpp
@@ -396,7 +396,7 @@ DLLEXPORT FPDF_BOOL STDCALL FPDF_CopyViewerPreferences(FPDF_DOCUMENT dest_doc,
return FALSE;
CPDF_Dictionary* pSrcDict = pSrcDoc->GetRoot();
- pSrcDict = pSrcDict->GetDict(FX_BSTRC("ViewerPreferences"));
+ pSrcDict = pSrcDict->GetDict("ViewerPreferences");
if (!pSrcDict)
return FALSE;
@@ -404,6 +404,6 @@ DLLEXPORT FPDF_BOOL STDCALL FPDF_CopyViewerPreferences(FPDF_DOCUMENT dest_doc,
if (!pDstDict)
return FALSE;
- pDstDict->SetAt(FX_BSTRC("ViewerPreferences"), pSrcDict->Clone(TRUE));
+ pDstDict->SetAt("ViewerPreferences", pSrcDict->Clone(TRUE));
return TRUE;
}
diff --git a/fpdfsdk/src/fpdfview.cpp b/fpdfsdk/src/fpdfview.cpp
index 6f39dce209..2f360ece35 100644
--- a/fpdfsdk/src/fpdfview.cpp
+++ b/fpdfsdk/src/fpdfview.cpp
@@ -815,11 +815,11 @@ FPDF_VIEWERREF_GetDuplex(FPDF_DOCUMENT document) {
return DuplexUndefined;
CPDF_ViewerPreferences viewRef(pDoc);
CFX_ByteString duplex = viewRef.Duplex();
- if (FX_BSTRC("Simplex") == duplex)
+ if ("Simplex" == duplex)
return Simplex;
- if (FX_BSTRC("DuplexFlipShortEdge") == duplex)
+ if ("DuplexFlipShortEdge" == duplex)
return DuplexFlipShortEdge;
- if (FX_BSTRC("DuplexFlipLongEdge") == duplex)
+ if ("DuplexFlipLongEdge" == duplex)
return DuplexFlipLongEdge;
return DuplexUndefined;
}
@@ -833,9 +833,9 @@ DLLEXPORT FPDF_DWORD STDCALL FPDF_CountNamedDests(FPDF_DOCUMENT document) {
if (!pRoot)
return 0;
- CPDF_NameTree nameTree(pDoc, FX_BSTRC("Dests"));
+ CPDF_NameTree nameTree(pDoc, "Dests");
int count = nameTree.GetCount();
- CPDF_Dictionary* pDest = pRoot->GetDict(FX_BSTRC("Dests"));
+ CPDF_Dictionary* pDest = pRoot->GetDict("Dests");
if (pDest)
count += pDest->GetCount();
return count;
@@ -850,7 +850,7 @@ DLLEXPORT FPDF_DEST STDCALL FPDF_GetNamedDestByName(FPDF_DOCUMENT document,
if (!pDoc)
return nullptr;
- CPDF_NameTree name_tree(pDoc, FX_BSTRC("Dests"));
+ CPDF_NameTree name_tree(pDoc, "Dests");
return name_tree.LookupNamedDest(pDoc, name);
}
@@ -874,10 +874,10 @@ DLLEXPORT FPDF_DEST STDCALL FPDF_GetNamedDest(FPDF_DOCUMENT document,
CPDF_Object* pDestObj = NULL;
CFX_ByteString bsName;
- CPDF_NameTree nameTree(pDoc, FX_BSTRC("Dests"));
+ CPDF_NameTree nameTree(pDoc, "Dests");
int count = nameTree.GetCount();
if (index >= count) {
- CPDF_Dictionary* pDest = pRoot->GetDict(FX_BSTRC("Dests"));
+ CPDF_Dictionary* pDest = pRoot->GetDict("Dests");
if (!pDest)
return NULL;
if (index >= count + pDest->GetCount())
@@ -899,7 +899,7 @@ DLLEXPORT FPDF_DEST STDCALL FPDF_GetNamedDest(FPDF_DOCUMENT document,
if (!pDestObj)
return nullptr;
if (CPDF_Dictionary* pDict = pDestObj->AsDictionary()) {
- pDestObj = pDict->GetArray(FX_BSTRC("D"));
+ pDestObj = pDict->GetArray("D");
if (!pDestObj)
return nullptr;
}
diff --git a/fpdfsdk/src/fsdk_mgr.cpp b/fpdfsdk/src/fsdk_mgr.cpp
index 053052ab33..8a73970e49 100644
--- a/fpdfsdk/src/fsdk_mgr.cpp
+++ b/fpdfsdk/src/fsdk_mgr.cpp
@@ -551,7 +551,7 @@ FX_BOOL CPDFSDK_Document::KillFocusAnnot(FX_UINT nFlag) {
CPDFSDK_Annot* pFocusAnnot = m_pFocusAnnot;
m_pFocusAnnot = nullptr;
if (pAnnotHandler->Annot_OnKillFocus(pFocusAnnot, nFlag)) {
- if (pFocusAnnot->GetType() == FX_BSTRC("Widget")) {
+ if (pFocusAnnot->GetType() == "Widget") {
CPDFSDK_Widget* pWidget = (CPDFSDK_Widget*)pFocusAnnot;
int nFieldType = pWidget->GetFieldType();
if (FIELDTYPE_TEXTFIELD == nFieldType ||