summaryrefslogtreecommitdiff
path: root/core/fpdfapi
diff options
context:
space:
mode:
authortsepez <tsepez@chromium.org>2016-04-04 16:41:35 -0700
committerCommit bot <commit-bot@chromium.org>2016-04-04 16:41:35 -0700
commit28f97ff783c16f3391384ce97b765ce4eb310ac7 (patch)
tree69c4c8bc9dd39d5336c96f28b633d197dd207c81 /core/fpdfapi
parented9c4386713084f37548b46ab36f618021f716f5 (diff)
downloadpdfium-28f97ff783c16f3391384ce97b765ce4eb310ac7.tar.xz
Make down-conversion explicit from CFX_ByteString to CFX_ByteStringC.
Having this happen implicitly can be dangerous because the lifetime has to be considered; we should have caught the "red bots" in https://codereview.chromium.org/1847333004/#ps60001 at compile time. Review URL: https://codereview.chromium.org/1853233002
Diffstat (limited to 'core/fpdfapi')
-rw-r--r--core/fpdfapi/fpdf_edit/cpdf_pagecontentgenerator.cpp5
-rw-r--r--core/fpdfapi/fpdf_edit/fpdf_edit_create.cpp30
-rw-r--r--core/fpdfapi/fpdf_edit/fpdf_edit_doc.cpp2
-rw-r--r--core/fpdfapi/fpdf_font/fpdf_font.cpp12
-rw-r--r--core/fpdfapi/fpdf_font/fpdf_font_cid.cpp2
-rw-r--r--core/fpdfapi/fpdf_page/cpdf_allstates.cpp2
-rw-r--r--core/fpdfapi/fpdf_page/fpdf_page_doc.cpp2
-rw-r--r--core/fpdfapi/fpdf_page/fpdf_page_parser.cpp28
-rw-r--r--core/fpdfapi/fpdf_page/fpdf_page_parser_old.cpp2
-rw-r--r--core/fpdfapi/fpdf_parser/cpdf_name.cpp2
-rw-r--r--core/fpdfapi/fpdf_parser/cpdf_number.cpp2
-rw-r--r--core/fpdfapi/fpdf_parser/cpdf_object_unittest.cpp2
-rw-r--r--core/fpdfapi/fpdf_parser/cpdf_parser.cpp7
-rw-r--r--core/fpdfapi/fpdf_parser/cpdf_standard_security_handler.cpp8
-rw-r--r--core/fpdfapi/fpdf_parser/cpdf_string.cpp2
-rw-r--r--core/fpdfapi/fpdf_parser/cpdf_syntax_parser.cpp4
-rw-r--r--core/fpdfapi/fpdf_parser/include/cpdf_object.h2
17 files changed, 65 insertions, 49 deletions
diff --git a/core/fpdfapi/fpdf_edit/cpdf_pagecontentgenerator.cpp b/core/fpdfapi/fpdf_edit/cpdf_pagecontentgenerator.cpp
index 6c5339128b..af79fd31c1 100644
--- a/core/fpdfapi/fpdf_edit/cpdf_pagecontentgenerator.cpp
+++ b/core/fpdfapi/fpdf_edit/cpdf_pagecontentgenerator.cpp
@@ -74,12 +74,13 @@ CFX_ByteString CPDF_PageContentGenerator::RealizeResource(
int idnum = 1;
while (1) {
name.Format("FX%c%d", szType[0], idnum);
- if (!pResList->KeyExist(name)) {
+ if (!pResList->KeyExist(name.AsByteStringC())) {
break;
}
idnum++;
}
- pResList->AddReference(name, m_pDocument, pResourceObj->GetObjNum());
+ pResList->AddReference(name.AsByteStringC(), m_pDocument,
+ pResourceObj->GetObjNum());
return name;
}
void CPDF_PageContentGenerator::ProcessImage(CFX_ByteTextBuf& buf,
diff --git a/core/fpdfapi/fpdf_edit/fpdf_edit_create.cpp b/core/fpdfapi/fpdf_edit/fpdf_edit_create.cpp
index 21934d35c4..323602b0e1 100644
--- a/core/fpdfapi/fpdf_edit/fpdf_edit_create.cpp
+++ b/core/fpdfapi/fpdf_edit/fpdf_edit_create.cpp
@@ -54,7 +54,7 @@ int32_t PDF_CreatorAppendObject(const CPDF_Object* pObj,
if (pFile->AppendString(" ") < 0) {
return -1;
}
- if ((len = pFile->AppendString(pObj->GetString())) < 0) {
+ if ((len = pFile->AppendString(pObj->GetString().AsByteStringC())) < 0) {
return -1;
}
offset += len + 1;
@@ -62,7 +62,8 @@ int32_t PDF_CreatorAppendObject(const CPDF_Object* pObj,
case CPDF_Object::STRING: {
CFX_ByteString str = pObj->GetString();
FX_BOOL bHex = pObj->AsString()->IsHex();
- if ((len = pFile->AppendString(PDF_EncodeString(str, bHex))) < 0) {
+ if ((len = pFile->AppendString(
+ PDF_EncodeString(str, bHex).AsByteStringC())) < 0) {
return -1;
}
offset += len;
@@ -73,7 +74,8 @@ int32_t PDF_CreatorAppendObject(const CPDF_Object* pObj,
return -1;
}
CFX_ByteString str = pObj->GetString();
- if ((len = pFile->AppendString(PDF_NameEncode(str))) < 0) {
+ if ((len = pFile->AppendString(PDF_NameEncode(str).AsByteStringC())) <
+ 0) {
return -1;
}
offset += len + 1;
@@ -132,7 +134,8 @@ int32_t PDF_CreatorAppendObject(const CPDF_Object* pObj,
if (pFile->AppendString("/") < 0) {
return -1;
}
- if ((len = pFile->AppendString(PDF_NameEncode(key))) < 0) {
+ if ((len = pFile->AppendString(PDF_NameEncode(key).AsByteStringC())) <
+ 0) {
return -1;
}
offset += len + 1;
@@ -211,7 +214,8 @@ int32_t PDF_CreatorWriteTrailer(CPDF_Document* pDocument,
if (pFile->AppendString(("/")) < 0) {
return -1;
}
- if ((len = pFile->AppendString(PDF_NameEncode(key))) < 0) {
+ if ((len = pFile->AppendString(PDF_NameEncode(key).AsByteStringC())) <
+ 0) {
return -1;
}
offset += len + 1;
@@ -1114,7 +1118,7 @@ int32_t CPDF_Creator::WriteDirectObj(uint32_t objnum,
if (m_File.AppendString(" ") < 0) {
return -1;
}
- if ((len = m_File.AppendString(pObj->GetString())) < 0) {
+ if ((len = m_File.AppendString(pObj->GetString().AsByteStringC())) < 0) {
return -1;
}
m_Offset += len + 1;
@@ -1124,7 +1128,7 @@ int32_t CPDF_Creator::WriteDirectObj(uint32_t objnum,
FX_BOOL bHex = pObj->AsString()->IsHex();
if (!m_pCryptoHandler || !bEncrypt) {
CFX_ByteString content = PDF_EncodeString(str, bHex);
- if ((len = m_File.AppendString(content)) < 0) {
+ if ((len = m_File.AppendString(content.AsByteStringC())) < 0) {
return -1;
}
m_Offset += len;
@@ -1136,7 +1140,7 @@ int32_t CPDF_Creator::WriteDirectObj(uint32_t objnum,
CFX_ByteString content = PDF_EncodeString(
CFX_ByteString((const FX_CHAR*)encryptor.m_pData, encryptor.m_dwSize),
bHex);
- if ((len = m_File.AppendString(content)) < 0) {
+ if ((len = m_File.AppendString(content.AsByteStringC())) < 0) {
return -1;
}
m_Offset += len;
@@ -1176,7 +1180,8 @@ int32_t CPDF_Creator::WriteDirectObj(uint32_t objnum,
return -1;
}
CFX_ByteString str = pObj->GetString();
- if ((len = m_File.AppendString(PDF_NameEncode(str))) < 0) {
+ if ((len = m_File.AppendString(PDF_NameEncode(str).AsByteStringC())) <
+ 0) {
return -1;
}
m_Offset += len + 1;
@@ -1240,7 +1245,8 @@ int32_t CPDF_Creator::WriteDirectObj(uint32_t objnum,
if (m_File.AppendString("/") < 0) {
return -1;
}
- if ((len = m_File.AppendString(PDF_NameEncode(key))) < 0) {
+ if ((len = m_File.AppendString(PDF_NameEncode(key).AsByteStringC())) <
+ 0) {
return -1;
}
m_Offset += len + 1;
@@ -1642,7 +1648,7 @@ int32_t CPDF_Creator::WriteDoc_Stage3(IFX_Pause* pPause) {
str = m_ObjectOffset.GetPtrAt(1)
? "xref\r\n"
: "xref\r\n0 1\r\n0000000000 65535 f\r\n";
- if (m_File.AppendString(str) < 0) {
+ if (m_File.AppendString(str.AsByteStringC()) < 0) {
return -1;
}
m_Pos = (void*)(uintptr_t)1;
@@ -1771,7 +1777,7 @@ int32_t CPDF_Creator::WriteDoc_Stage4(IFX_Pause* pPause) {
if (m_File.AppendString(("/")) < 0) {
return -1;
}
- if (m_File.AppendString(PDF_NameEncode(key)) < 0) {
+ if (m_File.AppendString(PDF_NameEncode(key).AsByteStringC()) < 0) {
return -1;
}
if (pValue->GetObjNum()) {
diff --git a/core/fpdfapi/fpdf_edit/fpdf_edit_doc.cpp b/core/fpdfapi/fpdf_edit/fpdf_edit_doc.cpp
index 0f75cb04a8..d70c04c690 100644
--- a/core/fpdfapi/fpdf_edit/fpdf_edit_doc.cpp
+++ b/core/fpdfapi/fpdf_edit/fpdf_edit_doc.cpp
@@ -1124,7 +1124,7 @@ CPDF_Font* CPDF_Document::AddStandardFont(const FX_CHAR* font,
CFX_ByteString name(font);
if (PDF_GetStandardFontName(&name) < 0)
return nullptr;
- return GetPageData()->GetStandardFont(name, pEncoding);
+ return GetPageData()->GetStandardFont(name.AsByteStringC(), pEncoding);
}
void CPDF_Document::DeletePage(int iPage) {
diff --git a/core/fpdfapi/fpdf_font/fpdf_font.cpp b/core/fpdfapi/fpdf_font/fpdf_font.cpp
index ce2390ec08..aff2b72960 100644
--- a/core/fpdfapi/fpdf_font/fpdf_font.cpp
+++ b/core/fpdfapi/fpdf_font/fpdf_font.cpp
@@ -233,9 +233,9 @@ void CPDF_ToUnicodeMap::Load(CPDF_Stream* pStream) {
break;
}
high = parser.GetWord();
- uint32_t lowcode = StringToCode(low);
- uint32_t highcode =
- (lowcode & 0xffffff00) | (StringToCode(high) & 0xff);
+ uint32_t lowcode = StringToCode(low.AsByteStringC());
+ uint32_t highcode = (lowcode & 0xffffff00) |
+ (StringToCode(high.AsByteStringC()) & 0xff);
if (highcode == (uint32_t)-1) {
break;
}
@@ -243,7 +243,7 @@ void CPDF_ToUnicodeMap::Load(CPDF_Stream* pStream) {
if (start == "[") {
for (uint32_t code = lowcode; code <= highcode; code++) {
CFX_ByteString dest = parser.GetWord();
- CFX_WideString destcode = StringToWideString(dest);
+ CFX_WideString destcode = StringToWideString(dest.AsByteStringC());
int len = destcode.GetLength();
if (len == 0) {
continue;
@@ -258,11 +258,11 @@ void CPDF_ToUnicodeMap::Load(CPDF_Stream* pStream) {
}
parser.GetWord();
} else {
- CFX_WideString destcode = StringToWideString(start);
+ CFX_WideString destcode = StringToWideString(start.AsByteStringC());
int len = destcode.GetLength();
uint32_t value = 0;
if (len == 1) {
- value = StringToCode(start);
+ value = StringToCode(start.AsByteStringC());
for (uint32_t code = lowcode; code <= highcode; code++) {
m_Map[code] = value++;
}
diff --git a/core/fpdfapi/fpdf_font/fpdf_font_cid.cpp b/core/fpdfapi/fpdf_font/fpdf_font_cid.cpp
index 2552a3c0a6..fb3707f498 100644
--- a/core/fpdfapi/fpdf_font/fpdf_font_cid.cpp
+++ b/core/fpdfapi/fpdf_font/fpdf_font_cid.cpp
@@ -440,7 +440,7 @@ void CPDF_CMapParser::ParseWord(const CFX_ByteStringC& word) {
}
if (m_CodeSeq % 2) {
CMap_CodeRange range;
- if (CMap_GetCodeRange(range, m_LastWord, word)) {
+ if (CMap_GetCodeRange(range, m_LastWord.AsByteStringC(), word)) {
m_CodeRanges.Add(range);
}
}
diff --git a/core/fpdfapi/fpdf_page/cpdf_allstates.cpp b/core/fpdfapi/fpdf_page/cpdf_allstates.cpp
index 159de584ee..d81a488d20 100644
--- a/core/fpdfapi/fpdf_page/cpdf_allstates.cpp
+++ b/core/fpdfapi/fpdf_page/cpdf_allstates.cpp
@@ -115,7 +115,7 @@ void CPDF_AllStates::ProcessExtGS(CPDF_Dictionary* pGS,
CFX_ByteString mode =
pArray ? pArray->GetStringAt(0) : pObject->GetString();
- pGeneralState->SetBlendMode(mode);
+ pGeneralState->SetBlendMode(mode.AsByteStringC());
if (pGeneralState->m_BlendType > FXDIB_BLEND_MULTIPLY) {
pParser->GetPageObjectHolder()->SetBackgroundAlphaNeeded(TRUE);
}
diff --git a/core/fpdfapi/fpdf_page/fpdf_page_doc.cpp b/core/fpdfapi/fpdf_page/fpdf_page_doc.cpp
index 9f4ad5a7d5..758ce940d2 100644
--- a/core/fpdfapi/fpdf_page/fpdf_page_doc.cpp
+++ b/core/fpdfapi/fpdf_page/fpdf_page_doc.cpp
@@ -331,7 +331,7 @@ CPDF_ColorSpace* CPDF_DocPageData::GetColorSpace(
if (!pCS && pResources) {
CPDF_Dictionary* pList = pResources->GetDictBy("ColorSpace");
if (pList) {
- pCSObj = pList->GetDirectObjectBy(name);
+ pCSObj = pList->GetDirectObjectBy(name.AsByteStringC());
return GetColorSpace(pCSObj, nullptr);
}
}
diff --git a/core/fpdfapi/fpdf_page/fpdf_page_parser.cpp b/core/fpdfapi/fpdf_page/fpdf_page_parser.cpp
index daddb9f05b..4f304a3b3b 100644
--- a/core/fpdfapi/fpdf_page/fpdf_page_parser.cpp
+++ b/core/fpdfapi/fpdf_page/fpdf_page_parser.cpp
@@ -566,9 +566,9 @@ void CPDF_StreamContentParser::Handle_BeginImage() {
if (!key.IsEmpty()) {
uint32_t dwObjNum = pObj ? pObj->GetObjNum() : 0;
if (dwObjNum)
- pDict->SetAtReference(key, m_pDocument, dwObjNum);
+ pDict->SetAtReference(key.AsByteStringC(), m_pDocument, dwObjNum);
else
- pDict->SetAt(key, pObj.release());
+ pDict->SetAt(key.AsByteStringC(), pObj.release());
}
}
PDF_ReplaceAbbr(pDict);
@@ -721,7 +721,8 @@ void CPDF_StreamContentParser::Handle_ExecuteXObject() {
pList = m_pPageResources->GetDictBy("XObject");
if (!pList)
return;
- CPDF_Reference* pRes = ToReference(pList->GetObjectBy(name));
+ CPDF_Reference* pRes =
+ ToReference(pList->GetObjectBy(name.AsByteStringC()));
if (!pRes)
return;
@@ -1257,7 +1258,7 @@ CPDF_Object* CPDF_StreamContentParser::FindResourceObj(
if (!pList) {
return NULL;
}
- CPDF_Object* pRes = pList->GetDirectObjectBy(name);
+ CPDF_Object* pRes = pList->GetDirectObjectBy(name.AsByteStringC());
return pRes;
}
CPDF_Dictionary* pList = m_pResources->GetDictBy(type);
@@ -1269,10 +1270,10 @@ CPDF_Object* CPDF_StreamContentParser::FindResourceObj(
if (!pList) {
return NULL;
}
- CPDF_Object* pRes = pList->GetDirectObjectBy(name);
+ CPDF_Object* pRes = pList->GetDirectObjectBy(name.AsByteStringC());
return pRes;
}
- CPDF_Object* pRes = pList->GetDirectObjectBy(name);
+ CPDF_Object* pRes = pList->GetDirectObjectBy(name.AsByteStringC());
return pRes;
}
@@ -1763,8 +1764,9 @@ void PDF_ReplaceAbbr(CPDF_Object* pObj) {
for (const auto& it : *pDict) {
CFX_ByteString key = it.first;
CPDF_Object* value = it.second;
- CFX_ByteStringC fullname = PDF_FindFullName(
- PDF_InlineKeyAbbr, FX_ArraySize(PDF_InlineKeyAbbr), key);
+ CFX_ByteStringC fullname =
+ PDF_FindFullName(PDF_InlineKeyAbbr, FX_ArraySize(PDF_InlineKeyAbbr),
+ key.AsByteStringC());
if (!fullname.IsEmpty()) {
AbbrReplacementOp op;
op.is_replace_key = true;
@@ -1777,7 +1779,8 @@ void PDF_ReplaceAbbr(CPDF_Object* pObj) {
if (value->IsName()) {
CFX_ByteString name = value->GetString();
fullname = PDF_FindFullName(PDF_InlineValueAbbr,
- FX_ArraySize(PDF_InlineValueAbbr), name);
+ FX_ArraySize(PDF_InlineValueAbbr),
+ name.AsByteStringC());
if (!fullname.IsEmpty()) {
AbbrReplacementOp op;
op.is_replace_key = false;
@@ -1791,9 +1794,9 @@ void PDF_ReplaceAbbr(CPDF_Object* pObj) {
}
for (const auto& op : replacements) {
if (op.is_replace_key)
- pDict->ReplaceKey(op.key, op.replacement);
+ pDict->ReplaceKey(op.key.AsByteStringC(), op.replacement);
else
- pDict->SetAtName(op.key, op.replacement);
+ pDict->SetAtName(op.key.AsByteStringC(), op.replacement);
}
break;
}
@@ -1804,7 +1807,8 @@ void PDF_ReplaceAbbr(CPDF_Object* pObj) {
if (pElement->IsName()) {
CFX_ByteString name = pElement->GetString();
CFX_ByteStringC fullname = PDF_FindFullName(
- PDF_InlineValueAbbr, FX_ArraySize(PDF_InlineValueAbbr), name);
+ PDF_InlineValueAbbr, FX_ArraySize(PDF_InlineValueAbbr),
+ name.AsByteStringC());
if (!fullname.IsEmpty()) {
pArray->SetAt(i, new CPDF_Name(fullname));
}
diff --git a/core/fpdfapi/fpdf_page/fpdf_page_parser_old.cpp b/core/fpdfapi/fpdf_page/fpdf_page_parser_old.cpp
index a5db2d6d20..a3c88c00df 100644
--- a/core/fpdfapi/fpdf_page/fpdf_page_parser_old.cpp
+++ b/core/fpdfapi/fpdf_page/fpdf_page_parser_old.cpp
@@ -427,7 +427,7 @@ CPDF_Object* CPDF_StreamParser::ReadNextObject(FX_BOOL bAllowNestedArray,
return nullptr;
}
if (!key.IsEmpty()) {
- pDict->SetAt(key, pObj);
+ pDict->SetAt(key.AsByteStringC(), pObj);
} else {
pObj->Release();
}
diff --git a/core/fpdfapi/fpdf_parser/cpdf_name.cpp b/core/fpdfapi/fpdf_parser/cpdf_name.cpp
index db37754b66..a7adf1b3d6 100644
--- a/core/fpdfapi/fpdf_parser/cpdf_name.cpp
+++ b/core/fpdfapi/fpdf_parser/cpdf_name.cpp
@@ -29,7 +29,7 @@ CFX_ByteString CPDF_Name::GetString() const {
}
CFX_ByteStringC CPDF_Name::GetConstString() const {
- return CFX_ByteStringC(m_Name);
+ return m_Name.AsByteStringC();
}
void CPDF_Name::SetString(const CFX_ByteString& str) {
diff --git a/core/fpdfapi/fpdf_parser/cpdf_number.cpp b/core/fpdfapi/fpdf_parser/cpdf_number.cpp
index d2f0503bc1..dbc17d5dd6 100644
--- a/core/fpdfapi/fpdf_parser/cpdf_number.cpp
+++ b/core/fpdfapi/fpdf_parser/cpdf_number.cpp
@@ -47,7 +47,7 @@ const CPDF_Number* CPDF_Number::AsNumber() const {
}
void CPDF_Number::SetString(const CFX_ByteString& str) {
- FX_atonum(str, m_bInteger, &m_Integer);
+ FX_atonum(str.AsByteStringC(), m_bInteger, &m_Integer);
}
CFX_ByteString CPDF_Number::GetString() const {
diff --git a/core/fpdfapi/fpdf_parser/cpdf_object_unittest.cpp b/core/fpdfapi/fpdf_parser/cpdf_object_unittest.cpp
index 2069a161ea..6c1738d5a6 100644
--- a/core/fpdfapi/fpdf_parser/cpdf_object_unittest.cpp
+++ b/core/fpdfapi/fpdf_parser/cpdf_object_unittest.cpp
@@ -135,7 +135,7 @@ class PDFObjectsTest : public testing::Test {
return false;
for (CPDF_Dictionary::const_iterator it = dict1->begin();
it != dict1->end(); ++it) {
- if (!Equal(it->second, dict2->GetObjectBy(it->first)))
+ if (!Equal(it->second, dict2->GetObjectBy(it->first.AsByteStringC())))
return false;
}
return true;
diff --git a/core/fpdfapi/fpdf_parser/cpdf_parser.cpp b/core/fpdfapi/fpdf_parser/cpdf_parser.cpp
index 305401525c..73ca71ef1a 100644
--- a/core/fpdfapi/fpdf_parser/cpdf_parser.cpp
+++ b/core/fpdfapi/fpdf_parser/cpdf_parser.cpp
@@ -822,10 +822,11 @@ FX_BOOL CPDF_Parser::RebuildCrossRef() {
uint32_t dwObjNum =
pElement ? pElement->GetObjNum() : 0;
if (dwObjNum) {
- m_pTrailer->SetAtReference(key, m_pDocument,
- dwObjNum);
+ m_pTrailer->SetAtReference(key.AsByteStringC(),
+ m_pDocument, dwObjNum);
} else {
- m_pTrailer->SetAt(key, pElement->Clone());
+ m_pTrailer->SetAt(key.AsByteStringC(),
+ pElement->Clone());
}
}
}
diff --git a/core/fpdfapi/fpdf_parser/cpdf_standard_security_handler.cpp b/core/fpdfapi/fpdf_parser/cpdf_standard_security_handler.cpp
index ac7667c3ea..9846c40d8f 100644
--- a/core/fpdfapi/fpdf_parser/cpdf_standard_security_handler.cpp
+++ b/core/fpdfapi/fpdf_parser/cpdf_standard_security_handler.cpp
@@ -166,14 +166,15 @@ FX_BOOL CPDF_StandardSecurityHandler::LoadDict(CPDF_Dictionary* pEncryptDict) {
m_Revision = pEncryptDict->GetIntegerBy("R");
m_Permissions = pEncryptDict->GetIntegerBy("P", -1);
if (m_Version < 4) {
- return _LoadCryptInfo(pEncryptDict, CFX_ByteString(), m_Cipher, m_KeyLen);
+ return _LoadCryptInfo(pEncryptDict, CFX_ByteStringC(), m_Cipher, m_KeyLen);
}
CFX_ByteString stmf_name = pEncryptDict->GetStringBy("StmF");
CFX_ByteString strf_name = pEncryptDict->GetStringBy("StrF");
if (stmf_name != strf_name) {
return FALSE;
}
- if (!_LoadCryptInfo(pEncryptDict, strf_name, m_Cipher, m_KeyLen)) {
+ if (!_LoadCryptInfo(pEncryptDict, strf_name.AsByteStringC(), m_Cipher,
+ m_KeyLen)) {
return FALSE;
}
return TRUE;
@@ -195,7 +196,8 @@ FX_BOOL CPDF_StandardSecurityHandler::LoadDict(CPDF_Dictionary* pEncryptDict,
return FALSE;
}
}
- if (!_LoadCryptInfo(pEncryptDict, strf_name, cipher, key_len)) {
+ if (!_LoadCryptInfo(pEncryptDict, strf_name.AsByteStringC(), cipher,
+ key_len)) {
return FALSE;
}
m_Cipher = cipher;
diff --git a/core/fpdfapi/fpdf_parser/cpdf_string.cpp b/core/fpdfapi/fpdf_parser/cpdf_string.cpp
index 9a88e937ab..3f04d125a2 100644
--- a/core/fpdfapi/fpdf_parser/cpdf_string.cpp
+++ b/core/fpdfapi/fpdf_parser/cpdf_string.cpp
@@ -32,7 +32,7 @@ CFX_ByteString CPDF_String::GetString() const {
}
CFX_ByteStringC CPDF_String::GetConstString() const {
- return CFX_ByteStringC(m_String);
+ return m_String.AsByteStringC();
}
void CPDF_String::SetString(const CFX_ByteString& str) {
diff --git a/core/fpdfapi/fpdf_parser/cpdf_syntax_parser.cpp b/core/fpdfapi/fpdf_parser/cpdf_syntax_parser.cpp
index 5a3db292e0..d04a682b77 100644
--- a/core/fpdfapi/fpdf_parser/cpdf_syntax_parser.cpp
+++ b/core/fpdfapi/fpdf_parser/cpdf_syntax_parser.cpp
@@ -399,7 +399,7 @@ CPDF_Object* CPDF_SyntaxParser::GetObject(CPDF_IndirectObjectHolder* pObjList,
}
}
m_Pos = SavedPos;
- return new CPDF_Number(word);
+ return new CPDF_Number(word.AsByteStringC());
}
if (word == "true" || word == "false")
@@ -521,7 +521,7 @@ CPDF_Object* CPDF_SyntaxParser::GetObjectByStrict(
return new CPDF_Reference(pObjList, FXSYS_atoui(word));
}
m_Pos = SavedPos;
- return new CPDF_Number(word);
+ return new CPDF_Number(word.AsByteStringC());
}
if (word == "true" || word == "false")
diff --git a/core/fpdfapi/fpdf_parser/include/cpdf_object.h b/core/fpdfapi/fpdf_parser/include/cpdf_object.h
index 802cbbc638..6cdaaf58fd 100644
--- a/core/fpdfapi/fpdf_parser/include/cpdf_object.h
+++ b/core/fpdfapi/fpdf_parser/include/cpdf_object.h
@@ -46,6 +46,8 @@ class CPDF_Object {
void Release();
virtual CFX_ByteString GetString() const;
+
+ // Note: |this| must outlive the use of |GetConstString|'s result.
virtual CFX_ByteStringC GetConstString() const;
virtual CFX_WideString GetUnicodeText() const;
virtual FX_FLOAT GetNumber() const;