summaryrefslogtreecommitdiff
path: root/core/src/fpdfapi
diff options
context:
space:
mode:
Diffstat (limited to 'core/src/fpdfapi')
-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.cpp337
-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
26 files changed, 779 insertions, 840 deletions
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..fcb1c2ed86 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,9 @@ 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;
+ const char kFormStream[] = "/Form\0stream";
+ const CFX_ByteStringC kFormStreamStr(kFormStream, sizeof(kFormStream) - 1);
+ bForm = m_Syntax.SearchMultiWord(kFormStreamStr, TRUE, size) == 0;
m_Syntax.RestorePos(SavedPos);
return TRUE;
}
@@ -1337,7 +1337,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 +1353,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 +1365,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 +1406,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 +1414,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 +1451,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 +1465,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 +1480,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 +1518,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 +1528,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 +1541,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 +1587,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 +1628,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 +2043,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 +2055,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 +2074,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 +2083,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 +2098,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 +2116,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 +2131,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 +2152,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 +2164,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 +2204,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 +2216,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 +2234,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 +2242,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 +2257,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 +2272,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 +2305,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 +2338,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 +2353,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 +2367,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 +2383,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 +2438,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 +2467,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 +2498,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 +2512,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 +2575,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 +2612,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 +2638,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 +3327,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 +3335,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 +3352,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 +3400,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 +3442,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 +3509,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 +3592,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 +3648,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 +3703,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 +3713,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 +3729,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 +3777,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 +4016,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 +4130,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 +4160,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 +4253,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 +4327,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 +4536,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 +4547,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 +4580,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 +4700,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 +4730,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 +4838,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 +4900,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 +4922,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 +4937,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 +4965,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 +4989,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 +5000,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;