From 8e4c505ff6d82263183e9f812fcc7b45c1414f15 Mon Sep 17 00:00:00 2001 From: tsepez Date: Thu, 14 Apr 2016 13:42:44 -0700 Subject: Rename CFX_ByteTextBuf::GetByteString() to AsStringC(). Do the same for CFX_WideTextBuf as well. The name is confusing because these return CFX_ByteStringC, not CFX_ByteString. The AsStringC naming gives parallelism with the string types themselves, and may help to indicate that the result is only good for the lifetime of the object being operated upon. Review URL: https://codereview.chromium.org/1886263003 --- fpdfsdk/fsdk_baseform.cpp | 6 +++--- fpdfsdk/fxedit/fxet_ap.cpp | 12 +++++------ fpdfsdk/fxedit/fxet_pageobjs.cpp | 32 ++++++++++++++--------------- fpdfsdk/pdfwindow/PWL_Caret.cpp | 2 +- fpdfsdk/pdfwindow/PWL_Edit.cpp | 2 +- fpdfsdk/pdfwindow/PWL_Icon.cpp | 2 +- fpdfsdk/pdfwindow/PWL_Label.cpp | 2 +- fpdfsdk/pdfwindow/PWL_Utils.cpp | 44 ++++++++++++++++++++-------------------- 8 files changed, 51 insertions(+), 51 deletions(-) (limited to 'fpdfsdk') diff --git a/fpdfsdk/fsdk_baseform.cpp b/fpdfsdk/fsdk_baseform.cpp index 7487cddede..86f5c5e501 100644 --- a/fpdfsdk/fsdk_baseform.cpp +++ b/fpdfsdk/fsdk_baseform.cpp @@ -1410,7 +1410,7 @@ void CPDFSDK_Widget::ResetAppearance_ComboBox(const FX_WCHAR* sValue) { sBody << CPWL_Utils::GetDropButtonAppStream(rcButton); CFX_ByteString sAP = GetBackgroundAppStream() + GetBorderAppStream() + - sLines.GetByteString() + sBody.GetByteString(); + sLines.AsStringC() + sBody.AsStringC(); WriteAppearance("N", GetRotatedRect(), GetMatrix(), sAP); } @@ -1499,7 +1499,7 @@ void CPDFSDK_Widget::ResetAppearance_ListBox() { } CFX_ByteString sAP = GetBackgroundAppStream() + GetBorderAppStream() + - sLines.GetByteString() + sBody.GetByteString(); + sLines.AsStringC() + sBody.AsStringC(); WriteAppearance("N", GetRotatedRect(), GetMatrix(), sAP); } @@ -1648,7 +1648,7 @@ void CPDFSDK_Widget::ResetAppearance_TextField(const FX_WCHAR* sValue) { } CFX_ByteString sAP = GetBackgroundAppStream() + GetBorderAppStream() + - sLines.GetByteString() + sBody.GetByteString(); + sLines.AsStringC() + sBody.AsStringC(); WriteAppearance("N", GetRotatedRect(), GetMatrix(), sAP); } diff --git a/fpdfsdk/fxedit/fxet_ap.cpp b/fpdfsdk/fxedit/fxet_ap.cpp index cafce2eb04..1a36c803da 100644 --- a/fpdfsdk/fxedit/fxet_ap.cpp +++ b/fpdfsdk/fxedit/fxet_ap.cpp @@ -56,7 +56,7 @@ static CFX_ByteString GetFontSetString(IPVT_FontMap* pFontMap, sRet << "/" << sFontAlias << " " << fFontSize << " Tf\n"; } - return sRet.GetByteString(); + return sRet.AsStringC(); } CFX_ByteString IFX_Edit::GetEditAppearanceStream( @@ -87,7 +87,7 @@ CFX_ByteString IFX_Edit::GetEditAppearanceStream( if (bContinuous) { if (place.LineCmp(oldplace) != 0) { if (sWords.GetSize() > 0) { - sEditStream << GetWordRenderString(sWords.GetByteString()); + sEditStream << GetWordRenderString(sWords.AsStringC()); sWords.Clear(); } @@ -114,7 +114,7 @@ CFX_ByteString IFX_Edit::GetEditAppearanceStream( if (pIterator->GetWord(word)) { if (word.nFontIndex != nCurFontIndex) { if (sWords.GetSize() > 0) { - sEditStream << GetWordRenderString(sWords.GetByteString()); + sEditStream << GetWordRenderString(sWords.AsStringC()); sWords.Clear(); } sEditStream << GetFontSetString(pEdit->GetFontMap(), @@ -152,7 +152,7 @@ CFX_ByteString IFX_Edit::GetEditAppearanceStream( } if (sWords.GetSize() > 0) { - sEditStream << GetWordRenderString(sWords.GetByteString()); + sEditStream << GetWordRenderString(sWords.AsStringC()); sWords.Clear(); } } @@ -172,7 +172,7 @@ CFX_ByteString IFX_Edit::GetEditAppearanceStream( sAppStream << sEditStream; } - return sAppStream.GetByteString(); + return sAppStream.AsStringC(); } CFX_ByteString IFX_Edit::GetSelectAppearanceStream( @@ -202,5 +202,5 @@ CFX_ByteString IFX_Edit::GetSelectAppearanceStream( } } - return sRet.GetByteString(); + return sRet.AsStringC(); } diff --git a/fpdfsdk/fxedit/fxet_pageobjs.cpp b/fpdfsdk/fxedit/fxet_pageobjs.cpp index a09b92f4d4..b3f4ad60c6 100644 --- a/fpdfsdk/fxedit/fxet_pageobjs.cpp +++ b/fpdfsdk/fxedit/fxet_pageobjs.cpp @@ -234,11 +234,11 @@ void IFX_Edit::DrawEdit(CFX_RenderDevice* pDevice, if (place.LineCmp(oldplace) != 0 || word.nFontIndex != nFontIndex || crOldFill != crCurFill) { if (sTextBuf.GetLength() > 0) { - DrawTextString(pDevice, CFX_FloatPoint(ptBT.x + ptOffset.x, - ptBT.y + ptOffset.y), - pFontMap->GetPDFFont(nFontIndex), fFontSize, - pUser2Device, sTextBuf.GetByteString(), - crOldFill, crTextStroke, nHorzScale); + DrawTextString( + pDevice, + CFX_FloatPoint(ptBT.x + ptOffset.x, ptBT.y + ptOffset.y), + pFontMap->GetPDFFont(nFontIndex), fFontSize, pUser2Device, + sTextBuf.AsStringC(), crOldFill, crTextStroke, nHorzScale); sTextBuf.Clear(); } @@ -266,7 +266,7 @@ void IFX_Edit::DrawEdit(CFX_RenderDevice* pDevice, DrawTextString( pDevice, CFX_FloatPoint(ptBT.x + ptOffset.x, ptBT.y + ptOffset.y), pFontMap->GetPDFFont(nFontIndex), fFontSize, pUser2Device, - sTextBuf.GetByteString(), crOldFill, crTextStroke, nHorzScale); + sTextBuf.AsStringC(), crOldFill, crTextStroke, nHorzScale); } } } @@ -348,11 +348,11 @@ void IFX_Edit::DrawRichEdit(CFX_RenderDevice* pDevice, FXSYS_memcmp(&word.WordProps, &wp, sizeof(CPVT_WordProps)) != 0 || crOld != crCurText) { if (sTextBuf.GetLength() > 0) { - DrawTextString(pDevice, CFX_FloatPoint(ptBT.x + ptOffset.x, - ptBT.y + ptOffset.y), - pFontMap->GetPDFFont(wp.nFontIndex), wp.fFontSize, - pUser2Device, sTextBuf.GetByteString(), crOld, 0, - wp.nHorzScale); + DrawTextString( + pDevice, + CFX_FloatPoint(ptBT.x + ptOffset.x, ptBT.y + ptOffset.y), + pFontMap->GetPDFFont(wp.nFontIndex), wp.fFontSize, + pUser2Device, sTextBuf.AsStringC(), crOld, 0, wp.nHorzScale); sTextBuf.Clear(); } @@ -393,7 +393,7 @@ void IFX_Edit::DrawRichEdit(CFX_RenderDevice* pDevice, DrawTextString( pDevice, CFX_FloatPoint(ptBT.x + ptOffset.x, ptBT.y + ptOffset.y), pFontMap->GetPDFFont(wp.nFontIndex), wp.fFontSize, pUser2Device, - sTextBuf.GetByteString(), crOld, 0, wp.nHorzScale); + sTextBuf.AsStringC(), crOld, 0, wp.nHorzScale); } } } @@ -497,7 +497,7 @@ void IFX_Edit::GeneratePageObjects( pObjectHolder, crText, pFontMap->GetPDFFont(nOldFontIndex), fFontSize, 0.0f, 100, CFX_FloatPoint(ptBT.x + ptOffset.x, ptBT.y + ptOffset.y), - sTextBuf.GetByteString())); + sTextBuf.AsStringC())); sTextBuf.Clear(); } @@ -517,7 +517,7 @@ void IFX_Edit::GeneratePageObjects( pObjectHolder, crText, pFontMap->GetPDFFont(nOldFontIndex), fFontSize, 0.0f, 100, CFX_FloatPoint(ptBT.x + ptOffset.x, ptBT.y + ptOffset.y), - sTextBuf.GetByteString())); + sTextBuf.AsStringC())); } } } @@ -568,7 +568,7 @@ void IFX_Edit::GenerateRichPageObjects( pObjectHolder, crOld, pFontMap->GetPDFFont(wp.nFontIndex), wp.fFontSize, wp.fCharSpace, wp.nHorzScale, CFX_FloatPoint(ptBT.x + ptOffset.x, ptBT.y + ptOffset.y), - sTextBuf.GetByteString())); + sTextBuf.AsStringC())); sTextBuf.Clear(); } @@ -611,7 +611,7 @@ void IFX_Edit::GenerateRichPageObjects( pObjectHolder, crOld, pFontMap->GetPDFFont(wp.nFontIndex), wp.fFontSize, wp.fCharSpace, wp.nHorzScale, CFX_FloatPoint(ptBT.x + ptOffset.x, ptBT.y + ptOffset.y), - sTextBuf.GetByteString())); + sTextBuf.AsStringC())); } } } diff --git a/fpdfsdk/pdfwindow/PWL_Caret.cpp b/fpdfsdk/pdfwindow/PWL_Caret.cpp index e49471a0d2..88ce429c85 100644 --- a/fpdfsdk/pdfwindow/PWL_Caret.cpp +++ b/fpdfsdk/pdfwindow/PWL_Caret.cpp @@ -95,7 +95,7 @@ CFX_ByteString CPWL_Caret::GetCaretAppearanceStream( const CFX_FloatPoint& ptOffset) { CFX_ByteTextBuf sCaret; GetCaretApp(sCaret, ptOffset); - return sCaret.GetByteString(); + return sCaret.AsStringC(); } void CPWL_Caret::TimerProc() { diff --git a/fpdfsdk/pdfwindow/PWL_Edit.cpp b/fpdfsdk/pdfwindow/PWL_Edit.cpp index 620838185e..4a9adfb207 100644 --- a/fpdfsdk/pdfwindow/PWL_Edit.cpp +++ b/fpdfsdk/pdfwindow/PWL_Edit.cpp @@ -708,7 +708,7 @@ CFX_ByteString CPWL_Edit::GetTextAppearanceStream( << sEdit.AsStringC() << "ET\n"; } - return sRet.GetByteString(); + return sRet.AsStringC(); } CFX_ByteString CPWL_Edit::GetCaretAppearanceStream( diff --git a/fpdfsdk/pdfwindow/PWL_Icon.cpp b/fpdfsdk/pdfwindow/PWL_Icon.cpp index d4635f6ecd..08ba970225 100644 --- a/fpdfsdk/pdfwindow/PWL_Icon.cpp +++ b/fpdfsdk/pdfwindow/PWL_Icon.cpp @@ -46,7 +46,7 @@ CFX_ByteString CPWL_Image::GetImageAppStream() { << "Q\n"; } - return sAppStream.GetByteString(); + return sAppStream.AsStringC(); } void CPWL_Image::SetPDFStream(CPDF_Stream* pStream) { diff --git a/fpdfsdk/pdfwindow/PWL_Label.cpp b/fpdfsdk/pdfwindow/PWL_Label.cpp index 9a1dce61d8..1375678cfb 100644 --- a/fpdfsdk/pdfwindow/PWL_Label.cpp +++ b/fpdfsdk/pdfwindow/PWL_Label.cpp @@ -132,7 +132,7 @@ CFX_ByteString CPWL_Label::GetTextAppearanceStream( << sEdit.AsStringC() << "ET\n"; } - return sRet.GetByteString(); + return sRet.AsStringC(); } CFX_WideString CPWL_Label::GetText() const { diff --git a/fpdfsdk/pdfwindow/PWL_Utils.cpp b/fpdfsdk/pdfwindow/PWL_Utils.cpp index 92787b9e6c..2c52309b3f 100644 --- a/fpdfsdk/pdfwindow/PWL_Utils.cpp +++ b/fpdfsdk/pdfwindow/PWL_Utils.cpp @@ -44,7 +44,7 @@ CFX_ByteString CPWL_Utils::GetAppStreamFromArray(const CPWL_PathData* pPathData, } } - return csAP.GetByteString(); + return csAP.AsStringC(); } void CPWL_Utils::GetPathDataFromArray(CFX_PathData& path, @@ -185,7 +185,7 @@ CFX_ByteString CPWL_Utils::GetAP_Check(const CFX_FloatRect& crBBox) { << pts[nNext][0].y << " c\n"; } - return csAP.GetByteString(); + return csAP.AsStringC(); } CFX_ByteString CPWL_Utils::GetAP_Circle(const CFX_FloatRect& crBBox) { @@ -227,7 +227,7 @@ CFX_ByteString CPWL_Utils::GetAP_Circle(const CFX_FloatRect& crBBox) { csAP << pt4.x - px * FX_BEZIER << " " << pt4.y << " " << pt1.x << " " << pt1.y - py * FX_BEZIER << " " << pt1.x << " " << pt1.y << " c\n"; - return csAP.GetByteString(); + return csAP.AsStringC(); } CFX_ByteString CPWL_Utils::GetAP_Cross(const CFX_FloatRect& crBBox) { @@ -238,7 +238,7 @@ CFX_ByteString CPWL_Utils::GetAP_Cross(const CFX_FloatRect& crBBox) { csAP << crBBox.left << " " << crBBox.bottom << " m\n"; csAP << crBBox.right << " " << crBBox.top << " l\n"; - return csAP.GetByteString(); + return csAP.AsStringC(); } CFX_ByteString CPWL_Utils::GetAP_Diamond(const CFX_FloatRect& crBBox) { @@ -258,7 +258,7 @@ CFX_ByteString CPWL_Utils::GetAP_Diamond(const CFX_FloatRect& crBBox) { csAP << pt4.x << " " << pt4.y << " l\n"; csAP << pt1.x << " " << pt1.y << " l\n"; - return csAP.GetByteString(); + return csAP.AsStringC(); } CFX_ByteString CPWL_Utils::GetAP_Square(const CFX_FloatRect& crBBox) { @@ -270,7 +270,7 @@ CFX_ByteString CPWL_Utils::GetAP_Square(const CFX_FloatRect& crBBox) { csAP << crBBox.left << " " << crBBox.bottom << " l\n"; csAP << crBBox.left << " " << crBBox.top << " l\n"; - return csAP.GetByteString(); + return csAP.AsStringC(); } CFX_ByteString CPWL_Utils::GetAP_Star(const CFX_FloatRect& crBBox) { @@ -302,7 +302,7 @@ CFX_ByteString CPWL_Utils::GetAP_Star(const CFX_FloatRect& crBBox) { csAP << px[nNext] << " " << py[nNext] << " l\n"; } - return csAP.GetByteString(); + return csAP.AsStringC(); } CFX_ByteString CPWL_Utils::GetAP_HalfCircle(const CFX_FloatRect& crBBox, @@ -337,7 +337,7 @@ CFX_ByteString CPWL_Utils::GetAP_HalfCircle(const CFX_FloatRect& crBBox, csAP << pt2.x + px * FX_BEZIER << " " << pt2.y << " " << pt3.x << " " << pt3.y + py * FX_BEZIER << " " << pt3.x << " " << pt3.y << " c\n"; - return csAP.GetByteString(); + return csAP.AsStringC(); } CFX_FloatRect CPWL_Utils::InflateRect(const CFX_FloatRect& rcRect, @@ -387,7 +387,7 @@ CFX_ByteString CPWL_Utils::GetRectFillAppStream(const CFX_FloatRect& rect, << " re f\nQ\n"; } - return sAppStream.GetByteString(); + return sAppStream.AsStringC(); } CFX_ByteString CPWL_Utils::GetCircleFillAppStream(const CFX_FloatRect& rect, @@ -399,7 +399,7 @@ CFX_ByteString CPWL_Utils::GetCircleFillAppStream(const CFX_FloatRect& rect, sAppStream << "q\n" << sColor << CPWL_Utils::GetAP_Circle(rect) << "f\nQ\n"; } - return sAppStream.GetByteString(); + return sAppStream.AsStringC(); } CFX_FloatRect CPWL_Utils::GetCenterSquare(const CFX_FloatRect& rect) { @@ -465,7 +465,7 @@ CFX_ByteString CPWL_Utils::GetTextAppStream(const CFX_FloatRect& rcBBox, IFX_Edit::DelEdit(pEdit); } - return sRet.GetByteString(); + return sRet.AsStringC(); } CFX_ByteString CPWL_Utils::GetPushButtonAppStream(const CFX_FloatRect& rcBBox, @@ -690,7 +690,7 @@ CFX_ByteString CPWL_Utils::GetPushButtonAppStream(const CFX_FloatRect& rcBBox, sAppStream << sTemp << "Q\n"; } - return sAppStream.GetByteString(); + return sAppStream.AsStringC(); } return ""; @@ -717,7 +717,7 @@ CFX_ByteString CPWL_Utils::GetColorAppStream(const CPWL_Color& color, break; } - return sColorStream.GetByteString(); + return sColorStream.AsStringC(); } CFX_ByteString CPWL_Utils::GetBorderAppStream(const CFX_FloatRect& rect, @@ -833,7 +833,7 @@ CFX_ByteString CPWL_Utils::GetBorderAppStream(const CFX_FloatRect& rect, sAppStream << "Q\n"; } - return sAppStream.GetByteString(); + return sAppStream.AsStringC(); } CFX_ByteString CPWL_Utils::GetCircleBorderAppStream( @@ -932,7 +932,7 @@ CFX_ByteString CPWL_Utils::GetCircleBorderAppStream( sAppStream << "Q\n"; } - return sAppStream.GetByteString(); + return sAppStream.AsStringC(); } CPWL_Color CPWL_Utils::SubstractColor(const CPWL_Color& sColor, @@ -991,7 +991,7 @@ CFX_ByteString CPWL_Utils::GetAppStream_Check(const CFX_FloatRect& rcBBox, CFX_ByteTextBuf sAP; sAP << "q\n" << CPWL_Utils::GetColorAppStream(crText, TRUE) << CPWL_Utils::GetAP_Check(rcBBox) << "f\nQ\n"; - return sAP.GetByteString(); + return sAP.AsStringC(); } CFX_ByteString CPWL_Utils::GetAppStream_Circle(const CFX_FloatRect& rcBBox, @@ -999,7 +999,7 @@ CFX_ByteString CPWL_Utils::GetAppStream_Circle(const CFX_FloatRect& rcBBox, CFX_ByteTextBuf sAP; sAP << "q\n" << CPWL_Utils::GetColorAppStream(crText, TRUE) << CPWL_Utils::GetAP_Circle(rcBBox) << "f\nQ\n"; - return sAP.GetByteString(); + return sAP.AsStringC(); } CFX_ByteString CPWL_Utils::GetAppStream_Cross(const CFX_FloatRect& rcBBox, @@ -1007,7 +1007,7 @@ CFX_ByteString CPWL_Utils::GetAppStream_Cross(const CFX_FloatRect& rcBBox, CFX_ByteTextBuf sAP; sAP << "q\n" << CPWL_Utils::GetColorAppStream(crText, FALSE) << CPWL_Utils::GetAP_Cross(rcBBox) << "S\nQ\n"; - return sAP.GetByteString(); + return sAP.AsStringC(); } CFX_ByteString CPWL_Utils::GetAppStream_Diamond(const CFX_FloatRect& rcBBox, @@ -1015,7 +1015,7 @@ CFX_ByteString CPWL_Utils::GetAppStream_Diamond(const CFX_FloatRect& rcBBox, CFX_ByteTextBuf sAP; sAP << "q\n1 w\n" << CPWL_Utils::GetColorAppStream(crText, TRUE) << CPWL_Utils::GetAP_Diamond(rcBBox) << "f\nQ\n"; - return sAP.GetByteString(); + return sAP.AsStringC(); } CFX_ByteString CPWL_Utils::GetAppStream_Square(const CFX_FloatRect& rcBBox, @@ -1023,7 +1023,7 @@ CFX_ByteString CPWL_Utils::GetAppStream_Square(const CFX_FloatRect& rcBBox, CFX_ByteTextBuf sAP; sAP << "q\n" << CPWL_Utils::GetColorAppStream(crText, TRUE) << CPWL_Utils::GetAP_Square(rcBBox) << "f\nQ\n"; - return sAP.GetByteString(); + return sAP.AsStringC(); } CFX_ByteString CPWL_Utils::GetAppStream_Star(const CFX_FloatRect& rcBBox, @@ -1031,7 +1031,7 @@ CFX_ByteString CPWL_Utils::GetAppStream_Star(const CFX_FloatRect& rcBBox, CFX_ByteTextBuf sAP; sAP << "q\n" << CPWL_Utils::GetColorAppStream(crText, TRUE) << CPWL_Utils::GetAP_Star(rcBBox) << "f\nQ\n"; - return sAP.GetByteString(); + return sAP.AsStringC(); } CFX_ByteString CPWL_Utils::GetCheckBoxAppStream(const CFX_FloatRect& rcBBox, @@ -1110,7 +1110,7 @@ CFX_ByteString CPWL_Utils::GetDropButtonAppStream(const CFX_FloatRect& rcBBox) { } } - return sAppStream.GetByteString(); + return sAppStream.AsStringC(); } void CPWL_Utils::ConvertCMYK2GRAY(FX_FLOAT dC, -- cgit v1.2.3