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 /core/fpdfapi | |
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
Diffstat (limited to 'core/fpdfapi')
-rw-r--r-- | core/fpdfapi/fpdf_font/cpdf_font.cpp | 2 | ||||
-rw-r--r-- | core/fpdfapi/fpdf_font/cpdf_type3font.cpp | 3 | ||||
-rw-r--r-- | core/fpdfapi/fpdf_font/fpdf_font_cid.cpp | 4 | ||||
-rw-r--r-- | core/fpdfapi/fpdf_page/cpdf_textobject.cpp | 9 | ||||
-rw-r--r-- | core/fpdfapi/fpdf_parser/cfdf_document.cpp | 2 | ||||
-rw-r--r-- | core/fpdfapi/fpdf_parser/cpdf_data_avail.cpp | 10 | ||||
-rw-r--r-- | core/fpdfapi/fpdf_parser/cpdf_parser.cpp | 20 | ||||
-rw-r--r-- | core/fpdfapi/fpdf_parser/cpdf_syntax_parser.cpp | 4 | ||||
-rw-r--r-- | core/fpdfapi/fpdf_parser/fpdf_parser_utility.cpp | 2 | ||||
-rw-r--r-- | core/fpdfapi/fpdf_render/fpdf_render_text.cpp | 6 |
10 files changed, 32 insertions, 30 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; } |