summaryrefslogtreecommitdiff
path: root/svtools
diff options
context:
space:
mode:
authorNoel Grandin <noelgrandin@gmail.com>2020-04-19 18:35:20 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2020-04-19 19:42:50 +0200
commit85a6aa5526c1e38865250e88ceb6bf02345248b2 (patch)
tree90078ea5ffb7b2667e1a6492cfdd5039b70629b1 /svtools
parent08f593989188d8833292bb9d1d466a23bfbd1e21 (diff)
tdf#131951 related, improve perf
similar to commit 9429dacc7ff93f99dd84532357020669df33a0c5 tdf#131951: automatically increase buffer size in a few places, let the OUStringBuffer handle large tokens, it has faster handling than repeatedly appending to an OUString Change-Id: I609b84b36e817fbcd6d366c53cd2e8b865216712 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/92503 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'svtools')
-rw-r--r--svtools/source/svhtml/parhtml.cxx14
-rw-r--r--svtools/source/svrtf/parrtf.cxx16
2 files changed, 4 insertions, 26 deletions
diff --git a/svtools/source/svhtml/parhtml.cxx b/svtools/source/svhtml/parhtml.cxx
index be0b8fed24d6..b3664713affa 100644
--- a/svtools/source/svhtml/parhtml.cxx
+++ b/svtools/source/svhtml/parhtml.cxx
@@ -925,12 +925,6 @@ HtmlTokenId HTMLParser::GetNextRawToken()
while( '-' == nNextCh && IsParserWorking() )
{
bTwoMinus = true;
-
- if( MAX_LEN == sTmpBuffer.getLength() )
- {
- aToken += sTmpBuffer;
- sTmpBuffer.setLength(0);
- }
sTmpBuffer.appendUtf32( nNextCh );
nNextCh = GetNextChar();
}
@@ -983,8 +977,7 @@ HtmlTokenId HTMLParser::GetNextRawToken()
break;
}
- if( (!bContinue && !sTmpBuffer.isEmpty()) ||
- MAX_LEN == sTmpBuffer.getLength() )
+ if( !bContinue && !sTmpBuffer.isEmpty() )
{
aToken += sTmpBuffer;
sTmpBuffer.setLength(0);
@@ -1063,11 +1056,6 @@ HtmlTokenId HTMLParser::GetNextToken_()
OUStringBuffer sTmpBuffer;
do {
sTmpBuffer.appendUtf32( nNextCh );
- if( MAX_LEN == sTmpBuffer.getLength() )
- {
- aToken += sTmpBuffer;
- sTmpBuffer.setLength(0);
- }
nNextCh = GetNextChar();
} while( '>' != nNextCh && '/' != nNextCh && !rtl::isAsciiWhiteSpace( nNextCh ) &&
IsParserWorking() && !rInput.eof() );
diff --git a/svtools/source/svrtf/parrtf.cxx b/svtools/source/svrtf/parrtf.cxx
index a52b8ee4f3af..8b5ad0a0a7cb 100644
--- a/svtools/source/svrtf/parrtf.cxx
+++ b/svtools/source/svrtf/parrtf.cxx
@@ -99,22 +99,12 @@ int SvRTFParser::GetNextToken_()
{
aToken = "\\";
{
- OUStringBuffer aStrBuffer;
- aStrBuffer.setLength( MAX_TOKEN_LEN );
- sal_Int32 nStrLen = 0;
+ OUStringBuffer aStrBuffer( MAX_TOKEN_LEN );
do {
- aStrBuffer[nStrLen++] = nNextCh;
- if( MAX_TOKEN_LEN == nStrLen )
- {
- aToken += aStrBuffer;
- nStrLen = 0;
- }
+ aStrBuffer.appendUtf32(nNextCh);
nNextCh = GetNextChar();
} while( RTF_ISALPHA( nNextCh ) );
- if( nStrLen )
- {
- aToken += aStrBuffer;
- }
+ aToken += aStrBuffer;
}
// minus before numeric parameters