From 3817965ded6c7ed915e4f9599e18b3e8abdaca44 Mon Sep 17 00:00:00 2001 From: Noel Grandin Date: Thu, 12 May 2022 14:33:06 +0200 Subject: 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 --- sfx2/source/bastyp/mieclip.cxx | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) (limited to 'sfx2/source/bastyp') 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))) -- cgit