diff options
author | tsepez <tsepez@chromium.org> | 2016-05-13 17:51:27 -0700 |
---|---|---|
committer | Commit bot <commit-bot@chromium.org> | 2016-05-13 17:51:27 -0700 |
commit | 71a452f8ce12e31cc4e0d8c7878567b0c7fc63c2 (patch) | |
tree | a0ee545eb67b14f9398df98196d88e5150893ce8 /fpdfsdk/fxedit/fxet_ap.cpp | |
parent | afe94306e3c542f0d499e7f7706ee5dec4028d8a (diff) | |
download | pdfium-71a452f8ce12e31cc4e0d8c7878567b0c7fc63c2.tar.xz |
Make CFX_ByteString(const CFX_ByteStringC&) explicit.
Add missing helper function to CFX_ByteTextBuf to avoid the
anti-pattern CFX_ByteString(sBuf.AsStringC()), using the name
"Make" to indicate there's an allocation going on in this case.
Change some method arguments to take pre-existing ByteStrings where
possible.
Review-Url: https://codereview.chromium.org/1977093002
Diffstat (limited to 'fpdfsdk/fxedit/fxet_ap.cpp')
-rw-r--r-- | fpdfsdk/fxedit/fxet_ap.cpp | 15 |
1 files changed, 6 insertions, 9 deletions
diff --git a/fpdfsdk/fxedit/fxet_ap.cpp b/fpdfsdk/fxedit/fxet_ap.cpp index 262f1e70cd..563acb65b5 100644 --- a/fpdfsdk/fxedit/fxet_ap.cpp +++ b/fpdfsdk/fxedit/fxet_ap.cpp @@ -48,15 +48,12 @@ static CFX_ByteString GetFontSetString(IPVT_FontMap* pFontMap, int32_t nFontIndex, FX_FLOAT fFontSize) { CFX_ByteTextBuf sRet; - if (pFontMap) { CFX_ByteString sFontAlias = pFontMap->GetPDFFontAlias(nFontIndex); - if (sFontAlias.GetLength() > 0 && fFontSize > 0) sRet << "/" << sFontAlias << " " << fFontSize << " Tf\n"; } - - return sRet.AsStringC(); + return sRet.MakeString(); } CFX_ByteString IFX_Edit::GetEditAppearanceStream( @@ -87,7 +84,7 @@ CFX_ByteString IFX_Edit::GetEditAppearanceStream( if (bContinuous) { if (place.LineCmp(oldplace) != 0) { if (sWords.GetSize() > 0) { - sEditStream << GetWordRenderString(sWords.AsStringC()); + sEditStream << GetWordRenderString(sWords.MakeString()); sWords.Clear(); } @@ -114,7 +111,7 @@ CFX_ByteString IFX_Edit::GetEditAppearanceStream( if (pIterator->GetWord(word)) { if (word.nFontIndex != nCurFontIndex) { if (sWords.GetSize() > 0) { - sEditStream << GetWordRenderString(sWords.AsStringC()); + sEditStream << GetWordRenderString(sWords.MakeString()); sWords.Clear(); } sEditStream << GetFontSetString(pEdit->GetFontMap(), word.nFontIndex, @@ -152,7 +149,7 @@ CFX_ByteString IFX_Edit::GetEditAppearanceStream( } if (sWords.GetSize() > 0) { - sEditStream << GetWordRenderString(sWords.AsStringC()); + sEditStream << GetWordRenderString(sWords.MakeString()); sWords.Clear(); } @@ -171,7 +168,7 @@ CFX_ByteString IFX_Edit::GetEditAppearanceStream( sAppStream << sEditStream; } - return sAppStream.AsStringC(); + return sAppStream.MakeString(); } CFX_ByteString IFX_Edit::GetSelectAppearanceStream( @@ -200,5 +197,5 @@ CFX_ByteString IFX_Edit::GetSelectAppearanceStream( } } - return sRet.AsStringC(); + return sRet.MakeString(); } |