From 0f874472c672175135520101837ff0c9d4701d7f Mon Sep 17 00:00:00 2001 From: Noel Grandin Date: Thu, 17 Oct 2019 20:33:50 +0200 Subject: size some stringbuffer to prevent re-alloc found by the simple expidient of putting asserts in the resize routine. Where an explicit const size is used, I started with 32 and kept doubling until that site did not need resizing anymore. Change-Id: I998787edc940d0a3ba23b5ac37131ab9ecd300f4 Reviewed-on: https://gerrit.libreoffice.org/81138 Tested-by: Jenkins Reviewed-by: Noel Grandin --- codemaker/source/cppumaker/cpputype.cxx | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'codemaker') diff --git a/codemaker/source/cppumaker/cpputype.cxx b/codemaker/source/cppumaker/cpputype.cxx index 67b842f0c3d1..a16256d4c353 100644 --- a/codemaker/source/cppumaker/cpputype.cxx +++ b/codemaker/source/cppumaker/cpputype.cxx @@ -1004,7 +1004,7 @@ OUString CppuType::resolveAllTypedefs(OUString const & name) const u2b(dynamic_cast(*ent).getType()), &k2)); k1 += k2; //TODO: overflow } - OUStringBuffer b; + OUStringBuffer b(k1*2 + n.getLength()); for (sal_Int32 i = 0; i != k1; ++i) { b.append("[]"); } @@ -2675,7 +2675,7 @@ OUString typeToIdentifier(OUString const & name) { sal_Int32 k; OUString n(b2u(codemaker::UnoType::decompose(u2b(name), &k))); - OUStringBuffer b; + OUStringBuffer b(4*k + n.getLength()); for (sal_Int32 i = 0; i != k; ++i) { b.append("seq_"); } @@ -3587,7 +3587,7 @@ void ServiceType::dumpHppFile( for (const unoidl::SingleInterfaceBasedServiceEntity::Constructor::Parameter& param : cons.parameters) { o << ", "; - OUStringBuffer buf; + OUStringBuffer buf(2 + param.type.getLength()); if (param.rest) { buf.append("[]"); } -- cgit v1.2.3