diff options
author | tsepez <tsepez@chromium.org> | 2016-04-04 16:41:35 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-04-04 16:41:35 -0700 |
commit | 28f97ff783c16f3391384ce97b765ce4eb310ac7 (patch) | |
tree | 69c4c8bc9dd39d5336c96f28b633d197dd207c81 /fpdfsdk/pdfwindow/PWL_Edit.cpp | |
parent | ed9c4386713084f37548b46ab36f618021f716f5 (diff) | |
download | pdfium-28f97ff783c16f3391384ce97b765ce4eb310ac7.tar.xz |
Make down-conversion explicit from CFX_ByteString to CFX_ByteStringC.
Having this happen implicitly can be dangerous because the lifetime
has to be considered; we should have caught the "red bots" in
https://codereview.chromium.org/1847333004/#ps60001 at compile time.
Review URL: https://codereview.chromium.org/1853233002
Diffstat (limited to 'fpdfsdk/pdfwindow/PWL_Edit.cpp')
-rw-r--r-- | fpdfsdk/pdfwindow/PWL_Edit.cpp | 26 |
1 files changed, 17 insertions, 9 deletions
diff --git a/fpdfsdk/pdfwindow/PWL_Edit.cpp b/fpdfsdk/pdfwindow/PWL_Edit.cpp index f53f263470..64588f2dff 100644 --- a/fpdfsdk/pdfwindow/PWL_Edit.cpp +++ b/fpdfsdk/pdfwindow/PWL_Edit.cpp @@ -265,6 +265,7 @@ void CPWL_Edit::GetThisAppearanceStream(CFX_ByteTextBuf& sAppStream) { case PBS_SOLID: { sLine << "q\n" << GetBorderWidth() << " w\n" << CPWL_Utils::GetColorAppStream(GetBorderColor(), FALSE) + .AsByteStringC() << " 2 J 0 j\n"; for (int32_t i = 1; i < nCharArray; i++) { @@ -281,6 +282,7 @@ void CPWL_Edit::GetThisAppearanceStream(CFX_ByteTextBuf& sAppStream) { case PBS_DASH: { sLine << "q\n" << GetBorderWidth() << " w\n" << CPWL_Utils::GetColorAppStream(GetBorderColor(), FALSE) + .AsByteStringC() << " 2 J 0 j\n" << "[" << GetBorderDash().nDash << " " << GetBorderDash().nGap << "] " << GetBorderDash().nPhase << " d\n"; @@ -319,7 +321,8 @@ void CPWL_Edit::GetThisAppearanceStream(CFX_ByteTextBuf& sAppStream) { if (sEditSel.GetLength() > 0) sText << CPWL_Utils::GetColorAppStream(PWL_DEFAULT_SELBACKCOLOR) - << sEditSel; + .AsByteStringC() + << sEditSel.AsByteStringC(); wrTemp = CPWL_Utils::OverlapWordRange(wrVisible, wrSelBefore); CFX_ByteString sEditBefore = CPWL_Utils::GetEditAppStream( @@ -327,8 +330,9 @@ void CPWL_Edit::GetThisAppearanceStream(CFX_ByteTextBuf& sAppStream) { m_pEdit->GetPasswordChar()); if (sEditBefore.GetLength() > 0) - sText << "BT\n" << CPWL_Utils::GetColorAppStream(GetTextColor()) - << sEditBefore << "ET\n"; + sText << "BT\n" + << CPWL_Utils::GetColorAppStream(GetTextColor()).AsByteStringC() + << sEditBefore.AsByteStringC() << "ET\n"; wrTemp = CPWL_Utils::OverlapWordRange(wrVisible, wrSelect); CFX_ByteString sEditMid = CPWL_Utils::GetEditAppStream( @@ -338,7 +342,8 @@ void CPWL_Edit::GetThisAppearanceStream(CFX_ByteTextBuf& sAppStream) { if (sEditMid.GetLength() > 0) sText << "BT\n" << CPWL_Utils::GetColorAppStream(CPWL_Color(COLORTYPE_GRAY, 1)) - << sEditMid << "ET\n"; + .AsByteStringC() + << sEditMid.AsByteStringC() << "ET\n"; wrTemp = CPWL_Utils::OverlapWordRange(wrVisible, wrSelAfter); CFX_ByteString sEditAfter = CPWL_Utils::GetEditAppStream( @@ -346,8 +351,9 @@ void CPWL_Edit::GetThisAppearanceStream(CFX_ByteTextBuf& sAppStream) { m_pEdit->GetPasswordChar()); if (sEditAfter.GetLength() > 0) - sText << "BT\n" << CPWL_Utils::GetColorAppStream(GetTextColor()) - << sEditAfter << "ET\n"; + sText << "BT\n" + << CPWL_Utils::GetColorAppStream(GetTextColor()).AsByteStringC() + << sEditAfter.AsByteStringC() << "ET\n"; if (HasFlag(PES_SPELLCHECK)) { CFX_ByteString sSpellCheck = CPWL_Utils::GetSpellCheckAppStream( @@ -355,7 +361,8 @@ void CPWL_Edit::GetThisAppearanceStream(CFX_ByteTextBuf& sAppStream) { if (sSpellCheck.GetLength() > 0) sText << CPWL_Utils::GetColorAppStream(CPWL_Color(COLORTYPE_RGB, 1, 0, 0), FALSE) - << sSpellCheck; + .AsByteStringC() + << sSpellCheck.AsByteStringC(); } if (sText.GetLength() > 0) { @@ -742,8 +749,9 @@ CFX_ByteString CPWL_Edit::GetTextAppearanceStream( CFX_ByteString sEdit = CPWL_Utils::GetEditAppStream(m_pEdit, ptOffset); if (sEdit.GetLength() > 0) { - sRet << "BT\n" << CPWL_Utils::GetColorAppStream(GetTextColor()) << sEdit - << "ET\n"; + sRet << "BT\n" + << CPWL_Utils::GetColorAppStream(GetTextColor()).AsByteStringC() + << sEdit.AsByteStringC() << "ET\n"; } return sRet.GetByteString(); |