diff options
author | tsepez <tsepez@chromium.org> | 2016-04-13 15:41:21 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-04-13 15:41:21 -0700 |
commit | b4c9f3f04673753da30011e9f1282cd5d1fa0f40 (patch) | |
tree | 9890d43409c8d60b1041de921c961067907419fb | |
parent | cdce75706de7e76e73550a0582e1fd28af324fd0 (diff) | |
download | pdfium-b4c9f3f04673753da30011e9f1282cd5d1fa0f40.tar.xz |
Remove implicit cast from CFX_ByteString to (const char*).
BUG=
Review URL: https://codereview.chromium.org/1885973002
45 files changed, 148 insertions, 146 deletions
diff --git a/core/fpdfapi/fpdf_font/cpdf_font.cpp b/core/fpdfapi/fpdf_font/cpdf_font.cpp index 7a6043ad87..3dfadeda9e 100644 --- a/core/fpdfapi/fpdf_font/cpdf_font.cpp +++ b/core/fpdfapi/fpdf_font/cpdf_font.cpp @@ -485,7 +485,7 @@ const FX_CHAR* CPDF_Font::GetAdobeCharName(int iBaseEncoding, const FX_CHAR* name = nullptr; if (pCharNames) - name = pCharNames[charcode]; + name = pCharNames[charcode].c_str(); if ((!name || name[0] == 0) && iBaseEncoding) name = PDF_CharNameFromPredefinedCharSet(iBaseEncoding, charcode); return name && name[0] ? name : nullptr; diff --git a/core/fpdfapi/fpdf_font/cpdf_type3font.cpp b/core/fpdfapi/fpdf_font/cpdf_type3font.cpp index 92f5102cdb..40fb54fbc7 100644 --- a/core/fpdfapi/fpdf_font/cpdf_type3font.cpp +++ b/core/fpdfapi/fpdf_font/cpdf_type3font.cpp @@ -73,7 +73,8 @@ FX_BOOL CPDF_Type3Font::Load() { LoadPDFEncoding(pEncoding, m_BaseEncoding, m_pCharNames, FALSE, FALSE); if (m_pCharNames) { for (int i = 0; i < 256; i++) { - m_Encoding.m_Unicodes[i] = PDF_UnicodeFromAdobeName(m_pCharNames[i]); + m_Encoding.m_Unicodes[i] = + PDF_UnicodeFromAdobeName(m_pCharNames[i].c_str()); if (m_Encoding.m_Unicodes[i] == 0) { m_Encoding.m_Unicodes[i] = i; } diff --git a/core/fpdfapi/fpdf_font/fpdf_font_cid.cpp b/core/fpdfapi/fpdf_font/fpdf_font_cid.cpp index da6b8de35b..f84fa9f2f9 100644 --- a/core/fpdfapi/fpdf_font/fpdf_font_cid.cpp +++ b/core/fpdfapi/fpdf_font/fpdf_font_cid.cpp @@ -304,7 +304,7 @@ CPDF_CMap* CPDF_CMapManager::GetPredefinedCMap(const CFX_ByteString& name, CPDF_CMap* CPDF_CMapManager::LoadPredefinedCMap(const CFX_ByteString& name, FX_BOOL bPromptCJK) { CPDF_CMap* pCMap = new CPDF_CMap; - const FX_CHAR* pname = name; + const FX_CHAR* pname = name.c_str(); if (*pname == '/') { pname++; } @@ -315,7 +315,7 @@ CPDF_CMap* CPDF_CMapManager::LoadPredefinedCMap(const CFX_ByteString& name, void CPDF_CMapManager::ReloadAll() { for (const auto& pair : m_CMaps) { CPDF_CMap* pCMap = pair.second; - pCMap->LoadPredefined(this, pair.first, FALSE); + pCMap->LoadPredefined(this, pair.first.c_str(), FALSE); } for (size_t i = 0; i < FX_ArraySize(m_CID2UnicodeMaps); ++i) { if (CPDF_CID2UnicodeMap* pMap = m_CID2UnicodeMaps[i]) { diff --git a/core/fpdfapi/fpdf_page/cpdf_textobject.cpp b/core/fpdfapi/fpdf_page/cpdf_textobject.cpp index 444101fb9e..a3fbbad8b0 100644 --- a/core/fpdfapi/fpdf_page/cpdf_textobject.cpp +++ b/core/fpdfapi/fpdf_page/cpdf_textobject.cpp @@ -142,7 +142,7 @@ void CPDF_TextObject::SetSegments(const CFX_ByteString* pStrs, CPDF_Font* pFont = m_TextState.GetFont(); m_nChars = 0; for (int i = 0; i < nsegs; ++i) { - m_nChars += pFont->CountChar(pStrs[i], pStrs[i].GetLength()); + m_nChars += pFont->CountChar(pStrs[i].c_str(), pStrs[i].GetLength()); } m_nChars += nsegs - 1; if (m_nChars > 1) { @@ -150,8 +150,9 @@ void CPDF_TextObject::SetSegments(const CFX_ByteString* pStrs, m_pCharPos = FX_Alloc(FX_FLOAT, m_nChars - 1); int index = 0; for (int i = 0; i < nsegs; ++i) { - const FX_CHAR* segment = pStrs[i]; - int offset = 0, len = pStrs[i].GetLength(); + const FX_CHAR* segment = pStrs[i].c_str(); + int len = pStrs[i].GetLength(); + int offset = 0; while (offset < len) { m_pCharCodes[index++] = pFont->GetNextChar(segment, len, offset); } @@ -163,7 +164,7 @@ void CPDF_TextObject::SetSegments(const CFX_ByteString* pStrs, } else { int offset = 0; m_pCharCodes = (uint32_t*)(uintptr_t)pFont->GetNextChar( - pStrs[0], pStrs[0].GetLength(), offset); + pStrs[0].c_str(), pStrs[0].GetLength(), offset); } } diff --git a/core/fpdfapi/fpdf_parser/cfdf_document.cpp b/core/fpdfapi/fpdf_parser/cfdf_document.cpp index 9cbf999702..3039c32938 100644 --- a/core/fpdfapi/fpdf_parser/cfdf_document.cpp +++ b/core/fpdfapi/fpdf_parser/cfdf_document.cpp @@ -53,7 +53,7 @@ void CFDF_Document::ParseStream(IFX_FileRead* pFile, FX_BOOL bOwnFile) { bool bNumber; CFX_ByteString word = parser.GetNextWord(&bNumber); if (bNumber) { - uint32_t objnum = FXSYS_atoui(word); + uint32_t objnum = FXSYS_atoui(word.c_str()); word = parser.GetNextWord(&bNumber); if (!bNumber) { break; diff --git a/core/fpdfapi/fpdf_parser/cpdf_data_avail.cpp b/core/fpdfapi/fpdf_parser/cpdf_data_avail.cpp index e08e913f74..f210c49c71 100644 --- a/core/fpdfapi/fpdf_parser/cpdf_data_avail.cpp +++ b/core/fpdfapi/fpdf_parser/cpdf_data_avail.cpp @@ -792,7 +792,7 @@ CPDF_Object* CPDF_DataAvail::ParseIndirectObjectAt( if (!bIsNumber) return nullptr; - uint32_t parser_objnum = FXSYS_atoui(word); + uint32_t parser_objnum = FXSYS_atoui(word.c_str()); if (objnum && parser_objnum != objnum) return nullptr; @@ -800,7 +800,7 @@ CPDF_Object* CPDF_DataAvail::ParseIndirectObjectAt( if (!bIsNumber) return nullptr; - uint32_t gennum = FXSYS_atoui(word); + uint32_t gennum = FXSYS_atoui(word.c_str()); if (m_syntaxParser.GetKeyword() != "obj") { m_syntaxParser.RestorePos(SavedPos); return nullptr; @@ -849,7 +849,7 @@ FX_BOOL CPDF_DataAvail::IsLinearizedFile(uint8_t* pData, uint32_t dwLen) { if (!bNumber) return FALSE; - uint32_t objnum = FXSYS_atoui(wordObjNum); + uint32_t objnum = FXSYS_atoui(wordObjNum.c_str()); if (m_pLinearized) { m_pLinearized->Release(); m_pLinearized = nullptr; @@ -901,7 +901,7 @@ FX_BOOL CPDF_DataAvail::CheckEnd(IPDF_DataAvail::DownloadHints* pHints) { return FALSE; } - m_dwXRefOffset = (FX_FILESIZE)FXSYS_atoi64(xrefpos_str); + m_dwXRefOffset = (FX_FILESIZE)FXSYS_atoi64(xrefpos_str.c_str()); if (!m_dwXRefOffset || m_dwXRefOffset > m_dwFileLen) { m_docStatus = PDF_DATAAVAIL_LOADALLFILE; return TRUE; @@ -943,7 +943,7 @@ int32_t CPDF_DataAvail::CheckCrossRefStream( if (!bNumber) return -1; - uint32_t objNum = FXSYS_atoui(objnum); + uint32_t objNum = FXSYS_atoui(objnum.c_str()); CPDF_Object* pObj = m_parser.ParseIndirectObjectAt(nullptr, 0, objNum); if (!pObj) { m_Pos += m_parser.m_pSyntax->SavePos(); diff --git a/core/fpdfapi/fpdf_parser/cpdf_parser.cpp b/core/fpdfapi/fpdf_parser/cpdf_parser.cpp index f1816f2028..d6531f5184 100644 --- a/core/fpdfapi/fpdf_parser/cpdf_parser.cpp +++ b/core/fpdfapi/fpdf_parser/cpdf_parser.cpp @@ -202,7 +202,7 @@ CPDF_Parser::Error CPDF_Parser::StartParse(IFX_FileRead* pFileAccess) { if (!bNumber) return FORMAT_ERROR; - m_LastXRefOffset = (FX_FILESIZE)FXSYS_atoi64(xrefpos_str); + m_LastXRefOffset = (FX_FILESIZE)FXSYS_atoi64(xrefpos_str.c_str()); if (!LoadAllCrossRefV4(m_LastXRefOffset) && !LoadAllCrossRefV5(m_LastXRefOffset)) { if (!RebuildCrossRef()) @@ -505,7 +505,7 @@ bool CPDF_Parser::LoadCrossRefV4(FX_FILESIZE pos, break; } - uint32_t start_objnum = FXSYS_atoui(word); + uint32_t start_objnum = FXSYS_atoui(word.c_str()); if (start_objnum >= kMaxObjectNumber) return false; @@ -846,7 +846,7 @@ FX_BOOL CPDF_Parser::RebuildCrossRef() { CFX_ByteString bsOffset = m_pSyntax->GetNextWord(&bNumber); if (bNumber) - m_LastXRefOffset = FXSYS_atoi(bsOffset); + m_LastXRefOffset = FXSYS_atoi(bsOffset.c_str()); } m_pSyntax->RestorePos(dwSavePos); } @@ -1293,7 +1293,7 @@ void CPDF_Parser::GetIndirectBinary(uint32_t objnum, return; } - uint32_t parser_objnum = FXSYS_atoui(word); + uint32_t parser_objnum = FXSYS_atoui(word.c_str()); if (parser_objnum && parser_objnum != objnum) { m_pSyntax->RestorePos(SavedPos); return; @@ -1365,7 +1365,7 @@ CPDF_Object* CPDF_Parser::ParseIndirectObjectAt( FX_FILESIZE objOffset = m_pSyntax->SavePos(); objOffset -= word.GetLength(); - uint32_t parser_objnum = FXSYS_atoui(word); + uint32_t parser_objnum = FXSYS_atoui(word.c_str()); if (objnum && parser_objnum != objnum) { m_pSyntax->RestorePos(SavedPos); return nullptr; @@ -1377,7 +1377,7 @@ CPDF_Object* CPDF_Parser::ParseIndirectObjectAt( return nullptr; } - uint32_t parser_gennum = FXSYS_atoui(word); + uint32_t parser_gennum = FXSYS_atoui(word.c_str()); if (m_pSyntax->GetKeyword() != "obj") { m_pSyntax->RestorePos(SavedPos); return nullptr; @@ -1415,7 +1415,7 @@ CPDF_Object* CPDF_Parser::ParseIndirectObjectAtByStrict( return nullptr; } - uint32_t parser_objnum = FXSYS_atoui(word); + uint32_t parser_objnum = FXSYS_atoui(word.c_str()); if (objnum && parser_objnum != objnum) { m_pSyntax->RestorePos(SavedPos); return nullptr; @@ -1427,7 +1427,7 @@ CPDF_Object* CPDF_Parser::ParseIndirectObjectAtByStrict( return nullptr; } - uint32_t gennum = FXSYS_atoui(word); + uint32_t gennum = FXSYS_atoui(word.c_str()); if (m_pSyntax->GetKeyword() != "obj") { m_pSyntax->RestorePos(SavedPos); return nullptr; @@ -1477,12 +1477,12 @@ FX_BOOL CPDF_Parser::IsLinearizedFile(IFX_FileRead* pFileAccess, if (!bIsNumber) return FALSE; - uint32_t objnum = FXSYS_atoui(word); + uint32_t objnum = FXSYS_atoui(word.c_str()); word = m_pSyntax->GetNextWord(&bIsNumber); if (!bIsNumber) return FALSE; - uint32_t gennum = FXSYS_atoui(word); + uint32_t gennum = FXSYS_atoui(word.c_str()); if (m_pSyntax->GetKeyword() != "obj") { m_pSyntax->RestorePos(SavedPos); return FALSE; diff --git a/core/fpdfapi/fpdf_parser/cpdf_syntax_parser.cpp b/core/fpdfapi/fpdf_parser/cpdf_syntax_parser.cpp index 0190c6e692..16daba184d 100644 --- a/core/fpdfapi/fpdf_parser/cpdf_syntax_parser.cpp +++ b/core/fpdfapi/fpdf_parser/cpdf_syntax_parser.cpp @@ -394,7 +394,7 @@ CPDF_Object* CPDF_SyntaxParser::GetObject(CPDF_IndirectObjectHolder* pObjList, if (bIsNumber) { CFX_ByteString nextword2 = GetNextWord(nullptr); if (nextword2 == "R") { - uint32_t objnum = FXSYS_atoui(word); + uint32_t objnum = FXSYS_atoui(word.c_str()); return new CPDF_Reference(pObjList, objnum); } } @@ -518,7 +518,7 @@ CPDF_Object* CPDF_SyntaxParser::GetObjectByStrict( if (bIsNumber) { CFX_ByteString nextword2 = GetNextWord(nullptr); if (nextword2 == "R") - return new CPDF_Reference(pObjList, FXSYS_atoui(word)); + return new CPDF_Reference(pObjList, FXSYS_atoui(word.c_str())); } m_Pos = SavedPos; return new CPDF_Number(word.AsStringC()); diff --git a/core/fpdfapi/fpdf_parser/fpdf_parser_utility.cpp b/core/fpdfapi/fpdf_parser/fpdf_parser_utility.cpp index bfd0de44b6..466ccaffa5 100644 --- a/core/fpdfapi/fpdf_parser/fpdf_parser_utility.cpp +++ b/core/fpdfapi/fpdf_parser/fpdf_parser_utility.cpp @@ -112,7 +112,7 @@ CFX_ByteString PDF_NameDecode(const CFX_ByteString& orig) { if (!FXSYS_memchr(orig.c_str(), '#', orig.GetLength())) { return orig; } - return PDF_NameDecode(CFX_ByteStringC(orig)); + return PDF_NameDecode(orig.AsStringC()); } CFX_ByteString PDF_NameEncode(const CFX_ByteString& orig) { diff --git a/core/fpdfapi/fpdf_render/fpdf_render_text.cpp b/core/fpdfapi/fpdf_render/fpdf_render_text.cpp index 264abe9a53..ff8df7685d 100644 --- a/core/fpdfapi/fpdf_render/fpdf_render_text.cpp +++ b/core/fpdfapi/fpdf_render/fpdf_render_text.cpp @@ -637,7 +637,7 @@ void CPDF_TextRenderer::DrawTextString(CFX_RenderDevice* pDevice, FX_ARGB stroke_argb, const CFX_GraphStateData* pGraphState, const CPDF_RenderOptions* pOptions) { - int nChars = pFont->CountChar(str, str.GetLength()); + int nChars = pFont->CountChar(str.c_str(), str.GetLength()); if (nChars == 0) { return; } @@ -646,7 +646,7 @@ void CPDF_TextRenderer::DrawTextString(CFX_RenderDevice* pDevice, uint32_t* pCharCodes; FX_FLOAT* pCharPos; if (nChars == 1) { - charcode = pFont->GetNextChar(str, str.GetLength(), offset); + charcode = pFont->GetNextChar(str.c_str(), str.GetLength(), offset); pCharCodes = (uint32_t*)(uintptr_t)charcode; pCharPos = NULL; } else { @@ -654,7 +654,7 @@ void CPDF_TextRenderer::DrawTextString(CFX_RenderDevice* pDevice, pCharPos = FX_Alloc(FX_FLOAT, nChars - 1); FX_FLOAT cur_pos = 0; for (int i = 0; i < nChars; i++) { - pCharCodes[i] = pFont->GetNextChar(str, str.GetLength(), offset); + pCharCodes[i] = pFont->GetNextChar(str.c_str(), str.GetLength(), offset); if (i) { pCharPos[i - 1] = cur_pos; } diff --git a/core/fpdfdoc/doc_basic.cpp b/core/fpdfdoc/doc_basic.cpp index e0b71df392..6d6e5c234f 100644 --- a/core/fpdfdoc/doc_basic.cpp +++ b/core/fpdfdoc/doc_basic.cpp @@ -511,7 +511,7 @@ int32_t CPDF_PageLabel::GetPageByLabel(const CFX_ByteStringC& bsLabel) const { } } bsLbl = bsOrig; - int nPage = FXSYS_atoi(bsLbl); + int nPage = FXSYS_atoi(bsLbl.c_str()); if (nPage > 0 && nPage <= nPages) { return nPage; } diff --git a/core/fpdfdoc/doc_form.cpp b/core/fpdfdoc/doc_form.cpp index 207b824545..6ca40fdaf6 100644 --- a/core/fpdfdoc/doc_form.cpp +++ b/core/fpdfdoc/doc_form.cpp @@ -633,11 +633,11 @@ FX_BOOL CPDF_InterForm::ValidateFieldName(const CPDF_FormControl* pControl, } int CPDF_InterForm::CompareFieldName(const CFX_ByteString& name1, const CFX_ByteString& name2) { - const FX_CHAR* ptr1 = name1; - const FX_CHAR* ptr2 = name2; if (name1.GetLength() == name2.GetLength()) { return name1 == name2 ? 1 : 0; } + const FX_CHAR* ptr1 = name1.c_str(); + const FX_CHAR* ptr2 = name2.c_str(); int i = 0; while (ptr1[i] == ptr2[i]) { i++; diff --git a/core/fpdfdoc/doc_utils.cpp b/core/fpdfdoc/doc_utils.cpp index 404353847f..2df7d97e31 100644 --- a/core/fpdfdoc/doc_utils.cpp +++ b/core/fpdfdoc/doc_utils.cpp @@ -603,8 +603,8 @@ void AddInterFormFont(CPDF_Dictionary*& pFormDict, csNameTag = pFont->GetBaseFont(); } csNameTag.Remove(' '); - csNameTag = - CPDF_InterForm::GenerateNewResourceName(pDR, "Font", 4, csNameTag); + csNameTag = CPDF_InterForm::GenerateNewResourceName(pDR, "Font", 4, + csNameTag.c_str()); pFonts->SetAtReference(csNameTag.AsStringC(), pDocument, pFont->GetFontDict()); } diff --git a/core/fpdftext/fpdf_text_int.cpp b/core/fpdftext/fpdf_text_int.cpp index 8d8fa4e9ed..a1e3fda7b1 100644 --- a/core/fpdftext/fpdf_text_int.cpp +++ b/core/fpdftext/fpdf_text_int.cpp @@ -906,7 +906,7 @@ int CPDF_TextPage::GetCharWidth(uint32_t charCode, CPDF_Font* pFont) const { CFX_ByteString str; pFont->AppendChar(str, charCode); - if (int w = pFont->GetStringWidth(str, 1)) + if (int w = pFont->GetStringWidth(str.c_str(), 1)) return w; return pFont->GetCharBBox(charCode).Width(); diff --git a/core/fxcrt/fx_basic_bstring.cpp b/core/fxcrt/fx_basic_bstring.cpp index 23fdcaa25e..bfa0cbd98c 100644 --- a/core/fxcrt/fx_basic_bstring.cpp +++ b/core/fxcrt/fx_basic_bstring.cpp @@ -921,7 +921,7 @@ void CFX_ByteString::TrimLeft() { } uint32_t CFX_ByteString::GetID(FX_STRSIZE start_pos) const { - return CFX_ByteStringC(*this).GetID(start_pos); + return AsStringC().GetID(start_pos); } uint32_t CFX_ByteStringC::GetID(FX_STRSIZE start_pos) const { if (m_Length == 0) { diff --git a/core/fxcrt/fx_basic_gcc.cpp b/core/fxcrt/fx_basic_gcc.cpp index c3afe1115b..ddbdcd5881 100644 --- a/core/fxcrt/fx_basic_gcc.cpp +++ b/core/fxcrt/fx_basic_gcc.cpp @@ -133,8 +133,8 @@ uint32_t FXSYS_GetModuleFileName(void* hModule, char* buf, uint32_t bufsize) { extern "C" { #endif FXSYS_FILE* FXSYS_wfopen(const FX_WCHAR* filename, const FX_WCHAR* mode) { - return FXSYS_fopen(CFX_ByteString::FromUnicode(filename), - CFX_ByteString::FromUnicode(mode)); + return FXSYS_fopen(CFX_ByteString::FromUnicode(filename).c_str(), + CFX_ByteString::FromUnicode(mode).c_str()); } char* FXSYS_strlwr(char* str) { if (!str) { diff --git a/core/fxcrt/fx_basic_util.cpp b/core/fxcrt/fx_basic_util.cpp index 4374dec779..1cf966589d 100644 --- a/core/fxcrt/fx_basic_util.cpp +++ b/core/fxcrt/fx_basic_util.cpp @@ -210,9 +210,9 @@ void* FX_OpenFolder(const FX_CHAR* path) { #if _FXM_PLATFORM_ == _FXM_PLATFORM_WINDOWS_ #ifndef _WIN32_WCE CFindFileDataA* pData = new CFindFileDataA; - pData->m_Handle = - FindFirstFileExA(CFX_ByteString(path) + "/*.*", FindExInfoStandard, - &pData->m_FindData, FindExSearchNameMatch, NULL, 0); + pData->m_Handle = FindFirstFileExA((CFX_ByteString(path) + "/*.*").c_str(), + FindExInfoStandard, &pData->m_FindData, + FindExSearchNameMatch, NULL, 0); #else CFindFileDataW* pData = new CFindFileDataW; pData->m_Handle = FindFirstFileW(CFX_WideString::FromLocal(path) + L"/*.*", @@ -242,7 +242,7 @@ void* FX_OpenFolder(const FX_WCHAR* path) { pData->m_bEnd = FALSE; return pData; #else - DIR* dir = opendir(CFX_ByteString::FromUnicode(path)); + DIR* dir = opendir(CFX_ByteString::FromUnicode(path).c_str()); return dir; #endif } diff --git a/core/fxcrt/include/fx_string.h b/core/fxcrt/include/fx_string.h index ef0dfee6fb..4b73551573 100644 --- a/core/fxcrt/include/fx_string.h +++ b/core/fxcrt/include/fx_string.h @@ -170,9 +170,6 @@ class CFX_ByteString { // Note: Any subsequent modification of |this| will invalidate 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: Any subsequent modification of |this| will invalidate the result. const uint8_t* raw_str() const { diff --git a/core/fxge/apple/fx_mac_imp.cpp b/core/fxge/apple/fx_mac_imp.cpp index aae3f71b39..82b5078565 100644 --- a/core/fxge/apple/fx_mac_imp.cpp +++ b/core/fxge/apple/fx_mac_imp.cpp @@ -64,7 +64,7 @@ void* CFX_MacFontInfo::MapFont(int weight, break; } if (iBaseFont < 12) { - return GetFont(face); + return GetFont(face.c_str()); } auto it = m_FontList.find(face); if (it != m_FontList.end()) diff --git a/core/fxge/ge/fx_ge_fontmap.cpp b/core/fxge/ge/fx_ge_fontmap.cpp index 8f9dad837e..194f91034d 100644 --- a/core/fxge/ge/fx_ge_fontmap.cpp +++ b/core/fxge/ge/fx_ge_fontmap.cpp @@ -758,11 +758,11 @@ void CFX_FontMapper::AddInstalledFont(const CFX_ByteString& name, int charset) { } if (bLocalized) { - void* hFont = m_pFontInfo->GetFont(name); + void* hFont = m_pFontInfo->GetFont(name.c_str()); if (!hFont) { int iExact; - hFont = - m_pFontInfo->MapFont(0, 0, FXFONT_DEFAULT_CHARSET, 0, name, iExact); + hFont = m_pFontInfo->MapFont(0, 0, FXFONT_DEFAULT_CHARSET, 0, + name.c_str(), iExact); if (!hFont) return; } @@ -796,7 +796,7 @@ CFX_ByteString CFX_FontMapper::MatchInstalledFonts( LoadInstalledFonts(); int i; for (i = pdfium::CollectionSize<int>(m_InstalledTTFonts) - 1; i >= 0; i--) { - CFX_ByteString norm1 = TT_NormalizeName(m_InstalledTTFonts[i]); + CFX_ByteString norm1 = TT_NormalizeName(m_InstalledTTFonts[i].c_str()); if (norm1 == norm_name) { break; } @@ -972,7 +972,7 @@ FXFT_Face CFX_FontMapper::FindSubstFont(const CFX_ByteString& name, } if (!style.IsEmpty()) { int nLen = style.GetLength(); - const FX_CHAR* pStyle = style; + const FX_CHAR* pStyle = style.c_str(); int i = 0; FX_BOOL bFirstItem = TRUE; CFX_ByteString buf; @@ -1045,10 +1045,10 @@ FXFT_Face CFX_FontMapper::FindSubstFont(const CFX_ByteString& name, PitchFamily); } family = GetFontFamily(family, nStyle); - CFX_ByteString match = MatchInstalledFonts(TT_NormalizeName(family)); + CFX_ByteString match = MatchInstalledFonts(TT_NormalizeName(family.c_str())); if (match.IsEmpty() && family != SubstName && (!bHasComma && (!bHasHypen || (bHasHypen && !bStyleAvail)))) { - match = MatchInstalledFonts(TT_NormalizeName(SubstName)); + match = MatchInstalledFonts(TT_NormalizeName(SubstName.c_str())); } if (match.IsEmpty() && iBaseFont >= 12) { if (!bCJK) { @@ -1104,7 +1104,7 @@ FXFT_Face CFX_FontMapper::FindSubstFont(const CFX_ByteString& name, } iExact = !match.IsEmpty(); void* hFont = m_pFontInfo->MapFont(weight, bItalic, Charset, PitchFamily, - family, iExact); + family.c_str(), iExact); if (iExact) { pSubstFont->m_SubstFlags |= FXFONT_SUBST_EXACT; } @@ -1123,7 +1123,7 @@ FXFT_Face CFX_FontMapper::FindSubstFont(const CFX_ByteString& name, weight = old_weight; } if (!match.IsEmpty()) { - hFont = m_pFontInfo->GetFont(match); + hFont = m_pFontInfo->GetFont(match.c_str()); if (!hFont) { return UseInternalSubst(pSubstFont, iBaseFont, italic_angle, old_weight, PitchFamily); @@ -1165,7 +1165,7 @@ FXFT_Face CFX_FontMapper::FindSubstFont(const CFX_ByteString& name, return UseInternalSubst(pSubstFont, iBaseFont, italic_angle, old_weight, PitchFamily); } - hFont = m_pFontInfo->GetFont(it->name); + hFont = m_pFontInfo->GetFont(it->name.c_str()); } } pSubstFont->m_ExtHandle = m_pFontInfo->RetainFont(hFont); @@ -1381,7 +1381,7 @@ FX_BOOL CFX_FolderFontInfo::EnumFontList(CFX_FontMapper* pMapper) { return TRUE; } void CFX_FolderFontInfo::ScanPath(const CFX_ByteString& path) { - void* handle = FX_OpenFolder(path); + void* handle = FX_OpenFolder(path.c_str()); if (!handle) return; @@ -1412,7 +1412,7 @@ void CFX_FolderFontInfo::ScanPath(const CFX_ByteString& path) { } void CFX_FolderFontInfo::ScanFile(const CFX_ByteString& path) { - FXSYS_FILE* pFile = FXSYS_fopen(path, "rb"); + FXSYS_FILE* pFile = FXSYS_fopen(path.c_str(), "rb"); if (!pFile) return; @@ -1616,7 +1616,7 @@ uint32_t CFX_FolderFontInfo::GetFontData(void* hFont, if (!datasize || size < datasize) return datasize; - FXSYS_FILE* pFile = FXSYS_fopen(pFont->m_FilePath, "rb"); + FXSYS_FILE* pFile = FXSYS_fopen(pFont->m_FilePath.c_str(), "rb"); if (!pFile) return 0; diff --git a/core/fxge/win32/fx_win32_device.cpp b/core/fxge/win32/fx_win32_device.cpp index 60ae57c767..f8057e7d5d 100644 --- a/core/fxge/win32/fx_win32_device.cpp +++ b/core/fxge/win32/fx_win32_device.cpp @@ -350,7 +350,7 @@ void* CFX_Win32FontInfo::MapFont(int weight, } HFONT hFont = ::CreateFontA(-10, 0, 0, 0, weight, bItalic, 0, 0, charset, - OUT_TT_ONLY_PRECIS, 0, 0, subst_pitch_family, face); + OUT_TT_ONLY_PRECIS, 0, 0, subst_pitch_family, face.c_str()); char facebuf[100]; HFONT hOldFont = (HFONT)::SelectObject(m_hDC, hFont); ::GetTextFaceA(m_hDC, 100, facebuf); @@ -393,8 +393,9 @@ void* CFX_Win32FontInfo::MapFont(int weight, } break; } - hFont = ::CreateFontA(-10, 0, 0, 0, weight, bItalic, 0, 0, charset, - OUT_TT_ONLY_PRECIS, 0, 0, subst_pitch_family, face); + hFont = + ::CreateFontA(-10, 0, 0, 0, weight, bItalic, 0, 0, charset, + OUT_TT_ONLY_PRECIS, 0, 0, subst_pitch_family, face.c_str()); return hFont; } void CFX_Win32FontInfo::DeleteFont(void* hFont) { diff --git a/core/fxge/win32/fx_win32_gdipext.cpp b/core/fxge/win32/fx_win32_gdipext.cpp index 4e52a8941a..15f0972bba 100644 --- a/core/fxge/win32/fx_win32_gdipext.cpp +++ b/core/fxge/win32/fx_win32_gdipext.cpp @@ -686,7 +686,7 @@ void CGdiplusExt::Load() { strPlusPath += buf; strPlusPath += "\\"; strPlusPath += "GDIPLUS.DLL"; - m_hModule = LoadLibraryA(strPlusPath); + m_hModule = LoadLibraryA(strPlusPath.c_str()); if (!m_hModule) { return; } diff --git a/fpdfsdk/fpdf_sysfontinfo.cpp b/fpdfsdk/fpdf_sysfontinfo.cpp index 7fe4b08e46..d5ee7d186f 100644 --- a/fpdfsdk/fpdf_sysfontinfo.cpp +++ b/fpdfsdk/fpdf_sysfontinfo.cpp @@ -152,7 +152,7 @@ static unsigned long DefaultGetFaceName(struct _FPDF_SYSFONTINFO* pThis, return 0; if (name.GetLength() >= (long)buf_size) return name.GetLength() + 1; - FXSYS_strcpy(buffer, name); + FXSYS_strcpy(buffer, name.c_str()); return name.GetLength() + 1; } diff --git a/fpdfsdk/fpdfformfill.cpp b/fpdfsdk/fpdfformfill.cpp index aa8bc9a0a0..9f4e2944ca 100644 --- a/fpdfsdk/fpdfformfill.cpp +++ b/fpdfsdk/fpdfformfill.cpp @@ -597,8 +597,7 @@ FPDF_StringHandleGetStringByIndex(FPDF_STRINGHANDLE sHandle, uint32_t real_size = len < *size ? len : *size; if (real_size > 0) - FXSYS_memcpy((void*)bsText, (const FX_CHAR*)(*sSuggestWords)[index], - real_size); + FXSYS_memcpy((void*)bsText, (*sSuggestWords)[index].c_str(), real_size); *size = real_size; return TRUE; } diff --git a/fpdfsdk/fpdfppo.cpp b/fpdfsdk/fpdfppo.cpp index 777310bb2b..300e7ba36e 100644 --- a/fpdfsdk/fpdfppo.cpp +++ b/fpdfsdk/fpdfppo.cpp @@ -191,12 +191,13 @@ CPDF_Object* CPDF_PageOrganizer::PageDictGetInheritableTag( if (!pp) return nullptr; - if (pDict->KeyExist((const char*)nSrctag)) - return pDict->GetObjectBy((const char*)nSrctag); + CFX_ByteStringC sSrcTag = nSrctag.AsStringC(); + if (pDict->KeyExist(sSrcTag)) + return pDict->GetObjectBy(sSrcTag); while (pp) { - if (pp->KeyExist((const char*)nSrctag)) - return pp->GetObjectBy((const char*)nSrctag); + if (pp->KeyExist(sSrcTag)) + return pp->GetObjectBy(sSrcTag); if (!pp->KeyExist("Parent")) break; pp = ToDictionary(pp->GetObjectBy("Parent")->GetDirect()); @@ -223,8 +224,9 @@ FX_BOOL CPDF_PageOrganizer::UpdateReference(CPDF_Object* pObj, const CFX_ByteString& key = it->first; CPDF_Object* pNextObj = it->second; ++it; - if (!FXSYS_strcmp(key, "Parent") || !FXSYS_strcmp(key, "Prev") || - !FXSYS_strcmp(key, "First")) { + if (!FXSYS_strcmp(key.c_str(), "Parent") || + !FXSYS_strcmp(key.c_str(), "Prev") || + !FXSYS_strcmp(key.c_str(), "First")) { continue; } if (pNextObj) { @@ -290,11 +292,11 @@ uint32_t CPDF_PageOrganizer::GetNewObjId(CPDF_Document* pDoc, if (CPDF_Dictionary* pDictClone = pClone->AsDictionary()) { if (pDictClone->KeyExist("Type")) { CFX_ByteString strType = pDictClone->GetStringBy("Type"); - if (!FXSYS_stricmp(strType, "Pages")) { + if (!FXSYS_stricmp(strType.c_str(), "Pages")) { pDictClone->Release(); return 4; } - if (!FXSYS_stricmp(strType, "Page")) { + if (!FXSYS_stricmp(strType.c_str(), "Page")) { pDictClone->Release(); return 0; } @@ -330,12 +332,12 @@ FPDF_BOOL ParserPageRangeString(CFX_ByteString rangstring, cbMidRange = rangstring.Mid(nStringFrom, nStringTo - nStringFrom); int nMid = cbMidRange.Find('-'); if (nMid == -1) { - long lPageNum = atol(cbMidRange); + long lPageNum = atol(cbMidRange.c_str()); if (lPageNum <= 0 || lPageNum > nCount) return FALSE; pageArray->push_back((uint16_t)lPageNum); } else { - int nStartPageNum = atol(cbMidRange.Mid(0, nMid)); + int nStartPageNum = atol(cbMidRange.Mid(0, nMid).c_str()); if (nStartPageNum == 0) return FALSE; @@ -344,7 +346,7 @@ FPDF_BOOL ParserPageRangeString(CFX_ByteString rangstring, if (nEnd == 0) return FALSE; - int nEndPageNum = atol(cbMidRange.Mid(nMid, nEnd)); + int nEndPageNum = atol(cbMidRange.Mid(nMid, nEnd).c_str()); if (nStartPageNum < 0 || nStartPageNum > nEndPageNum || nEndPageNum > nCount) { return FALSE; diff --git a/fpdfsdk/fpdfxfa/fpdfxfa_doc.cpp b/fpdfsdk/fpdfxfa/fpdfxfa_doc.cpp index 7fa258c506..53068d345d 100644 --- a/fpdfsdk/fpdfxfa/fpdfxfa_doc.cpp +++ b/fpdfsdk/fpdfxfa/fpdfxfa_doc.cpp @@ -39,7 +39,6 @@ #ifndef _WIN32 extern void SetLastError(int err); - extern int GetLastError(); #endif @@ -655,7 +654,7 @@ void CPDFXFA_Document::ExportData(CXFA_FFDoc* hDoc, CFX_ByteString content; if (fileType == FXFA_SAVEAS_XML) { content = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n"; - fileWrite.WriteBlock((const FX_CHAR*)content, fileWrite.GetSize(), + fileWrite.WriteBlock(content.c_str(), fileWrite.GetSize(), content.GetLength()); CFX_WideStringC data(L"data"); if (m_pXFADocView->GetDoc()->SavePackage(data, &fileWrite)) { @@ -698,13 +697,13 @@ void CPDFXFA_Document::ExportData(CXFA_FFDoc* hDoc, } else { if (i == size - 1) { CFX_WideString wPath = CFX_WideString::FromUTF16LE( - (unsigned short*)(const FX_CHAR*)bs, + reinterpret_cast<const unsigned short*>(bs.c_str()), bs.GetLength() / sizeof(unsigned short)); CFX_ByteString bPath = wPath.UTF8Encode(); - CFX_ByteString szFormat = + const char* szFormat = "\n<pdf href=\"%s\" xmlns=\"http://ns.adobe.com/xdp/pdf/\"/>"; - content.Format(szFormat, (char*)(const FX_CHAR*)bPath); - fileWrite.WriteBlock((const FX_CHAR*)content, fileWrite.GetSize(), + content.Format(szFormat, bPath.c_str()); + fileWrite.WriteBlock(content.c_str(), fileWrite.GetSize(), content.GetLength()); } @@ -954,8 +953,8 @@ FX_BOOL CPDFXFA_Document::_ExportSubmitFile(FPDF_FILEHANDLER* pFileHandler, if (fileType == FXFA_SAVEAS_XML) { CFX_WideString ws; ws.FromLocal("data"); - CFX_ByteString content = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n"; - fileStream.WriteBlock((const FX_CHAR*)content, 0, content.GetLength()); + const char* content = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\r\n"; + fileStream.WriteBlock(content, 0, strlen(content)); m_pXFADoc->SavePackage(ws.AsStringC(), &fileStream); } else if (fileType == FXFA_SAVEAS_XDP) { if (flag == 0) diff --git a/fpdfsdk/fsdk_actionhandler.cpp b/fpdfsdk/fsdk_actionhandler.cpp index 0bbdbab137..912bc40c7f 100644 --- a/fpdfsdk/fsdk_actionhandler.cpp +++ b/fpdfsdk/fsdk_actionhandler.cpp @@ -470,7 +470,7 @@ void CPDFSDK_ActionHandler::DoAction_Named(CPDFSDK_Document* pDocument, ASSERT(action.GetDict()); CFX_ByteString csName = action.GetNamedAction(); - pDocument->GetEnv()->FFI_ExecuteNamedAction(csName); + pDocument->GetEnv()->FFI_ExecuteNamedAction(csName.c_str()); } void CPDFSDK_ActionHandler::DoAction_SetOCGState(CPDFSDK_Document* pDocument, diff --git a/fpdfsdk/fsdk_mgr.cpp b/fpdfsdk/fsdk_mgr.cpp index 3412516f65..7240fe1d0b 100644 --- a/fpdfsdk/fsdk_mgr.cpp +++ b/fpdfsdk/fsdk_mgr.cpp @@ -840,7 +840,8 @@ CPDFSDK_Annot* CPDFSDK_PageView::AddAnnot(CXFA_FFWidget* pPDFAnnot) { #endif // PDF_ENABLE_XFA CPDFSDK_Annot* CPDFSDK_PageView::AddAnnot(CPDF_Dictionary* pDict) { - return pDict ? AddAnnot(pDict->GetStringBy("Subtype"), pDict) : nullptr; + return pDict ? AddAnnot(pDict->GetStringBy("Subtype").c_str(), pDict) + : nullptr; } CPDFSDK_Annot* CPDFSDK_PageView::AddAnnot(const FX_CHAR* lpSubType, diff --git a/fpdfsdk/javascript/PublicMethods.cpp b/fpdfsdk/javascript/PublicMethods.cpp index 5a694c742a..d03f671599 100644 --- a/fpdfsdk/javascript/PublicMethods.cpp +++ b/fpdfsdk/javascript/PublicMethods.cpp @@ -162,7 +162,7 @@ CJS_Array CJS_PublicMethods::AF_MakeArrayFromList(CJS_Runtime* pRuntime, } CFX_WideString wsStr = val.ToCFXWideString(); CFX_ByteString t = CFX_ByteString::FromUnicode(wsStr); - const char* p = (const char*)t; + const char* p = t.c_str(); int ch = ','; int nIndex = 0; @@ -170,8 +170,8 @@ CJS_Array CJS_PublicMethods::AF_MakeArrayFromList(CJS_Runtime* pRuntime, while (*p) { const char* pTemp = strchr(p, ch); if (!pTemp) { - StrArray.SetElement(nIndex, - CJS_Value(pRuntime, StrTrim(CFX_ByteString(p)))); + StrArray.SetElement( + nIndex, CJS_Value(pRuntime, StrTrim(CFX_ByteString(p)).c_str())); break; } @@ -179,8 +179,8 @@ CJS_Array CJS_PublicMethods::AF_MakeArrayFromList(CJS_Runtime* pRuntime, strncpy(pSub, p, pTemp - p); *(pSub + (pTemp - p)) = '\0'; - StrArray.SetElement(nIndex, - CJS_Value(pRuntime, StrTrim(CFX_ByteString(pSub)))); + StrArray.SetElement( + nIndex, CJS_Value(pRuntime, StrTrim(CFX_ByteString(pSub)).c_str())); delete[] pSub; nIndex++; @@ -756,7 +756,7 @@ FX_BOOL CJS_PublicMethods::AFNumber_Format(IJS_Context* cc, // for processing decimal places strValue.Replace(",", "."); - double dValue = atof(strValue); + double dValue = atof(strValue.c_str()); if (iDec > 0) dValue += DOUBLE_CORRECT; @@ -1040,7 +1040,7 @@ FX_BOOL CJS_PublicMethods::AFPercent_Format( iSepStyle = 0; // for processing decimal places - double dValue = atof(strValue); + double dValue = atof(strValue.c_str()); dValue *= 100; if (iDec > 0) dValue += DOUBLE_CORRECT; @@ -1778,7 +1778,8 @@ FX_BOOL CJS_PublicMethods::AFRange_Validate( return FALSE; if (pEvent->Value().IsEmpty()) return TRUE; - double dEentValue = atof(CFX_ByteString::FromUnicode(pEvent->Value())); + double dEentValue = + atof(CFX_ByteString::FromUnicode(pEvent->Value()).c_str()); FX_BOOL bGreaterThan = params[0].ToBool(); double dGreaterThan = params[1].ToDouble(); FX_BOOL bLessThan = params[2].ToBool(); diff --git a/fpdfsdk/javascript/global.cpp b/fpdfsdk/javascript/global.cpp index d843b60105..7242a144c9 100644 --- a/fpdfsdk/javascript/global.cpp +++ b/fpdfsdk/javascript/global.cpp @@ -414,7 +414,7 @@ FX_BOOL JSGlobalAlternate::SetGlobalVariables(const CFX_ByteString& propname, const CFX_ByteString& sData, v8::Local<v8::Object> pData, bool bDefaultPersistent) { - if (!propname) + if (propname.IsEmpty()) return FALSE; auto it = m_mapGlobal.find(propname); diff --git a/fpdfsdk/pdfwindow/PWL_FontMap.cpp b/fpdfsdk/pdfwindow/PWL_FontMap.cpp index 42beab7d21..96ca6ea2ff 100644 --- a/fpdfsdk/pdfwindow/PWL_FontMap.cpp +++ b/fpdfsdk/pdfwindow/PWL_FontMap.cpp @@ -306,10 +306,10 @@ CPDF_Font* CPWL_FontMap::AddStandardFont(CPDF_Document* pDoc, CPDF_Font* pFont = NULL; if (sFontName == "ZapfDingbats") { - pFont = pDoc->AddStandardFont(sFontName, NULL); + pFont = pDoc->AddStandardFont(sFontName.c_str(), NULL); } else { CPDF_FontEncoding fe(PDFFONT_ENCODING_WINANSI); - pFont = pDoc->AddStandardFont(sFontName, &fe); + pFont = pDoc->AddStandardFont(sFontName.c_str(), &fe); } return pFont; diff --git a/xfa/fgas/crt/fgas_codepage.cpp b/xfa/fgas/crt/fgas_codepage.cpp index 57d97db83c..4734a0005e 100644 --- a/xfa/fgas/crt/fgas_codepage.cpp +++ b/xfa/fgas/crt/fgas_codepage.cpp @@ -339,5 +339,5 @@ uint16_t FX_GetCodePageFormStringW(const FX_WCHAR* pStr, int32_t iLength) { *pBuf++ = (FX_CHAR)*pStr++; } csStr.ReleaseBuffer(iLength); - return FX_GetCodePageFromStringA(csStr, iLength); + return FX_GetCodePageFromStringA(csStr.c_str(), iLength); } diff --git a/xfa/fgas/crt/fgas_stream.cpp b/xfa/fgas/crt/fgas_stream.cpp index 02fa2109d1..1a3b239184 100644 --- a/xfa/fgas/crt/fgas_stream.cpp +++ b/xfa/fgas/crt/fgas_stream.cpp @@ -420,7 +420,7 @@ FX_BOOL CFX_FileStreamImp::LoadFile(const FX_WCHAR* pszSrcFileName, } } #else - CFX_ByteString wsMode; + const FX_CHAR* wsMode = "rb"; if (dwAccess & FX_STREAMACCESS_Write) { if (dwAccess & FX_STREAMACCESS_Append) { wsMode = "a+b"; @@ -429,18 +429,16 @@ FX_BOOL CFX_FileStreamImp::LoadFile(const FX_WCHAR* pszSrcFileName, } else { wsMode = "r+b"; } - } else { - wsMode = "rb"; } CFX_ByteString szFileName = CFX_ByteString::FromUnicode(pszSrcFileName); - m_hFile = FXSYS_fopen(szFileName, wsMode); + m_hFile = FXSYS_fopen(szFileName.c_str(), wsMode); if (m_hFile == NULL) { if (dwAccess & FX_STREAMACCESS_Write) { if (dwAccess & FX_STREAMACCESS_Create) { - m_hFile = FXSYS_fopen(szFileName, "w+b"); + m_hFile = FXSYS_fopen(szFileName.c_str(), "w+b"); } if (m_hFile == NULL) { - m_hFile = FXSYS_fopen(szFileName, "r+b"); + m_hFile = FXSYS_fopen(szFileName.c_str(), "r+b"); if (m_hFile == NULL) { return FALSE; } diff --git a/xfa/fgas/font/fgas_stdfontmgr.cpp b/xfa/fgas/font/fgas_stdfontmgr.cpp index 7dc0272976..89087aacf8 100644 --- a/xfa/fgas/font/fgas_stdfontmgr.cpp +++ b/xfa/fgas/font/fgas_stdfontmgr.cpp @@ -491,7 +491,8 @@ Restart: if (m_FolderPaths.GetSize() < 1) { return ""; } - pCurHandle = FX_OpenFolder(m_FolderPaths[m_FolderPaths.GetSize() - 1]); + pCurHandle = + FX_OpenFolder(m_FolderPaths[m_FolderPaths.GetSize() - 1].c_str()); FX_HandleParentPath hpp; hpp.pFileHandle = pCurHandle; hpp.bsParentPath = m_FolderPaths[m_FolderPaths.GetSize() - 1]; @@ -525,7 +526,7 @@ Restart: hpp.bsParentPath = m_FolderQueue.GetDataPtr(m_FolderQueue.GetSize() - 1)->bsParentPath + bsFolderSpearator + bsName; - hpp.pFileHandle = FX_OpenFolder(hpp.bsParentPath); + hpp.pFileHandle = FX_OpenFolder(hpp.bsParentPath.c_str()); if (hpp.pFileHandle == NULL) { continue; } @@ -701,7 +702,7 @@ IFX_Font* CFX_FontMgrImp::GetFontByCodePage(uint16_t wCodePage, CFX_ByteString bsHash; bsHash.Format("%d, %d", wCodePage, dwFontStyles); bsHash += CFX_WideString(pszFontFamily).UTF8Encode(); - uint32_t dwHash = FX_HashCode_String_GetA(bsHash, bsHash.GetLength()); + uint32_t dwHash = FX_HashCode_String_GetA(bsHash.c_str(), bsHash.GetLength()); CFX_ArrayTemplate<IFX_Font*>* pFonts = nullptr; if (m_Hash2Fonts.Lookup(dwHash, pFonts)) { @@ -758,7 +759,7 @@ IFX_Font* CFX_FontMgrImp::GetFontByUnicode(FX_WCHAR wUnicode, else bsHash.Format("%d, %d", wCodePage, dwFontStyles); bsHash += CFX_WideString(pszFontFamily).UTF8Encode(); - uint32_t dwHash = FX_HashCode_String_GetA(bsHash, bsHash.GetLength()); + uint32_t dwHash = FX_HashCode_String_GetA(bsHash.c_str(), bsHash.GetLength()); CFX_ArrayTemplate<IFX_Font*>* pFonts = nullptr; if (m_Hash2Fonts.Lookup(dwHash, pFonts)) { if (!pFonts) @@ -859,8 +860,7 @@ IFX_Font* CFX_FontMgrImp::LoadFont(const FX_WCHAR* pszFileName, CFX_ByteString bsHash; bsHash += CFX_WideString(pszFileName).UTF8Encode(); - uint32_t dwHash = - FX_HashCode_String_GetA((const FX_CHAR*)bsHash, bsHash.GetLength()); + uint32_t dwHash = FX_HashCode_String_GetA(bsHash.c_str(), bsHash.GetLength()); IFX_FileAccess* pFontAccess = nullptr; if (!m_Hash2FileAccess.Lookup(dwHash, pFontAccess)) { pFontAccess = FX_CreateDefaultFileAccess(pszFileName); @@ -894,7 +894,7 @@ IFX_Font* CFX_FontMgrImp::LoadFont(IFX_FileAccess* pFontAccess, if (bWantCache) { CFX_ByteString bsHash; bsHash.Format("%d, %d", (uintptr_t)pFontAccess, iFaceIndex); - dwHash = FX_HashCode_String_GetA(bsHash, bsHash.GetLength()); + dwHash = FX_HashCode_String_GetA(bsHash.c_str(), bsHash.GetLength()); if (m_FileAccess2IFXFont.Lookup(dwHash, pFont)) { if (pFont) { if (pFaceCount) @@ -1032,8 +1032,9 @@ IFX_FileRead* CFX_FontMgrImp::CreateFontStream( IFX_SystemFontInfo* pSystemFontInfo, uint32_t index) { int iExact = 0; - void* hFont = pSystemFontInfo->MapFont( - 0, 0, FXFONT_DEFAULT_CHARSET, 0, pFontMapper->GetFaceName(index), iExact); + void* hFont = + pSystemFontInfo->MapFont(0, 0, FXFONT_DEFAULT_CHARSET, 0, + pFontMapper->GetFaceName(index).c_str(), iExact); if (!hFont) return nullptr; diff --git a/xfa/fxbarcode/oned/BC_OnedCode128Writer.cpp b/xfa/fxbarcode/oned/BC_OnedCode128Writer.cpp index ac05e78910..98ec75ac2f 100644 --- a/xfa/fxbarcode/oned/BC_OnedCode128Writer.cpp +++ b/xfa/fxbarcode/oned/BC_OnedCode128Writer.cpp @@ -211,7 +211,7 @@ int32_t CBC_OnedCode128Writer::Encode128C(const CFX_ByteString& contents, patternIndex = (int32_t)ch; position++; } else { - patternIndex = FXSYS_atoi(contents.Mid(position, 2)); + patternIndex = FXSYS_atoi(contents.Mid(position, 2).c_str()); if (contents.GetAt(position + 1) < '0' || contents.GetAt(position + 1) > '9') { position += 1; diff --git a/xfa/fxbarcode/oned/BC_OnedEAN13Writer.cpp b/xfa/fxbarcode/oned/BC_OnedEAN13Writer.cpp index b534602fb3..bdc5e1f2c7 100644 --- a/xfa/fxbarcode/oned/BC_OnedEAN13Writer.cpp +++ b/xfa/fxbarcode/oned/BC_OnedEAN13Writer.cpp @@ -66,9 +66,9 @@ int32_t CBC_OnedEAN13Writer::CalcChecksum(const CFX_ByteString& contents) { int32_t j = 1; for (int32_t i = contents.GetLength() - 1; i >= 0; i--) { if (j % 2) { - odd += FXSYS_atoi(contents.Mid(i, 1)); + odd += FXSYS_atoi(contents.Mid(i, 1).c_str()); } else { - even += FXSYS_atoi(contents.Mid(i, 1)); + even += FXSYS_atoi(contents.Mid(i, 1).c_str()); } j++; } @@ -107,7 +107,7 @@ uint8_t* CBC_OnedEAN13Writer::Encode(const CFX_ByteString& contents, return NULL; } m_iDataLenth = 13; - int32_t firstDigit = FXSYS_atoi(contents.Mid(0, 1)); + int32_t firstDigit = FXSYS_atoi(contents.Mid(0, 1).c_str()); int32_t parities = CBC_OnedEAN13Reader::FIRST_DIGIT_ENCODINGS[firstDigit]; outLength = m_codeWidth; uint8_t* result = FX_Alloc(uint8_t, m_codeWidth); @@ -120,7 +120,7 @@ uint8_t* CBC_OnedEAN13Writer::Encode(const CFX_ByteString& contents, } int32_t i = 0; for (i = 1; i <= 6; i++) { - int32_t digit = FXSYS_atoi(contents.Mid(i, 1)); + int32_t digit = FXSYS_atoi(contents.Mid(i, 1).c_str()); if ((parities >> (6 - i) & 1) == 1) { digit += 10; } @@ -137,7 +137,7 @@ uint8_t* CBC_OnedEAN13Writer::Encode(const CFX_ByteString& contents, return NULL; } for (i = 7; i <= 12; i++) { - int32_t digit = FXSYS_atoi(contents.Mid(i, 1)); + int32_t digit = FXSYS_atoi(contents.Mid(i, 1).c_str()); pos += AppendPattern(result, pos, CBC_OneDimReader::L_PATTERNS[digit], 4, 1, e); if (e != BCExceptionNO) { diff --git a/xfa/fxbarcode/oned/BC_OnedEAN8Writer.cpp b/xfa/fxbarcode/oned/BC_OnedEAN8Writer.cpp index 5336867538..4427cb8970 100644 --- a/xfa/fxbarcode/oned/BC_OnedEAN8Writer.cpp +++ b/xfa/fxbarcode/oned/BC_OnedEAN8Writer.cpp @@ -76,9 +76,9 @@ int32_t CBC_OnedEAN8Writer::CalcChecksum(const CFX_ByteString& contents) { int32_t j = 1; for (int32_t i = contents.GetLength() - 1; i >= 0; i--) { if (j % 2) { - odd += FXSYS_atoi(contents.Mid(i, 1)); + odd += FXSYS_atoi(contents.Mid(i, 1).c_str()); } else { - even += FXSYS_atoi(contents.Mid(i, 1)); + even += FXSYS_atoi(contents.Mid(i, 1).c_str()); } j++; } @@ -128,7 +128,7 @@ uint8_t* CBC_OnedEAN8Writer::Encode(const CFX_ByteString& contents, } int32_t i = 0; for (i = 0; i <= 3; i++) { - int32_t digit = FXSYS_atoi(contents.Mid(i, 1)); + int32_t digit = FXSYS_atoi(contents.Mid(i, 1).c_str()); pos += AppendPattern(result, pos, CBC_OneDimReader::L_PATTERNS[digit], 4, 0, e); if (e != BCExceptionNO) { @@ -142,7 +142,7 @@ uint8_t* CBC_OnedEAN8Writer::Encode(const CFX_ByteString& contents, return NULL; } for (i = 4; i <= 7; i++) { - int32_t digit = FXSYS_atoi(contents.Mid(i, 1)); + int32_t digit = FXSYS_atoi(contents.Mid(i, 1).c_str()); pos += AppendPattern(result, pos, CBC_OneDimReader::L_PATTERNS[digit], 4, 1, e); if (e != BCExceptionNO) { diff --git a/xfa/fxbarcode/oned/BC_OnedUPCAWriter.cpp b/xfa/fxbarcode/oned/BC_OnedUPCAWriter.cpp index 21ccafc20c..943384d55c 100644 --- a/xfa/fxbarcode/oned/BC_OnedUPCAWriter.cpp +++ b/xfa/fxbarcode/oned/BC_OnedUPCAWriter.cpp @@ -70,9 +70,9 @@ int32_t CBC_OnedUPCAWriter::CalcChecksum(const CFX_ByteString& contents) { int32_t j = 1; for (int32_t i = contents.GetLength() - 1; i >= 0; i--) { if (j % 2) { - odd += FXSYS_atoi(contents.Mid(i, 1)); + odd += FXSYS_atoi(contents.Mid(i, 1).c_str()); } else { - even += FXSYS_atoi(contents.Mid(i, 1)); + even += FXSYS_atoi(contents.Mid(i, 1).c_str()); } j++; } diff --git a/xfa/fxfa/app/xfa_ffdoc.cpp b/xfa/fxfa/app/xfa_ffdoc.cpp index 04fe075d2c..c83895c25e 100644 --- a/xfa/fxfa/app/xfa_ffdoc.cpp +++ b/xfa/fxfa/app/xfa_ffdoc.cpp @@ -412,9 +412,8 @@ FX_BOOL CXFA_FFDoc::SavePackage(const CFX_WideStringC& wsPackage, if (pCSContext) { pCSContext->GetChecksum(bsChecksum); } - bFlags = pExport->Export(pFile, pNode, 0, bsChecksum.GetLength() - ? (const FX_CHAR*)bsChecksum - : NULL); + bFlags = pExport->Export( + pFile, pNode, 0, bsChecksum.GetLength() ? bsChecksum.c_str() : NULL); } else { bFlags = pExport->Export(pFile); } diff --git a/xfa/fxfa/app/xfa_ffwidget.cpp b/xfa/fxfa/app/xfa_ffwidget.cpp index f2c8ad79a0..037e6560de 100644 --- a/xfa/fxfa/app/xfa_ffwidget.cpp +++ b/xfa/fxfa/app/xfa_ffwidget.cpp @@ -991,7 +991,7 @@ CFX_DIBitmap* XFA_LoadImageData(CXFA_FFDoc* pDoc, CFX_ByteString bsData = wsImage.UTF8Encode(); int32_t iLength = bsData.GetLength(); pImageBuffer = FX_Alloc(uint8_t, iLength); - int32_t iRead = XFA_Base64Decode((const FX_CHAR*)bsData, pImageBuffer); + int32_t iRead = XFA_Base64Decode(bsData.c_str(), pImageBuffer); if (iRead > 0) { pImageFileRead = FX_CreateMemoryStream(pImageBuffer, iRead); } diff --git a/xfa/fxfa/fm2js/xfa_fm2jscontext.cpp b/xfa/fxfa/fm2js/xfa_fm2jscontext.cpp index e687ee53b8..68d3a374b8 100644 --- a/xfa/fxfa/fm2js/xfa_fm2jscontext.cpp +++ b/xfa/fxfa/fm2js/xfa_fm2jscontext.cpp @@ -3249,9 +3249,9 @@ void CXFA_FM2JSContext::Eval(FXJSE_HOBJECT hThis, FXJSE_HCONTEXT hContext = FXJSE_Context_Create(hruntime); FXJSE_HVALUE returnValue = FXJSE_Value_Create(hruntime); javaScript = wsJavaScriptBuf.GetWideString(); - FXJSE_ExecuteScript(hContext, - FX_UTF8Encode(javaScript, javaScript.GetLength()), - returnValue); + FXJSE_ExecuteScript( + hContext, FX_UTF8Encode(javaScript, javaScript.GetLength()).c_str(), + returnValue); FXJSE_Value_Set(args.GetReturnValue(), returnValue); FXJSE_Value_Release(returnValue); FXJSE_Context_Release(hContext); @@ -3470,7 +3470,7 @@ void CXFA_FM2JSContext::UnitValue(FXJSE_HOBJECT hThis, FXJSE_Value_SetNull(args.GetReturnValue()); } else { HValueToUTF8String(unitspanValue, unitspanString); - const FX_CHAR* pData = unitspanString; + const FX_CHAR* pData = unitspanString.c_str(); if (pData) { int32_t u = 0; while (*(pData + u) == 0x20 || *(pData + u) == 0x09 || @@ -3505,7 +3505,7 @@ void CXFA_FM2JSContext::UnitValue(FXJSE_HOBJECT hThis, unitValue = GetSimpleHValue(hThis, args, 1); CFX_ByteString unitTempString; HValueToUTF8String(unitValue, unitTempString); - const FX_CHAR* pData = unitTempString; + const FX_CHAR* pData = unitTempString.c_str(); int32_t u = 0; while (*(pData + u) == ' ' || *(pData + u) == 0x09 || *(pData + u) == 0x0B || *(pData + u) == 0x0C || @@ -4904,8 +4904,8 @@ void CXFA_FM2JSContext::Str(FXJSE_HOBJECT hThis, formatStr += CFX_ByteString::FormatInteger(iPrecision); } formatStr += "f"; - numberString.Format(formatStr, fNumber); - const FX_CHAR* pData = numberString; + numberString.Format(formatStr.c_str(), fNumber); + const FX_CHAR* pData = numberString.c_str(); int32_t iLength = numberString.GetLength(); int32_t u = 0; while (u < iLength) { @@ -6990,7 +6990,7 @@ int32_t CXFA_FM2JSContext::HValueToInteger(FXJSE_HOBJECT hThis, } else if (FXJSE_Value_IsUTF8String(hValue)) { CFX_ByteString szValue; FXJSE_Value_ToUTF8String(hValue, szValue); - iValue = FXSYS_atoi(szValue); + iValue = FXSYS_atoi(szValue.c_str()); } else { iValue = FXJSE_Value_ToInteger(hValue); } diff --git a/xfa/fxfa/parser/xfa_locale.cpp b/xfa/fxfa/parser/xfa_locale.cpp index b974939f41..91ca23e920 100644 --- a/xfa/fxfa/parser/xfa_locale.cpp +++ b/xfa/fxfa/parser/xfa_locale.cpp @@ -76,8 +76,8 @@ void CXFA_XMLLocale::GetNumbericSymbol(FX_LOCALENUMSYMBOL eType, if (!pElement) { return; } - GetPattern(pElement, CFX_ByteStringC((const FX_CHAR*)bsSymbols, - bsSymbols.GetLength() - 1), + GetPattern(pElement, + CFX_ByteStringC(bsSymbols.c_str(), bsSymbols.GetLength() - 1), wsName.AsStringC(), wsNumSymbol); } void CXFA_XMLLocale::GetDateTimeSymbols(CFX_WideString& wsDtSymbol) const { diff --git a/xfa/fxfa/parser/xfa_object_imp.cpp b/xfa/fxfa/parser/xfa_object_imp.cpp index 8b8db882ea..157d7dfa57 100644 --- a/xfa/fxfa/parser/xfa_object_imp.cpp +++ b/xfa/fxfa/parser/xfa_object_imp.cpp @@ -1730,7 +1730,7 @@ void CXFA_Node::Script_Boolean_Value(FXJSE_HVALUE hValue, if (!(FXJSE_Value_IsNull(hValue) || FXJSE_Value_IsUndefined(hValue))) { FXJSE_Value_ToUTF8String(hValue, newValue); } - int32_t iValue = FXSYS_atoi(newValue); + int32_t iValue = FXSYS_atoi(newValue.c_str()); CFX_WideString wsNewValue = (iValue == 0) ? FX_WSTRC(L"0") : FX_WSTRC(L"1"); CFX_WideString wsFormatValue(wsNewValue); CXFA_WidgetData* pContainerWidgetData = GetContainerWidgetData(); diff --git a/xfa/fxfa/parser/xfa_script_imp.cpp b/xfa/fxfa/parser/xfa_script_imp.cpp index 71fec27814..d92cdc7271 100644 --- a/xfa/fxfa/parser/xfa_script_imp.cpp +++ b/xfa/fxfa/parser/xfa_script_imp.cpp @@ -101,7 +101,8 @@ FX_BOOL CXFA_ScriptContext::RunScript(XFA_SCRIPTLANGTYPE eScriptType, CXFA_Object* pOriginalObject = m_pThisObject; m_pThisObject = pThisObject; FXJSE_HVALUE pValue = pThisObject ? GetJSValueFromMap(pThisObject) : NULL; - FX_BOOL bRet = FXJSE_ExecuteScript(m_hJsContext, btScript, hRetValue, pValue); + FX_BOOL bRet = + FXJSE_ExecuteScript(m_hJsContext, btScript.c_str(), hRetValue, pValue); m_pThisObject = pOriginalObject; m_eScriptType = eSaveType; return bRet; @@ -466,7 +467,8 @@ FX_BOOL CXFA_ScriptContext::RunVariablesScript(CXFA_Node* pScriptNode) { CreateVariablesContext(pScriptNode, pThisObject); CXFA_Object* pOriginalObject = m_pThisObject; m_pThisObject = pThisObject; - FX_BOOL bRet = FXJSE_ExecuteScript(hVariablesContext, btScript, hRetValue); + FX_BOOL bRet = + FXJSE_ExecuteScript(hVariablesContext, btScript.c_str(), hRetValue); m_pThisObject = pOriginalObject; FXJSE_Value_Release(hRetValue); return bRet; diff --git a/xfa/fxjse/class.cpp b/xfa/fxjse/class.cpp index c93e0bc581..29a8077bd0 100644 --- a/xfa/fxjse/class.cpp +++ b/xfa/fxjse/class.cpp @@ -241,8 +241,8 @@ static void FXJSE_Context_GlobalObjToString( CFX_ByteString szStringVal; szStringVal.Format("[object %s]", lpClass->name); info.GetReturnValue().Set(v8::String::NewFromUtf8( - info.GetIsolate(), (const FX_CHAR*)szStringVal, - v8::String::kNormalString, szStringVal.GetLength())); + info.GetIsolate(), szStringVal.c_str(), v8::String::kNormalString, + szStringVal.GetLength())); } else { v8::Local<v8::String> local_str = info.This() |