summaryrefslogtreecommitdiff
path: root/fpdfsdk/pdfwindow
diff options
context:
space:
mode:
authortsepez <tsepez@chromium.org>2016-04-04 16:41:35 -0700
committerCommit bot <commit-bot@chromium.org>2016-04-04 16:41:35 -0700
commit28f97ff783c16f3391384ce97b765ce4eb310ac7 (patch)
tree69c4c8bc9dd39d5336c96f28b633d197dd207c81 /fpdfsdk/pdfwindow
parented9c4386713084f37548b46ab36f618021f716f5 (diff)
downloadpdfium-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')
-rw-r--r--fpdfsdk/pdfwindow/PWL_Edit.cpp26
-rw-r--r--fpdfsdk/pdfwindow/PWL_Icon.cpp2
-rw-r--r--fpdfsdk/pdfwindow/PWL_Label.cpp8
-rw-r--r--fpdfsdk/pdfwindow/PWL_ListBox.cpp14
-rw-r--r--fpdfsdk/pdfwindow/PWL_ScrollBar.cpp3
-rw-r--r--fpdfsdk/pdfwindow/PWL_Signature.cpp2
6 files changed, 35 insertions, 20 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();
diff --git a/fpdfsdk/pdfwindow/PWL_Icon.cpp b/fpdfsdk/pdfwindow/PWL_Icon.cpp
index 560f8e0e32..69f9e599da 100644
--- a/fpdfsdk/pdfwindow/PWL_Icon.cpp
+++ b/fpdfsdk/pdfwindow/PWL_Icon.cpp
@@ -42,7 +42,7 @@ CFX_ByteString CPWL_Image::GetImageAppStream() {
sAppStream << mt.GetA() << " " << mt.GetB() << " " << mt.GetC() << " "
<< mt.GetD() << " " << mt.GetE() << " " << mt.GetF() << " cm\n";
- sAppStream << "0 g 0 G 1 w /" << sAlias << " Do\n"
+ sAppStream << "0 g 0 G 1 w /" << sAlias.AsByteStringC() << " Do\n"
<< "Q\n";
}
diff --git a/fpdfsdk/pdfwindow/PWL_Label.cpp b/fpdfsdk/pdfwindow/PWL_Label.cpp
index cfbeb4362c..8c5b0676d7 100644
--- a/fpdfsdk/pdfwindow/PWL_Label.cpp
+++ b/fpdfsdk/pdfwindow/PWL_Label.cpp
@@ -118,7 +118,8 @@ CFX_FloatRect CPWL_Label::GetContentRect() const {
void CPWL_Label::GetThisAppearanceStream(CFX_ByteTextBuf& sAppStream) {
CPWL_Wnd::GetThisAppearanceStream(sAppStream);
- sAppStream << GetTextAppearanceStream(CFX_FloatPoint(0.0f, 0.0f));
+ sAppStream << GetTextAppearanceStream(CFX_FloatPoint(0.0f, 0.0f))
+ .AsByteStringC();
}
CFX_ByteString CPWL_Label::GetTextAppearanceStream(
@@ -127,8 +128,9 @@ CFX_ByteString CPWL_Label::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();
diff --git a/fpdfsdk/pdfwindow/PWL_ListBox.cpp b/fpdfsdk/pdfwindow/PWL_ListBox.cpp
index d39d8419a6..ccccc77dcd 100644
--- a/fpdfsdk/pdfwindow/PWL_ListBox.cpp
+++ b/fpdfsdk/pdfwindow/PWL_ListBox.cpp
@@ -118,21 +118,25 @@ void CPWL_ListBox::GetThisAppearanceStream(CFX_ByteTextBuf& sAppStream) {
CFX_FloatPoint ptOffset(rcItem.left, (rcItem.top + rcItem.bottom) * 0.5f);
if (m_pList->IsItemSelected(i)) {
- sListItems << CPWL_Utils::GetRectFillAppStream(
- rcItem, PWL_DEFAULT_SELBACKCOLOR);
+ sListItems << CPWL_Utils::GetRectFillAppStream(rcItem,
+ PWL_DEFAULT_SELBACKCOLOR)
+ .AsByteStringC();
CFX_ByteString sItem =
CPWL_Utils::GetEditAppStream(m_pList->GetItemEdit(i), ptOffset);
if (sItem.GetLength() > 0) {
sListItems << "BT\n"
<< CPWL_Utils::GetColorAppStream(PWL_DEFAULT_SELTEXTCOLOR)
- << sItem << "ET\n";
+ .AsByteStringC()
+ << sItem.AsByteStringC() << "ET\n";
}
} else {
CFX_ByteString sItem =
CPWL_Utils::GetEditAppStream(m_pList->GetItemEdit(i), ptOffset);
if (sItem.GetLength() > 0) {
- sListItems << "BT\n" << CPWL_Utils::GetColorAppStream(GetTextColor())
- << sItem << "ET\n";
+ sListItems << "BT\n"
+ << CPWL_Utils::GetColorAppStream(GetTextColor())
+ .AsByteStringC()
+ << sItem.AsByteStringC() << "ET\n";
}
}
}
diff --git a/fpdfsdk/pdfwindow/PWL_ScrollBar.cpp b/fpdfsdk/pdfwindow/PWL_ScrollBar.cpp
index 9db2aea35b..a96cf5f2a5 100644
--- a/fpdfsdk/pdfwindow/PWL_ScrollBar.cpp
+++ b/fpdfsdk/pdfwindow/PWL_ScrollBar.cpp
@@ -670,7 +670,8 @@ void CPWL_ScrollBar::GetThisAppearanceStream(CFX_ByteTextBuf& sAppStream) {
sButton << "q\n";
sButton << "0 w\n"
- << CPWL_Utils::GetColorAppStream(GetBackgroundColor(), TRUE);
+ << CPWL_Utils::GetColorAppStream(GetBackgroundColor(), TRUE)
+ .AsByteStringC();
sButton << rectWnd.left << " " << rectWnd.bottom << " "
<< rectWnd.right - rectWnd.left << " "
<< rectWnd.top - rectWnd.bottom << " re b Q\n";
diff --git a/fpdfsdk/pdfwindow/PWL_Signature.cpp b/fpdfsdk/pdfwindow/PWL_Signature.cpp
index 72b6ebe7c3..221922972f 100644
--- a/fpdfsdk/pdfwindow/PWL_Signature.cpp
+++ b/fpdfsdk/pdfwindow/PWL_Signature.cpp
@@ -42,7 +42,7 @@ void CPWL_Signature_Image::DrawThisAppearance(CFX_RenderDevice* pDevice,
void CPWL_Signature_Image::GetThisAppearanceStream(
CFX_ByteTextBuf& sAppStream) {
- sAppStream << CPWL_Image::GetImageAppStream();
+ sAppStream << CPWL_Image::GetImageAppStream().AsByteStringC();
}
void CPWL_Signature_Image::GetScale(FX_FLOAT& fHScale, FX_FLOAT& fVScale) {