From b4c9f3f04673753da30011e9f1282cd5d1fa0f40 Mon Sep 17 00:00:00 2001 From: tsepez Date: Wed, 13 Apr 2016 15:41:21 -0700 Subject: Remove implicit cast from CFX_ByteString to (const char*). BUG= Review URL: https://codereview.chromium.org/1885973002 --- core/fpdfapi/fpdf_page/cpdf_textobject.cpp | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) (limited to 'core/fpdfapi/fpdf_page') 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); } } -- cgit v1.2.3