summaryrefslogtreecommitdiff
path: root/vcl
diff options
context:
space:
mode:
authorNoel Grandin <noelgrandin@gmail.com>2019-10-17 20:33:50 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2019-11-03 17:11:32 +0100
commit48101a1a0d574db3db1f99c782bd67e885b232bb (patch)
treeafd2f88944d73f43762b3a31df2ff81c8115ba9e /vcl
parentab285c743afa1c8769581871d7b56374fd8c49f1 (diff)
size some stringbuffer to prevent re-alloc
I started with 32 and kept doubling the size until the site did not need re-alloc, but clamped it at 512. Change-Id: I55fe36b31cd3d40f86e5729337a927cf920f2af6 Reviewed-on: https://gerrit.libreoffice.org/81960 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'vcl')
-rw-r--r--vcl/source/gdi/impgraph.cxx5
-rw-r--r--vcl/source/uitest/logger.cxx3
2 files changed, 5 insertions, 3 deletions
diff --git a/vcl/source/gdi/impgraph.cxx b/vcl/source/gdi/impgraph.cxx
index 2fbd6795394c..824caae1698f 100644
--- a/vcl/source/gdi/impgraph.cxx
+++ b/vcl/source/gdi/impgraph.cxx
@@ -167,9 +167,10 @@ OString GraphicID::getIDString() const
{
static const char aHexData[] = { '0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'A', 'B', 'C', 'D', 'E', 'F' };
- OStringBuffer aHexStr;
sal_Int32 nShift, nIndex = 0;
- aHexStr.setLength(24 + (2 * BITMAP_CHECKSUM_SIZE));
+ sal_Int32 nLen = 24 + (2 * BITMAP_CHECKSUM_SIZE);
+ OStringBuffer aHexStr(nLen);
+ aHexStr.setLength(nLen);
for( nShift = 28; nShift >= 0; nShift -= 4 )
aHexStr[nIndex++] = aHexData[ ( mnID1 >> static_cast<sal_uInt32>(nShift) ) & 0xf ];
diff --git a/vcl/source/uitest/logger.cxx b/vcl/source/uitest/logger.cxx
index 858dd0353d14..d7fd1dcf7392 100644
--- a/vcl/source/uitest/logger.cxx
+++ b/vcl/source/uitest/logger.cxx
@@ -309,7 +309,8 @@ OUString StringMapToOUString(const std::map<OUString, OUString>& rParameters)
if (rParameters.empty())
return "";
- OUStringBuffer aParameterString = " {";
+ OUStringBuffer aParameterString(static_cast<int>(rParameters.size()*32));
+ aParameterString.append(" {");
for (std::map<OUString, OUString>::const_iterator itr = rParameters.begin();
itr != rParameters.end(); ++itr)