summaryrefslogtreecommitdiff
path: root/svx/source/tbxctrls
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2022-05-12 14:33:06 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2022-05-13 11:11:27 +0200
commit3817965ded6c7ed915e4f9599e18b3e8abdaca44 (patch)
treee112927919e8b7c9ce6c1e233ff6fce05f189784 /svx/source/tbxctrls
parent8ad920befe1290c40ef762e8d7d9797b1924f5d2 (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 'svx/source/tbxctrls')
-rw-r--r--svx/source/tbxctrls/Palette.cxx12
1 files changed, 6 insertions, 6 deletions
diff --git a/svx/source/tbxctrls/Palette.cxx b/svx/source/tbxctrls/Palette.cxx
index fabccc8f2022..84858c2eb208 100644
--- a/svx/source/tbxctrls/Palette.cxx
+++ b/svx/source/tbxctrls/Palette.cxx
@@ -172,7 +172,7 @@ void PaletteASE::LoadPalette()
// PaletteGPL ------------------------------------------------------------------
-static OString lcl_getToken(const OString& rStr, sal_Int32& index);
+static OString lcl_getToken(OStringBuffer& rStr, sal_Int32& index);
PaletteGPL::PaletteGPL( const OUString &rFPath, const OUString &rFName ) :
mbLoadedPalette( false ),
@@ -254,7 +254,7 @@ void PaletteGPL::LoadPalette()
if( !mbValidPalette ) return;
- OString aLine;
+ OStringBuffer aLine;
do {
if (aLine[0] != '#' && aLine[0] != '\n')
{
@@ -274,9 +274,9 @@ void PaletteGPL::LoadPalette()
if(token.isEmpty()) continue;
sal_Int32 b = token.toInt32();
- OString name;
+ std::string_view name;
if(nIndex != -1)
- name = aLine.copy(nIndex);
+ name = std::string_view(aLine).substr(nIndex);
maColors.emplace_back(
Color(r, g, b),
@@ -287,7 +287,7 @@ void PaletteGPL::LoadPalette()
// finds first token in rStr from index, separated by whitespace
// returns position of next token in index
-static OString lcl_getToken(const OString& rStr, sal_Int32& index)
+static OString lcl_getToken(OStringBuffer& rStr, sal_Int32& index)
{
sal_Int32 substart, toklen = 0;
OUString aWhitespaceChars( " \n\t" );
@@ -317,7 +317,7 @@ static OString lcl_getToken(const OString& rStr, sal_Int32& index)
if(index == rStr.getLength())
index = -1;
- return rStr.copy(substart, toklen);
+ return OString(std::string_view(rStr).substr(substart, toklen));
}
// PaletteSOC ------------------------------------------------------------------