summaryrefslogtreecommitdiff
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
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
-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
-rw-r--r--core/fpdfdoc/cpvt_color.cpp2
-rw-r--r--core/fpdfdoc/cpvt_fontmap.cpp5
-rw-r--r--core/fpdfdoc/cpvt_generateap.cpp19
-rw-r--r--core/fpdfdoc/doc_action.cpp4
-rw-r--r--core/fpdfdoc/doc_annot.cpp4
-rw-r--r--core/fpdfdoc/doc_basic.cpp12
-rw-r--r--core/fpdfdoc/doc_bookmark.cpp4
-rw-r--r--core/fpdfdoc/doc_form.cpp5
-rw-r--r--core/fpdfdoc/doc_formcontrol.cpp20
-rw-r--r--core/fpdfdoc/doc_formfield.cpp4
-rw-r--r--core/fpdfdoc/doc_link.cpp4
-rw-r--r--core/fpdfdoc/doc_ocg.cpp10
-rw-r--r--core/fpdfdoc/doc_tagged.cpp9
-rw-r--r--core/fpdfdoc/doc_utils.cpp67
-rw-r--r--core/fxcrt/fx_basic_buffer.cpp2
-rw-r--r--core/fxcrt/fx_xml_parser.cpp7
-rw-r--r--core/fxcrt/fxcrt_posix.cpp2
-rw-r--r--core/fxcrt/include/fx_basic.h10
-rw-r--r--core/fxcrt/include/fx_string.h30
-rw-r--r--core/fxge/ge/fx_ge_ps.cpp2
-rw-r--r--core/fxge/win32/fx_win32_device.cpp2
-rw-r--r--fpdfsdk/formfiller/cba_fontmap.cpp18
-rw-r--r--fpdfsdk/fpdf_ext.cpp5
-rw-r--r--fpdfsdk/fpdf_flatten.cpp9
-rw-r--r--fpdfsdk/fpdfppo.cpp8
-rw-r--r--fpdfsdk/fsdk_baseannot.cpp12
-rw-r--r--fpdfsdk/fsdk_baseform.cpp8
-rw-r--r--fpdfsdk/fsdk_mgr.cpp2
-rw-r--r--fpdfsdk/fxedit/fxet_pageobjs.cpp12
-rw-r--r--fpdfsdk/pdfwindow/PWL_Edit.cpp26
-rw-r--r--fpdfsdk/pdfwindow/PWL_Icon.cpp2
-rw-r--r--fpdfsdk/pdfwindow/PWL_Label.cpp8
-rw-r--r--fpdfsdk/pdfwindow/PWL_ListBox.cpp14
-rw-r--r--fpdfsdk/pdfwindow/PWL_ScrollBar.cpp3
-rw-r--r--fpdfsdk/pdfwindow/PWL_Signature.cpp2
-rw-r--r--xfa/fee/fde_txtedtengine.cpp6
-rw-r--r--xfa/fgas/localization/fgas_locale.cpp29
-rw-r--r--xfa/fwl/basewidget/fwl_editimp.cpp4
-rw-r--r--xfa/fxbarcode/oned/BC_OnedCodaBarReader.cpp3
-rw-r--r--xfa/fxfa/app/xfa_checksum.cpp2
-rw-r--r--xfa/fxfa/app/xfa_fftextedit.cpp6
-rw-r--r--xfa/fxfa/app/xfa_fontmgr.cpp3
-rw-r--r--xfa/fxfa/fm2js/xfa_fm2jscontext.cpp316
-rw-r--r--xfa/fxfa/parser/xfa_locale.cpp11
-rw-r--r--xfa/fxfa/parser/xfa_object_imp.cpp92
-rw-r--r--xfa/fxfa/parser/xfa_script_eventpseudomodel.cpp2
-rw-r--r--xfa/fxfa/parser/xfa_script_hostpseudomodel.cpp28
64 files changed, 550 insertions, 419 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;
diff --git a/core/fpdfdoc/cpvt_color.cpp b/core/fpdfdoc/cpvt_color.cpp
index afeff23e15..7ddb9df0d0 100644
--- a/core/fpdfdoc/cpvt_color.cpp
+++ b/core/fpdfdoc/cpvt_color.cpp
@@ -10,7 +10,7 @@
// Static.
CPVT_Color CPVT_Color::ParseColor(const CFX_ByteString& str) {
- CPDF_SimpleParser syntax(str);
+ CPDF_SimpleParser syntax(str.AsByteStringC());
if (syntax.FindTagParamFromStart("g", 1))
return CPVT_Color(CPVT_Color::kGray, FX_atof(syntax.GetWord()));
diff --git a/core/fpdfdoc/cpvt_fontmap.cpp b/core/fpdfdoc/cpvt_fontmap.cpp
index 529f85169e..0aa7ac3486 100644
--- a/core/fpdfdoc/cpvt_fontmap.cpp
+++ b/core/fpdfdoc/cpvt_fontmap.cpp
@@ -38,8 +38,9 @@ void CPVT_FontMap::GetAnnotSysPDFFont(CPDF_Document* pDoc,
return;
if (CPDF_Dictionary* pFontList = pResDict->GetDictBy("Font")) {
- if (!pFontList->KeyExist(sSysFontAlias))
- pFontList->SetAtReference(sSysFontAlias, pDoc, pPDFFont->GetFontDict());
+ if (!pFontList->KeyExist(sSysFontAlias.AsByteStringC()))
+ pFontList->SetAtReference(sSysFontAlias.AsByteStringC(), pDoc,
+ pPDFFont->GetFontDict());
}
pSysFont = pPDFFont;
}
diff --git a/core/fpdfdoc/cpvt_generateap.cpp b/core/fpdfdoc/cpvt_generateap.cpp
index dd935de61e..c5e2cc7fab 100644
--- a/core/fpdfdoc/cpvt_generateap.cpp
+++ b/core/fpdfdoc/cpvt_generateap.cpp
@@ -36,7 +36,7 @@ FX_BOOL GenerateWidgetAP(CPDF_Document* pDoc,
if (DA.IsEmpty())
return FALSE;
- CPDF_SimpleParser syntax(DA);
+ CPDF_SimpleParser syntax(DA.AsByteStringC());
syntax.FindTagParamFromStart("Tf", 2);
CFX_ByteString sFontName = syntax.GetWord();
sFontName = PDF_NameDecode(sFontName);
@@ -54,12 +54,12 @@ FX_BOOL GenerateWidgetAP(CPDF_Document* pDoc,
}
CPDF_Dictionary* pDRFontDict = pDRDict ? pDRDict->GetDictBy("Font") : nullptr;
if (pDRFontDict) {
- pFontDict = pDRFontDict->GetDictBy(sFontName.Mid(1));
+ pFontDict = pDRFontDict->GetDictBy(sFontName.Mid(1).AsByteStringC());
if (!pFontDict && !bUseFormRes) {
pDRDict = pFormDict->GetDictBy("DR");
pDRFontDict = pDRDict->GetDictBy("Font");
if (pDRFontDict)
- pFontDict = pDRFontDict->GetDictBy(sFontName.Mid(1));
+ pFontDict = pDRFontDict->GetDictBy(sFontName.Mid(1).AsByteStringC());
}
}
if (!pDRFontDict)
@@ -72,7 +72,8 @@ FX_BOOL GenerateWidgetAP(CPDF_Document* pDoc,
pFontDict->SetAtName("BaseFont", "Helvetica");
pFontDict->SetAtName("Encoding", "WinAnsiEncoding");
pDoc->AddIndirectObject(pFontDict);
- pDRFontDict->SetAtReference(sFontName.Mid(1), pDoc, pFontDict);
+ pDRFontDict->SetAtReference(sFontName.Mid(1).AsByteStringC(), pDoc,
+ pFontDict);
}
CPDF_Font* pDefFont = pDoc->LoadFont(pFontDict);
if (!pDefFont)
@@ -189,8 +190,9 @@ FX_BOOL GenerateWidgetAP(CPDF_Document* pDoc,
pStreamResFontList = new CPDF_Dictionary;
pStreamResList->SetAt("Font", pStreamResFontList);
}
- if (!pStreamResFontList->KeyExist(sFontName))
- pStreamResFontList->SetAtReference(sFontName, pDoc, pFontDict);
+ if (!pStreamResFontList->KeyExist(sFontName.AsByteStringC()))
+ pStreamResFontList->SetAtReference(sFontName.AsByteStringC(), pDoc,
+ pFontDict);
} else {
pStreamDict->SetAt("Resources", pFormDict->GetDictBy("DR")->Clone());
pStreamResList = pStreamDict->GetDictBy("Resources");
@@ -435,8 +437,9 @@ FX_BOOL GenerateWidgetAP(CPDF_Document* pDoc,
pStreamResFontList = new CPDF_Dictionary;
pStreamResList->SetAt("Font", pStreamResFontList);
}
- if (!pStreamResFontList->KeyExist(sFontName))
- pStreamResFontList->SetAtReference(sFontName, pDoc, pFontDict);
+ if (!pStreamResFontList->KeyExist(sFontName.AsByteStringC()))
+ pStreamResFontList->SetAtReference(sFontName.AsByteStringC(), pDoc,
+ pFontDict);
} else {
pStreamDict->SetAt("Resources", pFormDict->GetDictBy("DR")->Clone());
pStreamResList = pStreamDict->GetDictBy("Resources");
diff --git a/core/fpdfdoc/doc_action.cpp b/core/fpdfdoc/doc_action.cpp
index 2f08bfa3af..9a43b58e98 100644
--- a/core/fpdfdoc/doc_action.cpp
+++ b/core/fpdfdoc/doc_action.cpp
@@ -38,8 +38,8 @@ CPDF_Dest CPDF_Action::GetDest(CPDF_Document* pDoc) const {
}
if (pDest->IsString() || pDest->IsName()) {
CPDF_NameTree name_tree(pDoc, "Dests");
- CFX_ByteStringC name = pDest->GetString();
- return CPDF_Dest(name_tree.LookupNamedDest(pDoc, name));
+ return CPDF_Dest(
+ name_tree.LookupNamedDest(pDoc, pDest->GetString().AsByteStringC()));
}
if (CPDF_Array* pArray = pDest->AsArray())
return CPDF_Dest(pArray);
diff --git a/core/fpdfdoc/doc_annot.cpp b/core/fpdfdoc/doc_annot.cpp
index 276516589a..ca900acb9a 100644
--- a/core/fpdfdoc/doc_annot.cpp
+++ b/core/fpdfdoc/doc_annot.cpp
@@ -181,12 +181,12 @@ CPDF_Stream* FPDFDOC_GetAnnotAP(CPDF_Dictionary* pAnnotDict,
CPDF_Dictionary* pDict = pAnnotDict->GetDictBy("Parent");
value = pDict ? pDict->GetStringBy("V") : CFX_ByteString();
}
- if (value.IsEmpty() || !pDict->KeyExist(value))
+ if (value.IsEmpty() || !pDict->KeyExist(value.AsByteStringC()))
as = "Off";
else
as = value;
}
- return pDict->GetStreamBy(as);
+ return pDict->GetStreamBy(as.AsByteStringC());
}
return nullptr;
}
diff --git a/core/fpdfdoc/doc_basic.cpp b/core/fpdfdoc/doc_basic.cpp
index c711709e73..0c7f895405 100644
--- a/core/fpdfdoc/doc_basic.cpp
+++ b/core/fpdfdoc/doc_basic.cpp
@@ -90,12 +90,13 @@ static CPDF_Object* SearchNameNode(CPDF_Dictionary* pNode,
if (pLimits) {
CFX_ByteString csLeft = pLimits->GetStringAt(0);
CFX_ByteString csRight = pLimits->GetStringAt(1);
- if (csLeft.Compare(csRight) > 0) {
+ if (csLeft.Compare(csRight.AsByteStringC()) > 0) {
CFX_ByteString csTmp = csRight;
csRight = csLeft;
csLeft = csTmp;
}
- if (csName.Compare(csLeft) < 0 || csName.Compare(csRight) > 0) {
+ if (csName.Compare(csLeft.AsByteStringC()) < 0 ||
+ csName.Compare(csRight.AsByteStringC()) > 0) {
return NULL;
}
}
@@ -104,7 +105,7 @@ static CPDF_Object* SearchNameNode(CPDF_Dictionary* pNode,
uint32_t dwCount = pNames->GetCount() / 2;
for (uint32_t i = 0; i < dwCount; i++) {
CFX_ByteString csValue = pNames->GetStringAt(i * 2);
- int32_t iCompare = csValue.Compare(csName);
+ int32_t iCompare = csValue.Compare(csName.AsByteStringC());
if (iCompare <= 0) {
if (ppFind) {
*ppFind = pNames;
@@ -500,7 +501,7 @@ int32_t CPDF_PageLabel::GetPageByLabel(const CFX_ByteStringC& bsLabel) const {
CFX_ByteString bsOrig = bsLabel;
for (int i = 0; i < nPages; i++) {
bsLbl = PDF_EncodeText(GetLabel(i));
- if (!bsLbl.Compare(bsOrig)) {
+ if (!bsLbl.Compare(bsOrig.AsByteStringC())) {
return i;
}
}
@@ -512,6 +513,5 @@ int32_t CPDF_PageLabel::GetPageByLabel(const CFX_ByteStringC& bsLabel) const {
return -1;
}
int32_t CPDF_PageLabel::GetPageByLabel(const CFX_WideStringC& wsLabel) const {
- CFX_ByteString bsLabel = PDF_EncodeText(wsLabel.GetPtr());
- return GetPageByLabel(bsLabel);
+ return GetPageByLabel(PDF_EncodeText(wsLabel.GetPtr()).AsByteStringC());
}
diff --git a/core/fpdfdoc/doc_bookmark.cpp b/core/fpdfdoc/doc_bookmark.cpp
index 22ff7921ef..35a04043fe 100644
--- a/core/fpdfdoc/doc_bookmark.cpp
+++ b/core/fpdfdoc/doc_bookmark.cpp
@@ -80,8 +80,8 @@ CPDF_Dest CPDF_Bookmark::GetDest(CPDF_Document* pDocument) const {
return CPDF_Dest();
if (pDest->IsString() || pDest->IsName()) {
CPDF_NameTree name_tree(pDocument, "Dests");
- CFX_ByteStringC name = pDest->GetString();
- return CPDF_Dest(name_tree.LookupNamedDest(pDocument, name));
+ return CPDF_Dest(name_tree.LookupNamedDest(
+ pDocument, pDest->GetString().AsByteStringC()));
}
if (CPDF_Array* pArray = pDest->AsArray())
return CPDF_Dest(pArray);
diff --git a/core/fpdfdoc/doc_form.cpp b/core/fpdfdoc/doc_form.cpp
index 2a6d739549..aa4b5c9f30 100644
--- a/core/fpdfdoc/doc_form.cpp
+++ b/core/fpdfdoc/doc_form.cpp
@@ -343,8 +343,9 @@ CFX_ByteString CPDF_InterForm::GenerateNewResourceName(
int num = 0;
CFX_ByteString bsNum;
while (TRUE) {
- if (!pDict->KeyExist(csTmp + bsNum)) {
- return csTmp + bsNum;
+ CFX_ByteString csKey = csTmp + bsNum;
+ if (!pDict->KeyExist(csKey.AsByteStringC())) {
+ return csKey;
}
if (m < iCount) {
csTmp += csStr[m++];
diff --git a/core/fpdfdoc/doc_formcontrol.cpp b/core/fpdfdoc/doc_formcontrol.cpp
index 1fcc4a386b..0a0a8c9a03 100644
--- a/core/fpdfdoc/doc_formcontrol.cpp
+++ b/core/fpdfdoc/doc_formcontrol.cpp
@@ -78,7 +78,7 @@ void CPDF_FormControl::SetOnStateName(const CFX_ByteString& csOn) {
continue;
}
if (csKey2 != "Off") {
- pSubDict->ReplaceKey(csKey2, csValue);
+ pSubDict->ReplaceKey(csKey2.AsByteStringC(), csValue.AsByteStringC());
break;
}
}
@@ -202,7 +202,7 @@ CPDF_ApSettings CPDF_FormControl::GetMK() const {
}
bool CPDF_FormControl::HasMKEntry(CFX_ByteString csEntry) const {
- return GetMK().HasMKEntry(csEntry);
+ return GetMK().HasMKEntry(csEntry.AsByteStringC());
}
int CPDF_FormControl::GetRotation() {
@@ -210,24 +210,24 @@ int CPDF_FormControl::GetRotation() {
}
FX_ARGB CPDF_FormControl::GetColor(int& iColorType, CFX_ByteString csEntry) {
- return GetMK().GetColor(iColorType, csEntry);
+ return GetMK().GetColor(iColorType, csEntry.AsByteStringC());
}
FX_FLOAT CPDF_FormControl::GetOriginalColor(int index, CFX_ByteString csEntry) {
- return GetMK().GetOriginalColor(index, csEntry);
+ return GetMK().GetOriginalColor(index, csEntry.AsByteStringC());
}
void CPDF_FormControl::GetOriginalColor(int& iColorType,
FX_FLOAT fc[4],
CFX_ByteString csEntry) {
- GetMK().GetOriginalColor(iColorType, fc, csEntry);
+ GetMK().GetOriginalColor(iColorType, fc, csEntry.AsByteStringC());
}
CFX_WideString CPDF_FormControl::GetCaption(CFX_ByteString csEntry) {
- return GetMK().GetCaption(csEntry);
+ return GetMK().GetCaption(csEntry.AsByteStringC());
}
CPDF_Stream* CPDF_FormControl::GetIcon(CFX_ByteString csEntry) {
- return GetMK().GetIcon(csEntry);
+ return GetMK().GetIcon(csEntry.AsByteStringC());
}
CPDF_IconFit CPDF_FormControl::GetIconFit() {
@@ -286,7 +286,8 @@ CPDF_Font* CPDF_FormControl::GetDefaultControlFont() {
if (CPDF_Dictionary* pDict = ToDictionary(pObj)) {
CPDF_Dictionary* pFonts = pDict->GetDictBy("Font");
if (pFonts) {
- CPDF_Dictionary* pElement = pFonts->GetDictBy(csFontNameTag);
+ CPDF_Dictionary* pElement =
+ pFonts->GetDictBy(csFontNameTag.AsByteStringC());
if (pElement) {
CPDF_Font* pFont = m_pField->m_pForm->m_pDocument->LoadFont(pElement);
if (pFont) {
@@ -303,7 +304,8 @@ CPDF_Font* CPDF_FormControl::GetDefaultControlFont() {
if (CPDF_Dictionary* pDict = ToDictionary(pObj)) {
CPDF_Dictionary* pFonts = pDict->GetDictBy("Font");
if (pFonts) {
- CPDF_Dictionary* pElement = pFonts->GetDictBy(csFontNameTag);
+ CPDF_Dictionary* pElement =
+ pFonts->GetDictBy(csFontNameTag.AsByteStringC());
if (pElement) {
CPDF_Font* pFont = m_pField->m_pForm->m_pDocument->LoadFont(pElement);
if (pFont) {
diff --git a/core/fpdfdoc/doc_formfield.cpp b/core/fpdfdoc/doc_formfield.cpp
index 0f8b3dd5ea..931f9e18d9 100644
--- a/core/fpdfdoc/doc_formfield.cpp
+++ b/core/fpdfdoc/doc_formfield.cpp
@@ -1054,7 +1054,7 @@ void CPDF_FormField::LoadDA() {
if (DA.IsEmpty()) {
return;
}
- CPDF_SimpleParser syntax(DA);
+ CPDF_SimpleParser syntax(DA.AsByteStringC());
syntax.FindTagParamFromStart("Tf", 2);
CFX_ByteString font_name = syntax.GetWord();
CPDF_Dictionary* pFontDict = NULL;
@@ -1062,7 +1062,7 @@ void CPDF_FormField::LoadDA() {
m_pForm->m_pFormDict->GetDictBy("DR")->GetDictBy("Font"))
pFontDict = m_pForm->m_pFormDict->GetDictBy("DR")
->GetDictBy("Font")
- ->GetDictBy(font_name);
+ ->GetDictBy(font_name.AsByteStringC());
if (!pFontDict) {
return;
diff --git a/core/fpdfdoc/doc_link.cpp b/core/fpdfdoc/doc_link.cpp
index 723955f9ea..d86bf203e4 100644
--- a/core/fpdfdoc/doc_link.cpp
+++ b/core/fpdfdoc/doc_link.cpp
@@ -81,8 +81,8 @@ CPDF_Dest CPDF_Link::GetDest(CPDF_Document* pDoc) {
if (pDest->IsString() || pDest->IsName()) {
CPDF_NameTree name_tree(pDoc, "Dests");
- CFX_ByteStringC name = pDest->GetString();
- return CPDF_Dest(name_tree.LookupNamedDest(pDoc, name));
+ return CPDF_Dest(
+ name_tree.LookupNamedDest(pDoc, pDest->GetString().AsByteStringC()));
}
if (CPDF_Array* pArray = pDest->AsArray())
return CPDF_Dest(pArray);
diff --git a/core/fpdfdoc/doc_ocg.cpp b/core/fpdfdoc/doc_ocg.cpp
index a739c1675c..7464936b62 100644
--- a/core/fpdfdoc/doc_ocg.cpp
+++ b/core/fpdfdoc/doc_ocg.cpp
@@ -142,7 +142,7 @@ FX_BOOL CPDF_OCContext::LoadOCGStateFromConfig(const CFX_ByteStringC& csConfig,
if (!pState) {
continue;
}
- bState = pState->GetStringBy(csFind) != "OFF";
+ bState = pState->GetStringBy(csFind.AsByteStringC()) != "OFF";
}
}
return bState;
@@ -154,11 +154,11 @@ FX_BOOL CPDF_OCContext::LoadOCGState(const CPDF_Dictionary* pOCGDict) const {
CFX_ByteString csState = FPDFDOC_OCG_GetUsageTypeString(m_eUsageType);
CPDF_Dictionary* pUsage = pOCGDict->GetDictBy("Usage");
if (pUsage) {
- CPDF_Dictionary* pState = pUsage->GetDictBy(csState);
+ CPDF_Dictionary* pState = pUsage->GetDictBy(csState.AsByteStringC());
if (pState) {
CFX_ByteString csFind = csState + "State";
- if (pState->KeyExist(csFind)) {
- return pState->GetStringBy(csFind) != "OFF";
+ if (pState->KeyExist(csFind.AsByteStringC())) {
+ return pState->GetStringBy(csFind.AsByteStringC()) != "OFF";
}
}
if (csState != "View") {
@@ -169,7 +169,7 @@ FX_BOOL CPDF_OCContext::LoadOCGState(const CPDF_Dictionary* pOCGDict) const {
}
}
FX_BOOL bDefValid = FALSE;
- return LoadOCGStateFromConfig(csState, pOCGDict, bDefValid);
+ return LoadOCGStateFromConfig(csState.AsByteStringC(), pOCGDict, bDefValid);
}
FX_BOOL CPDF_OCContext::GetOCGVisible(const CPDF_Dictionary* pOCGDict) {
diff --git a/core/fpdfdoc/doc_tagged.cpp b/core/fpdfdoc/doc_tagged.cpp
index 684789acc2..2a3554c499 100644
--- a/core/fpdfdoc/doc_tagged.cpp
+++ b/core/fpdfdoc/doc_tagged.cpp
@@ -205,7 +205,8 @@ CPDF_StructElementImpl::CPDF_StructElementImpl(CPDF_StructTreeImpl* pTree,
m_pDict = pDict;
m_Type = pDict->GetStringBy("S");
if (pTree->m_pRoleMap) {
- CFX_ByteString mapped = pTree->m_pRoleMap->GetStringBy(m_Type);
+ CFX_ByteString mapped =
+ pTree->m_pRoleMap->GetStringBy(m_Type.AsByteStringC());
if (!mapped.IsEmpty()) {
m_Type = mapped;
}
@@ -373,14 +374,16 @@ CPDF_Object* CPDF_StructElementImpl::GetAttr(const CFX_ByteStringC& owner,
if (CPDF_Array* pArray = pC->AsArray()) {
for (uint32_t i = 0; i < pArray->GetCount(); i++) {
CFX_ByteString class_name = pArray->GetStringAt(i);
- CPDF_Dictionary* pClassDict = pClassMap->GetDictBy(class_name);
+ CPDF_Dictionary* pClassDict =
+ pClassMap->GetDictBy(class_name.AsByteStringC());
if (pClassDict && pClassDict->GetStringBy("O") == owner)
return pClassDict->GetDirectObjectBy(name);
}
return nullptr;
}
CFX_ByteString class_name = pC->GetString();
- CPDF_Dictionary* pClassDict = pClassMap->GetDictBy(class_name);
+ CPDF_Dictionary* pClassDict =
+ pClassMap->GetDictBy(class_name.AsByteStringC());
if (pClassDict && pClassDict->GetStringBy("O") == owner)
return pClassDict->GetDirectObjectBy(name);
return nullptr;
diff --git a/core/fpdfdoc/doc_utils.cpp b/core/fpdfdoc/doc_utils.cpp
index f83d001af5..d3b3cac627 100644
--- a/core/fpdfdoc/doc_utils.cpp
+++ b/core/fpdfdoc/doc_utils.cpp
@@ -82,7 +82,7 @@ FX_BOOL CPDF_DefaultAppearance::HasFont() {
if (m_csDA.IsEmpty()) {
return FALSE;
}
- CPDF_SimpleParser syntax(m_csDA);
+ CPDF_SimpleParser syntax(m_csDA.AsByteStringC());
return syntax.FindTagParamFromStart("Tf", 2);
}
CFX_ByteString CPDF_DefaultAppearance::GetFontString() {
@@ -90,7 +90,7 @@ CFX_ByteString CPDF_DefaultAppearance::GetFontString() {
if (m_csDA.IsEmpty()) {
return csFont;
}
- CPDF_SimpleParser syntax(m_csDA);
+ CPDF_SimpleParser syntax(m_csDA.AsByteStringC());
if (syntax.FindTagParamFromStart("Tf", 2)) {
csFont += (CFX_ByteString)syntax.GetWord();
csFont += " ";
@@ -107,11 +107,11 @@ void CPDF_DefaultAppearance::GetFont(CFX_ByteString& csFontNameTag,
if (m_csDA.IsEmpty()) {
return;
}
- CPDF_SimpleParser syntax(m_csDA);
+ CPDF_SimpleParser syntax(m_csDA.AsByteStringC());
if (syntax.FindTagParamFromStart("Tf", 2)) {
- csFontNameTag = (CFX_ByteString)syntax.GetWord();
+ csFontNameTag = CFX_ByteString(syntax.GetWord());
csFontNameTag.Delete(0, 1);
- fFontSize = FX_atof((CFX_ByteString)syntax.GetWord());
+ fFontSize = FX_atof(syntax.GetWord());
}
csFontNameTag = PDF_NameDecode(csFontNameTag);
}
@@ -119,7 +119,7 @@ FX_BOOL CPDF_DefaultAppearance::HasColor(FX_BOOL bStrokingOperation) {
if (m_csDA.IsEmpty()) {
return FALSE;
}
- CPDF_SimpleParser syntax(m_csDA);
+ CPDF_SimpleParser syntax(m_csDA.AsByteStringC());
if (syntax.FindTagParamFromStart(bStrokingOperation ? "G" : "g", 1)) {
return TRUE;
}
@@ -134,7 +134,7 @@ CFX_ByteString CPDF_DefaultAppearance::GetColorString(
if (m_csDA.IsEmpty()) {
return csColor;
}
- CPDF_SimpleParser syntax(m_csDA);
+ CPDF_SimpleParser syntax(m_csDA.AsByteStringC());
if (syntax.FindTagParamFromStart(bStrokingOperation ? "G" : "g", 1)) {
csColor += (CFX_ByteString)syntax.GetWord();
csColor += " ";
@@ -174,25 +174,25 @@ void CPDF_DefaultAppearance::GetColor(int& iColorType,
if (m_csDA.IsEmpty()) {
return;
}
- CPDF_SimpleParser syntax(m_csDA);
+ CPDF_SimpleParser syntax(m_csDA.AsByteStringC());
if (syntax.FindTagParamFromStart(bStrokingOperation ? "G" : "g", 1)) {
iColorType = COLORTYPE_GRAY;
- fc[0] = FX_atof((CFX_ByteString)syntax.GetWord());
+ fc[0] = FX_atof(syntax.GetWord());
return;
}
if (syntax.FindTagParamFromStart(bStrokingOperation ? "RG" : "rg", 3)) {
iColorType = COLORTYPE_RGB;
- fc[0] = FX_atof((CFX_ByteString)syntax.GetWord());
- fc[1] = FX_atof((CFX_ByteString)syntax.GetWord());
- fc[2] = FX_atof((CFX_ByteString)syntax.GetWord());
+ fc[0] = FX_atof(syntax.GetWord());
+ fc[1] = FX_atof(syntax.GetWord());
+ fc[2] = FX_atof(syntax.GetWord());
return;
}
if (syntax.FindTagParamFromStart(bStrokingOperation ? "K" : "k", 4)) {
iColorType = COLORTYPE_CMYK;
- fc[0] = FX_atof((CFX_ByteString)syntax.GetWord());
- fc[1] = FX_atof((CFX_ByteString)syntax.GetWord());
- fc[2] = FX_atof((CFX_ByteString)syntax.GetWord());
- fc[3] = FX_atof((CFX_ByteString)syntax.GetWord());
+ fc[0] = FX_atof(syntax.GetWord());
+ fc[1] = FX_atof(syntax.GetWord());
+ fc[2] = FX_atof(syntax.GetWord());
+ fc[3] = FX_atof(syntax.GetWord());
}
}
void CPDF_DefaultAppearance::GetColor(FX_ARGB& color,
@@ -203,27 +203,27 @@ void CPDF_DefaultAppearance::GetColor(FX_ARGB& color,
if (m_csDA.IsEmpty()) {
return;
}
- CPDF_SimpleParser syntax(m_csDA);
+ CPDF_SimpleParser syntax(m_csDA.AsByteStringC());
if (syntax.FindTagParamFromStart(bStrokingOperation ? "G" : "g", 1)) {
iColorType = COLORTYPE_GRAY;
- FX_FLOAT g = FX_atof((CFX_ByteString)syntax.GetWord()) * 255 + 0.5f;
+ FX_FLOAT g = FX_atof(syntax.GetWord()) * 255 + 0.5f;
color = ArgbEncode(255, (int)g, (int)g, (int)g);
return;
}
if (syntax.FindTagParamFromStart(bStrokingOperation ? "RG" : "rg", 3)) {
iColorType = COLORTYPE_RGB;
- FX_FLOAT r = FX_atof((CFX_ByteString)syntax.GetWord()) * 255 + 0.5f;
- FX_FLOAT g = FX_atof((CFX_ByteString)syntax.GetWord()) * 255 + 0.5f;
- FX_FLOAT b = FX_atof((CFX_ByteString)syntax.GetWord()) * 255 + 0.5f;
+ FX_FLOAT r = FX_atof(syntax.GetWord()) * 255 + 0.5f;
+ FX_FLOAT g = FX_atof(syntax.GetWord()) * 255 + 0.5f;
+ FX_FLOAT b = FX_atof(syntax.GetWord()) * 255 + 0.5f;
color = ArgbEncode(255, (int)r, (int)g, (int)b);
return;
}
if (syntax.FindTagParamFromStart(bStrokingOperation ? "K" : "k", 4)) {
iColorType = COLORTYPE_CMYK;
- FX_FLOAT c = FX_atof((CFX_ByteString)syntax.GetWord());
- FX_FLOAT m = FX_atof((CFX_ByteString)syntax.GetWord());
- FX_FLOAT y = FX_atof((CFX_ByteString)syntax.GetWord());
- FX_FLOAT k = FX_atof((CFX_ByteString)syntax.GetWord());
+ FX_FLOAT c = FX_atof(syntax.GetWord());
+ FX_FLOAT m = FX_atof(syntax.GetWord());
+ FX_FLOAT y = FX_atof(syntax.GetWord());
+ FX_FLOAT k = FX_atof(syntax.GetWord());
FX_FLOAT r = 1.0f - std::min(1.0f, c + k);
FX_FLOAT g = 1.0f - std::min(1.0f, m + k);
FX_FLOAT b = 1.0f - std::min(1.0f, y + k);
@@ -235,7 +235,7 @@ FX_BOOL CPDF_DefaultAppearance::HasTextMatrix() {
if (m_csDA.IsEmpty()) {
return FALSE;
}
- CPDF_SimpleParser syntax(m_csDA);
+ CPDF_SimpleParser syntax(m_csDA.AsByteStringC());
return syntax.FindTagParamFromStart("Tm", 6);
}
CFX_ByteString CPDF_DefaultAppearance::GetTextMatrixString() {
@@ -243,7 +243,7 @@ CFX_ByteString CPDF_DefaultAppearance::GetTextMatrixString() {
if (m_csDA.IsEmpty()) {
return csTM;
}
- CPDF_SimpleParser syntax(m_csDA);
+ CPDF_SimpleParser syntax(m_csDA.AsByteStringC());
if (syntax.FindTagParamFromStart("Tm", 6)) {
for (int i = 0; i < 6; i++) {
csTM += (CFX_ByteString)syntax.GetWord();
@@ -258,11 +258,11 @@ CFX_Matrix CPDF_DefaultAppearance::GetTextMatrix() {
if (m_csDA.IsEmpty()) {
return tm;
}
- CPDF_SimpleParser syntax(m_csDA);
+ CPDF_SimpleParser syntax(m_csDA.AsByteStringC());
if (syntax.FindTagParamFromStart("Tm", 6)) {
FX_FLOAT f[6];
for (int i = 0; i < 6; i++) {
- f[i] = FX_atof((CFX_ByteString)syntax.GetWord());
+ f[i] = FX_atof(syntax.GetWord());
}
tm.Set(f[0], f[1], f[2], f[3], f[4], f[5]);
}
@@ -387,7 +387,7 @@ CPDF_Font* GetInterFormFont(CPDF_Dictionary* pFormDict,
if (!pFonts) {
return NULL;
}
- CPDF_Dictionary* pElement = pFonts->GetDictBy(csAlias);
+ CPDF_Dictionary* pElement = pFonts->GetDictBy(csAlias.AsByteStringC());
if (!pElement) {
return NULL;
}
@@ -606,7 +606,8 @@ void AddInterFormFont(CPDF_Dictionary*& pFormDict,
csNameTag.Remove(' ');
csNameTag =
CPDF_InterForm::GenerateNewResourceName(pDR, "Font", 4, csNameTag);
- pFonts->SetAtReference(csNameTag, pDocument, pFont->GetFontDict());
+ pFonts->SetAtReference(csNameTag.AsByteStringC(), pDocument,
+ pFont->GetFontDict());
}
CPDF_Font* AddNativeInterFormFont(CPDF_Dictionary*& pFormDict,
CPDF_Document* pDocument,
@@ -650,7 +651,7 @@ void RemoveInterFormFont(CPDF_Dictionary* pFormDict, const CPDF_Font* pFont) {
}
CPDF_Dictionary* pDR = pFormDict->GetDictBy("DR");
CPDF_Dictionary* pFonts = pDR->GetDictBy("Font");
- pFonts->RemoveAt(csTag);
+ pFonts->RemoveAt(csTag.AsByteStringC());
}
void RemoveInterFormFont(CPDF_Dictionary* pFormDict, CFX_ByteString csNameTag) {
if (!pFormDict || csNameTag.IsEmpty()) {
@@ -664,7 +665,7 @@ void RemoveInterFormFont(CPDF_Dictionary* pFormDict, CFX_ByteString csNameTag) {
if (!pFonts) {
return;
}
- pFonts->RemoveAt(csNameTag);
+ pFonts->RemoveAt(csNameTag.AsByteStringC());
}
CPDF_Font* GetDefaultInterFormFont(CPDF_Dictionary* pFormDict,
diff --git a/core/fxcrt/fx_basic_buffer.cpp b/core/fxcrt/fx_basic_buffer.cpp
index 28c8ac0f32..de7bff2401 100644
--- a/core/fxcrt/fx_basic_buffer.cpp
+++ b/core/fxcrt/fx_basic_buffer.cpp
@@ -248,7 +248,7 @@ CFX_ArchiveSaver& CFX_ArchiveSaver::operator<<(const FX_WCHAR* wstr) {
}
CFX_ArchiveSaver& CFX_ArchiveSaver::operator<<(const CFX_WideString& wstr) {
CFX_ByteString encoded = wstr.UTF16LE_Encode();
- return operator<<(encoded);
+ return operator<<(encoded.AsByteStringC());
}
void CFX_ArchiveSaver::Write(const void* pData, FX_STRSIZE dwSize) {
if (m_pStream) {
diff --git a/core/fxcrt/fx_xml_parser.cpp b/core/fxcrt/fx_xml_parser.cpp
index 9cdf73ca90..b39c32bfbd 100644
--- a/core/fxcrt/fx_xml_parser.cpp
+++ b/core/fxcrt/fx_xml_parser.cpp
@@ -371,7 +371,7 @@ CXML_Element* CXML_Parser::ParseElement(CXML_Element* pParent,
}
CXML_Element* pElement = new CXML_Element;
pElement->m_pParent = pParent;
- pElement->SetTag(tag_space, tag_name);
+ pElement->SetTag(tag_space.AsByteStringC(), tag_name.AsByteStringC());
do {
CFX_ByteString attr_space, attr_name;
while (m_dwIndex < m_dwBufferSize) {
@@ -397,7 +397,8 @@ CXML_Element* CXML_Parser::ParseElement(CXML_Element* pParent,
}
CFX_WideString attr_value;
GetAttrValue(attr_value);
- pElement->m_AttrMap.SetAt(attr_space, attr_name, attr_value);
+ pElement->m_AttrMap.SetAt(attr_space.AsByteStringC(),
+ attr_name.AsByteStringC(), attr_value);
}
m_nOffset = m_nBufferOffset + (FX_FILESIZE)m_dwIndex;
if (m_dwIndex < m_dwBufferSize || IsEOF()) {
@@ -600,7 +601,7 @@ CFX_ByteString CXML_Element::GetNamespace(FX_BOOL bQualified) const {
if (bQualified) {
return m_QSpaceName;
}
- return GetNamespaceURI(m_QSpaceName);
+ return GetNamespaceURI(m_QSpaceName.AsByteStringC());
}
CFX_ByteString CXML_Element::GetNamespaceURI(
const CFX_ByteStringC& qName) const {
diff --git a/core/fxcrt/fxcrt_posix.cpp b/core/fxcrt/fxcrt_posix.cpp
index 2f17e71567..0226313934 100644
--- a/core/fxcrt/fxcrt_posix.cpp
+++ b/core/fxcrt/fxcrt_posix.cpp
@@ -45,7 +45,7 @@ FX_BOOL CFXCRT_FileAccess_Posix::Open(const CFX_ByteStringC& fileName,
}
FX_BOOL CFXCRT_FileAccess_Posix::Open(const CFX_WideStringC& fileName,
uint32_t dwMode) {
- return Open(FX_UTF8Encode(fileName), dwMode);
+ return Open(FX_UTF8Encode(fileName).AsByteStringC(), dwMode);
}
void CFXCRT_FileAccess_Posix::Close() {
if (m_nFD < 0) {
diff --git a/core/fxcrt/include/fx_basic.h b/core/fxcrt/include/fx_basic.h
index feeb6e756d..2ef11beb27 100644
--- a/core/fxcrt/include/fx_basic.h
+++ b/core/fxcrt/include/fx_basic.h
@@ -27,8 +27,8 @@ class CFX_BinaryBuf {
void Clear();
void EstimateSize(FX_STRSIZE size, FX_STRSIZE alloc_step = 0);
void AppendBlock(const void* pBuf, FX_STRSIZE size);
- void AppendString(const CFX_ByteStringC& str) {
- AppendBlock(str.GetPtr(), str.GetLength());
+ void AppendString(const CFX_ByteString& str) {
+ AppendBlock(str.c_str(), str.GetLength());
}
void AppendByte(uint8_t byte) {
@@ -63,6 +63,12 @@ class CFX_ByteTextBuf : public CFX_BinaryBuf {
CFX_ByteTextBuf& operator<<(int i);
CFX_ByteTextBuf& operator<<(uint32_t i);
CFX_ByteTextBuf& operator<<(double f);
+ CFX_ByteTextBuf& operator<<(const FX_CHAR* pStr) {
+ return *this << CFX_ByteStringC(pStr);
+ }
+ CFX_ByteTextBuf& operator<<(const CFX_ByteString& str) {
+ return *this << str.AsByteStringC();
+ }
CFX_ByteTextBuf& operator<<(const CFX_ByteStringC& lpsz);
CFX_ByteTextBuf& operator<<(const CFX_ByteTextBuf& buf);
};
diff --git a/core/fxcrt/include/fx_string.h b/core/fxcrt/include/fx_string.h
index 9aa67845f8..cbf8c4de2f 100644
--- a/core/fxcrt/include/fx_string.h
+++ b/core/fxcrt/include/fx_string.h
@@ -61,8 +61,6 @@ class CFX_ByteStringC {
m_Length = src.m_Length;
}
- CFX_ByteStringC(const CFX_ByteString& src);
-
CFX_ByteStringC& operator=(const FX_CHAR* src) {
m_Ptr = (const uint8_t*)src;
m_Length = m_Ptr ? FXSYS_strlen(src) : 0;
@@ -167,12 +165,14 @@ class CFX_ByteString {
static CFX_ByteString FromUnicode(const CFX_WideString& str);
// Explicit conversion to C-style string.
+ // Note: |this| must outlive the use of the result.
const FX_CHAR* c_str() const { return m_pData ? m_pData->m_String : ""; }
// Implicit conversion to C-style string -- deprecated.
operator const FX_CHAR*() const { return m_pData ? m_pData->m_String : ""; }
// Explicit conversion to uint8_t*.
+ // Note: |this| must outlive the use of the result.
const uint8_t* raw_str() const {
return m_pData ? reinterpret_cast<const uint8_t*>(m_pData->m_String)
: nullptr;
@@ -184,6 +184,12 @@ class CFX_ByteString {
: nullptr;
}
+ // Explicit conversion to CFX_ByteStringC.
+ // Note: |this| must outlive the use of the result.
+ CFX_ByteStringC AsByteStringC() const {
+ return CFX_ByteStringC(raw_str(), GetLength());
+ }
+
FX_STRSIZE GetLength() const { return m_pData ? m_pData->m_nDataLength : 0; }
bool IsEmpty() const { return !GetLength(); }
@@ -330,10 +336,6 @@ class CFX_ByteString {
friend class fxcrt_ByteStringConcat_Test;
};
-inline CFX_ByteStringC::CFX_ByteStringC(const CFX_ByteString& src) {
- m_Ptr = (const uint8_t*)src;
- m_Length = src.GetLength();
-}
inline CFX_ByteStringC& CFX_ByteStringC::operator=(const CFX_ByteString& src) {
m_Ptr = (const uint8_t*)src;
m_Length = src.GetLength();
@@ -373,29 +375,29 @@ inline CFX_ByteString operator+(FX_CHAR ch, const CFX_ByteStringC& str2) {
}
inline CFX_ByteString operator+(const CFX_ByteString& str1,
const CFX_ByteString& str2) {
- return CFX_ByteString(str1, str2);
+ return CFX_ByteString(str1.AsByteStringC(), str2.AsByteStringC());
}
inline CFX_ByteString operator+(const CFX_ByteString& str1, FX_CHAR ch) {
- return CFX_ByteString(str1, CFX_ByteStringC(ch));
+ return CFX_ByteString(str1.AsByteStringC(), CFX_ByteStringC(ch));
}
inline CFX_ByteString operator+(FX_CHAR ch, const CFX_ByteString& str2) {
- return CFX_ByteString(ch, str2);
+ return CFX_ByteString(ch, str2.AsByteStringC());
}
inline CFX_ByteString operator+(const CFX_ByteString& str1,
const FX_CHAR* str2) {
- return CFX_ByteString(str1, str2);
+ return CFX_ByteString(str1.AsByteStringC(), str2);
}
inline CFX_ByteString operator+(const FX_CHAR* str1,
const CFX_ByteString& str2) {
- return CFX_ByteString(str1, str2);
+ return CFX_ByteString(str1, str2.AsByteStringC());
}
inline CFX_ByteString operator+(const CFX_ByteString& str1,
const CFX_ByteStringC& str2) {
- return CFX_ByteString(str1, str2);
+ return CFX_ByteString(str1.AsByteStringC(), str2);
}
inline CFX_ByteString operator+(const CFX_ByteStringC& str1,
const CFX_ByteString& str2) {
- return CFX_ByteString(str1, str2);
+ return CFX_ByteString(str1, str2.AsByteStringC());
}
class CFX_WideStringC {
@@ -758,7 +760,7 @@ inline CFX_ByteString FX_UTF8Encode(const CFX_WideString& wsStr) {
FX_FLOAT FX_atof(const CFX_ByteStringC& str);
inline FX_FLOAT FX_atof(const CFX_WideStringC& wsStr) {
- return FX_atof(FX_UTF8Encode(wsStr.GetPtr(), wsStr.GetLength()));
+ return FX_atof(FX_UTF8Encode(wsStr.GetPtr(), wsStr.GetLength()).c_str());
}
void FX_atonum(const CFX_ByteStringC& str, FX_BOOL& bInteger, void* pData);
FX_STRSIZE FX_ftoa(FX_FLOAT f, FX_CHAR* buf);
diff --git a/core/fxge/ge/fx_ge_ps.cpp b/core/fxge/ge/fx_ge_ps.cpp
index 32f2fce914..ec8f18e774 100644
--- a/core/fxge/ge/fx_ge_ps.cpp
+++ b/core/fxge/ge/fx_ge_ps.cpp
@@ -680,7 +680,7 @@ FX_BOOL CFX_PSRenderer::DrawText(int nChars,
buf << pCharPos[i].m_OriginX << " " << pCharPos[i].m_OriginY << " m";
CFX_ByteString hex;
hex.Format("<%02X>", ps_glyphindex);
- buf << hex << "Tj\n";
+ buf << hex.AsByteStringC() << "Tj\n";
}
buf << "Q\n";
m_pOutput->OutputPS((const FX_CHAR*)buf.GetBuffer(), buf.GetSize());
diff --git a/core/fxge/win32/fx_win32_device.cpp b/core/fxge/win32/fx_win32_device.cpp
index cb3f331d49..ed57a02c23 100644
--- a/core/fxge/win32/fx_win32_device.cpp
+++ b/core/fxge/win32/fx_win32_device.cpp
@@ -460,7 +460,7 @@ IFX_SystemFontInfo* IFX_SystemFontInfo::CreateDefault(const char** pUnused) {
if (path_len > 0 && path_len < MAX_PATH) {
CFX_ByteString fonts_path(windows_path);
fonts_path += "\\Fonts";
- pInfoFallback->AddPath(fonts_path);
+ pInfoFallback->AddPath(fonts_path.AsByteStringC());
}
return pInfoFallback;
}
diff --git a/fpdfsdk/formfiller/cba_fontmap.cpp b/fpdfsdk/formfiller/cba_fontmap.cpp
index c69dcbebcd..1ecf7d4de4 100644
--- a/fpdfsdk/formfiller/cba_fontmap.cpp
+++ b/fpdfsdk/formfiller/cba_fontmap.cpp
@@ -159,15 +159,15 @@ void CBA_FontMap::AddFontToAnnotDict(CPDF_Font* pFont,
}
// to avoid checkbox and radiobutton
- CPDF_Object* pObject = pAPDict->GetObjectBy(m_sAPType);
+ CPDF_Object* pObject = pAPDict->GetObjectBy(m_sAPType.AsByteStringC());
if (ToDictionary(pObject))
return;
- CPDF_Stream* pStream = pAPDict->GetStreamBy(m_sAPType);
+ CPDF_Stream* pStream = pAPDict->GetStreamBy(m_sAPType.AsByteStringC());
if (!pStream) {
pStream = new CPDF_Stream(NULL, 0, NULL);
int32_t objnum = m_pDocument->AddIndirectObject(pStream);
- pAPDict->SetAtReference(m_sAPType, m_pDocument, objnum);
+ pAPDict->SetAtReference(m_sAPType.AsByteStringC(), m_pDocument, objnum);
}
CPDF_Dictionary* pStreamDict = pStream->GetDict();
@@ -191,8 +191,8 @@ void CBA_FontMap::AddFontToAnnotDict(CPDF_Font* pFont,
int32_t objnum = m_pDocument->AddIndirectObject(pStreamResFontList);
pStreamResList->SetAtReference("Font", m_pDocument, objnum);
}
- if (!pStreamResFontList->KeyExist(sAlias))
- pStreamResFontList->SetAtReference(sAlias, m_pDocument,
+ if (!pStreamResFontList->KeyExist(sAlias.AsByteStringC()))
+ pStreamResFontList->SetAtReference(sAlias.AsByteStringC(), m_pDocument,
pFont->GetFontDict());
}
}
@@ -221,14 +221,14 @@ CPDF_Font* CBA_FontMap::GetAnnotDefaultFont(CFX_ByteString& sAlias) {
CPDF_Dictionary* pFontDict = NULL;
if (!sDA.IsEmpty()) {
- CPDF_SimpleParser syntax(sDA);
+ CPDF_SimpleParser syntax(sDA.AsByteStringC());
syntax.FindTagParamFromStart("Tf", 2);
CFX_ByteString sFontName = syntax.GetWord();
sAlias = PDF_NameDecode(sFontName).Mid(1);
if (CPDF_Dictionary* pDRDict = m_pAnnotDict->GetDictBy("DR"))
if (CPDF_Dictionary* pDRFontDict = pDRDict->GetDictBy("Font"))
- pFontDict = pDRFontDict->GetDictBy(sAlias);
+ pFontDict = pDRFontDict->GetDictBy(sAlias.AsByteStringC());
if (!pFontDict)
if (CPDF_Dictionary* pAPDict = m_pAnnotDict->GetDictBy("AP"))
@@ -237,14 +237,14 @@ CPDF_Font* CBA_FontMap::GetAnnotDefaultFont(CFX_ByteString& sAlias) {
pNormalDict->GetDictBy("Resources"))
if (CPDF_Dictionary* pResFontDict =
pNormalResDict->GetDictBy("Font"))
- pFontDict = pResFontDict->GetDictBy(sAlias);
+ pFontDict = pResFontDict->GetDictBy(sAlias.AsByteStringC());
if (bWidget) {
if (!pFontDict) {
if (pAcroFormDict) {
if (CPDF_Dictionary* pDRDict = pAcroFormDict->GetDictBy("DR"))
if (CPDF_Dictionary* pDRFontDict = pDRDict->GetDictBy("Font"))
- pFontDict = pDRFontDict->GetDictBy(sAlias);
+ pFontDict = pDRFontDict->GetDictBy(sAlias.AsByteStringC());
}
}
}
diff --git a/fpdfsdk/fpdf_ext.cpp b/fpdfsdk/fpdf_ext.cpp
index 484993c6a1..a1009c5cdf 100644
--- a/fpdfsdk/fpdf_ext.cpp
+++ b/fpdfsdk/fpdf_ext.cpp
@@ -104,10 +104,11 @@ FX_BOOL CheckSharedForm(const CXML_Element* pElement, CFX_ByteString cbName) {
pElement->GetAttrByIndex(i, space, name, value);
if (space == "xmlns" && name == "adhocwf" &&
value == L"http://ns.adobe.com/AcrobatAdhocWorkflow/1.0/") {
- CXML_Element* pVersion = pElement->GetElement("adhocwf", cbName);
+ CXML_Element* pVersion =
+ pElement->GetElement("adhocwf", cbName.AsByteStringC());
if (!pVersion)
continue;
- CFX_WideString wsContent = pVersion->GetContent(0); // == 1.1
+ CFX_WideString wsContent = pVersion->GetContent(0);
int nType = wsContent.GetInteger();
switch (nType) {
case 1:
diff --git a/fpdfsdk/fpdf_flatten.cpp b/fpdfsdk/fpdf_flatten.cpp
index 46501865e5..bbd5ad3dd3 100644
--- a/fpdfsdk/fpdf_flatten.cpp
+++ b/fpdfsdk/fpdf_flatten.cpp
@@ -395,8 +395,7 @@ DLLEXPORT int STDCALL FPDFPage_Flatten(FPDF_PAGE page, int nFlag) {
char sExtend[5] = {};
FXSYS_itoa(iKey, sExtend, 10);
key = CFX_ByteString("FFT") + CFX_ByteString(sExtend);
-
- if (!pPageXObject->KeyExist(key))
+ if (!pPageXObject->KeyExist(key.AsByteStringC()))
break;
}
}
@@ -406,7 +405,7 @@ DLLEXPORT int STDCALL FPDFPage_Flatten(FPDF_PAGE page, int nFlag) {
CPDF_Dictionary* pNewXORes = NULL;
if (!key.IsEmpty()) {
- pPageXObject->SetAtReference(key, pDocument, dwObjNum);
+ pPageXObject->SetAtReference(key.AsByteStringC(), pDocument, dwObjNum);
CPDF_Dictionary* pNewOXbjectDic = pNewXObject->GetDict();
pNewXORes = new CPDF_Dictionary;
pNewOXbjectDic->SetAt("Resources", pNewXORes);
@@ -438,7 +437,7 @@ DLLEXPORT int STDCALL FPDFPage_Flatten(FPDF_PAGE page, int nFlag) {
continue;
if (!sAnnotState.IsEmpty()) {
- pAPStream = pAPDic->GetStreamBy(sAnnotState);
+ pAPStream = pAPDic->GetStreamBy(sAnnotState.AsByteStringC());
} else {
auto it = pAPDic->begin();
if (it != pAPDic->end()) {
@@ -487,7 +486,7 @@ DLLEXPORT int STDCALL FPDFPage_Flatten(FPDF_PAGE page, int nFlag) {
CFX_ByteString sFormName;
sFormName.Format("F%d", i);
uint32_t dwObjNum = pDocument->AddIndirectObject(pObj);
- pXObject->SetAtReference(sFormName, pDocument, dwObjNum);
+ pXObject->SetAtReference(sFormName.AsByteStringC(), pDocument, dwObjNum);
CPDF_StreamAcc acc;
acc.LoadAllData(pNewXObject);
diff --git a/fpdfsdk/fpdfppo.cpp b/fpdfsdk/fpdfppo.cpp
index cab2c6c3e0..21d8c7d9ae 100644
--- a/fpdfsdk/fpdfppo.cpp
+++ b/fpdfsdk/fpdfppo.cpp
@@ -110,9 +110,9 @@ FX_BOOL CPDF_PageOrganizer::ExportPage(CPDF_Document* pSrcPDFDoc,
const CFX_ByteString& cbSrcKeyStr = it.first;
CPDF_Object* pObj = it.second;
if (cbSrcKeyStr.Compare(("Type")) && cbSrcKeyStr.Compare(("Parent"))) {
- if (pCurPageDict->KeyExist(cbSrcKeyStr))
- pCurPageDict->RemoveAt(cbSrcKeyStr);
- pCurPageDict->SetAt(cbSrcKeyStr, pObj->Clone());
+ if (pCurPageDict->KeyExist(cbSrcKeyStr.AsByteStringC()))
+ pCurPageDict->RemoveAt(cbSrcKeyStr.AsByteStringC());
+ pCurPageDict->SetAt(cbSrcKeyStr.AsByteStringC(), pObj->Clone());
}
}
@@ -229,7 +229,7 @@ FX_BOOL CPDF_PageOrganizer::UpdateReference(CPDF_Object* pObj,
}
if (pNextObj) {
if (!UpdateReference(pNextObj, pDoc, pObjNumberMap))
- pDict->RemoveAt(key);
+ pDict->RemoveAt(key.AsByteStringC());
} else {
return FALSE;
}
diff --git a/fpdfsdk/fsdk_baseannot.cpp b/fpdfsdk/fsdk_baseannot.cpp
index 07a47cdff9..249fd83fc8 100644
--- a/fpdfsdk/fsdk_baseannot.cpp
+++ b/fpdfsdk/fsdk_baseannot.cpp
@@ -831,24 +831,22 @@ void CPDFSDK_BAAnnot::WriteAppearance(const CFX_ByteString& sAPType,
if (sAPState.IsEmpty()) {
pParentDict = pAPDict;
- pStream = pAPDict->GetStreamBy(sAPType);
+ pStream = pAPDict->GetStreamBy(sAPType.AsByteStringC());
} else {
- CPDF_Dictionary* pAPTypeDict = pAPDict->GetDictBy(sAPType);
+ CPDF_Dictionary* pAPTypeDict = pAPDict->GetDictBy(sAPType.AsByteStringC());
if (!pAPTypeDict) {
pAPTypeDict = new CPDF_Dictionary;
- pAPDict->SetAt(sAPType, pAPTypeDict);
+ pAPDict->SetAt(sAPType.AsByteStringC(), pAPTypeDict);
}
-
pParentDict = pAPTypeDict;
- pStream = pAPTypeDict->GetStreamBy(sAPState);
+ pStream = pAPTypeDict->GetStreamBy(sAPState.AsByteStringC());
}
if (!pStream) {
pStream = new CPDF_Stream(nullptr, 0, nullptr);
-
CPDF_Document* pDoc = m_pPageView->GetPDFDocument();
int32_t objnum = pDoc->AddIndirectObject(pStream);
- pParentDict->SetAtReference(sAPType, pDoc, objnum);
+ pParentDict->SetAtReference(sAPType.AsByteStringC(), pDoc, objnum);
}
CPDF_Dictionary* pStreamDict = pStream->GetDict();
diff --git a/fpdfsdk/fsdk_baseform.cpp b/fpdfsdk/fsdk_baseform.cpp
index be92b4a7e2..d195d87fc1 100644
--- a/fpdfsdk/fsdk_baseform.cpp
+++ b/fpdfsdk/fsdk_baseform.cpp
@@ -466,7 +466,7 @@ FX_BOOL CPDFSDK_Widget::IsWidgetAppearanceValid(
case FIELDTYPE_CHECKBOX:
case FIELDTYPE_RADIOBUTTON:
if (CPDF_Dictionary* pSubDict = psub->AsDictionary()) {
- return pSubDict->GetStreamBy(GetAppState()) != NULL;
+ return !!pSubDict->GetStreamBy(GetAppState().AsByteStringC());
}
return FALSE;
}
@@ -1813,7 +1813,7 @@ void CPDFSDK_Widget::AddImageToAppearance(const CFX_ByteString& sAPType,
ASSERT(pDoc);
CPDF_Dictionary* pAPDict = m_pAnnot->GetAnnotDict()->GetDictBy("AP");
- CPDF_Stream* pStream = pAPDict->GetStreamBy(sAPType);
+ CPDF_Stream* pStream = pAPDict->GetStreamBy(sAPType.AsByteStringC());
CPDF_Dictionary* pStreamDict = pStream->GetDict();
CFX_ByteString sImageAlias = "IMG";
@@ -1831,14 +1831,14 @@ void CPDFSDK_Widget::AddImageToAppearance(const CFX_ByteString& sAPType,
if (pStreamResList) {
CPDF_Dictionary* pXObject = new CPDF_Dictionary;
- pXObject->SetAtReference(sImageAlias, pDoc, pImage);
+ pXObject->SetAtReference(sImageAlias.AsByteStringC(), pDoc, pImage);
pStreamResList->SetAt("XObject", pXObject);
}
}
void CPDFSDK_Widget::RemoveAppearance(const CFX_ByteString& sAPType) {
if (CPDF_Dictionary* pAPDict = m_pAnnot->GetAnnotDict()->GetDictBy("AP")) {
- pAPDict->RemoveAt(sAPType);
+ pAPDict->RemoveAt(sAPType.AsByteStringC());
}
}
diff --git a/fpdfsdk/fsdk_mgr.cpp b/fpdfsdk/fsdk_mgr.cpp
index 323128c9fe..cc228eb8b9 100644
--- a/fpdfsdk/fsdk_mgr.cpp
+++ b/fpdfsdk/fsdk_mgr.cpp
@@ -186,7 +186,7 @@ FX_BOOL CFX_SystemHandler::FindNativeTrueTypeFont(
pFontMapper->LoadInstalledFonts();
for (const auto& font : pFontMapper->m_InstalledTTFonts) {
- if (font.Compare(sFontFaceName))
+ if (font.Compare(sFontFaceName.AsByteStringC()))
return TRUE;
}
diff --git a/fpdfsdk/fxedit/fxet_pageobjs.cpp b/fpdfsdk/fxedit/fxet_pageobjs.cpp
index 3f32d9d3e1..1133cab796 100644
--- a/fpdfsdk/fxedit/fxet_pageobjs.cpp
+++ b/fpdfsdk/fxedit/fxet_pageobjs.cpp
@@ -246,7 +246,8 @@ void IFX_Edit::DrawEdit(CFX_RenderDevice* pDevice,
}
sTextBuf << GetPDFWordString(pFontMap, word.nFontIndex, word.Word,
- SubWord);
+ SubWord)
+ .AsByteStringC();
} else {
DrawTextString(
pDevice, CFX_FloatPoint(word.ptWord.x + ptOffset.x,
@@ -359,7 +360,8 @@ void IFX_Edit::DrawRichEdit(CFX_RenderDevice* pDevice,
}
sTextBuf << GetPDFWordString(pFontMap, word.WordProps.nFontIndex,
- word.Word, 0);
+ word.Word, 0)
+ .AsByteStringC();
if (word.WordProps.nWordStyle & PVTWORD_STYLE_UNDERLINE) {
CFX_PathData pathUnderline;
@@ -502,7 +504,8 @@ void IFX_Edit::GeneratePageObjects(
nOldFontIndex = word.nFontIndex;
}
- sTextBuf << GetPDFWordString(pFontMap, word.nFontIndex, word.Word, 0);
+ sTextBuf << GetPDFWordString(pFontMap, word.nFontIndex, word.Word, 0)
+ .AsByteStringC();
oldplace = place;
}
}
@@ -574,7 +577,8 @@ void IFX_Edit::GenerateRichPageObjects(
}
sTextBuf << GetPDFWordString(pFontMap, word.WordProps.nFontIndex,
- word.Word, 0);
+ word.Word, 0)
+ .AsByteStringC();
if (word.WordProps.nWordStyle & PVTWORD_STYLE_UNDERLINE) {
CFX_FloatRect rcUnderline = GetUnderLineRect(word);
diff --git a/fpdfsdk/pdfwindow/PWL_Edit.cpp b/fpdfsdk/pdfwindow/PWL_Edit.cpp
index f53f263470..64588f2dff 100644
--- a/fpdfsdk/pdfwindow/PWL_Edit.cpp
+++ b/fpdfsdk/pdfwindow/PWL_Edit.cpp
@@ -265,6 +265,7 @@ void CPWL_Edit::GetThisAppearanceStream(CFX_ByteTextBuf& sAppStream) {
case PBS_SOLID: {
sLine << "q\n" << GetBorderWidth() << " w\n"
<< CPWL_Utils::GetColorAppStream(GetBorderColor(), FALSE)
+ .AsByteStringC()
<< " 2 J 0 j\n";
for (int32_t i = 1; i < nCharArray; i++) {
@@ -281,6 +282,7 @@ void CPWL_Edit::GetThisAppearanceStream(CFX_ByteTextBuf& sAppStream) {
case PBS_DASH: {
sLine << "q\n" << GetBorderWidth() << " w\n"
<< CPWL_Utils::GetColorAppStream(GetBorderColor(), FALSE)
+ .AsByteStringC()
<< " 2 J 0 j\n"
<< "[" << GetBorderDash().nDash << " " << GetBorderDash().nGap
<< "] " << GetBorderDash().nPhase << " d\n";
@@ -319,7 +321,8 @@ void CPWL_Edit::GetThisAppearanceStream(CFX_ByteTextBuf& sAppStream) {
if (sEditSel.GetLength() > 0)
sText << CPWL_Utils::GetColorAppStream(PWL_DEFAULT_SELBACKCOLOR)
- << sEditSel;
+ .AsByteStringC()
+ << sEditSel.AsByteStringC();
wrTemp = CPWL_Utils::OverlapWordRange(wrVisible, wrSelBefore);
CFX_ByteString sEditBefore = CPWL_Utils::GetEditAppStream(
@@ -327,8 +330,9 @@ void CPWL_Edit::GetThisAppearanceStream(CFX_ByteTextBuf& sAppStream) {
m_pEdit->GetPasswordChar());
if (sEditBefore.GetLength() > 0)
- sText << "BT\n" << CPWL_Utils::GetColorAppStream(GetTextColor())
- << sEditBefore << "ET\n";
+ sText << "BT\n"
+ << CPWL_Utils::GetColorAppStream(GetTextColor()).AsByteStringC()
+ << sEditBefore.AsByteStringC() << "ET\n";
wrTemp = CPWL_Utils::OverlapWordRange(wrVisible, wrSelect);
CFX_ByteString sEditMid = CPWL_Utils::GetEditAppStream(
@@ -338,7 +342,8 @@ void CPWL_Edit::GetThisAppearanceStream(CFX_ByteTextBuf& sAppStream) {
if (sEditMid.GetLength() > 0)
sText << "BT\n"
<< CPWL_Utils::GetColorAppStream(CPWL_Color(COLORTYPE_GRAY, 1))
- << sEditMid << "ET\n";
+ .AsByteStringC()
+ << sEditMid.AsByteStringC() << "ET\n";
wrTemp = CPWL_Utils::OverlapWordRange(wrVisible, wrSelAfter);
CFX_ByteString sEditAfter = CPWL_Utils::GetEditAppStream(
@@ -346,8 +351,9 @@ void CPWL_Edit::GetThisAppearanceStream(CFX_ByteTextBuf& sAppStream) {
m_pEdit->GetPasswordChar());
if (sEditAfter.GetLength() > 0)
- sText << "BT\n" << CPWL_Utils::GetColorAppStream(GetTextColor())
- << sEditAfter << "ET\n";
+ sText << "BT\n"
+ << CPWL_Utils::GetColorAppStream(GetTextColor()).AsByteStringC()
+ << sEditAfter.AsByteStringC() << "ET\n";
if (HasFlag(PES_SPELLCHECK)) {
CFX_ByteString sSpellCheck = CPWL_Utils::GetSpellCheckAppStream(
@@ -355,7 +361,8 @@ void CPWL_Edit::GetThisAppearanceStream(CFX_ByteTextBuf& sAppStream) {
if (sSpellCheck.GetLength() > 0)
sText << CPWL_Utils::GetColorAppStream(CPWL_Color(COLORTYPE_RGB, 1, 0, 0),
FALSE)
- << sSpellCheck;
+ .AsByteStringC()
+ << sSpellCheck.AsByteStringC();
}
if (sText.GetLength() > 0) {
@@ -742,8 +749,9 @@ CFX_ByteString CPWL_Edit::GetTextAppearanceStream(
CFX_ByteString sEdit = CPWL_Utils::GetEditAppStream(m_pEdit, ptOffset);
if (sEdit.GetLength() > 0) {
- sRet << "BT\n" << CPWL_Utils::GetColorAppStream(GetTextColor()) << sEdit
- << "ET\n";
+ sRet << "BT\n"
+ << CPWL_Utils::GetColorAppStream(GetTextColor()).AsByteStringC()
+ << sEdit.AsByteStringC() << "ET\n";
}
return sRet.GetByteString();
diff --git a/fpdfsdk/pdfwindow/PWL_Icon.cpp b/fpdfsdk/pdfwindow/PWL_Icon.cpp
index 560f8e0e32..69f9e599da 100644
--- a/fpdfsdk/pdfwindow/PWL_Icon.cpp
+++ b/fpdfsdk/pdfwindow/PWL_Icon.cpp
@@ -42,7 +42,7 @@ CFX_ByteString CPWL_Image::GetImageAppStream() {
sAppStream << mt.GetA() << " " << mt.GetB() << " " << mt.GetC() << " "
<< mt.GetD() << " " << mt.GetE() << " " << mt.GetF() << " cm\n";
- sAppStream << "0 g 0 G 1 w /" << sAlias << " Do\n"
+ sAppStream << "0 g 0 G 1 w /" << sAlias.AsByteStringC() << " Do\n"
<< "Q\n";
}
diff --git a/fpdfsdk/pdfwindow/PWL_Label.cpp b/fpdfsdk/pdfwindow/PWL_Label.cpp
index cfbeb4362c..8c5b0676d7 100644
--- a/fpdfsdk/pdfwindow/PWL_Label.cpp
+++ b/fpdfsdk/pdfwindow/PWL_Label.cpp
@@ -118,7 +118,8 @@ CFX_FloatRect CPWL_Label::GetContentRect() const {
void CPWL_Label::GetThisAppearanceStream(CFX_ByteTextBuf& sAppStream) {
CPWL_Wnd::GetThisAppearanceStream(sAppStream);
- sAppStream << GetTextAppearanceStream(CFX_FloatPoint(0.0f, 0.0f));
+ sAppStream << GetTextAppearanceStream(CFX_FloatPoint(0.0f, 0.0f))
+ .AsByteStringC();
}
CFX_ByteString CPWL_Label::GetTextAppearanceStream(
@@ -127,8 +128,9 @@ CFX_ByteString CPWL_Label::GetTextAppearanceStream(
CFX_ByteString sEdit = CPWL_Utils::GetEditAppStream(m_pEdit, ptOffset);
if (sEdit.GetLength() > 0) {
- sRet << "BT\n" << CPWL_Utils::GetColorAppStream(GetTextColor()) << sEdit
- << "ET\n";
+ sRet << "BT\n"
+ << CPWL_Utils::GetColorAppStream(GetTextColor()).AsByteStringC()
+ << sEdit.AsByteStringC() << "ET\n";
}
return sRet.GetByteString();
diff --git a/fpdfsdk/pdfwindow/PWL_ListBox.cpp b/fpdfsdk/pdfwindow/PWL_ListBox.cpp
index d39d8419a6..ccccc77dcd 100644
--- a/fpdfsdk/pdfwindow/PWL_ListBox.cpp
+++ b/fpdfsdk/pdfwindow/PWL_ListBox.cpp
@@ -118,21 +118,25 @@ void CPWL_ListBox::GetThisAppearanceStream(CFX_ByteTextBuf& sAppStream) {
CFX_FloatPoint ptOffset(rcItem.left, (rcItem.top + rcItem.bottom) * 0.5f);
if (m_pList->IsItemSelected(i)) {
- sListItems << CPWL_Utils::GetRectFillAppStream(
- rcItem, PWL_DEFAULT_SELBACKCOLOR);
+ sListItems << CPWL_Utils::GetRectFillAppStream(rcItem,
+ PWL_DEFAULT_SELBACKCOLOR)
+ .AsByteStringC();
CFX_ByteString sItem =
CPWL_Utils::GetEditAppStream(m_pList->GetItemEdit(i), ptOffset);
if (sItem.GetLength() > 0) {
sListItems << "BT\n"
<< CPWL_Utils::GetColorAppStream(PWL_DEFAULT_SELTEXTCOLOR)
- << sItem << "ET\n";
+ .AsByteStringC()
+ << sItem.AsByteStringC() << "ET\n";
}
} else {
CFX_ByteString sItem =
CPWL_Utils::GetEditAppStream(m_pList->GetItemEdit(i), ptOffset);
if (sItem.GetLength() > 0) {
- sListItems << "BT\n" << CPWL_Utils::GetColorAppStream(GetTextColor())
- << sItem << "ET\n";
+ sListItems << "BT\n"
+ << CPWL_Utils::GetColorAppStream(GetTextColor())
+ .AsByteStringC()
+ << sItem.AsByteStringC() << "ET\n";
}
}
}
diff --git a/fpdfsdk/pdfwindow/PWL_ScrollBar.cpp b/fpdfsdk/pdfwindow/PWL_ScrollBar.cpp
index 9db2aea35b..a96cf5f2a5 100644
--- a/fpdfsdk/pdfwindow/PWL_ScrollBar.cpp
+++ b/fpdfsdk/pdfwindow/PWL_ScrollBar.cpp
@@ -670,7 +670,8 @@ void CPWL_ScrollBar::GetThisAppearanceStream(CFX_ByteTextBuf& sAppStream) {
sButton << "q\n";
sButton << "0 w\n"
- << CPWL_Utils::GetColorAppStream(GetBackgroundColor(), TRUE);
+ << CPWL_Utils::GetColorAppStream(GetBackgroundColor(), TRUE)
+ .AsByteStringC();
sButton << rectWnd.left << " " << rectWnd.bottom << " "
<< rectWnd.right - rectWnd.left << " "
<< rectWnd.top - rectWnd.bottom << " re b Q\n";
diff --git a/fpdfsdk/pdfwindow/PWL_Signature.cpp b/fpdfsdk/pdfwindow/PWL_Signature.cpp
index 72b6ebe7c3..221922972f 100644
--- a/fpdfsdk/pdfwindow/PWL_Signature.cpp
+++ b/fpdfsdk/pdfwindow/PWL_Signature.cpp
@@ -42,7 +42,7 @@ void CPWL_Signature_Image::DrawThisAppearance(CFX_RenderDevice* pDevice,
void CPWL_Signature_Image::GetThisAppearanceStream(
CFX_ByteTextBuf& sAppStream) {
- sAppStream << CPWL_Image::GetImageAppStream();
+ sAppStream << CPWL_Image::GetImageAppStream().AsByteStringC();
}
void CPWL_Signature_Image::GetScale(FX_FLOAT& fHScale, FX_FLOAT& fVScale) {
diff --git a/xfa/fee/fde_txtedtengine.cpp b/xfa/fee/fde_txtedtengine.cpp
index d397afd7e3..19b5b24311 100644
--- a/xfa/fee/fde_txtedtengine.cpp
+++ b/xfa/fee/fde_txtedtengine.cpp
@@ -391,7 +391,7 @@ int32_t CFDE_TxtEdtEngine::Insert(int32_t nStart,
new CFDE_TxtEdtDoRecord_Insert(this, m_nCaret, lpBuffer, nLength);
CFX_ByteString bsDoRecord;
pRecord->Serialize(bsDoRecord);
- m_Param.pEventSink->On_AddDoRecord(this, bsDoRecord);
+ m_Param.pEventSink->On_AddDoRecord(this, bsDoRecord.AsByteStringC());
pRecord->Release();
}
GetText(m_ChangeInfo.wsPrevText, 0);
@@ -454,7 +454,7 @@ int32_t CFDE_TxtEdtEngine::Delete(int32_t nStart, FX_BOOL bBackspace) {
new CFDE_TxtEdtDoRecord_DeleteRange(this, nStart, m_nCaret, wsRange);
CFX_ByteString bsDoRecord;
pRecord->Serialize(bsDoRecord);
- m_Param.pEventSink->On_AddDoRecord(this, bsDoRecord);
+ m_Param.pEventSink->On_AddDoRecord(this, bsDoRecord.AsByteStringC());
pRecord->Release();
}
m_ChangeInfo.nChangeType = FDE_TXTEDT_TEXTCHANGE_TYPE_Delete;
@@ -944,7 +944,7 @@ void CFDE_TxtEdtEngine::DeleteRange_DoRecord(int32_t nStart,
this, nStart, m_nCaret, wsRange, bSel);
CFX_ByteString bsDoRecord;
pRecord->Serialize(bsDoRecord);
- m_Param.pEventSink->On_AddDoRecord(this, bsDoRecord);
+ m_Param.pEventSink->On_AddDoRecord(this, bsDoRecord.AsByteStringC());
pRecord->Release();
}
m_ChangeInfo.nChangeType = FDE_TXTEDT_TEXTCHANGE_TYPE_Delete;
diff --git a/xfa/fgas/localization/fgas_locale.cpp b/xfa/fgas/localization/fgas_locale.cpp
index 2d72454038..8cf80ce4f1 100644
--- a/xfa/fgas/localization/fgas_locale.cpp
+++ b/xfa/fgas/localization/fgas_locale.cpp
@@ -111,12 +111,12 @@ void CFX_Locale::GetNumbericSymbol(FX_LOCALENUMSYMBOL eType,
CFX_ByteString bsSpace;
CFX_WideString wsName = gs_LocalNumberSymbols[eType];
CXML_Element* pNumberSymbols =
- m_pElement->GetElement(bsSpace, "numberSymbols");
+ m_pElement->GetElement(bsSpace.AsByteStringC(), "numberSymbols");
if (!pNumberSymbols) {
return;
}
- wsNumSymbol =
- FX_GetXMLContent(bsSpace, pNumberSymbols, "numberSymbol", wsName);
+ wsNumSymbol = FX_GetXMLContent(bsSpace.AsByteStringC(), pNumberSymbols,
+ "numberSymbol", wsName);
}
void CFX_Locale::GetDateTimeSymbols(CFX_WideString& wsDtSymbol) const {
if (!m_pElement) {
@@ -124,7 +124,7 @@ void CFX_Locale::GetDateTimeSymbols(CFX_WideString& wsDtSymbol) const {
}
CFX_ByteString bsSpace;
CXML_Element* pNumberSymbols =
- m_pElement->GetElement(bsSpace, "dateTimeSymbols");
+ m_pElement->GetElement(bsSpace.AsByteStringC(), "dateTimeSymbols");
if (!pNumberSymbols) {
return;
}
@@ -137,20 +137,23 @@ static void FX_GetCalendarSymbol(CXML_Element* pXmlElement,
CFX_WideString& wsName) {
CFX_ByteString bsSpace;
CFX_ByteString pstrSymbolNames = symbol_type + "Names";
- CXML_Element* pChild = pXmlElement->GetElement(bsSpace, "calendarSymbols");
+ CXML_Element* pChild =
+ pXmlElement->GetElement(bsSpace.AsByteStringC(), "calendarSymbols");
if (!pChild) {
return;
}
- CXML_Element* pSymbolNames = pChild->GetElement(bsSpace, pstrSymbolNames);
+ CXML_Element* pSymbolNames = pChild->GetElement(
+ bsSpace.AsByteStringC(), pstrSymbolNames.AsByteStringC());
if (!pSymbolNames) {
return;
}
if (pSymbolNames->GetAttrInteger("abbr") != bAbbr) {
- pSymbolNames = pChild->GetElement(bsSpace, pstrSymbolNames, 1);
+ pSymbolNames = pChild->GetElement(bsSpace.AsByteStringC(),
+ pstrSymbolNames.AsByteStringC(), 1);
}
if (pSymbolNames && pSymbolNames->GetAttrInteger("abbr") == bAbbr) {
- CXML_Element* pSymbolName =
- pSymbolNames->GetElement(bsSpace, symbol_type, index);
+ CXML_Element* pSymbolName = pSymbolNames->GetElement(
+ bsSpace.AsByteStringC(), symbol_type.AsByteStringC(), index);
if (pSymbolName) {
wsName = pSymbolName->GetContent(0);
}
@@ -228,13 +231,13 @@ static void FX_GetPattern(CXML_Element* pXmlElement,
const CFX_WideString& wsSubCategory,
CFX_WideString& wsPattern) {
CFX_ByteString bsSpace;
- CXML_Element* pDatePatterns =
- pXmlElement->GetElement(bsSpace, bsCategory + "s");
+ CXML_Element* pDatePatterns = pXmlElement->GetElement(
+ bsSpace.AsByteStringC(), (bsCategory + "s").AsByteStringC());
if (!pDatePatterns) {
return;
}
- wsPattern =
- FX_GetXMLContent(bsSpace, pDatePatterns, bsCategory, wsSubCategory);
+ wsPattern = FX_GetXMLContent(bsSpace.AsByteStringC(), pDatePatterns,
+ bsCategory.AsByteStringC(), wsSubCategory);
}
static void FX_GetDateTimePattern(CXML_Element* pXmlElement,
const CFX_ByteString& bsCategory,
diff --git a/xfa/fwl/basewidget/fwl_editimp.cpp b/xfa/fwl/basewidget/fwl_editimp.cpp
index d5aa2c0507..008936c90e 100644
--- a/xfa/fwl/basewidget/fwl_editimp.cpp
+++ b/xfa/fwl/basewidget/fwl_editimp.cpp
@@ -734,14 +734,14 @@ FX_BOOL CFWL_EditImp::Undo() {
return FALSE;
}
CFX_ByteString bsRecord = m_RecordArr[m_iCurRecord--];
- return Undo(bsRecord);
+ return Undo(bsRecord.AsByteStringC());
}
FX_BOOL CFWL_EditImp::Redo() {
if (!CanRedo()) {
return FALSE;
}
CFX_ByteString bsRecord = m_RecordArr[++m_iCurRecord];
- return Redo(bsRecord);
+ return Redo(bsRecord.AsByteStringC());
}
FX_BOOL CFWL_EditImp::CanUndo() {
return m_iCurRecord >= 0;
diff --git a/xfa/fxbarcode/oned/BC_OnedCodaBarReader.cpp b/xfa/fxbarcode/oned/BC_OnedCodaBarReader.cpp
index 5f8a0c25aa..f767ffa169 100644
--- a/xfa/fxbarcode/oned/BC_OnedCodaBarReader.cpp
+++ b/xfa/fxbarcode/oned/BC_OnedCodaBarReader.cpp
@@ -106,7 +106,8 @@ CFX_ByteString CBC_OnedCodaBarReader::DecodeRow(int32_t rowNumber,
}
}
if (result.GetLength() < 5) {
- int32_t index = temp.Find(result.Mid(1, result.GetLength() - 1));
+ int32_t index =
+ temp.Find(result.Mid(1, result.GetLength() - 1).AsByteStringC());
if (index == len - (result.GetLength() - 1)) {
e = BCExceptionNotFound;
return "";
diff --git a/xfa/fxfa/app/xfa_checksum.cpp b/xfa/fxfa/app/xfa_checksum.cpp
index aac5456b63..c76ec505e9 100644
--- a/xfa/fxfa/app/xfa_checksum.cpp
+++ b/xfa/fxfa/app/xfa_checksum.cpp
@@ -73,7 +73,7 @@ void CXFA_SAXReaderHandler::OnTagClose(void* pTag, uint32_t dwEndPos) {
if (pSAXContext->m_eNode == FX_SAXNODE_Instruction) {
textBuf << "?>";
} else if (pSAXContext->m_eNode == FX_SAXNODE_Tag) {
- textBuf << "></" << pSAXContext->m_bsTagName << ">";
+ textBuf << "></" << pSAXContext->m_bsTagName.AsByteStringC() << ">";
}
UpdateChecksum(FALSE);
}
diff --git a/xfa/fxfa/app/xfa_fftextedit.cpp b/xfa/fxfa/app/xfa_fftextedit.cpp
index 085ec07d9f..fa530169e0 100644
--- a/xfa/fxfa/app/xfa_fftextedit.cpp
+++ b/xfa/fxfa/app/xfa_fftextedit.cpp
@@ -420,13 +420,13 @@ FWL_ERR CXFA_FFTextEdit::OnProcessEvent(CFWL_Event* pEvent) {
case FWL_EVTHASH_EDT_CheckWord: {
CFX_WideString wstr(L"FWL_EVENT_DTP_SelectChanged");
CFWL_EvtEdtCheckWord* event = (CFWL_EvtEdtCheckWord*)pEvent;
- event->bCheckWord = CheckWord(event->bsWord);
+ event->bCheckWord = CheckWord(event->bsWord.AsByteStringC());
break;
}
case FWL_EVTHASH_EDT_GetSuggestWords: {
CFWL_EvtEdtGetSuggestWords* event = (CFWL_EvtEdtGetSuggestWords*)pEvent;
- event->bSuggestWords =
- GetSuggestWords(event->bsWord, event->bsArraySuggestWords);
+ event->bSuggestWords = GetSuggestWords(event->bsWord.AsByteStringC(),
+ event->bsArraySuggestWords);
break;
}
default: {}
diff --git a/xfa/fxfa/app/xfa_fontmgr.cpp b/xfa/fxfa/app/xfa_fontmgr.cpp
index e915dcbaf7..b9cfd6fb28 100644
--- a/xfa/fxfa/app/xfa_fontmgr.cpp
+++ b/xfa/fxfa/app/xfa_fontmgr.cpp
@@ -1861,7 +1861,8 @@ IFX_Font* CXFA_PDFFontMgr::FindFont(CFX_ByteString strPsName,
for (const auto& it : *pFontSetDict) {
const CFX_ByteString& key = it.first;
CPDF_Object* pObj = it.second;
- if (!PsNameMatchDRFontName(strPsName, bBold, bItalic, key, bStrictMatch)) {
+ if (!PsNameMatchDRFontName(strPsName.AsByteStringC(), bBold, bItalic, key,
+ bStrictMatch)) {
continue;
}
CPDF_Object* pDirect = pObj->GetDirect();
diff --git a/xfa/fxfa/fm2js/xfa_fm2jscontext.cpp b/xfa/fxfa/fm2js/xfa_fm2jscontext.cpp
index 73eaed6f5b..97eadbd3d5 100644
--- a/xfa/fxfa/fm2js/xfa_fm2jscontext.cpp
+++ b/xfa/fxfa/fm2js/xfa_fm2jscontext.cpp
@@ -315,8 +315,8 @@ void CXFA_FM2JSContext::Avg(FXJSE_HOBJECT hThis,
FXJSE_HVALUE newPropertyValue = FXJSE_Value_Create(hruntime);
for (int32_t j = 2; j < iLength; j++) {
FXJSE_Value_GetObjectPropByIdx(argValue, j, jsObjectValue);
- FXJSE_Value_GetObjectProp(jsObjectValue, propertyStr,
- newPropertyValue);
+ FXJSE_Value_GetObjectProp(
+ jsObjectValue, propertyStr.AsByteStringC(), newPropertyValue);
if (!FXJSE_Value_IsNull(newPropertyValue)) {
dSum += HValueToDouble(hThis, newPropertyValue);
uCount++;
@@ -398,8 +398,8 @@ void CXFA_FM2JSContext::Count(FXJSE_HOBJECT hThis,
FXJSE_Value_ToUTF8String(propertyValue, propertyStr);
for (int32_t i = 2; i < iLength; i++) {
FXJSE_Value_GetObjectPropByIdx(argValue, i, jsObjectValue);
- FXJSE_Value_GetObjectProp(jsObjectValue, propertyStr,
- newPropertyValue);
+ FXJSE_Value_GetObjectProp(
+ jsObjectValue, propertyStr.AsByteStringC(), newPropertyValue);
uCount += (FXJSE_Value_IsNull(newPropertyValue) ? 0 : 1);
}
}
@@ -490,8 +490,8 @@ void CXFA_FM2JSContext::Max(FXJSE_HOBJECT hThis,
FXJSE_Value_ToUTF8String(propertyValue, propertyStr);
for (int32_t i = 2; i < iLength; i++) {
FXJSE_Value_GetObjectPropByIdx(argValue, i, jsObjectValue);
- FXJSE_Value_GetObjectProp(jsObjectValue, propertyStr,
- newPropertyValue);
+ FXJSE_Value_GetObjectProp(
+ jsObjectValue, propertyStr.AsByteStringC(), newPropertyValue);
if (!FXJSE_Value_IsNull(newPropertyValue)) {
uCount++;
if (uCount == 1) {
@@ -593,8 +593,8 @@ void CXFA_FM2JSContext::Min(FXJSE_HOBJECT hThis,
FXJSE_Value_ToUTF8String(propertyValue, propertyStr);
for (int32_t i = 2; i < iLength; i++) {
FXJSE_Value_GetObjectPropByIdx(argValue, i, jsObjectValue);
- FXJSE_Value_GetObjectProp(jsObjectValue, propertyStr,
- newPropertyValue);
+ FXJSE_Value_GetObjectProp(
+ jsObjectValue, propertyStr.AsByteStringC(), newPropertyValue);
if (!FXJSE_Value_IsNull(newPropertyValue)) {
uCount++;
if (uCount == 1) {
@@ -679,8 +679,8 @@ void CXFA_FM2JSContext::Mod(FXJSE_HOBJECT hThis,
CFX_ByteString propertyStr;
FXJSE_Value_ToUTF8String(propertyValue, propertyStr);
FXJSE_HVALUE newPropertyValue = FXJSE_Value_Create(hruntime);
- FXJSE_Value_GetObjectProp(jsObjectValue, propertyStr,
- newPropertyValue);
+ FXJSE_Value_GetObjectProp(
+ jsObjectValue, propertyStr.AsByteStringC(), newPropertyValue);
dDividend = HValueToDouble(hThis, newPropertyValue);
FXJSE_Value_Release(newPropertyValue);
}
@@ -708,8 +708,8 @@ void CXFA_FM2JSContext::Mod(FXJSE_HOBJECT hThis,
CFX_ByteString propertyStr;
FXJSE_Value_ToUTF8String(propertyValue, propertyStr);
FXJSE_HVALUE newPropertyValue = FXJSE_Value_Create(hruntime);
- FXJSE_Value_GetObjectProp(jsObjectValue, propertyStr,
- newPropertyValue);
+ FXJSE_Value_GetObjectProp(
+ jsObjectValue, propertyStr.AsByteStringC(), newPropertyValue);
dDividor = HValueToDouble(hThis, newPropertyValue);
FXJSE_Value_Release(newPropertyValue);
}
@@ -761,7 +761,7 @@ void CXFA_FM2JSContext::Round(FXJSE_HOBJECT hThis,
CFX_ByteString propertyStr;
FXJSE_Value_ToUTF8String(propertyValue, propertyStr);
FXJSE_HVALUE newPropertyValue = FXJSE_Value_Create(hruntime);
- FXJSE_Value_GetObjectProp(jsObjectValue, propertyStr,
+ FXJSE_Value_GetObjectProp(jsObjectValue, propertyStr.AsByteStringC(),
newPropertyValue);
dValue = HValueToDouble(hThis, newPropertyValue);
FXJSE_Value_Release(newPropertyValue);
@@ -773,7 +773,8 @@ void CXFA_FM2JSContext::Round(FXJSE_HOBJECT hThis,
}
CFX_Decimal decimalValue((FX_FLOAT)dValue, uPrecision);
CFX_WideString wsValue = decimalValue;
- FXJSE_Value_SetUTF8String(args.GetReturnValue(), wsValue.UTF8Encode());
+ FXJSE_Value_SetUTF8String(args.GetReturnValue(),
+ wsValue.UTF8Encode().AsByteStringC());
}
FXJSE_Value_Release(argOne);
} else if (argc == 2) {
@@ -794,7 +795,7 @@ void CXFA_FM2JSContext::Round(FXJSE_HOBJECT hThis,
CFX_ByteString propertyStr;
FXJSE_Value_ToUTF8String(propertyValue, propertyStr);
FXJSE_HVALUE newPropertyValue = FXJSE_Value_Create(hruntime);
- FXJSE_Value_GetObjectProp(jsObjectValue, propertyStr,
+ FXJSE_Value_GetObjectProp(jsObjectValue, propertyStr.AsByteStringC(),
newPropertyValue);
dValue = HValueToDouble(hThis, newPropertyValue);
FXJSE_Value_Release(newPropertyValue);
@@ -816,7 +817,7 @@ void CXFA_FM2JSContext::Round(FXJSE_HOBJECT hThis,
CFX_ByteString propertyStr;
FXJSE_Value_ToUTF8String(propertyValue, propertyStr);
FXJSE_HVALUE newPropertyValue = FXJSE_Value_Create(hruntime);
- FXJSE_Value_GetObjectProp(jsObjectValue, propertyStr,
+ FXJSE_Value_GetObjectProp(jsObjectValue, propertyStr.AsByteStringC(),
newPropertyValue);
dPrecision = HValueToDouble(hThis, newPropertyValue);
FXJSE_Value_Release(newPropertyValue);
@@ -835,7 +836,8 @@ void CXFA_FM2JSContext::Round(FXJSE_HOBJECT hThis,
}
CFX_Decimal decimalValue((FX_FLOAT)dValue, uPrecision);
CFX_WideString wsValue = decimalValue;
- FXJSE_Value_SetUTF8String(args.GetReturnValue(), wsValue.UTF8Encode());
+ FXJSE_Value_SetUTF8String(args.GetReturnValue(),
+ wsValue.UTF8Encode().AsByteStringC());
}
FXJSE_Value_Release(argOne);
FXJSE_Value_Release(argTwo);
@@ -884,8 +886,8 @@ void CXFA_FM2JSContext::Sum(FXJSE_HOBJECT hThis,
FXJSE_Value_ToUTF8String(propertyValue, propertyStr);
for (int32_t j = 2; j < iLength; j++) {
FXJSE_Value_GetObjectPropByIdx(argValue, j, jsObjectValue);
- FXJSE_Value_GetObjectProp(jsObjectValue, propertyStr,
- newPropertyValue);
+ FXJSE_Value_GetObjectProp(
+ jsObjectValue, propertyStr.AsByteStringC(), newPropertyValue);
if (!FXJSE_Value_IsNull(newPropertyValue)) {
dSum += HValueToDouble(hThis, newPropertyValue);
uCount++;
@@ -935,7 +937,7 @@ void CXFA_FM2JSContext::Date(FXJSE_HOBJECT hThis,
bufferMon.Format("%02d", pTmStruct->tm_mon + 1);
bufferDay.Format("%02d", pTmStruct->tm_mday);
CFX_ByteString bufferCurrent = bufferYear + bufferMon + bufferDay;
- int32_t dDays = DateString2Num(bufferCurrent);
+ int32_t dDays = DateString2Num(bufferCurrent.AsByteStringC());
FXJSE_Value_SetInteger(args.GetReturnValue(), dDays);
} else {
CXFA_FM2JSContext* pContext =
@@ -979,11 +981,12 @@ void CXFA_FM2JSContext::Date2Num(FXJSE_HOBJECT hThis,
}
if (!bFlags) {
CFX_ByteString szIsoDateString;
- FX_BOOL bRet = Local2IsoDate(hThis, dateString, formatString, localString,
- szIsoDateString);
+ FX_BOOL bRet = Local2IsoDate(
+ hThis, dateString.AsByteStringC(), formatString.AsByteStringC(),
+ localString.AsByteStringC(), szIsoDateString);
if (bRet) {
FXJSE_Value_SetInteger(args.GetReturnValue(),
- DateString2Num(szIsoDateString));
+ DateString2Num(szIsoDateString.AsByteStringC()));
} else {
FXJSE_Value_SetInteger(args.GetReturnValue(), 0);
}
@@ -1034,11 +1037,12 @@ void CXFA_FM2JSContext::DateFmt(FXJSE_HOBJECT hThis,
}
if (!bFlags) {
CFX_ByteString formatStr;
- GetStandardDateFormat(hThis, iStyle, szLocal, formatStr);
+ GetStandardDateFormat(hThis, iStyle, szLocal.AsByteStringC(), formatStr);
if (formatStr.IsEmpty()) {
formatStr = "";
}
- FXJSE_Value_SetUTF8String(args.GetReturnValue(), formatStr);
+ FXJSE_Value_SetUTF8String(args.GetReturnValue(),
+ formatStr.AsByteStringC());
} else {
FXJSE_Value_SetNull(args.GetReturnValue());
}
@@ -1065,7 +1069,7 @@ void CXFA_FM2JSContext::IsoDate2Num(FXJSE_HOBJECT hThis,
} else {
CFX_ByteString szArgString;
HValueToUTF8String(argOne, szArgString);
- int32_t dDays = DateString2Num(szArgString);
+ int32_t dDays = DateString2Num(szArgString.AsByteStringC());
FXJSE_Value_SetInteger(args.GetReturnValue(), (int32_t)dDays);
}
FXJSE_Value_Release(argOne);
@@ -1164,11 +1168,13 @@ void CXFA_FM2JSContext::LocalDateFmt(FXJSE_HOBJECT hThis,
}
if (!bFlags) {
CFX_ByteString formatStr;
- GetLocalDateFormat(hThis, iStyle, szLocal, formatStr, FALSE);
+ GetLocalDateFormat(hThis, iStyle, szLocal.AsByteStringC(), formatStr,
+ FALSE);
if (formatStr.IsEmpty()) {
formatStr = "";
}
- FXJSE_Value_SetUTF8String(args.GetReturnValue(), formatStr);
+ FXJSE_Value_SetUTF8String(args.GetReturnValue(),
+ formatStr.AsByteStringC());
} else {
FXJSE_Value_SetNull(args.GetReturnValue());
}
@@ -1215,11 +1221,13 @@ void CXFA_FM2JSContext::LocalTimeFmt(FXJSE_HOBJECT hThis,
}
if (!bFlags) {
CFX_ByteString formatStr;
- GetLocalTimeFormat(hThis, iStyle, szLocal, formatStr, FALSE);
+ GetLocalTimeFormat(hThis, iStyle, szLocal.AsByteStringC(), formatStr,
+ FALSE);
if (formatStr.IsEmpty()) {
formatStr = "";
}
- FXJSE_Value_SetUTF8String(args.GetReturnValue(), formatStr);
+ FXJSE_Value_SetUTF8String(args.GetReturnValue(),
+ formatStr.AsByteStringC());
} else {
FXJSE_Value_SetNull(args.GetReturnValue());
}
@@ -1366,12 +1374,14 @@ void CXFA_FM2JSContext::Num2Date(FXJSE_HOBJECT hThis,
CFX_ByteString szIsoDateString;
szIsoDateString.Format("%d%02d%02d", iYear + i, iMonth, iDay);
CFX_ByteString szLocalDateString;
- IsoDate2Local(hThis, szIsoDateString, formatString, localString,
+ IsoDate2Local(hThis, szIsoDateString.AsByteStringC(),
+ formatString.AsByteStringC(), localString.AsByteStringC(),
szLocalDateString);
if (szLocalDateString.IsEmpty()) {
szLocalDateString = "";
}
- FXJSE_Value_SetUTF8String(args.GetReturnValue(), szLocalDateString);
+ FXJSE_Value_SetUTF8String(args.GetReturnValue(),
+ szLocalDateString.AsByteStringC());
} else {
FXJSE_Value_SetNull(args.GetReturnValue());
}
@@ -1427,12 +1437,13 @@ void CXFA_FM2JSContext::Num2GMTime(FXJSE_HOBJECT hThis,
}
if (!bFlags) {
CFX_ByteString szGMTTimeString;
- Num2AllTime(hThis, iTime, formatString, localString, TRUE,
- szGMTTimeString);
+ Num2AllTime(hThis, iTime, formatString.AsByteStringC(),
+ localString.AsByteStringC(), TRUE, szGMTTimeString);
if (szGMTTimeString.IsEmpty()) {
szGMTTimeString = "";
}
- FXJSE_Value_SetUTF8String(args.GetReturnValue(), szGMTTimeString);
+ FXJSE_Value_SetUTF8String(args.GetReturnValue(),
+ szGMTTimeString.AsByteStringC());
} else {
FXJSE_Value_SetNull(args.GetReturnValue());
}
@@ -1488,12 +1499,13 @@ void CXFA_FM2JSContext::Num2Time(FXJSE_HOBJECT hThis,
}
if (!bFlags) {
CFX_ByteString szLocalTimeString;
- Num2AllTime(hThis, (int32_t)fTime, formatString, localString, FALSE,
- szLocalTimeString);
+ Num2AllTime(hThis, (int32_t)fTime, formatString.AsByteStringC(),
+ localString.AsByteStringC(), FALSE, szLocalTimeString);
if (szLocalTimeString.IsEmpty()) {
szLocalTimeString = "";
}
- FXJSE_Value_SetUTF8String(args.GetReturnValue(), szLocalTimeString);
+ FXJSE_Value_SetUTF8String(args.GetReturnValue(),
+ szLocalTimeString.AsByteStringC());
} else {
FXJSE_Value_SetNull(args.GetReturnValue());
}
@@ -1666,11 +1678,12 @@ void CXFA_FM2JSContext::TimeFmt(FXJSE_HOBJECT hThis,
}
if (!bFlags) {
CFX_ByteString formatStr;
- GetStandardTimeFormat(hThis, iStyle, szLocal, formatStr);
+ GetStandardTimeFormat(hThis, iStyle, szLocal.AsByteStringC(), formatStr);
if (formatStr.IsEmpty()) {
formatStr = "";
}
- FXJSE_Value_SetUTF8String(args.GetReturnValue(), formatStr);
+ FXJSE_Value_SetUTF8String(args.GetReturnValue(),
+ formatStr.AsByteStringC());
} else {
FXJSE_Value_SetNull(args.GetReturnValue());
}
@@ -2486,9 +2499,11 @@ void CXFA_FM2JSContext::Num2AllTime(FXJSE_HOBJECT hThis,
CFX_ByteString strIsoTime;
strIsoTime.Format("%02d:%02d:%02d", iHour, iMin, iSec);
if (bGM) {
- iRet = GetGMTTime(hThis, strIsoTime, szFormat, szLocale, strTime);
+ iRet = GetGMTTime(hThis, strIsoTime.AsByteStringC(), szFormat, szLocale,
+ strTime);
} else {
- iRet = IsoTime2Local(hThis, strIsoTime, szFormat, szLocale, strTime);
+ iRet = IsoTime2Local(hThis, strIsoTime.AsByteStringC(), szFormat, szLocale,
+ strTime);
}
if (!iRet) {
strTime = "";
@@ -3072,11 +3087,13 @@ void CXFA_FM2JSContext::Choose(FXJSE_HOBJECT hThis,
} else {
CFX_ByteString propStr;
FXJSE_Value_ToUTF8String(propertyValue, propStr);
- FXJSE_Value_GetObjectProp(jsobjectValue, propStr, newProperty);
+ FXJSE_Value_GetObjectProp(jsobjectValue, propStr.AsByteStringC(),
+ newProperty);
}
CFX_ByteString bsChoosed;
HValueToUTF8String(newProperty, bsChoosed);
- FXJSE_Value_SetUTF8String(args.GetReturnValue(), bsChoosed);
+ FXJSE_Value_SetUTF8String(args.GetReturnValue(),
+ bsChoosed.AsByteStringC());
FXJSE_Value_Release(newProperty);
FXJSE_Value_Release(jsobjectValue);
FXJSE_Value_Release(propertyValue);
@@ -3087,7 +3104,8 @@ void CXFA_FM2JSContext::Choose(FXJSE_HOBJECT hThis,
if (iValueIndex == iIndex) {
CFX_ByteString bsChoosed;
HValueToUTF8String(argIndexValue, bsChoosed);
- FXJSE_Value_SetUTF8String(args.GetReturnValue(), bsChoosed);
+ FXJSE_Value_SetUTF8String(args.GetReturnValue(),
+ bsChoosed.AsByteStringC());
bFound = TRUE;
}
}
@@ -3197,9 +3215,10 @@ void CXFA_FM2JSContext::Within(FXJSE_HOBJECT hThis,
HValueToUTF8String(argOne, oneString);
HValueToUTF8String(argLow, lowString);
HValueToUTF8String(argHeight, heightString);
- FXJSE_Value_SetInteger(args.GetReturnValue(),
- ((oneString.Compare(lowString) >= 0) &&
- (oneString.Compare(heightString) <= 0)));
+ FXJSE_Value_SetInteger(
+ args.GetReturnValue(),
+ ((oneString.Compare(lowString.AsByteStringC()) >= 0) &&
+ (oneString.Compare(heightString.AsByteStringC()) <= 0)));
}
FXJSE_Value_Release(argLow);
FXJSE_Value_Release(argHeight);
@@ -3637,7 +3656,7 @@ void CXFA_FM2JSContext::At(FXJSE_HOBJECT hThis,
} else {
CFX_ByteString stringOne;
HValueToUTF8String(argOne, stringOne);
- FX_STRSIZE iPosition = stringOne.Find(stringTwo);
+ FX_STRSIZE iPosition = stringOne.Find(stringTwo.AsByteStringC());
FXJSE_Value_SetInteger(args.GetReturnValue(), iPosition + 1);
}
}
@@ -3674,7 +3693,8 @@ void CXFA_FM2JSContext::Concat(FXJSE_HOBJECT hThis,
if (bAllNull) {
FXJSE_Value_SetNull(args.GetReturnValue());
} else {
- FXJSE_Value_SetUTF8String(args.GetReturnValue(), resultString);
+ FXJSE_Value_SetUTF8String(args.GetReturnValue(),
+ resultString.AsByteStringC());
}
} else {
pContext->ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD,
@@ -3695,7 +3715,7 @@ void CXFA_FM2JSContext::Decode(FXJSE_HOBJECT hThis,
CFX_ByteString toDecodeString;
HValueToUTF8String(argOne, toDecodeString);
CFX_ByteTextBuf resultBuf;
- DecodeURL(toDecodeString, resultBuf);
+ DecodeURL(toDecodeString.AsByteStringC(), resultBuf);
FXJSE_Value_SetUTF8String(args.GetReturnValue(),
resultBuf.GetByteString());
}
@@ -3712,11 +3732,11 @@ void CXFA_FM2JSContext::Decode(FXJSE_HOBJECT hThis,
HValueToUTF8String(argTwo, identifyString);
CFX_ByteTextBuf resultBuf;
if (identifyString.EqualNoCase("html")) {
- DecodeHTML(toDecodeString, resultBuf);
+ DecodeHTML(toDecodeString.AsByteStringC(), resultBuf);
} else if (identifyString.EqualNoCase("xml")) {
- DecodeXML(toDecodeString, resultBuf);
+ DecodeXML(toDecodeString.AsByteStringC(), resultBuf);
} else {
- DecodeURL(toDecodeString, resultBuf);
+ DecodeURL(toDecodeString.AsByteStringC(), resultBuf);
}
FXJSE_Value_SetUTF8String(args.GetReturnValue(),
resultBuf.GetByteString());
@@ -3781,7 +3801,8 @@ void CXFA_FM2JSContext::DecodeURL(const CFX_ByteStringC& szURLString,
wsResultBuf.AppendChar(0);
szResultString.Clear();
szResultString << FX_UTF8Encode(wsResultBuf.GetBuffer(),
- wsResultBuf.GetLength());
+ wsResultBuf.GetLength())
+ .AsByteStringC();
}
void CXFA_FM2JSContext::DecodeHTML(const CFX_ByteStringC& szHTMLString,
CFX_ByteTextBuf& szResultString) {
@@ -3855,7 +3876,8 @@ void CXFA_FM2JSContext::DecodeHTML(const CFX_ByteStringC& szHTMLString,
wsResultBuf.AppendChar(0);
szResultString.Clear();
szResultString << FX_UTF8Encode(wsResultBuf.GetBuffer(),
- wsResultBuf.GetLength());
+ wsResultBuf.GetLength())
+ .AsByteStringC();
}
void CXFA_FM2JSContext::DecodeXML(const CFX_ByteStringC& szXMLString,
CFX_ByteTextBuf& szResultString) {
@@ -3952,7 +3974,8 @@ void CXFA_FM2JSContext::DecodeXML(const CFX_ByteStringC& szXMLString,
}
wsXMLBuf.AppendChar(0);
szResultString.Clear();
- szResultString << FX_UTF8Encode(wsXMLBuf.GetBuffer(), wsXMLBuf.GetLength());
+ szResultString << FX_UTF8Encode(wsXMLBuf.GetBuffer(), wsXMLBuf.GetLength())
+ .AsByteStringC();
}
void CXFA_FM2JSContext::Encode(FXJSE_HOBJECT hThis,
const CFX_ByteStringC& szFuncName,
@@ -3968,7 +3991,7 @@ void CXFA_FM2JSContext::Encode(FXJSE_HOBJECT hThis,
CFX_ByteString toEncodeString;
HValueToUTF8String(argOne, toEncodeString);
CFX_ByteTextBuf resultBuf;
- EncodeURL(toEncodeString, resultBuf);
+ EncodeURL(toEncodeString.AsByteStringC(), resultBuf);
FXJSE_Value_SetUTF8String(args.GetReturnValue(),
resultBuf.GetByteString());
}
@@ -3985,11 +4008,11 @@ void CXFA_FM2JSContext::Encode(FXJSE_HOBJECT hThis,
HValueToUTF8String(argTwo, identifyString);
CFX_ByteTextBuf resultBuf;
if (identifyString.EqualNoCase("html")) {
- EncodeHTML(toEncodeString, resultBuf);
+ EncodeHTML(toEncodeString.AsByteStringC(), resultBuf);
} else if (identifyString.EqualNoCase("xml")) {
- EncodeXML(toEncodeString, resultBuf);
+ EncodeXML(toEncodeString.AsByteStringC(), resultBuf);
} else {
- EncodeURL(toEncodeString, resultBuf);
+ EncodeURL(toEncodeString.AsByteStringC(), resultBuf);
}
FXJSE_Value_SetUTF8String(args.GetReturnValue(),
resultBuf.GetByteString());
@@ -4106,8 +4129,8 @@ void CXFA_FM2JSContext::EncodeURL(const CFX_ByteStringC& szURLString,
}
wsResultBuf.AppendChar(0);
szResultBuf.Clear();
- szResultBuf << FX_UTF8Encode(wsResultBuf.GetBuffer(),
- wsResultBuf.GetLength());
+ szResultBuf << FX_UTF8Encode(wsResultBuf.GetBuffer(), wsResultBuf.GetLength())
+ .AsByteStringC();
}
void CXFA_FM2JSContext::EncodeHTML(const CFX_ByteStringC& szHTMLString,
CFX_ByteTextBuf& szResultBuf) {
@@ -4160,8 +4183,8 @@ void CXFA_FM2JSContext::EncodeHTML(const CFX_ByteStringC& szHTMLString,
}
wsResultBuf.AppendChar(0);
szResultBuf.Clear();
- szResultBuf << FX_UTF8Encode(wsResultBuf.GetBuffer(),
- wsResultBuf.GetLength());
+ szResultBuf << FX_UTF8Encode(wsResultBuf.GetBuffer(), wsResultBuf.GetLength())
+ .AsByteStringC();
}
void CXFA_FM2JSContext::EncodeXML(const CFX_ByteStringC& szXMLString,
CFX_ByteTextBuf& szResultBuf) {
@@ -4242,8 +4265,8 @@ void CXFA_FM2JSContext::EncodeXML(const CFX_ByteStringC& szXMLString,
}
wsResultBuf.AppendChar(0);
szResultBuf.Clear();
- szResultBuf << FX_UTF8Encode(wsResultBuf.GetBuffer(),
- wsResultBuf.GetLength());
+ szResultBuf << FX_UTF8Encode(wsResultBuf.GetBuffer(), wsResultBuf.GetLength())
+ .AsByteStringC();
}
FX_BOOL CXFA_FM2JSContext::HTMLSTR2Code(const CFX_WideStringC& pData,
uint32_t& iCode) {
@@ -4392,7 +4415,8 @@ void CXFA_FM2JSContext::Format(FXJSE_HOBJECT hThis,
CXFA_WidgetData widgetData(pThisNode);
IFX_Locale* pLocale = widgetData.GetLocal();
uint32_t patternType;
- FX_BOOL bCompelte = XFA_PATTERN_STRING_Type(szPattern, patternType);
+ FX_BOOL bCompelte =
+ XFA_PATTERN_STRING_Type(szPattern.AsByteStringC(), patternType);
CFX_WideString wsPattern =
CFX_WideString::FromUTF8(szPattern, szPattern.GetLength());
CFX_WideString wsValue =
@@ -4448,8 +4472,9 @@ void CXFA_FM2JSContext::Format(FXJSE_HOBJECT hThis,
CFX_WideString wsRet;
if (localeValue.FormatPatterns(wsRet, wsPattern, pLocale,
XFA_VALUEPICTURE_Display)) {
- FXJSE_Value_SetUTF8String(args.GetReturnValue(),
- FX_UTF8Encode(wsRet, wsRet.GetLength()));
+ FXJSE_Value_SetUTF8String(
+ args.GetReturnValue(),
+ FX_UTF8Encode(wsRet, wsRet.GetLength()).AsByteStringC());
} else {
FXJSE_Value_SetUTF8String(args.GetReturnValue(), "");
}
@@ -4482,7 +4507,7 @@ void CXFA_FM2JSContext::Left(FXJSE_HOBJECT hThis,
count = 0;
}
FXJSE_Value_SetUTF8String(args.GetReturnValue(),
- sourceString.Left(count));
+ sourceString.Left(count).AsByteStringC());
}
FXJSE_Value_Release(argOne);
FXJSE_Value_Release(argTwo);
@@ -4548,7 +4573,8 @@ void CXFA_FM2JSContext::Lower(FXJSE_HOBJECT hThis,
lowStringBuf.AppendChar(0);
FXJSE_Value_SetUTF8String(
args.GetReturnValue(),
- FX_UTF8Encode(lowStringBuf.GetBuffer(), lowStringBuf.GetLength()));
+ FX_UTF8Encode(lowStringBuf.GetBuffer(), lowStringBuf.GetLength())
+ .AsByteStringC());
if (argc == 2) {
FXJSE_Value_Release(localeValue);
}
@@ -4574,7 +4600,8 @@ void CXFA_FM2JSContext::Ltrim(FXJSE_HOBJECT hThis,
CFX_ByteString sourceString;
HValueToUTF8String(argOne, sourceString);
sourceString.TrimLeft();
- FXJSE_Value_SetUTF8String(args.GetReturnValue(), sourceString);
+ FXJSE_Value_SetUTF8String(args.GetReturnValue(),
+ sourceString.AsByteStringC());
}
FXJSE_Value_Release(argOne);
} else {
@@ -4605,7 +4632,7 @@ void CXFA_FM2JSContext::Parse(FXJSE_HOBJECT hThis,
IFX_Locale* pLocale = widgetData.GetLocal();
uint32_t patternType;
FX_BOOL bCompletePattern =
- XFA_PATTERN_STRING_Type(szPattern, patternType);
+ XFA_PATTERN_STRING_Type(szPattern.AsByteStringC(), patternType);
CFX_WideString wsPattern =
CFX_WideString::FromUTF8(szPattern, szPattern.GetLength());
CFX_WideString wsValue =
@@ -4616,7 +4643,8 @@ void CXFA_FM2JSContext::Parse(FXJSE_HOBJECT hThis,
(CXFA_LocaleMgr*)pMgr);
if (localeValue.IsValid()) {
szParsedValue = FX_UTF8Encode(localeValue.GetValue());
- FXJSE_Value_SetUTF8String(args.GetReturnValue(), szParsedValue);
+ FXJSE_Value_SetUTF8String(args.GetReturnValue(),
+ szParsedValue.AsByteStringC());
} else {
FXJSE_Value_SetUTF8String(args.GetReturnValue(), "");
}
@@ -4635,7 +4663,8 @@ void CXFA_FM2JSContext::Parse(FXJSE_HOBJECT hThis,
pLocale, (CXFA_LocaleMgr*)pMgr);
if (localeValue.IsValid()) {
szParsedValue = FX_UTF8Encode(localeValue.GetValue());
- FXJSE_Value_SetUTF8String(args.GetReturnValue(), szParsedValue);
+ FXJSE_Value_SetUTF8String(args.GetReturnValue(),
+ szParsedValue.AsByteStringC());
} else {
FXJSE_Value_SetUTF8String(args.GetReturnValue(), "");
}
@@ -4647,7 +4676,8 @@ void CXFA_FM2JSContext::Parse(FXJSE_HOBJECT hThis,
pLocale, (CXFA_LocaleMgr*)pMgr);
if (localeValue.IsValid()) {
szParsedValue = FX_UTF8Encode(localeValue.GetValue());
- FXJSE_Value_SetUTF8String(args.GetReturnValue(), szParsedValue);
+ FXJSE_Value_SetUTF8String(args.GetReturnValue(),
+ szParsedValue.AsByteStringC());
} else {
FXJSE_Value_SetUTF8String(args.GetReturnValue(), "");
}
@@ -4659,7 +4689,8 @@ void CXFA_FM2JSContext::Parse(FXJSE_HOBJECT hThis,
pLocale, (CXFA_LocaleMgr*)pMgr);
if (localeValue.IsValid()) {
szParsedValue = FX_UTF8Encode(localeValue.GetValue());
- FXJSE_Value_SetUTF8String(args.GetReturnValue(), szParsedValue);
+ FXJSE_Value_SetUTF8String(args.GetReturnValue(),
+ szParsedValue.AsByteStringC());
} else {
FXJSE_Value_SetUTF8String(args.GetReturnValue(), "");
}
@@ -4671,7 +4702,8 @@ void CXFA_FM2JSContext::Parse(FXJSE_HOBJECT hThis,
pLocale, (CXFA_LocaleMgr*)pMgr);
if (localeValue.IsValid()) {
szParsedValue = FX_UTF8Encode(localeValue.GetValue());
- FXJSE_Value_SetUTF8String(args.GetReturnValue(), szParsedValue);
+ FXJSE_Value_SetUTF8String(args.GetReturnValue(),
+ szParsedValue.AsByteStringC());
} else {
FXJSE_Value_SetUTF8String(args.GetReturnValue(), "");
}
@@ -4704,7 +4736,8 @@ void CXFA_FM2JSContext::Parse(FXJSE_HOBJECT hThis,
pLocale, (CXFA_LocaleMgr*)pMgr);
if (localeValue.IsValid()) {
szParsedValue = FX_UTF8Encode(localeValue.GetValue());
- FXJSE_Value_SetUTF8String(args.GetReturnValue(), szParsedValue);
+ FXJSE_Value_SetUTF8String(args.GetReturnValue(),
+ szParsedValue.AsByteStringC());
} else {
FXJSE_Value_SetUTF8String(args.GetReturnValue(), "");
}
@@ -4761,7 +4794,7 @@ void CXFA_FM2JSContext::Replace(FXJSE_HOBJECT hThis,
}
}
if (iFindIndex == iFindLen) {
- resultString << threeString;
+ resultString << threeString.AsByteStringC();
u += iFindLen - 1;
iFindIndex = 0;
} else {
@@ -4808,7 +4841,7 @@ void CXFA_FM2JSContext::Right(FXJSE_HOBJECT hThis,
count = 0;
}
FXJSE_Value_SetUTF8String(args.GetReturnValue(),
- sourceString.Right(count));
+ sourceString.Right(count).AsByteStringC());
}
FXJSE_Value_Release(argOne);
FXJSE_Value_Release(argTwo);
@@ -4830,7 +4863,8 @@ void CXFA_FM2JSContext::Rtrim(FXJSE_HOBJECT hThis,
CFX_ByteString sourceString;
HValueToUTF8String(argOne, sourceString);
sourceString.TrimRight();
- FXJSE_Value_SetUTF8String(args.GetReturnValue(), sourceString);
+ FXJSE_Value_SetUTF8String(args.GetReturnValue(),
+ sourceString.AsByteStringC());
}
FXJSE_Value_Release(argOne);
} else {
@@ -5035,7 +5069,7 @@ void CXFA_FM2JSContext::Stuff(FXJSE_HOBJECT hThis,
resultString.AppendChar(sourceString.GetAt(i));
++i;
}
- resultString << insertString;
+ resultString << insertString.AsByteStringC();
i = iStart + iDelete;
while (i < iLength) {
resultString.AppendChar(sourceString.GetAt(i));
@@ -5089,8 +5123,9 @@ void CXFA_FM2JSContext::Substr(FXJSE_HOBJECT hThis,
iCount = 0;
}
iStart -= 1;
- FXJSE_Value_SetUTF8String(args.GetReturnValue(),
- szSourceStr.Mid(iStart, iCount));
+ FXJSE_Value_SetUTF8String(
+ args.GetReturnValue(),
+ szSourceStr.Mid(iStart, iCount).AsByteStringC());
}
}
FXJSE_Value_Release(stringValue);
@@ -5118,7 +5153,7 @@ void CXFA_FM2JSContext::Uuid(FXJSE_HOBJECT hThis,
FX_GUID_CreateV4(&guid);
CFX_ByteString bsUId;
FX_GUID_ToString(&guid, bsUId, iNum);
- FXJSE_Value_SetUTF8String(args.GetReturnValue(), bsUId);
+ FXJSE_Value_SetUTF8String(args.GetReturnValue(), bsUId.AsByteStringC());
if (argc == 1) {
FXJSE_Value_Release(argOne);
}
@@ -5164,9 +5199,10 @@ void CXFA_FM2JSContext::Upper(FXJSE_HOBJECT hThis,
++i;
}
upperStringBuf.AppendChar(0);
- FXJSE_Value_SetUTF8String(args.GetReturnValue(),
- FX_UTF8Encode(upperStringBuf.GetBuffer(),
- upperStringBuf.GetLength()));
+ FXJSE_Value_SetUTF8String(
+ args.GetReturnValue(),
+ FX_UTF8Encode(upperStringBuf.GetBuffer(), upperStringBuf.GetLength())
+ .AsByteStringC());
if (argc == 2) {
FXJSE_Value_Release(localeValue);
}
@@ -5219,7 +5255,7 @@ void CXFA_FM2JSContext::WordNum(FXJSE_HOBJECT hThis,
CFX_ByteTextBuf resultBuf;
CFX_ByteString numberString;
numberString.Format("%.2f", fNumber);
- WordUS(numberString, iIdentifier, resultBuf);
+ WordUS(numberString.AsByteStringC(), iIdentifier, resultBuf);
FXJSE_Value_SetUTF8String(args.GetReturnValue(),
resultBuf.GetByteString());
}
@@ -5535,7 +5571,8 @@ void CXFA_FM2JSContext::Post(FXJSE_HOBJECT hThis,
if (bFlags) {
FXJSE_Value_SetUTF8String(
args.GetReturnValue(),
- FX_UTF8Encode(decodedResponse, decodedResponse.GetLength()));
+ FX_UTF8Encode(decodedResponse, decodedResponse.GetLength())
+ .AsByteStringC());
} else {
pContext->ThrowScriptErrorMessage(XFA_IDS_SERVER_DENY);
}
@@ -5625,7 +5662,8 @@ void CXFA_FM2JSContext::assign_value_operator(FXJSE_HOBJECT hThis,
FXJSE_Value_ToUTF8String(propertyValue, propertyStr);
for (int32_t i = 2; i < iLeftLength; i++) {
FXJSE_Value_GetObjectPropByIdx(lValue, i, jsObjectValue);
- FXJSE_Value_SetObjectProp(jsObjectValue, propertyStr, rValue);
+ FXJSE_Value_SetObjectProp(jsObjectValue, propertyStr.AsByteStringC(),
+ rValue);
}
}
FXJSE_Value_Release(jsObjectValue);
@@ -5808,8 +5846,9 @@ void CXFA_FM2JSContext::less_operator(FXJSE_HOBJECT hThis,
CFX_ByteString secondOutput;
FXJSE_Value_ToUTF8String(argFirst, firstOutput);
FXJSE_Value_ToUTF8String(argSecond, secondOutput);
- FXJSE_Value_SetInteger(args.GetReturnValue(),
- (firstOutput.Compare(secondOutput) == -1) ? 1 : 0);
+ FXJSE_Value_SetInteger(
+ args.GetReturnValue(),
+ firstOutput.Compare(secondOutput.AsByteStringC()) == -1);
} else {
FX_DOUBLE first = HValueToDouble(hThis, argFirst);
FX_DOUBLE second = HValueToDouble(hThis, argSecond);
@@ -5840,8 +5879,9 @@ void CXFA_FM2JSContext::lessequal_operator(FXJSE_HOBJECT hThis,
CFX_ByteString secondOutput;
FXJSE_Value_ToUTF8String(argFirst, firstOutput);
FXJSE_Value_ToUTF8String(argSecond, secondOutput);
- FXJSE_Value_SetInteger(args.GetReturnValue(),
- (firstOutput.Compare(secondOutput) != 1) ? 1 : 0);
+ FXJSE_Value_SetInteger(
+ args.GetReturnValue(),
+ firstOutput.Compare(secondOutput.AsByteStringC()) != 1);
} else {
FX_DOUBLE first = HValueToDouble(hThis, argFirst);
FX_DOUBLE second = HValueToDouble(hThis, argSecond);
@@ -5869,8 +5909,9 @@ void CXFA_FM2JSContext::greater_operator(FXJSE_HOBJECT hThis,
CFX_ByteString secondOutput;
FXJSE_Value_ToUTF8String(argFirst, firstOutput);
FXJSE_Value_ToUTF8String(argSecond, secondOutput);
- FXJSE_Value_SetInteger(args.GetReturnValue(),
- (firstOutput.Compare(secondOutput) == 1) ? 1 : 0);
+ FXJSE_Value_SetInteger(
+ args.GetReturnValue(),
+ firstOutput.Compare(secondOutput.AsByteStringC()) == 1);
} else {
FX_DOUBLE first = HValueToDouble(hThis, argFirst);
FX_DOUBLE second = HValueToDouble(hThis, argSecond);
@@ -5901,8 +5942,9 @@ void CXFA_FM2JSContext::greaterequal_operator(FXJSE_HOBJECT hThis,
CFX_ByteString secondOutput;
FXJSE_Value_ToUTF8String(argFirst, firstOutput);
FXJSE_Value_ToUTF8String(argSecond, secondOutput);
- FXJSE_Value_SetInteger(args.GetReturnValue(),
- (firstOutput.Compare(secondOutput) != -1) ? 1 : 0);
+ FXJSE_Value_SetInteger(
+ args.GetReturnValue(),
+ firstOutput.Compare(secondOutput.AsByteStringC()) != -1);
} else {
FX_DOUBLE first = HValueToDouble(hThis, argFirst);
FX_DOUBLE second = HValueToDouble(hThis, argSecond);
@@ -6082,7 +6124,8 @@ void CXFA_FM2JSContext::dot_accessor(FXJSE_HOBJECT hThis,
iIndexValue = HValueToInteger(hThis, argIndex);
}
CFX_ByteString szSomExp;
- GenerateSomExpression(szName, iIndexFlags, iIndexValue, bIsStar, szSomExp);
+ GenerateSomExpression(szName.AsByteStringC(), iIndexFlags, iIndexValue,
+ bIsStar, szSomExp);
if (FXJSE_Value_IsArray(argAccessor)) {
FXJSE_HVALUE hLengthValue = FXJSE_Value_Create(hruntime);
FXJSE_Value_GetObjectProp(argAccessor, "length", hLengthValue);
@@ -6099,8 +6142,9 @@ void CXFA_FM2JSContext::dot_accessor(FXJSE_HOBJECT hThis,
for (int32_t i = 2; i < iLength; i++) {
FXJSE_Value_GetObjectPropByIdx(argAccessor, i, hJSObjValue);
XFA_RESOLVENODE_RS resoveNodeRS;
- int32_t iRet = ResolveObjects(hThis, hJSObjValue, szSomExp,
- resoveNodeRS, TRUE, szName.IsEmpty());
+ int32_t iRet =
+ ResolveObjects(hThis, hJSObjValue, szSomExp.AsByteStringC(),
+ resoveNodeRS, TRUE, szName.IsEmpty());
if (iRet > 0) {
ParseResolveResult(hThis, resoveNodeRS, hJSObjValue,
hResolveValues[i - 2], iSizes[i - 2], bAttribute);
@@ -6115,7 +6159,7 @@ void CXFA_FM2JSContext::dot_accessor(FXJSE_HOBJECT hThis,
}
FXJSE_Value_SetInteger(rgValues[0], 1);
if (bAttribute) {
- FXJSE_Value_SetUTF8String(rgValues[1], szName);
+ FXJSE_Value_SetUTF8String(rgValues[1], szName.AsByteStringC());
} else {
FXJSE_Value_SetNull(rgValues[1]);
}
@@ -6155,15 +6199,15 @@ void CXFA_FM2JSContext::dot_accessor(FXJSE_HOBJECT hThis,
int32_t iRet = 0;
if (FXJSE_Value_IsObject(argAccessor) ||
(FXJSE_Value_IsNull(argAccessor) && bsAccessorName.IsEmpty())) {
- iRet = ResolveObjects(hThis, argAccessor, szSomExp, resoveNodeRS, TRUE,
- szName.IsEmpty());
+ iRet = ResolveObjects(hThis, argAccessor, szSomExp.AsByteStringC(),
+ resoveNodeRS, TRUE, szName.IsEmpty());
} else if (!FXJSE_Value_IsObject(argAccessor) &&
!bsAccessorName.IsEmpty()) {
FX_BOOL bGetObject =
- GetObjectByName(hThis, argAccessor, bsAccessorName);
+ GetObjectByName(hThis, argAccessor, bsAccessorName.AsByteStringC());
if (bGetObject) {
- iRet = ResolveObjects(hThis, argAccessor, szSomExp, resoveNodeRS,
- TRUE, szName.IsEmpty());
+ iRet = ResolveObjects(hThis, argAccessor, szSomExp.AsByteStringC(),
+ resoveNodeRS, TRUE, szName.IsEmpty());
}
}
if (iRet > 0) {
@@ -6178,7 +6222,7 @@ void CXFA_FM2JSContext::dot_accessor(FXJSE_HOBJECT hThis,
}
FXJSE_Value_SetInteger(rgValues[0], 1);
if (bAttribute) {
- FXJSE_Value_SetUTF8String(rgValues[1], szName);
+ FXJSE_Value_SetUTF8String(rgValues[1], szName.AsByteStringC());
} else {
FXJSE_Value_SetNull(rgValues[1]);
}
@@ -6233,7 +6277,8 @@ void CXFA_FM2JSContext::dotdot_accessor(FXJSE_HOBJECT hThis,
iIndexValue = HValueToInteger(hThis, argIndex);
}
CFX_ByteString szSomExp;
- GenerateSomExpression(szName, iIndexFlags, iIndexValue, bIsStar, szSomExp);
+ GenerateSomExpression(szName.AsByteStringC(), iIndexFlags, iIndexValue,
+ bIsStar, szSomExp);
if (FXJSE_Value_IsArray(argAccessor)) {
FXJSE_HVALUE hLengthValue = FXJSE_Value_Create(hruntime);
FXJSE_Value_GetObjectProp(argAccessor, "length", hLengthValue);
@@ -6246,8 +6291,8 @@ void CXFA_FM2JSContext::dotdot_accessor(FXJSE_HOBJECT hThis,
for (int32_t i = 2; i < iLength; i++) {
FXJSE_Value_GetObjectPropByIdx(argAccessor, i, hJSObjValue);
XFA_RESOLVENODE_RS resoveNodeRS;
- int32_t iRet =
- ResolveObjects(hThis, hJSObjValue, szSomExp, resoveNodeRS, FALSE);
+ int32_t iRet = ResolveObjects(
+ hThis, hJSObjValue, szSomExp.AsByteStringC(), resoveNodeRS, FALSE);
if (iRet > 0) {
ParseResolveResult(hThis, resoveNodeRS, hJSObjValue,
hResolveValues[i - 2], iSizes[i - 2], bAttribute);
@@ -6262,7 +6307,7 @@ void CXFA_FM2JSContext::dotdot_accessor(FXJSE_HOBJECT hThis,
}
FXJSE_Value_SetInteger(rgValues[0], 1);
if (bAttribute) {
- FXJSE_Value_SetUTF8String(rgValues[1], szName);
+ FXJSE_Value_SetUTF8String(rgValues[1], szName.AsByteStringC());
} else {
FXJSE_Value_SetNull(rgValues[1]);
}
@@ -6301,15 +6346,15 @@ void CXFA_FM2JSContext::dotdot_accessor(FXJSE_HOBJECT hThis,
int32_t iRet = 0;
if (FXJSE_Value_IsObject(argAccessor) ||
(FXJSE_Value_IsNull(argAccessor) && bsAccessorName.IsEmpty())) {
- iRet =
- ResolveObjects(hThis, argAccessor, szSomExp, resoveNodeRS, FALSE);
+ iRet = ResolveObjects(hThis, argAccessor, szSomExp.AsByteStringC(),
+ resoveNodeRS, FALSE);
} else if (!FXJSE_Value_IsObject(argAccessor) &&
!bsAccessorName.IsEmpty()) {
FX_BOOL bGetObject =
- GetObjectByName(hThis, argAccessor, bsAccessorName);
+ GetObjectByName(hThis, argAccessor, bsAccessorName.AsByteStringC());
if (bGetObject) {
- iRet =
- ResolveObjects(hThis, argAccessor, szSomExp, resoveNodeRS, FALSE);
+ iRet = ResolveObjects(hThis, argAccessor, szSomExp.AsByteStringC(),
+ resoveNodeRS, FALSE);
}
}
if (iRet > 0) {
@@ -6324,7 +6369,7 @@ void CXFA_FM2JSContext::dotdot_accessor(FXJSE_HOBJECT hThis,
}
FXJSE_Value_SetInteger(rgValues[0], 1);
if (bAttribute) {
- FXJSE_Value_SetUTF8String(rgValues[1], szName);
+ FXJSE_Value_SetUTF8String(rgValues[1], szName.AsByteStringC());
} else {
FXJSE_Value_SetNull(rgValues[1]);
}
@@ -6380,7 +6425,7 @@ void CXFA_FM2JSContext::eval_translation(FXJSE_HOBJECT hThis,
CFX_WideString javaScript = wsJavaScriptBuf.GetWideString();
FXJSE_Value_SetUTF8String(
args.GetReturnValue(),
- FX_UTF8Encode(javaScript, javaScript.GetLength()));
+ FX_UTF8Encode(javaScript, javaScript.GetLength()).AsByteStringC());
} else {
pContext->ThrowScriptErrorMessage(XFA_IDS_COMPILER_ERROR);
}
@@ -6435,7 +6480,7 @@ void CXFA_FM2JSContext::get_fm_value(FXJSE_HOBJECT hThis,
} else {
CFX_ByteString propertyStr;
FXJSE_Value_ToUTF8String(propertyValue, propertyStr);
- FXJSE_Value_GetObjectProp(jsobjectValue, propertyStr,
+ FXJSE_Value_GetObjectProp(jsobjectValue, propertyStr.AsByteStringC(),
args.GetReturnValue());
}
FXJSE_Value_Release(propertyValue);
@@ -6604,7 +6649,8 @@ FXJSE_HVALUE CXFA_FM2JSContext::GetSimpleHValue(FXJSE_HOBJECT hThis,
} else {
CFX_ByteString propertyStr;
FXJSE_Value_ToUTF8String(propertyValue, propertyStr);
- FXJSE_Value_GetObjectProp(jsobjectValue, propertyStr, simpleValue);
+ FXJSE_Value_GetObjectProp(jsobjectValue, propertyStr.AsByteStringC(),
+ simpleValue);
}
FXJSE_Value_Release(propertyValue);
FXJSE_Value_Release(jsobjectValue);
@@ -6647,7 +6693,8 @@ FX_BOOL CXFA_FM2JSContext::HValueIsNull(FXJSE_HOBJECT hThis, FXJSE_HVALUE arg) {
CFX_ByteString propertyStr;
FXJSE_Value_ToUTF8String(propertyValue, propertyStr);
FXJSE_HVALUE newPropertyValue = FXJSE_Value_Create(hruntime);
- FXJSE_Value_GetObjectProp(jsObjectValue, propertyStr, newPropertyValue);
+ FXJSE_Value_GetObjectProp(jsObjectValue, propertyStr.AsByteStringC(),
+ newPropertyValue);
if (FXJSE_Value_IsNull(newPropertyValue)) {
isNull = TRUE;
}
@@ -6753,7 +6800,8 @@ void CXFA_FM2JSContext::unfoldArgs(FXJSE_HOBJECT hThis,
FXJSE_Value_ToUTF8String(propertyValue, propertyString);
for (int32_t j = 2; j < iLength; j++) {
FXJSE_Value_GetObjectPropByIdx(argsValue[i], j, jsObjectValue);
- FXJSE_Value_GetObjectProp(jsObjectValue, propertyString,
+ FXJSE_Value_GetObjectProp(jsObjectValue,
+ propertyString.AsByteStringC(),
resultValues[index]);
index++;
}
@@ -6963,7 +7011,8 @@ int32_t CXFA_FM2JSContext::HValueToInteger(FXJSE_HOBJECT hThis,
} else {
CFX_ByteString propertyStr;
FXJSE_Value_ToUTF8String(propertyValue, propertyStr);
- FXJSE_Value_GetObjectProp(jsobjectValue, propertyStr, newProperty);
+ FXJSE_Value_GetObjectProp(jsobjectValue, propertyStr.AsByteStringC(),
+ newProperty);
}
iValue = HValueToInteger(hThis, newProperty);
FXJSE_Value_Release(newProperty);
@@ -7006,7 +7055,8 @@ FX_FLOAT CXFA_FM2JSContext::HValueToFloat(FXJSE_HOBJECT hThis,
} else {
CFX_ByteString propertyStr;
FXJSE_Value_ToUTF8String(propertyValue, propertyStr);
- FXJSE_Value_GetObjectProp(jsobjectValue, propertyStr, newProperty);
+ FXJSE_Value_GetObjectProp(jsobjectValue, propertyStr.AsByteStringC(),
+ newProperty);
}
fRet = HValueToFloat(hThis, newProperty);
FXJSE_Value_Release(newProperty);
@@ -7020,7 +7070,7 @@ FX_FLOAT CXFA_FM2JSContext::HValueToFloat(FXJSE_HOBJECT hThis,
} else if (FXJSE_Value_IsUTF8String(arg)) {
CFX_ByteString bsOutput;
FXJSE_Value_ToUTF8String(arg, bsOutput);
- fRet = (FX_FLOAT)StringToDouble(bsOutput);
+ fRet = (FX_FLOAT)StringToDouble(bsOutput.AsByteStringC());
} else if (FXJSE_Value_IsUndefined(arg)) {
fRet = 0;
} else {
@@ -7045,7 +7095,8 @@ FX_DOUBLE CXFA_FM2JSContext::HValueToDouble(FXJSE_HOBJECT hThis,
} else {
CFX_ByteString propertyStr;
FXJSE_Value_ToUTF8String(propertyValue, propertyStr);
- FXJSE_Value_GetObjectProp(jsobjectValue, propertyStr, newProperty);
+ FXJSE_Value_GetObjectProp(jsobjectValue, propertyStr.AsByteStringC(),
+ newProperty);
}
dRet = HValueToDouble(hThis, newProperty);
FXJSE_Value_Release(newProperty);
@@ -7059,7 +7110,7 @@ FX_DOUBLE CXFA_FM2JSContext::HValueToDouble(FXJSE_HOBJECT hThis,
} else if (FXJSE_Value_IsUTF8String(arg)) {
CFX_ByteString bsOutput;
FXJSE_Value_ToUTF8String(arg, bsOutput);
- dRet = StringToDouble(bsOutput);
+ dRet = StringToDouble(bsOutput.AsByteStringC());
} else if (FXJSE_Value_IsUndefined(arg)) {
dRet = 0;
} else {
@@ -7219,5 +7270,6 @@ void CXFA_FM2JSContext::ThrowScriptErrorMessage(int32_t iStringID, ...) {
va_start(arg_ptr, iStringID);
wsMessage.FormatV((const FX_WCHAR*)wsFormat, arg_ptr);
va_end(arg_ptr);
- FXJSE_ThrowMessage("", FX_UTF8Encode(wsMessage, wsMessage.GetLength()));
+ FXJSE_ThrowMessage(
+ "", FX_UTF8Encode(wsMessage, wsMessage.GetLength()).AsByteStringC());
}
diff --git a/xfa/fxfa/parser/xfa_locale.cpp b/xfa/fxfa/parser/xfa_locale.cpp
index 35d8c36fa2..141e295be9 100644
--- a/xfa/fxfa/parser/xfa_locale.cpp
+++ b/xfa/fxfa/parser/xfa_locale.cpp
@@ -72,7 +72,8 @@ void CXFA_XMLLocale::GetNumbericSymbol(FX_LOCALENUMSYMBOL eType,
default:
return;
}
- CXML_Element* pElement = m_pLocaleData->GetElement("", bsSymbols);
+ CXML_Element* pElement =
+ m_pLocaleData->GetElement("", bsSymbols.AsByteStringC());
if (!pElement) {
return;
}
@@ -86,7 +87,7 @@ void CXFA_XMLLocale::GetDateTimeSymbols(CFX_WideString& wsDtSymbol) const {
}
CFX_ByteString bsSpace;
CXML_Element* pNumberSymbols =
- m_pLocaleData->GetElement(bsSpace, "dateTimeSymbols");
+ m_pLocaleData->GetElement(bsSpace.AsByteStringC(), "dateTimeSymbols");
if (!pNumberSymbols) {
return;
}
@@ -120,10 +121,12 @@ CFX_WideString CXFA_XMLLocale::GetCalendarSymbol(const CFX_ByteStringC& symbol,
if (m_pLocaleData) {
CXML_Element* pChild = m_pLocaleData->GetElement("", "calendarSymbols");
if (pChild) {
- CXML_Element* pSymbolNames = pChild->GetElement("", pstrSymbolNames);
+ CXML_Element* pSymbolNames =
+ pChild->GetElement("", pstrSymbolNames.AsByteStringC());
if (pSymbolNames) {
if (pSymbolNames->GetAttrInteger("abbr") != bAbbr) {
- pSymbolNames = pChild->GetElement("", pstrSymbolNames, 1);
+ pSymbolNames =
+ pChild->GetElement("", pstrSymbolNames.AsByteStringC(), 1);
}
if (pSymbolNames && pSymbolNames->GetAttrInteger("abbr") == bAbbr) {
CXML_Element* pSymbolName =
diff --git a/xfa/fxfa/parser/xfa_object_imp.cpp b/xfa/fxfa/parser/xfa_object_imp.cpp
index 15f21c8a23..d245e33e29 100644
--- a/xfa/fxfa/parser/xfa_object_imp.cpp
+++ b/xfa/fxfa/parser/xfa_object_imp.cpp
@@ -56,7 +56,8 @@ void CXFA_Object::Script_ObjectClass_ClassName(FXJSE_HVALUE hValue,
CFX_WideStringC className;
GetClassName(className);
FXJSE_Value_SetUTF8String(
- hValue, FX_UTF8Encode(className.GetPtr(), className.GetLength()));
+ hValue, FX_UTF8Encode(className.GetPtr(), className.GetLength())
+ .AsByteStringC());
} else {
ThrowScriptErrorMessage(XFA_IDS_INVAlID_PROP_SET);
}
@@ -71,7 +72,8 @@ void CXFA_Object::ThrowScriptErrorMessage(int32_t iStringID, ...) {
va_start(arg_ptr, iStringID);
wsMessage.FormatV((const FX_WCHAR*)wsFormat, arg_ptr);
va_end(arg_ptr);
- FXJSE_ThrowMessage("", FX_UTF8Encode(wsMessage, wsMessage.GetLength()));
+ FXJSE_ThrowMessage(
+ "", FX_UTF8Encode(wsMessage, wsMessage.GetLength()).AsByteStringC());
}
static void XFA_DeleteWideString(void* pData) {
@@ -752,7 +754,8 @@ void CXFA_Node::Script_TreeClass_Nodes(FXJSE_HVALUE hValue,
FXSYS_assert(pAppProvider);
CFX_WideString wsMessage;
pAppProvider->LoadString(XFA_IDS_Unable_TO_SET, wsMessage);
- FXJSE_ThrowMessage("", FX_UTF8Encode(wsMessage, wsMessage.GetLength()));
+ FXJSE_ThrowMessage(
+ "", FX_UTF8Encode(wsMessage, wsMessage.GetLength()).AsByteStringC());
} else {
CXFA_AttachNodeList* pNodeList = new CXFA_AttachNodeList(m_pDocument, this);
FXJSE_Value_SetObject(hValue, (CXFA_Object*)pNodeList,
@@ -813,7 +816,8 @@ void CXFA_Node::Script_TreeClass_SomExpression(FXJSE_HVALUE hValue,
} else {
CFX_WideString wsSOMExpression;
GetSOMExpression(wsSOMExpression);
- FXJSE_Value_SetUTF8String(hValue, FX_UTF8Encode(wsSOMExpression));
+ FXJSE_Value_SetUTF8String(hValue,
+ FX_UTF8Encode(wsSOMExpression).AsByteStringC());
}
}
void CXFA_Node::Script_NodeClass_ApplyXSL(CFXJSE_Arguments* pArguments) {
@@ -877,7 +881,7 @@ void CXFA_Node::Script_NodeClass_GetAttribute(CFXJSE_Arguments* pArguments) {
GetAttribute(wsExpression, wsValue);
FXJSE_HVALUE hValue = pArguments->GetReturnValue();
if (hValue) {
- FXJSE_Value_SetUTF8String(hValue, FX_UTF8Encode(wsValue));
+ FXJSE_Value_SetUTF8String(hValue, FX_UTF8Encode(wsValue).AsByteStringC());
}
}
void CXFA_Node::Script_NodeClass_GetElement(CFXJSE_Arguments* pArguments) {
@@ -1180,7 +1184,8 @@ void CXFA_Node::Script_NodeClass_Ns(FXJSE_HVALUE hValue,
} else {
CFX_WideString wsNameSpace;
TryNamespace(wsNameSpace);
- FXJSE_Value_SetUTF8String(hValue, FX_UTF8Encode(wsNameSpace));
+ FXJSE_Value_SetUTF8String(hValue,
+ FX_UTF8Encode(wsNameSpace).AsByteStringC());
}
}
void CXFA_Node::Script_NodeClass_Model(FXJSE_HVALUE hValue,
@@ -1534,8 +1539,8 @@ void CXFA_Node::Script_Attribute_String(FXJSE_HVALUE hValue,
} else {
CFX_WideString wsValue;
GetAttribute(eAttribute, wsValue);
- FXJSE_Value_SetUTF8String(hValue,
- FX_UTF8Encode(wsValue, wsValue.GetLength()));
+ FXJSE_Value_SetUTF8String(
+ hValue, FX_UTF8Encode(wsValue, wsValue.GetLength()).AsByteStringC());
}
}
void CXFA_Node::Script_Attribute_StringRead(FXJSE_HVALUE hValue,
@@ -1544,8 +1549,8 @@ void CXFA_Node::Script_Attribute_StringRead(FXJSE_HVALUE hValue,
if (!bSetting) {
CFX_WideString wsValue;
GetAttribute(eAttribute, wsValue);
- FXJSE_Value_SetUTF8String(hValue,
- FX_UTF8Encode(wsValue, wsValue.GetLength()));
+ FXJSE_Value_SetUTF8String(
+ hValue, FX_UTF8Encode(wsValue, wsValue.GetLength()).AsByteStringC());
} else {
ThrowScriptErrorMessage(XFA_IDS_INVAlID_PROP_SET);
}
@@ -1628,7 +1633,7 @@ void CXFA_Node::Script_Som_Message(FXJSE_HVALUE hValue,
default:
break;
}
- FXJSE_Value_SetUTF8String(hValue, FX_UTF8Encode(wsMessage));
+ FXJSE_Value_SetUTF8String(hValue, FX_UTF8Encode(wsMessage).AsByteStringC());
}
}
void CXFA_Node::Script_Som_ValidationMessage(FXJSE_HVALUE hValue,
@@ -1710,8 +1715,8 @@ void CXFA_Node::Script_Som_DefaultValue(FXJSE_HVALUE hValue,
CFX_Decimal decimal(content);
FXJSE_Value_SetFloat(hValue, (FX_FLOAT)(double)decimal);
} else {
- FXJSE_Value_SetUTF8String(hValue,
- FX_UTF8Encode(content, content.GetLength()));
+ FXJSE_Value_SetUTF8String(
+ hValue, FX_UTF8Encode(content, content.GetLength()).AsByteStringC());
}
}
}
@@ -1726,8 +1731,8 @@ void CXFA_Node::Script_Som_DefaultValue_Read(FXJSE_HVALUE hValue,
if (content.IsEmpty()) {
FXJSE_Value_SetNull(hValue);
} else {
- FXJSE_Value_SetUTF8String(hValue,
- FX_UTF8Encode(content, content.GetLength()));
+ FXJSE_Value_SetUTF8String(
+ hValue, FX_UTF8Encode(content, content.GetLength()).AsByteStringC());
}
}
void CXFA_Node::Script_Boolean_Value(FXJSE_HVALUE hValue,
@@ -1867,7 +1872,7 @@ void CXFA_Node::Script_Som_BorderColor(FXJSE_HVALUE hValue,
int32_t a, r, g, b;
ArgbDecode(color, a, r, g, b);
strColor.Format(L"%d,%d,%d", r, g, b);
- FXJSE_Value_SetUTF8String(hValue, FX_UTF8Encode(strColor));
+ FXJSE_Value_SetUTF8String(hValue, FX_UTF8Encode(strColor).AsByteStringC());
}
}
void CXFA_Node::Script_Som_BorderWidth(FXJSE_HVALUE hValue,
@@ -1893,7 +1898,8 @@ void CXFA_Node::Script_Som_BorderWidth(FXJSE_HVALUE hValue,
CXFA_Edge edge = border.GetEdge(0);
CXFA_Measurement thickness = edge.GetMSThickness();
thickness.ToString(wsThickness);
- FXJSE_Value_SetUTF8String(hValue, FX_UTF8Encode(wsThickness));
+ FXJSE_Value_SetUTF8String(hValue,
+ FX_UTF8Encode(wsThickness).AsByteStringC());
}
}
void CXFA_Node::Script_Som_FillColor(FXJSE_HVALUE hValue,
@@ -1923,7 +1929,7 @@ void CXFA_Node::Script_Som_FillColor(FXJSE_HVALUE hValue,
int32_t a, r, g, b;
ArgbDecode(color, a, r, g, b);
wsColor.Format(L"%d,%d,%d", r, g, b);
- FXJSE_Value_SetUTF8String(hValue, FX_UTF8Encode(wsColor));
+ FXJSE_Value_SetUTF8String(hValue, FX_UTF8Encode(wsColor).AsByteStringC());
}
}
void CXFA_Node::Script_Som_DataNode(FXJSE_HVALUE hValue,
@@ -1965,8 +1971,8 @@ void CXFA_Node::Script_Draw_DefaultValue(FXJSE_HVALUE hValue,
if (content.IsEmpty()) {
FXJSE_Value_SetNull(hValue);
} else {
- FXJSE_Value_SetUTF8String(hValue,
- FX_UTF8Encode(content, content.GetLength()));
+ FXJSE_Value_SetUTF8String(
+ hValue, FX_UTF8Encode(content, content.GetLength()).AsByteStringC());
}
}
}
@@ -2018,7 +2024,8 @@ void CXFA_Node::Script_Field_DefaultValue(FXJSE_HVALUE hValue,
if (eUI == XFA_ELEMENT_NumericEdit &&
(pNode->GetInteger(XFA_ATTRIBUTE_FracDigits) == -1)) {
FXJSE_Value_SetUTF8String(
- hValue, FX_UTF8Encode(content, content.GetLength()));
+ hValue,
+ FX_UTF8Encode(content, content.GetLength()).AsByteStringC());
} else {
CFX_Decimal decimal(content);
FXJSE_Value_SetFloat(hValue, (FX_FLOAT)(double)decimal);
@@ -2031,8 +2038,9 @@ void CXFA_Node::Script_Field_DefaultValue(FXJSE_HVALUE hValue,
CFX_Decimal decimal(content);
FXJSE_Value_SetFloat(hValue, (FX_FLOAT)(double)decimal);
} else {
- FXJSE_Value_SetUTF8String(hValue,
- FX_UTF8Encode(content, content.GetLength()));
+ FXJSE_Value_SetUTF8String(
+ hValue,
+ FX_UTF8Encode(content, content.GetLength()).AsByteStringC());
}
}
}
@@ -2052,7 +2060,7 @@ void CXFA_Node::Script_Field_EditValue(FXJSE_HVALUE hValue,
pWidgetData->SetValue(wsValue, XFA_VALUEPICTURE_Edit);
} else {
pWidgetData->GetValue(wsValue, XFA_VALUEPICTURE_Edit);
- FXJSE_Value_SetUTF8String(hValue, FX_UTF8Encode(wsValue));
+ FXJSE_Value_SetUTF8String(hValue, FX_UTF8Encode(wsValue).AsByteStringC());
}
}
void CXFA_Node::Script_Som_FontColor(FXJSE_HVALUE hValue,
@@ -2081,7 +2089,7 @@ void CXFA_Node::Script_Som_FontColor(FXJSE_HVALUE hValue,
int32_t a, r, g, b;
ArgbDecode(color, a, r, g, b);
wsColor.Format(L"%d,%d,%d", r, g, b);
- FXJSE_Value_SetUTF8String(hValue, FX_UTF8Encode(wsColor));
+ FXJSE_Value_SetUTF8String(hValue, FX_UTF8Encode(wsColor).AsByteStringC());
}
}
void CXFA_Node::Script_Field_FormatMessage(FXJSE_HVALUE hValue,
@@ -2104,7 +2112,7 @@ void CXFA_Node::Script_Field_FormattedValue(FXJSE_HVALUE hValue,
pWidgetData->SetValue(wsValue, XFA_VALUEPICTURE_Display);
} else {
pWidgetData->GetValue(wsValue, XFA_VALUEPICTURE_Display);
- FXJSE_Value_SetUTF8String(hValue, FX_UTF8Encode(wsValue));
+ FXJSE_Value_SetUTF8String(hValue, FX_UTF8Encode(wsValue).AsByteStringC());
}
}
void CXFA_Node::Script_Som_Mandatory(FXJSE_HVALUE hValue,
@@ -2128,7 +2136,7 @@ void CXFA_Node::Script_Som_Mandatory(FXJSE_HVALUE hValue,
if (pInfo) {
wsValue = pInfo->pName;
}
- FXJSE_Value_SetUTF8String(hValue, FX_UTF8Encode(wsValue));
+ FXJSE_Value_SetUTF8String(hValue, FX_UTF8Encode(wsValue).AsByteStringC());
}
}
void CXFA_Node::Script_Som_MandatoryMessage(FXJSE_HVALUE hValue,
@@ -2234,8 +2242,9 @@ void CXFA_Node::Script_Field_GetSaveItem(CFXJSE_Arguments* pArguments) {
CFX_WideString wsValue;
FX_BOOL bHasItem = pWidgetData->GetChoiceListItem(wsValue, iIndex, TRUE);
if (bHasItem) {
- FXJSE_Value_SetUTF8String(pArguments->GetReturnValue(),
- FX_UTF8Encode(wsValue, wsValue.GetLength()));
+ FXJSE_Value_SetUTF8String(
+ pArguments->GetReturnValue(),
+ FX_UTF8Encode(wsValue, wsValue.GetLength()).AsByteStringC());
} else {
FXJSE_Value_SetNull(pArguments->GetReturnValue());
}
@@ -2257,7 +2266,8 @@ void CXFA_Node::Script_Field_BoundItem(CFXJSE_Arguments* pArguments) {
pWidgetData->GetItemValue(wsValue, wsBoundValue);
FXJSE_HVALUE hValue = pArguments->GetReturnValue();
if (hValue) {
- FXJSE_Value_SetUTF8String(hValue, FX_UTF8Encode(wsBoundValue));
+ FXJSE_Value_SetUTF8String(hValue,
+ FX_UTF8Encode(wsBoundValue).AsByteStringC());
}
}
void CXFA_Node::Script_Field_GetItemState(CFXJSE_Arguments* pArguments) {
@@ -2312,8 +2322,9 @@ void CXFA_Node::Script_Field_GetDisplayItem(CFXJSE_Arguments* pArguments) {
CFX_WideString wsValue;
FX_BOOL bHasItem = pWidgetData->GetChoiceListItem(wsValue, iIndex, FALSE);
if (bHasItem) {
- FXJSE_Value_SetUTF8String(pArguments->GetReturnValue(),
- FX_UTF8Encode(wsValue, wsValue.GetLength()));
+ FXJSE_Value_SetUTF8String(
+ pArguments->GetReturnValue(),
+ FX_UTF8Encode(wsValue, wsValue.GetLength()).AsByteStringC());
} else {
FXJSE_Value_SetNull(pArguments->GetReturnValue());
}
@@ -2403,7 +2414,7 @@ void CXFA_Node::Script_ExclGroup_DefaultAndRawValue(FXJSE_HVALUE hValue,
if (wsValue.IsEmpty() && curVersion >= XFA_VERSION_300) {
FXJSE_Value_SetNull(hValue);
} else {
- FXJSE_Value_SetUTF8String(hValue, FX_UTF8Encode(wsValue));
+ FXJSE_Value_SetUTF8String(hValue, FX_UTF8Encode(wsValue).AsByteStringC());
}
}
}
@@ -2602,7 +2613,8 @@ void CXFA_Node::Script_Subform_Locale(FXJSE_HVALUE hValue,
CFX_WideString wsLocaleName;
GetLocaleName(wsLocaleName);
FXJSE_Value_SetUTF8String(
- hValue, FX_UTF8Encode(wsLocaleName, wsLocaleName.GetLength()));
+ hValue,
+ FX_UTF8Encode(wsLocaleName, wsLocaleName.GetLength()).AsByteStringC());
}
}
void CXFA_Node::Script_Subform_ExecEvent(CFXJSE_Arguments* pArguments) {
@@ -3497,7 +3509,8 @@ void CXFA_Node::Script_Form_Checksum(FXJSE_HVALUE hValue,
CFX_WideString wsChecksum;
GetAttribute(XFA_ATTRIBUTE_Checksum, wsChecksum, FALSE);
FXJSE_Value_SetUTF8String(
- hValue, FX_UTF8Encode(wsChecksum, wsChecksum.GetLength()));
+ hValue,
+ FX_UTF8Encode(wsChecksum, wsChecksum.GetLength()).AsByteStringC());
}
}
void CXFA_Node::Script_Packet_GetAttribute(CFXJSE_Arguments* pArguments) {
@@ -3514,7 +3527,8 @@ void CXFA_Node::Script_Packet_GetAttribute(CFXJSE_Arguments* pArguments) {
}
FXJSE_Value_SetUTF8String(
pArguments->GetReturnValue(),
- FX_UTF8Encode(wsAttributeValue, wsAttributeValue.GetLength()));
+ FX_UTF8Encode(wsAttributeValue, wsAttributeValue.GetLength())
+ .AsByteStringC());
} else {
ThrowScriptErrorMessage(XFA_IDS_INCORRECT_NUMBER_OF_METHOD,
L"getAttribute");
@@ -3576,7 +3590,8 @@ void CXFA_Node::Script_Packet_Content(FXJSE_HVALUE hValue,
pXMLElement->GetTextData(wsTextData);
}
FXJSE_Value_SetUTF8String(
- hValue, FX_UTF8Encode(wsTextData, wsTextData.GetLength()));
+ hValue,
+ FX_UTF8Encode(wsTextData, wsTextData.GetLength()).AsByteStringC());
}
}
void CXFA_Node::Script_Source_Next(CFXJSE_Arguments* pArguments) {
@@ -3728,7 +3743,8 @@ void CXFA_Node::Script_Script_Stateless(FXJSE_HVALUE hValue,
ThrowScriptErrorMessage(XFA_IDS_INVAlID_PROP_SET);
return;
}
- FXJSE_Value_SetUTF8String(hValue, FX_UTF8Encode(FX_WSTRC(L"0")));
+ FXJSE_Value_SetUTF8String(hValue,
+ FX_UTF8Encode(FX_WSTRC(L"0")).AsByteStringC());
}
void CXFA_Node::Script_Encrypt_Format(FXJSE_HVALUE hValue,
FX_BOOL bSetting,
diff --git a/xfa/fxfa/parser/xfa_script_eventpseudomodel.cpp b/xfa/fxfa/parser/xfa_script_eventpseudomodel.cpp
index f616596a7f..4cfcf1cbc7 100644
--- a/xfa/fxfa/parser/xfa_script_eventpseudomodel.cpp
+++ b/xfa/fxfa/parser/xfa_script_eventpseudomodel.cpp
@@ -34,7 +34,7 @@ void Script_EventPseudoModel_StringProperty(FXJSE_HVALUE hValue,
FXJSE_Value_ToUTF8String(hValue, bsValue);
wsValue = CFX_WideString::FromUTF8(bsValue, bsValue.GetLength());
} else {
- FXJSE_Value_SetUTF8String(hValue, FX_UTF8Encode(wsValue));
+ FXJSE_Value_SetUTF8String(hValue, FX_UTF8Encode(wsValue).AsByteStringC());
}
}
void Script_EventPseudoModel_InterProperty(FXJSE_HVALUE hValue,
diff --git a/xfa/fxfa/parser/xfa_script_hostpseudomodel.cpp b/xfa/fxfa/parser/xfa_script_hostpseudomodel.cpp
index ad20b76380..74c6300e02 100644
--- a/xfa/fxfa/parser/xfa_script_hostpseudomodel.cpp
+++ b/xfa/fxfa/parser/xfa_script_hostpseudomodel.cpp
@@ -32,7 +32,7 @@ void CScript_HostPseudoModel::Script_HostPseudoModel_LoadString(
uint32_t dwFlag) {
CFX_WideString wsValue;
pNotify->GetAppProvider()->LoadString(dwFlag, wsValue);
- FXJSE_Value_SetUTF8String(hValue, FX_UTF8Encode(wsValue));
+ FXJSE_Value_SetUTF8String(hValue, FX_UTF8Encode(wsValue).AsByteStringC());
}
void CScript_HostPseudoModel::Script_HostPseudoModel_AppType(
FXJSE_HVALUE hValue,
@@ -48,7 +48,7 @@ void CScript_HostPseudoModel::Script_HostPseudoModel_AppType(
}
CFX_WideString wsAppType;
pNotify->GetAppProvider()->GetAppType(wsAppType);
- FXJSE_Value_SetUTF8String(hValue, FX_UTF8Encode(wsAppType));
+ FXJSE_Value_SetUTF8String(hValue, FX_UTF8Encode(wsAppType).AsByteStringC());
}
void CScript_HostPseudoModel::Script_HostPseudoModel_FoxitAppType(
FXJSE_HVALUE hValue,
@@ -64,7 +64,7 @@ void CScript_HostPseudoModel::Script_HostPseudoModel_FoxitAppType(
}
CFX_WideString wsAppType;
pNotify->GetAppProvider()->GetFoxitAppType(wsAppType);
- FXJSE_Value_SetUTF8String(hValue, FX_UTF8Encode(wsAppType));
+ FXJSE_Value_SetUTF8String(hValue, FX_UTF8Encode(wsAppType).AsByteStringC());
}
void CScript_HostPseudoModel::Script_HostPseudoModel_CalculationsEnabled(
FXJSE_HVALUE hValue,
@@ -114,7 +114,7 @@ void CScript_HostPseudoModel::Script_HostPseudoModel_Language(
}
CFX_WideString wsLanguage;
pNotify->GetAppProvider()->GetLanguage(wsLanguage);
- FXJSE_Value_SetUTF8String(hValue, FX_UTF8Encode(wsLanguage));
+ FXJSE_Value_SetUTF8String(hValue, FX_UTF8Encode(wsLanguage).AsByteStringC());
}
void CScript_HostPseudoModel::Script_HostPseudoModel_NumPages(
FXJSE_HVALUE hValue,
@@ -146,7 +146,7 @@ void CScript_HostPseudoModel::Script_HostPseudoModel_Platform(
}
CFX_WideString wsPlatform;
pNotify->GetAppProvider()->GetPlatform(wsPlatform);
- FXJSE_Value_SetUTF8String(hValue, FX_UTF8Encode(wsPlatform));
+ FXJSE_Value_SetUTF8String(hValue, FX_UTF8Encode(wsPlatform).AsByteStringC());
}
void CScript_HostPseudoModel::Script_HostPseudoModel_Title(
FXJSE_HVALUE hValue,
@@ -169,7 +169,7 @@ void CScript_HostPseudoModel::Script_HostPseudoModel_Title(
}
CFX_WideString wsTitle;
pNotify->GetDocProvider()->GetTitle(hDoc, wsTitle);
- FXJSE_Value_SetUTF8String(hValue, FX_UTF8Encode(wsTitle));
+ FXJSE_Value_SetUTF8String(hValue, FX_UTF8Encode(wsTitle).AsByteStringC());
}
void CScript_HostPseudoModel::Script_HostPseudoModel_ValidationsEnabled(
FXJSE_HVALUE hValue,
@@ -205,7 +205,7 @@ void CScript_HostPseudoModel::Script_HostPseudoModel_Variation(
}
CFX_WideString wsVariation;
pNotify->GetAppProvider()->GetVariation(wsVariation);
- FXJSE_Value_SetUTF8String(hValue, FX_UTF8Encode(wsVariation));
+ FXJSE_Value_SetUTF8String(hValue, FX_UTF8Encode(wsVariation).AsByteStringC());
}
void CScript_HostPseudoModel::Script_HostPseudoModel_Version(
FXJSE_HVALUE hValue,
@@ -221,7 +221,7 @@ void CScript_HostPseudoModel::Script_HostPseudoModel_Version(
}
CFX_WideString wsVersion;
pNotify->GetAppProvider()->GetVersion(wsVersion);
- FXJSE_Value_SetUTF8String(hValue, FX_UTF8Encode(wsVersion));
+ FXJSE_Value_SetUTF8String(hValue, FX_UTF8Encode(wsVersion).AsByteStringC());
}
void CScript_HostPseudoModel::Script_HostPseudoModel_FoxitVersion(
FXJSE_HVALUE hValue,
@@ -237,7 +237,7 @@ void CScript_HostPseudoModel::Script_HostPseudoModel_FoxitVersion(
}
CFX_WideString wsVersion;
pNotify->GetAppProvider()->GetFoxitVersion(wsVersion);
- FXJSE_Value_SetUTF8String(hValue, FX_UTF8Encode(wsVersion));
+ FXJSE_Value_SetUTF8String(hValue, FX_UTF8Encode(wsVersion).AsByteStringC());
}
void CScript_HostPseudoModel::Script_HostPseudoModel_Name(
FXJSE_HVALUE hValue,
@@ -253,7 +253,7 @@ void CScript_HostPseudoModel::Script_HostPseudoModel_Name(
}
CFX_WideString wsAppName;
pNotify->GetAppProvider()->GetAppName(wsAppName);
- FXJSE_Value_SetUTF8String(hValue, FX_UTF8Encode(wsAppName));
+ FXJSE_Value_SetUTF8String(hValue, FX_UTF8Encode(wsAppName).AsByteStringC());
}
void CScript_HostPseudoModel::Script_HostPseudoModel_FoxitName(
FXJSE_HVALUE hValue,
@@ -269,7 +269,8 @@ void CScript_HostPseudoModel::Script_HostPseudoModel_FoxitName(
}
CFX_WideString wsFoxitAppName;
pNotify->GetAppProvider()->GetFoxitAppName(wsFoxitAppName);
- FXJSE_Value_SetUTF8String(hValue, FX_UTF8Encode(wsFoxitAppName));
+ FXJSE_Value_SetUTF8String(hValue,
+ FX_UTF8Encode(wsFoxitAppName).AsByteStringC());
}
void CScript_HostPseudoModel::Script_HostPseudoModel_GotoURL(
CFXJSE_Arguments* pArguments) {
@@ -388,7 +389,7 @@ void CScript_HostPseudoModel::Script_HostPseudoModel_Response(
wsDefaultAnswer, bMark);
FXJSE_HVALUE hValue = pArguments->GetReturnValue();
if (hValue) {
- FXJSE_Value_SetUTF8String(hValue, FX_UTF8Encode(wsAnswer));
+ FXJSE_Value_SetUTF8String(hValue, FX_UTF8Encode(wsAnswer).AsByteStringC());
}
}
void CScript_HostPseudoModel::Script_HostPseudoModel_DocumentInBatch(
@@ -801,6 +802,7 @@ void CScript_HostPseudoModel::Script_HostPseudoModel_CurrentDateTime(
CFX_WideString wsDataTime = pNotify->GetCurrentDateTime();
FXJSE_HVALUE hValue = pArguments->GetReturnValue();
if (hValue) {
- FXJSE_Value_SetUTF8String(hValue, FX_UTF8Encode(wsDataTime));
+ FXJSE_Value_SetUTF8String(hValue,
+ FX_UTF8Encode(wsDataTime).AsByteStringC());
}
}