diff options
author | Noel Grandin <noelgrandin@gmail.com> | 2019-10-17 20:33:50 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2019-10-23 08:55:00 +0200 |
commit | c68be56c295c8dda3043c80d4641575ec2799e55 (patch) | |
tree | 40fc9a82e021498f7cebe76e59bec5bb85d6385c /sax | |
parent | 437dc68285dab0f08a1ded2193d86d64f560cd9b (diff) |
size some stringbuffer to prevent re-alloc
Change-Id: I385587a922c555c320a45dcc6d644315b72510e9
Reviewed-on: https://gerrit.libreoffice.org/81278
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'sax')
-rw-r--r-- | sax/qa/cppunit/test_converter.cxx | 6 | ||||
-rw-r--r-- | sax/source/fastparser/fastparser.cxx | 3 |
2 files changed, 5 insertions, 4 deletions
diff --git a/sax/qa/cppunit/test_converter.cxx b/sax/qa/cppunit/test_converter.cxx index 536aa53bbdcd..525e110c1a46 100644 --- a/sax/qa/cppunit/test_converter.cxx +++ b/sax/qa/cppunit/test_converter.cxx @@ -90,7 +90,7 @@ void doTest(util::Duration const & rid, char const*const pis, CPPUNIT_ASSERT_EQUAL(rid.Seconds, od.Seconds); CPPUNIT_ASSERT_EQUAL(rid.NanoSeconds, od.NanoSeconds); CPPUNIT_ASSERT_EQUAL(rid.Negative, od.Negative); - OUStringBuffer buf; + OUStringBuffer buf(64); Converter::convertDuration(buf, od); SAL_INFO("sax.cppunit","" << buf.toString()); CPPUNIT_ASSERT(buf.makeStringAndClear().equalsAscii(pos)); @@ -159,7 +159,7 @@ void doTest(util::DateTime const & rdt, char const*const pis, SAL_INFO("sax.cppunit","Y:" << odt.Year << " M:" << odt.Month << " D:" << odt.Day << " H:" << odt.Hours << " M:" << odt.Minutes << " S:" << odt.Seconds << " nS:" << odt.NanoSeconds << " UTC: " << static_cast<bool>(odt.IsUTC)); CPPUNIT_ASSERT(bSuccess); CPPUNIT_ASSERT(eqDateTime(rdt, odt)); - OUStringBuffer buf; + OUStringBuffer buf(32); Converter::convertDateTime(buf, odt, nullptr, true); SAL_INFO("sax.cppunit","" << buf.toString()); CPPUNIT_ASSERT_EQUAL(OUString::createFromAscii(pos), @@ -253,7 +253,7 @@ void doTestTime(util::DateTime const & rdt, char const*const pis, SAL_INFO("sax.cppunit","Y:" << odt.Year << " M:" << odt.Month << " D:" << odt.Day << " H:" << odt.Hours << " M:" << odt.Minutes << " S:" << odt.Seconds << " nS:" << odt.NanoSeconds << " UTC: " << static_cast<bool>(odt.IsUTC)); CPPUNIT_ASSERT(bSuccess); CPPUNIT_ASSERT(eqDateTime(rdt, odt)); - OUStringBuffer buf; + OUStringBuffer buf(32); Converter::convertTimeOrDateTime(buf, odt); SAL_INFO("sax.cppunit","" << buf.toString()); CPPUNIT_ASSERT_EQUAL(OUString::createFromAscii(pos), diff --git a/sax/source/fastparser/fastparser.cxx b/sax/source/fastparser/fastparser.cxx index ac04d1522a24..7383b8c339ea 100644 --- a/sax/source/fastparser/fastparser.cxx +++ b/sax/source/fastparser/fastparser.cxx @@ -551,7 +551,8 @@ OUString lclGetErrorMessage( xmlParserCtxtPtr ctxt, const OUString& sSystemId, s pMessage = error->message; else pMessage = "unknown error"; - OUStringBuffer aBuffer( "[" ); + OUStringBuffer aBuffer( 128 ); + aBuffer.append( "[" ); aBuffer.append( sSystemId ); aBuffer.append( " line " ); aBuffer.append( nLine ); |