diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2022-05-12 14:33:06 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2022-05-13 11:11:27 +0200 |
commit | 3817965ded6c7ed915e4f9599e18b3e8abdaca44 (patch) | |
tree | e112927919e8b7c9ce6c1e233ff6fce05f189784 /sfx2/source/bastyp | |
parent | 8ad920befe1290c40ef762e8d7d9797b1924f5d2 (diff) |
add SvStream::ReadLine(OStringBuffer... to reduce OString allocation
and use it where possible
Change-Id: I3efc7a642f73661ce606c917c0323ba9948521c6
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/134265
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'sfx2/source/bastyp')
-rw-r--r-- | sfx2/source/bastyp/mieclip.cxx | 13 |
1 files changed, 7 insertions, 6 deletions
diff --git a/sfx2/source/bastyp/mieclip.cxx b/sfx2/source/bastyp/mieclip.cxx index 580c6444d326..e40c5bd2970a 100644 --- a/sfx2/source/bastyp/mieclip.cxx +++ b/sfx2/source/bastyp/mieclip.cxx @@ -35,7 +35,7 @@ SvStream* MSE40HTMLClipFormatObj::IsValid( SvStream& rStream ) bool bRet = false; pStrm.reset(); - OString sLine; + OStringBuffer sLine; sal_Int32 nStt = -1, nEnd = -1, nFragStart = -1, nFragEnd = -1; sal_Int32 nIndex = 0; @@ -49,16 +49,17 @@ SvStream* MSE40HTMLClipFormatObj::IsValid( SvStream& rStream ) { nIndex = 0; std::string_view sTmp(o3tl::getToken(sLine, 0, ':', nIndex)); + std::string_view sView(sLine); if (sTmp == "StartHTML") - nStt = o3tl::toInt32(sLine.subView(nIndex)); + nStt = o3tl::toInt32(sView.substr(nIndex)); else if (sTmp == "EndHTML") - nEnd = o3tl::toInt32(sLine.subView(nIndex)); + nEnd = o3tl::toInt32(sView.substr(nIndex)); else if (sTmp == "StartFragment") - nFragStart = o3tl::toInt32(sLine.subView(nIndex)); + nFragStart = o3tl::toInt32(sView.substr(nIndex)); else if (sTmp == "EndFragment") - nFragEnd = o3tl::toInt32(sLine.subView(nIndex)); + nFragEnd = o3tl::toInt32(sView.substr(nIndex)); else if (sTmp == "SourceURL") - sBaseURL = OStringToOUString( sLine.subView(nIndex), RTL_TEXTENCODING_UTF8 ); + sBaseURL = OStringToOUString( sView.substr(nIndex), RTL_TEXTENCODING_UTF8 ); if (nEnd >= 0 && nStt >= 0 && (!sBaseURL.isEmpty() || rStream.Tell() >= o3tl::make_unsigned(nStt))) |