diff options
Diffstat (limited to 'core')
39 files changed, 144 insertions, 158 deletions
diff --git a/core/fpdfapi/fpdf_edit/cpdf_pagecontentgenerator.cpp b/core/fpdfapi/fpdf_edit/cpdf_pagecontentgenerator.cpp index af79fd31c1..a484edd6b9 100644 --- a/core/fpdfapi/fpdf_edit/cpdf_pagecontentgenerator.cpp +++ b/core/fpdfapi/fpdf_edit/cpdf_pagecontentgenerator.cpp @@ -74,12 +74,12 @@ CFX_ByteString CPDF_PageContentGenerator::RealizeResource( int idnum = 1; while (1) { name.Format("FX%c%d", szType[0], idnum); - if (!pResList->KeyExist(name.AsByteStringC())) { + if (!pResList->KeyExist(name.AsStringC())) { break; } idnum++; } - pResList->AddReference(name.AsByteStringC(), m_pDocument, + pResList->AddReference(name.AsStringC(), m_pDocument, pResourceObj->GetObjNum()); return name; } diff --git a/core/fpdfapi/fpdf_edit/fpdf_edit_create.cpp b/core/fpdfapi/fpdf_edit/fpdf_edit_create.cpp index 323602b0e1..c0d2ab0dd3 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().AsByteStringC())) < 0) { + if ((len = pFile->AppendString(pObj->GetString().AsStringC())) < 0) { return -1; } offset += len + 1; @@ -62,8 +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).AsByteStringC())) < 0) { + if ((len = pFile->AppendString(PDF_EncodeString(str, bHex).AsStringC())) < + 0) { return -1; } offset += len; @@ -74,8 +74,7 @@ int32_t PDF_CreatorAppendObject(const CPDF_Object* pObj, return -1; } CFX_ByteString str = pObj->GetString(); - if ((len = pFile->AppendString(PDF_NameEncode(str).AsByteStringC())) < - 0) { + if ((len = pFile->AppendString(PDF_NameEncode(str).AsStringC())) < 0) { return -1; } offset += len + 1; @@ -134,8 +133,7 @@ int32_t PDF_CreatorAppendObject(const CPDF_Object* pObj, if (pFile->AppendString("/") < 0) { return -1; } - if ((len = pFile->AppendString(PDF_NameEncode(key).AsByteStringC())) < - 0) { + if ((len = pFile->AppendString(PDF_NameEncode(key).AsStringC())) < 0) { return -1; } offset += len + 1; @@ -214,8 +212,7 @@ int32_t PDF_CreatorWriteTrailer(CPDF_Document* pDocument, if (pFile->AppendString(("/")) < 0) { return -1; } - if ((len = pFile->AppendString(PDF_NameEncode(key).AsByteStringC())) < - 0) { + if ((len = pFile->AppendString(PDF_NameEncode(key).AsStringC())) < 0) { return -1; } offset += len + 1; @@ -1118,7 +1115,7 @@ int32_t CPDF_Creator::WriteDirectObj(uint32_t objnum, if (m_File.AppendString(" ") < 0) { return -1; } - if ((len = m_File.AppendString(pObj->GetString().AsByteStringC())) < 0) { + if ((len = m_File.AppendString(pObj->GetString().AsStringC())) < 0) { return -1; } m_Offset += len + 1; @@ -1128,7 +1125,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.AsByteStringC())) < 0) { + if ((len = m_File.AppendString(content.AsStringC())) < 0) { return -1; } m_Offset += len; @@ -1140,7 +1137,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.AsByteStringC())) < 0) { + if ((len = m_File.AppendString(content.AsStringC())) < 0) { return -1; } m_Offset += len; @@ -1180,8 +1177,7 @@ int32_t CPDF_Creator::WriteDirectObj(uint32_t objnum, return -1; } CFX_ByteString str = pObj->GetString(); - if ((len = m_File.AppendString(PDF_NameEncode(str).AsByteStringC())) < - 0) { + if ((len = m_File.AppendString(PDF_NameEncode(str).AsStringC())) < 0) { return -1; } m_Offset += len + 1; @@ -1245,8 +1241,7 @@ int32_t CPDF_Creator::WriteDirectObj(uint32_t objnum, if (m_File.AppendString("/") < 0) { return -1; } - if ((len = m_File.AppendString(PDF_NameEncode(key).AsByteStringC())) < - 0) { + if ((len = m_File.AppendString(PDF_NameEncode(key).AsStringC())) < 0) { return -1; } m_Offset += len + 1; @@ -1648,7 +1643,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.AsByteStringC()) < 0) { + if (m_File.AppendString(str.AsStringC()) < 0) { return -1; } m_Pos = (void*)(uintptr_t)1; @@ -1777,7 +1772,7 @@ int32_t CPDF_Creator::WriteDoc_Stage4(IFX_Pause* pPause) { if (m_File.AppendString(("/")) < 0) { return -1; } - if (m_File.AppendString(PDF_NameEncode(key).AsByteStringC()) < 0) { + if (m_File.AppendString(PDF_NameEncode(key).AsStringC()) < 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 d70c04c690..04ab9ea863 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.AsByteStringC(), pEncoding); + return GetPageData()->GetStandardFont(name.AsStringC(), 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 a3adecc764..c405072502 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.AsByteStringC()); - uint32_t highcode = (lowcode & 0xffffff00) | - (StringToCode(high.AsByteStringC()) & 0xff); + uint32_t lowcode = StringToCode(low.AsStringC()); + uint32_t highcode = + (lowcode & 0xffffff00) | (StringToCode(high.AsStringC()) & 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.AsByteStringC()); + CFX_WideString destcode = StringToWideString(dest.AsStringC()); 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.AsByteStringC()); + CFX_WideString destcode = StringToWideString(start.AsStringC()); int len = destcode.GetLength(); uint32_t value = 0; if (len == 1) { - value = StringToCode(start.AsByteStringC()); + value = StringToCode(start.AsStringC()); 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 78c72a7fef..da6b8de35b 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.AsByteStringC(), word)) { + if (CMap_GetCodeRange(range, m_LastWord.AsStringC(), word)) { m_CodeRanges.Add(range); } } diff --git a/core/fpdfapi/fpdf_page/cpdf_allstates.cpp b/core/fpdfapi/fpdf_page/cpdf_allstates.cpp index d81a488d20..f2d637f888 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.AsByteStringC()); + pGeneralState->SetBlendMode(mode.AsStringC()); 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 758ce940d2..2dfccb26d7 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.AsByteStringC()); + pCSObj = pList->GetDirectObjectBy(name.AsStringC()); 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 4f304a3b3b..21edc9e0cd 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.AsByteStringC(), m_pDocument, dwObjNum); + pDict->SetAtReference(key.AsStringC(), m_pDocument, dwObjNum); else - pDict->SetAt(key.AsByteStringC(), pObj.release()); + pDict->SetAt(key.AsStringC(), pObj.release()); } } PDF_ReplaceAbbr(pDict); @@ -721,8 +721,7 @@ void CPDF_StreamContentParser::Handle_ExecuteXObject() { pList = m_pPageResources->GetDictBy("XObject"); if (!pList) return; - CPDF_Reference* pRes = - ToReference(pList->GetObjectBy(name.AsByteStringC())); + CPDF_Reference* pRes = ToReference(pList->GetObjectBy(name.AsStringC())); if (!pRes) return; @@ -1258,7 +1257,7 @@ CPDF_Object* CPDF_StreamContentParser::FindResourceObj( if (!pList) { return NULL; } - CPDF_Object* pRes = pList->GetDirectObjectBy(name.AsByteStringC()); + CPDF_Object* pRes = pList->GetDirectObjectBy(name.AsStringC()); return pRes; } CPDF_Dictionary* pList = m_pResources->GetDictBy(type); @@ -1270,10 +1269,10 @@ CPDF_Object* CPDF_StreamContentParser::FindResourceObj( if (!pList) { return NULL; } - CPDF_Object* pRes = pList->GetDirectObjectBy(name.AsByteStringC()); + CPDF_Object* pRes = pList->GetDirectObjectBy(name.AsStringC()); return pRes; } - CPDF_Object* pRes = pList->GetDirectObjectBy(name.AsByteStringC()); + CPDF_Object* pRes = pList->GetDirectObjectBy(name.AsStringC()); return pRes; } @@ -1766,7 +1765,7 @@ void PDF_ReplaceAbbr(CPDF_Object* pObj) { CPDF_Object* value = it.second; CFX_ByteStringC fullname = PDF_FindFullName(PDF_InlineKeyAbbr, FX_ArraySize(PDF_InlineKeyAbbr), - key.AsByteStringC()); + key.AsStringC()); if (!fullname.IsEmpty()) { AbbrReplacementOp op; op.is_replace_key = true; @@ -1780,7 +1779,7 @@ void PDF_ReplaceAbbr(CPDF_Object* pObj) { CFX_ByteString name = value->GetString(); fullname = PDF_FindFullName(PDF_InlineValueAbbr, FX_ArraySize(PDF_InlineValueAbbr), - name.AsByteStringC()); + name.AsStringC()); if (!fullname.IsEmpty()) { AbbrReplacementOp op; op.is_replace_key = false; @@ -1794,9 +1793,9 @@ void PDF_ReplaceAbbr(CPDF_Object* pObj) { } for (const auto& op : replacements) { if (op.is_replace_key) - pDict->ReplaceKey(op.key.AsByteStringC(), op.replacement); + pDict->ReplaceKey(op.key.AsStringC(), op.replacement); else - pDict->SetAtName(op.key.AsByteStringC(), op.replacement); + pDict->SetAtName(op.key.AsStringC(), op.replacement); } break; } @@ -1808,7 +1807,7 @@ void PDF_ReplaceAbbr(CPDF_Object* pObj) { CFX_ByteString name = pElement->GetString(); CFX_ByteStringC fullname = PDF_FindFullName( PDF_InlineValueAbbr, FX_ArraySize(PDF_InlineValueAbbr), - name.AsByteStringC()); + name.AsStringC()); 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 058ac338b2..5ec25d9fde 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.AsByteStringC(), pObj); + pDict->SetAt(key.AsStringC(), pObj); } else { pObj->Release(); } diff --git a/core/fpdfapi/fpdf_parser/cpdf_name.cpp b/core/fpdfapi/fpdf_parser/cpdf_name.cpp index a7adf1b3d6..d641374547 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 m_Name.AsByteStringC(); + return m_Name.AsStringC(); } 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 dbc17d5dd6..a6bace57c9 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.AsByteStringC(), m_bInteger, &m_Integer); + FX_atonum(str.AsStringC(), 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 17fd891d1b..362991f723 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.AsByteStringC()))) + if (!Equal(it->second, dict2->GetObjectBy(it->first.AsStringC()))) return false; } return true; diff --git a/core/fpdfapi/fpdf_parser/cpdf_parser.cpp b/core/fpdfapi/fpdf_parser/cpdf_parser.cpp index 15af1ca5c7..4ba43678b8 100644 --- a/core/fpdfapi/fpdf_parser/cpdf_parser.cpp +++ b/core/fpdfapi/fpdf_parser/cpdf_parser.cpp @@ -822,10 +822,10 @@ FX_BOOL CPDF_Parser::RebuildCrossRef() { uint32_t dwObjNum = pElement ? pElement->GetObjNum() : 0; if (dwObjNum) { - m_pTrailer->SetAtReference(key.AsByteStringC(), + m_pTrailer->SetAtReference(key.AsStringC(), m_pDocument, dwObjNum); } else { - m_pTrailer->SetAt(key.AsByteStringC(), + m_pTrailer->SetAt(key.AsStringC(), 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 9846c40d8f..b7ed0315bb 100644 --- a/core/fpdfapi/fpdf_parser/cpdf_standard_security_handler.cpp +++ b/core/fpdfapi/fpdf_parser/cpdf_standard_security_handler.cpp @@ -173,7 +173,7 @@ FX_BOOL CPDF_StandardSecurityHandler::LoadDict(CPDF_Dictionary* pEncryptDict) { if (stmf_name != strf_name) { return FALSE; } - if (!_LoadCryptInfo(pEncryptDict, strf_name.AsByteStringC(), m_Cipher, + if (!_LoadCryptInfo(pEncryptDict, strf_name.AsStringC(), m_Cipher, m_KeyLen)) { return FALSE; } @@ -196,8 +196,7 @@ FX_BOOL CPDF_StandardSecurityHandler::LoadDict(CPDF_Dictionary* pEncryptDict, return FALSE; } } - if (!_LoadCryptInfo(pEncryptDict, strf_name.AsByteStringC(), cipher, - key_len)) { + if (!_LoadCryptInfo(pEncryptDict, strf_name.AsStringC(), 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 3f04d125a2..52f6a5a836 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 m_String.AsByteStringC(); + return m_String.AsStringC(); } 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 3deecf54ff..0190c6e692 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.AsByteStringC()); + return new CPDF_Number(word.AsStringC()); } 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.AsByteStringC()); + return new CPDF_Number(word.AsStringC()); } if (word == "true" || word == "false") diff --git a/core/fpdfdoc/cpvt_color.cpp b/core/fpdfdoc/cpvt_color.cpp index 7ddb9df0d0..72b8140b7b 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.AsByteStringC()); + CPDF_SimpleParser syntax(str.AsStringC()); 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 eb8869df2b..a0919ed084 100644 --- a/core/fpdfdoc/cpvt_fontmap.cpp +++ b/core/fpdfdoc/cpvt_fontmap.cpp @@ -38,8 +38,8 @@ void CPVT_FontMap::GetAnnotSysPDFFont(CPDF_Document* pDoc, return; if (CPDF_Dictionary* pFontList = pResDict->GetDictBy("Font")) { - if (!pFontList->KeyExist(sSysFontAlias.AsByteStringC())) - pFontList->SetAtReference(sSysFontAlias.AsByteStringC(), pDoc, + if (!pFontList->KeyExist(sSysFontAlias.AsStringC())) + pFontList->SetAtReference(sSysFontAlias.AsStringC(), pDoc, pPDFFont->GetFontDict()); } pSysFont = pPDFFont; diff --git a/core/fpdfdoc/cpvt_generateap.cpp b/core/fpdfdoc/cpvt_generateap.cpp index ee99becaee..19b171a896 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.AsByteStringC()); + CPDF_SimpleParser syntax(DA.AsStringC()); 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).AsByteStringC()); + pFontDict = pDRFontDict->GetDictBy(sFontName.Mid(1).AsStringC()); if (!pFontDict && !bUseFormRes) { pDRDict = pFormDict->GetDictBy("DR"); pDRFontDict = pDRDict->GetDictBy("Font"); if (pDRFontDict) - pFontDict = pDRFontDict->GetDictBy(sFontName.Mid(1).AsByteStringC()); + pFontDict = pDRFontDict->GetDictBy(sFontName.Mid(1).AsStringC()); } } if (!pDRFontDict) @@ -72,8 +72,7 @@ FX_BOOL GenerateWidgetAP(CPDF_Document* pDoc, pFontDict->SetAtName("BaseFont", "Helvetica"); pFontDict->SetAtName("Encoding", "WinAnsiEncoding"); pDoc->AddIndirectObject(pFontDict); - pDRFontDict->SetAtReference(sFontName.Mid(1).AsByteStringC(), pDoc, - pFontDict); + pDRFontDict->SetAtReference(sFontName.Mid(1).AsStringC(), pDoc, pFontDict); } CPDF_Font* pDefFont = pDoc->LoadFont(pFontDict); if (!pDefFont) @@ -190,8 +189,8 @@ FX_BOOL GenerateWidgetAP(CPDF_Document* pDoc, pStreamResFontList = new CPDF_Dictionary; pStreamResList->SetAt("Font", pStreamResFontList); } - if (!pStreamResFontList->KeyExist(sFontName.AsByteStringC())) - pStreamResFontList->SetAtReference(sFontName.AsByteStringC(), pDoc, + if (!pStreamResFontList->KeyExist(sFontName.AsStringC())) + pStreamResFontList->SetAtReference(sFontName.AsStringC(), pDoc, pFontDict); } else { pStreamDict->SetAt("Resources", pFormDict->GetDictBy("DR")->Clone()); @@ -437,8 +436,8 @@ FX_BOOL GenerateWidgetAP(CPDF_Document* pDoc, pStreamResFontList = new CPDF_Dictionary; pStreamResList->SetAt("Font", pStreamResFontList); } - if (!pStreamResFontList->KeyExist(sFontName.AsByteStringC())) - pStreamResFontList->SetAtReference(sFontName.AsByteStringC(), pDoc, + if (!pStreamResFontList->KeyExist(sFontName.AsStringC())) + pStreamResFontList->SetAtReference(sFontName.AsStringC(), pDoc, pFontDict); } else { pStreamDict->SetAt("Resources", pFormDict->GetDictBy("DR")->Clone()); diff --git a/core/fpdfdoc/doc_action.cpp b/core/fpdfdoc/doc_action.cpp index 075849482c..3036d61ab0 100644 --- a/core/fpdfdoc/doc_action.cpp +++ b/core/fpdfdoc/doc_action.cpp @@ -39,7 +39,7 @@ CPDF_Dest CPDF_Action::GetDest(CPDF_Document* pDoc) const { if (pDest->IsString() || pDest->IsName()) { CPDF_NameTree name_tree(pDoc, "Dests"); return CPDF_Dest( - name_tree.LookupNamedDest(pDoc, pDest->GetString().AsByteStringC())); + name_tree.LookupNamedDest(pDoc, pDest->GetString().AsStringC())); } if (CPDF_Array* pArray = pDest->AsArray()) return CPDF_Dest(pArray); @@ -74,7 +74,7 @@ CFX_WideString CPDF_Action::GetFilePath() const { CPDF_Dictionary* pWinDict = m_pDict->GetDictBy("Win"); if (pWinDict) { return CFX_WideString::FromLocal( - pWinDict->GetStringBy("F").AsByteStringC()); + pWinDict->GetStringBy("F").AsStringC()); } } return path; diff --git a/core/fpdfdoc/doc_annot.cpp b/core/fpdfdoc/doc_annot.cpp index d1942eccd0..1db37ccdb3 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.AsByteStringC())) + if (value.IsEmpty() || !pDict->KeyExist(value.AsStringC())) as = "Off"; else as = value; } - return pDict->GetStreamBy(as.AsByteStringC()); + return pDict->GetStreamBy(as.AsStringC()); } return nullptr; } diff --git a/core/fpdfdoc/doc_basic.cpp b/core/fpdfdoc/doc_basic.cpp index 308bf04287..bdb3f8cb0a 100644 --- a/core/fpdfdoc/doc_basic.cpp +++ b/core/fpdfdoc/doc_basic.cpp @@ -90,13 +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.AsByteStringC()) > 0) { + if (csLeft.Compare(csRight.AsStringC()) > 0) { CFX_ByteString csTmp = csRight; csRight = csLeft; csLeft = csTmp; } - if (csName.Compare(csLeft.AsByteStringC()) < 0 || - csName.Compare(csRight.AsByteStringC()) > 0) { + if (csName.Compare(csLeft.AsStringC()) < 0 || + csName.Compare(csRight.AsStringC()) > 0) { return NULL; } } @@ -105,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.AsByteStringC()); + int32_t iCompare = csValue.Compare(csName.AsStringC()); if (iCompare <= 0) { if (ppFind) { *ppFind = pNames; @@ -321,25 +321,24 @@ bool CPDF_FileSpec::GetFileName(CFX_WideString* csFileName) const { return true; if (csFileName->IsEmpty()) { if (pDict->KeyExist("DOS")) { - *csFileName = CFX_WideString::FromLocal( - pDict->GetStringBy("DOS").AsByteStringC()); + *csFileName = + CFX_WideString::FromLocal(pDict->GetStringBy("DOS").AsStringC()); } else if (pDict->KeyExist("Mac")) { - *csFileName = CFX_WideString::FromLocal( - pDict->GetStringBy("Mac").AsByteStringC()); + *csFileName = + CFX_WideString::FromLocal(pDict->GetStringBy("Mac").AsStringC()); } else if (pDict->KeyExist("Unix")) { - *csFileName = CFX_WideString::FromLocal( - pDict->GetStringBy("Unix").AsByteStringC()); + *csFileName = + CFX_WideString::FromLocal(pDict->GetStringBy("Unix").AsStringC()); } else { return false; } } } else if (m_pObj->IsString()) { - *csFileName = - CFX_WideString::FromLocal(m_pObj->GetString().AsByteStringC()); + *csFileName = CFX_WideString::FromLocal(m_pObj->GetString().AsStringC()); } else { return false; } - *csFileName = DecodeFileName(csFileName->AsWideStringC()); + *csFileName = DecodeFileName(csFileName->AsStringC()); return true; } @@ -505,7 +504,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.AsByteStringC())) { + if (!bsLbl.Compare(bsOrig.AsStringC())) { return i; } } @@ -517,5 +516,5 @@ int32_t CPDF_PageLabel::GetPageByLabel(const CFX_ByteStringC& bsLabel) const { return -1; } int32_t CPDF_PageLabel::GetPageByLabel(const CFX_WideStringC& wsLabel) const { - return GetPageByLabel(PDF_EncodeText(wsLabel.c_str()).AsByteStringC()); + return GetPageByLabel(PDF_EncodeText(wsLabel.c_str()).AsStringC()); } diff --git a/core/fpdfdoc/doc_bookmark.cpp b/core/fpdfdoc/doc_bookmark.cpp index 18e6174621..aee9fb7b14 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"); - return CPDF_Dest(name_tree.LookupNamedDest( - pDocument, pDest->GetString().AsByteStringC())); + return CPDF_Dest( + name_tree.LookupNamedDest(pDocument, pDest->GetString().AsStringC())); } 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 384bcaa435..e1f5f30856 100644 --- a/core/fpdfdoc/doc_form.cpp +++ b/core/fpdfdoc/doc_form.cpp @@ -35,13 +35,13 @@ CFX_WideString FPDFDOC_FDF_GetFieldValue(const CPDF_Dictionary& pFieldDict, const CFX_ByteString csBValue = pFieldDict.GetStringBy("V"); for (const auto& encoding : g_fieldEncoding) { if (bsEncoding == encoding.m_name) - return CFX_WideString::FromCodePage(csBValue.AsByteStringC(), + return CFX_WideString::FromCodePage(csBValue.AsStringC(), encoding.m_codePage); } CFX_ByteString csTemp = csBValue.Left(2); if (csTemp == "\xFF\xFE" || csTemp == "\xFE\xFF") return PDF_DecodeText(csBValue); - return CFX_WideString::FromLocal(csBValue.AsByteStringC()); + return CFX_WideString::FromLocal(csBValue.AsStringC()); } } // namespace @@ -345,7 +345,7 @@ CFX_ByteString CPDF_InterForm::GenerateNewResourceName( CFX_ByteString bsNum; while (TRUE) { CFX_ByteString csKey = csTmp + bsNum; - if (!pDict->KeyExist(csKey.AsByteStringC())) { + if (!pDict->KeyExist(csKey.AsStringC())) { return csKey; } if (m < iCount) { diff --git a/core/fpdfdoc/doc_formcontrol.cpp b/core/fpdfdoc/doc_formcontrol.cpp index 6435cfd76c..1fef183d80 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.AsByteStringC(), csValue.AsByteStringC()); + pSubDict->ReplaceKey(csKey2.AsStringC(), csValue.AsStringC()); break; } } @@ -202,7 +202,7 @@ CPDF_ApSettings CPDF_FormControl::GetMK() const { } bool CPDF_FormControl::HasMKEntry(CFX_ByteString csEntry) const { - return GetMK().HasMKEntry(csEntry.AsByteStringC()); + return GetMK().HasMKEntry(csEntry.AsStringC()); } 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.AsByteStringC()); + return GetMK().GetColor(iColorType, csEntry.AsStringC()); } FX_FLOAT CPDF_FormControl::GetOriginalColor(int index, CFX_ByteString csEntry) { - return GetMK().GetOriginalColor(index, csEntry.AsByteStringC()); + return GetMK().GetOriginalColor(index, csEntry.AsStringC()); } void CPDF_FormControl::GetOriginalColor(int& iColorType, FX_FLOAT fc[4], CFX_ByteString csEntry) { - GetMK().GetOriginalColor(iColorType, fc, csEntry.AsByteStringC()); + GetMK().GetOriginalColor(iColorType, fc, csEntry.AsStringC()); } CFX_WideString CPDF_FormControl::GetCaption(CFX_ByteString csEntry) { - return GetMK().GetCaption(csEntry.AsByteStringC()); + return GetMK().GetCaption(csEntry.AsStringC()); } CPDF_Stream* CPDF_FormControl::GetIcon(CFX_ByteString csEntry) { - return GetMK().GetIcon(csEntry.AsByteStringC()); + return GetMK().GetIcon(csEntry.AsStringC()); } CPDF_IconFit CPDF_FormControl::GetIconFit() { @@ -286,8 +286,7 @@ 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.AsByteStringC()); + CPDF_Dictionary* pElement = pFonts->GetDictBy(csFontNameTag.AsStringC()); if (pElement) { CPDF_Font* pFont = m_pField->m_pForm->m_pDocument->LoadFont(pElement); if (pFont) { @@ -304,8 +303,7 @@ 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.AsByteStringC()); + CPDF_Dictionary* pElement = pFonts->GetDictBy(csFontNameTag.AsStringC()); 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 1adc92ae4f..103465a8e5 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.AsByteStringC()); + CPDF_SimpleParser syntax(DA.AsStringC()); 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.AsByteStringC()); + ->GetDictBy(font_name.AsStringC()); if (!pFontDict) { return; diff --git a/core/fpdfdoc/doc_link.cpp b/core/fpdfdoc/doc_link.cpp index 8f8d0d158c..07cc9f26ff 100644 --- a/core/fpdfdoc/doc_link.cpp +++ b/core/fpdfdoc/doc_link.cpp @@ -82,7 +82,7 @@ CPDF_Dest CPDF_Link::GetDest(CPDF_Document* pDoc) { if (pDest->IsString() || pDest->IsName()) { CPDF_NameTree name_tree(pDoc, "Dests"); return CPDF_Dest( - name_tree.LookupNamedDest(pDoc, pDest->GetString().AsByteStringC())); + name_tree.LookupNamedDest(pDoc, pDest->GetString().AsStringC())); } 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 02b6eb115e..9b57509e56 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.AsByteStringC()) != "OFF"; + bState = pState->GetStringBy(csFind.AsStringC()) != "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.AsByteStringC()); + CPDF_Dictionary* pState = pUsage->GetDictBy(csState.AsStringC()); if (pState) { CFX_ByteString csFind = csState + "State"; - if (pState->KeyExist(csFind.AsByteStringC())) { - return pState->GetStringBy(csFind.AsByteStringC()) != "OFF"; + if (pState->KeyExist(csFind.AsStringC())) { + return pState->GetStringBy(csFind.AsStringC()) != "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.AsByteStringC(), pOCGDict, bDefValid); + return LoadOCGStateFromConfig(csState.AsStringC(), 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 94c143d51c..a86514059c 100644 --- a/core/fpdfdoc/doc_tagged.cpp +++ b/core/fpdfdoc/doc_tagged.cpp @@ -205,8 +205,7 @@ 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.AsByteStringC()); + CFX_ByteString mapped = pTree->m_pRoleMap->GetStringBy(m_Type.AsStringC()); if (!mapped.IsEmpty()) { m_Type = mapped; } @@ -375,15 +374,14 @@ CPDF_Object* CPDF_StructElementImpl::GetAttr(const CFX_ByteStringC& owner, for (uint32_t i = 0; i < pArray->GetCount(); i++) { CFX_ByteString class_name = pArray->GetStringAt(i); CPDF_Dictionary* pClassDict = - pClassMap->GetDictBy(class_name.AsByteStringC()); + pClassMap->GetDictBy(class_name.AsStringC()); 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.AsByteStringC()); + CPDF_Dictionary* pClassDict = pClassMap->GetDictBy(class_name.AsStringC()); 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 7e7fa8110f..7c66b879cb 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.AsByteStringC()); + CPDF_SimpleParser syntax(m_csDA.AsStringC()); 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.AsByteStringC()); + CPDF_SimpleParser syntax(m_csDA.AsStringC()); if (syntax.FindTagParamFromStart("Tf", 2)) { csFont += (CFX_ByteString)syntax.GetWord(); csFont += " "; @@ -107,7 +107,7 @@ void CPDF_DefaultAppearance::GetFont(CFX_ByteString& csFontNameTag, if (m_csDA.IsEmpty()) { return; } - CPDF_SimpleParser syntax(m_csDA.AsByteStringC()); + CPDF_SimpleParser syntax(m_csDA.AsStringC()); if (syntax.FindTagParamFromStart("Tf", 2)) { csFontNameTag = CFX_ByteString(syntax.GetWord()); csFontNameTag.Delete(0, 1); @@ -119,7 +119,7 @@ FX_BOOL CPDF_DefaultAppearance::HasColor(FX_BOOL bStrokingOperation) { if (m_csDA.IsEmpty()) { return FALSE; } - CPDF_SimpleParser syntax(m_csDA.AsByteStringC()); + CPDF_SimpleParser syntax(m_csDA.AsStringC()); 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.AsByteStringC()); + CPDF_SimpleParser syntax(m_csDA.AsStringC()); if (syntax.FindTagParamFromStart(bStrokingOperation ? "G" : "g", 1)) { csColor += (CFX_ByteString)syntax.GetWord(); csColor += " "; @@ -174,7 +174,7 @@ void CPDF_DefaultAppearance::GetColor(int& iColorType, if (m_csDA.IsEmpty()) { return; } - CPDF_SimpleParser syntax(m_csDA.AsByteStringC()); + CPDF_SimpleParser syntax(m_csDA.AsStringC()); if (syntax.FindTagParamFromStart(bStrokingOperation ? "G" : "g", 1)) { iColorType = COLORTYPE_GRAY; fc[0] = FX_atof(syntax.GetWord()); @@ -203,7 +203,7 @@ void CPDF_DefaultAppearance::GetColor(FX_ARGB& color, if (m_csDA.IsEmpty()) { return; } - CPDF_SimpleParser syntax(m_csDA.AsByteStringC()); + CPDF_SimpleParser syntax(m_csDA.AsStringC()); if (syntax.FindTagParamFromStart(bStrokingOperation ? "G" : "g", 1)) { iColorType = COLORTYPE_GRAY; FX_FLOAT g = FX_atof(syntax.GetWord()) * 255 + 0.5f; @@ -235,7 +235,7 @@ FX_BOOL CPDF_DefaultAppearance::HasTextMatrix() { if (m_csDA.IsEmpty()) { return FALSE; } - CPDF_SimpleParser syntax(m_csDA.AsByteStringC()); + CPDF_SimpleParser syntax(m_csDA.AsStringC()); 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.AsByteStringC()); + CPDF_SimpleParser syntax(m_csDA.AsStringC()); if (syntax.FindTagParamFromStart("Tm", 6)) { for (int i = 0; i < 6; i++) { csTM += (CFX_ByteString)syntax.GetWord(); @@ -258,7 +258,7 @@ CFX_Matrix CPDF_DefaultAppearance::GetTextMatrix() { if (m_csDA.IsEmpty()) { return tm; } - CPDF_SimpleParser syntax(m_csDA.AsByteStringC()); + CPDF_SimpleParser syntax(m_csDA.AsStringC()); if (syntax.FindTagParamFromStart("Tm", 6)) { FX_FLOAT f[6]; for (int i = 0; i < 6; i++) { @@ -387,7 +387,7 @@ CPDF_Font* GetInterFormFont(CPDF_Dictionary* pFormDict, if (!pFonts) { return NULL; } - CPDF_Dictionary* pElement = pFonts->GetDictBy(csAlias.AsByteStringC()); + CPDF_Dictionary* pElement = pFonts->GetDictBy(csAlias.AsStringC()); if (!pElement) { return NULL; } @@ -606,7 +606,7 @@ void AddInterFormFont(CPDF_Dictionary*& pFormDict, csNameTag.Remove(' '); csNameTag = CPDF_InterForm::GenerateNewResourceName(pDR, "Font", 4, csNameTag); - pFonts->SetAtReference(csNameTag.AsByteStringC(), pDocument, + pFonts->SetAtReference(csNameTag.AsStringC(), pDocument, pFont->GetFontDict()); } CPDF_Font* AddNativeInterFormFont(CPDF_Dictionary*& pFormDict, @@ -651,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.AsByteStringC()); + pFonts->RemoveAt(csTag.AsStringC()); } void RemoveInterFormFont(CPDF_Dictionary* pFormDict, CFX_ByteString csNameTag) { if (!pFormDict || csNameTag.IsEmpty()) { @@ -665,7 +665,7 @@ void RemoveInterFormFont(CPDF_Dictionary* pFormDict, CFX_ByteString csNameTag) { if (!pFonts) { return; } - pFonts->RemoveAt(csNameTag.AsByteStringC()); + pFonts->RemoveAt(csNameTag.AsStringC()); } CPDF_Font* GetDefaultInterFormFont(CPDF_Dictionary* pFormDict, diff --git a/core/fxcrt/fx_basic_bstring.cpp b/core/fxcrt/fx_basic_bstring.cpp index 34abe1e067..5b9c683c53 100644 --- a/core/fxcrt/fx_basic_bstring.cpp +++ b/core/fxcrt/fx_basic_bstring.cpp @@ -810,7 +810,7 @@ CFX_ByteString CFX_ByteString::FromUnicode(const FX_WCHAR* str, // static CFX_ByteString CFX_ByteString::FromUnicode(const CFX_WideString& str) { - return CFX_CharMap::GetByteString(0, str.AsWideStringC()); + return CFX_CharMap::GetByteString(0, str.AsStringC()); } int CFX_ByteString::Compare(const CFX_ByteStringC& str) const { diff --git a/core/fxcrt/fx_basic_buffer.cpp b/core/fxcrt/fx_basic_buffer.cpp index 8553474914..7f85c95d3f 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.AsByteStringC()); + return operator<<(encoded.AsStringC()); } 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 d59a6b9780..b4df4d0532 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.AsByteStringC(), tag_name.AsByteStringC()); + pElement->SetTag(tag_space.AsStringC(), tag_name.AsStringC()); do { CFX_ByteString attr_space, attr_name; while (m_dwIndex < m_dwBufferSize) { @@ -397,9 +397,8 @@ CXML_Element* CXML_Parser::ParseElement(CXML_Element* pParent, } CFX_WideString attr_value; GetAttrValue(attr_value); - pElement->m_AttrMap.SetAt(attr_space.AsByteStringC(), - attr_name.AsByteStringC(), - attr_value.AsWideStringC()); + pElement->m_AttrMap.SetAt(attr_space.AsStringC(), attr_name.AsStringC(), + attr_value.AsStringC()); } m_nOffset = m_nBufferOffset + (FX_FILESIZE)m_dwIndex; if (m_dwIndex < m_dwBufferSize || IsEOF()) { @@ -462,7 +461,7 @@ CXML_Element* CXML_Parser::ParseElement(CXML_Element* pParent, if (!bCDATA && !m_bSaveSpaceChars) { dataStr.TrimRight(L" \t\r\n"); } - InsertContentSegment(bCDATA, dataStr.AsWideStringC(), pElement); + InsertContentSegment(bCDATA, dataStr.AsStringC(), pElement); content.Clear(); decoder.Clear(); bCDATA = FALSE; @@ -506,7 +505,7 @@ CXML_Element* CXML_Parser::ParseElement(CXML_Element* pParent, if (!m_bSaveSpaceChars) { dataStr.TrimRight(L" \t\r\n"); } - InsertContentSegment(bCDATA, dataStr.AsWideStringC(), pElement); + InsertContentSegment(bCDATA, dataStr.AsStringC(), pElement); content.Clear(); decoder.Clear(); bCDATA = FALSE; @@ -602,7 +601,7 @@ CFX_ByteString CXML_Element::GetNamespace(FX_BOOL bQualified) const { if (bQualified) { return m_QSpaceName; } - return GetNamespaceURI(m_QSpaceName.AsByteStringC()); + return GetNamespaceURI(m_QSpaceName.AsStringC()); } 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 a18bb69c55..9237acef6b 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).AsByteStringC(), dwMode); + return Open(FX_UTF8Encode(fileName).AsStringC(), 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 1cb5174351..1b64a5924f 100644 --- a/core/fxcrt/include/fx_basic.h +++ b/core/fxcrt/include/fx_basic.h @@ -67,7 +67,7 @@ class CFX_ByteTextBuf : public CFX_BinaryBuf { return *this << CFX_ByteStringC(pStr); } CFX_ByteTextBuf& operator<<(const CFX_ByteString& str) { - return *this << str.AsByteStringC(); + return *this << str.AsStringC(); } 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 6e2954fcbb..5e3cb45fba 100644 --- a/core/fxcrt/include/fx_string.h +++ b/core/fxcrt/include/fx_string.h @@ -188,7 +188,7 @@ class CFX_ByteString { // Explicit conversion to CFX_ByteStringC. // Note: |this| must outlive the use of the result. - CFX_ByteStringC AsByteStringC() const { + CFX_ByteStringC AsStringC() const { return CFX_ByteStringC(raw_str(), GetLength()); } @@ -332,29 +332,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.AsByteStringC(), str2.AsByteStringC()); + return CFX_ByteString(str1.AsStringC(), str2.AsStringC()); } inline CFX_ByteString operator+(const CFX_ByteString& str1, FX_CHAR ch) { - return CFX_ByteString(str1.AsByteStringC(), CFX_ByteStringC(ch)); + return CFX_ByteString(str1.AsStringC(), CFX_ByteStringC(ch)); } inline CFX_ByteString operator+(FX_CHAR ch, const CFX_ByteString& str2) { - return CFX_ByteString(ch, str2.AsByteStringC()); + return CFX_ByteString(ch, str2.AsStringC()); } inline CFX_ByteString operator+(const CFX_ByteString& str1, const FX_CHAR* str2) { - return CFX_ByteString(str1.AsByteStringC(), str2); + return CFX_ByteString(str1.AsStringC(), str2); } inline CFX_ByteString operator+(const FX_CHAR* str1, const CFX_ByteString& str2) { - return CFX_ByteString(str1, str2.AsByteStringC()); + return CFX_ByteString(str1, str2.AsStringC()); } inline CFX_ByteString operator+(const CFX_ByteString& str1, const CFX_ByteStringC& str2) { - return CFX_ByteString(str1.AsByteStringC(), str2); + return CFX_ByteString(str1.AsStringC(), str2); } inline CFX_ByteString operator+(const CFX_ByteStringC& str1, const CFX_ByteString& str2) { - return CFX_ByteString(str1, str2.AsByteStringC()); + return CFX_ByteString(str1, str2.AsStringC()); } class CFX_WideStringC { @@ -512,7 +512,7 @@ class CFX_WideString { // Explicit conversion to CFX_WideStringC. // Note: |this| must outlive the use of the result. - CFX_WideStringC AsWideStringC() const { + CFX_WideStringC AsStringC() const { return CFX_WideStringC(c_str(), GetLength()); } @@ -641,29 +641,29 @@ inline CFX_WideString operator+(FX_WCHAR ch, const CFX_WideStringC& str2) { } inline CFX_WideString operator+(const CFX_WideString& str1, const CFX_WideString& str2) { - return CFX_WideString(str1.AsWideStringC(), str2.AsWideStringC()); + return CFX_WideString(str1.AsStringC(), str2.AsStringC()); } inline CFX_WideString operator+(const CFX_WideString& str1, FX_WCHAR ch) { - return CFX_WideString(str1.AsWideStringC(), CFX_WideStringC(ch)); + return CFX_WideString(str1.AsStringC(), CFX_WideStringC(ch)); } inline CFX_WideString operator+(FX_WCHAR ch, const CFX_WideString& str2) { - return CFX_WideString(ch, str2.AsWideStringC()); + return CFX_WideString(ch, str2.AsStringC()); } inline CFX_WideString operator+(const CFX_WideString& str1, const FX_WCHAR* str2) { - return CFX_WideString(str1.AsWideStringC(), str2); + return CFX_WideString(str1.AsStringC(), str2); } inline CFX_WideString operator+(const FX_WCHAR* str1, const CFX_WideString& str2) { - return CFX_WideString(str1, str2.AsWideStringC()); + return CFX_WideString(str1, str2.AsStringC()); } inline CFX_WideString operator+(const CFX_WideString& str1, const CFX_WideStringC& str2) { - return CFX_WideString(str1.AsWideStringC(), str2); + return CFX_WideString(str1.AsStringC(), str2); } inline CFX_WideString operator+(const CFX_WideStringC& str1, const CFX_WideString& str2) { - return CFX_WideString(str1, str2.AsWideStringC()); + return CFX_WideString(str1, str2.AsStringC()); } inline bool operator==(const wchar_t* lhs, const CFX_WideString& rhs) { return rhs == lhs; diff --git a/core/fxge/ge/fx_ge_ps.cpp b/core/fxge/ge/fx_ge_ps.cpp index b4e9ed918a..241a184ed1 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.AsByteStringC() << "Tj\n"; + buf << hex.AsStringC() << "Tj\n"; } buf << "Q\n"; m_pOutput->OutputPS((const FX_CHAR*)buf.GetBuffer(), buf.GetSize()); diff --git a/core/fxge/ge/fx_ge_text.cpp b/core/fxge/ge/fx_ge_text.cpp index 125547e5a7..44ab9f7ab5 100644 --- a/core/fxge/ge/fx_ge_text.cpp +++ b/core/fxge/ge/fx_ge_text.cpp @@ -193,7 +193,7 @@ FX_BOOL CFX_RenderDevice::DrawNormalText(int nChars, #if _FXM_PLATFORM_ == _FXM_PLATFORM_APPLE_ if ((text_flags & FXFONT_CIDFONT) || (pFont->GetPsName().Find( - CFX_WideString::FromLocal("+ZJHL").AsWideStringC()) != -1) || + CFX_WideString::FromLocal("+ZJHL").AsStringC()) != -1) || (pFont->GetPsName() == CFX_WideString::FromLocal("CNAAJI+cmex10"))) { should_call_draw_device_text = false; } diff --git a/core/fxge/win32/fx_win32_device.cpp b/core/fxge/win32/fx_win32_device.cpp index 7b8a4faa55..60ae57c767 100644 --- a/core/fxge/win32/fx_win32_device.cpp +++ b/core/fxge/win32/fx_win32_device.cpp @@ -454,7 +454,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.AsByteStringC()); + pInfoFallback->AddPath(fonts_path.AsStringC()); } return pInfoFallback; } |