diff options
-rw-r--r-- | codemaker/source/commonjava/commonjava.cxx | 2 | ||||
-rw-r--r-- | codemaker/source/cppumaker/cpputype.cxx | 55 | ||||
-rw-r--r-- | codemaker/source/javamaker/javatype.cxx | 25 | ||||
-rw-r--r-- | comphelper/qa/unit/base64_test.cxx | 16 | ||||
-rw-r--r-- | comphelper/source/misc/docpasswordhelper.cxx | 2 | ||||
-rw-r--r-- | editeng/source/editeng/editdoc.cxx | 2 | ||||
-rw-r--r-- | editeng/source/editeng/impedit2.cxx | 2 | ||||
-rw-r--r-- | i18npool/qa/cppunit/test_breakiterator.cxx | 16 | ||||
-rw-r--r-- | i18npool/source/breakiterator/xdictionary.cxx | 10 | ||||
-rw-r--r-- | i18npool/source/collator/gencoll_rule.cxx | 6 | ||||
-rw-r--r-- | i18npool/source/indexentry/genindex_data.cxx | 3 | ||||
-rw-r--r-- | idlc/source/aststructinstance.cxx | 3 | ||||
-rw-r--r-- | idlc/source/idlccompile.cxx | 12 | ||||
-rw-r--r-- | idlc/source/idlcproduce.cxx | 2 | ||||
-rw-r--r-- | include/comphelper/unwrapargs.hxx | 14 | ||||
-rw-r--r-- | registry/source/keyimpl.cxx | 3 | ||||
-rw-r--r-- | registry/source/regimpl.cxx | 2 | ||||
-rw-r--r-- | sax/qa/cppunit/test_converter.cxx | 6 | ||||
-rw-r--r-- | sax/source/fastparser/fastparser.cxx | 3 | ||||
-rw-r--r-- | tools/source/ref/globname.cxx | 2 | ||||
-rw-r--r-- | xmloff/source/core/nmspmap.cxx | 2 |
21 files changed, 123 insertions, 65 deletions
diff --git a/codemaker/source/commonjava/commonjava.cxx b/codemaker/source/commonjava/commonjava.cxx index 955a0ba5e7cd..bdb1b02b63a7 100644 --- a/codemaker/source/commonjava/commonjava.cxx +++ b/codemaker/source/commonjava/commonjava.cxx @@ -39,7 +39,7 @@ namespace codemaker { namespace java { OString translateUnoToJavaType( codemaker::UnoType::Sort sort, OString const & nucleus, bool referenceType) { - OStringBuffer buf; + OStringBuffer buf(128); if (sort <= codemaker::UnoType::Sort::Any) { OString const javaTypes[static_cast<int>(codemaker::UnoType::Sort::Any) + 1][2] = { { "void", "java/lang/Void" }, diff --git a/codemaker/source/cppumaker/cpputype.cxx b/codemaker/source/cppumaker/cpputype.cxx index a16256d4c353..dcec84ccdc3f 100644 --- a/codemaker/source/cppumaker/cpputype.cxx +++ b/codemaker/source/cppumaker/cpputype.cxx @@ -2400,6 +2400,28 @@ void PolyStructType::dumpLightGetCppuType(FileStream & out) << "static ::typelib_TypeDescriptionReference * the_type = 0;\n" << indent() << "if (the_type == 0) {\n"; inc(); + + out << "#ifdef LIBO_INTERNAL_ONLY\n"; + + out << indent() << "::rtl::OString the_buffer = \"" << name_ + << "<\" +\n"; + for (std::vector< OUString >::const_iterator i( + entity_->getTypeParameters().begin()); + i != entity_->getTypeParameters().end();) { + out << indent() + << ("::rtl::OUStringToOString(" + "::cppu::getTypeFavourChar(static_cast< "); + dumpTypeParameterName(out, *i); + out << " * >(0)).getTypeName(), RTL_TEXTENCODING_UTF8) +\n"; + ++i; + if (i != entity_->getTypeParameters().end()) { + out << indent() << "\",\" +\n"; + } + } + out << indent() << "\">\";\n"; + + out << "#else\n"; + out << indent() << "::rtl::OStringBuffer the_buffer(\"" << name_ << "<\");\n"; for (std::vector< OUString >::const_iterator i( @@ -2415,9 +2437,14 @@ void PolyStructType::dumpLightGetCppuType(FileStream & out) out << indent() << "the_buffer.append(',');\n"; } } - out << indent() << "the_buffer.append('>');\n" << indent() + out << indent() << "the_buffer.append('>');\n"; + + out << "#endif\n"; + + out << indent() << "::typelib_static_type_init(&the_type, " << getTypeClass(name_, true) << ", the_buffer.getStr());\n"; + dec(); out << indent() << "}\n" << indent() << "return *reinterpret_cast< ::css::uno::Type * >(&the_type);\n"; @@ -2506,6 +2533,27 @@ void PolyStructType::dumpComprehensiveGetCppuType(FileStream & out) out << indent() << "::css::uno::Type * operator()() const\n" << indent() << "{\n"; inc(); + + out << "#ifdef LIBO_INTERNAL_ONLY\n"; + out << indent() + << "::rtl::OUString the_name =\n"; + out << indent() << "\"" << name_ << "<\" +\n"; + for (std::vector< OUString >::const_iterator i( + entity_->getTypeParameters().begin()); + i != entity_->getTypeParameters().end();) { + out << indent() + << "::cppu::getTypeFavourChar(static_cast< "; + dumpTypeParameterName(out, *i); + out << " * >(0)).getTypeName() +\n"; + ++i; + if (i != entity_->getTypeParameters().end()) { + out << indent() + << "\",\" +\n"; + } + } + out << indent() + << "\">\";\n"; + out << "#else\n"; out << indent() << "::rtl::OUStringBuffer the_buffer;\n" << indent() << "the_buffer.append(\"" << name_ << "<\");\n"; for (std::vector< OUString >::const_iterator i( @@ -2522,9 +2570,10 @@ void PolyStructType::dumpComprehensiveGetCppuType(FileStream & out) "static_cast< ::sal_Unicode >(','));\n"); } } - out << indent() << "the_buffer.append(static_cast< ::sal_Unicode >('>'));\n" - << indent() + out << indent() << "the_buffer.append(static_cast< ::sal_Unicode >('>'));\n"; + out << indent() << "::rtl::OUString the_name(the_buffer.makeStringAndClear());\n"; + out << "#endif\n"; std::map< OUString, sal_uInt32 > parameters; std::map< OUString, sal_uInt32 > types; std::vector< unoidl::PolymorphicStructTypeTemplateEntity::Member >:: diff --git a/codemaker/source/javamaker/javatype.cxx b/codemaker/source/javamaker/javatype.cxx index 0616d8f08771..16c2ef73e089 100644 --- a/codemaker/source/javamaker/javatype.cxx +++ b/codemaker/source/javamaker/javatype.cxx @@ -89,7 +89,7 @@ OUString createUnoName( rtl::Reference< TypeManager > const & manager, OUString const & nucleus, sal_Int32 rank, std::vector< OUString > const & arguments) { - OUStringBuffer buf; + OUStringBuffer buf(256); appendUnoName(manager, nucleus, rank, arguments, &buf); return buf.makeStringAndClear(); } @@ -293,8 +293,8 @@ SpecialType getFieldDescriptor( PolymorphicUnoType * polymorphicUnoType) { assert(descriptor != nullptr); - OStringBuffer desc; - OStringBuffer sig; + OStringBuffer desc(64); + OStringBuffer sig(64); bool needsSig = false; SpecialType specialType = translateUnoTypeToDescriptor( manager, type, false, false, dependencies, &desc, &sig, &needsSig, @@ -331,9 +331,9 @@ public: private: rtl::Reference< TypeManager > m_manager; std::set<OUString> * m_dependencies; - OStringBuffer m_descriptorStart; + OStringBuffer m_descriptorStart{16*1024}; OString m_descriptorEnd; - OStringBuffer m_signatureStart; + OStringBuffer m_signatureStart{16*1024}; OString m_signatureEnd; bool m_needsSignature; }; @@ -347,9 +347,9 @@ MethodDescriptor::MethodDescriptor( assert(dependencies != nullptr); m_descriptorStart.append('('); m_signatureStart.append('('); - OStringBuffer descEnd; + OStringBuffer descEnd(128); descEnd.append(')'); - OStringBuffer sigEnd; + OStringBuffer sigEnd(128); sigEnd.append(')'); SpecialType special = translateUnoTypeToDescriptor( m_manager, returnType, false, false, m_dependencies, &descEnd, &sigEnd, @@ -896,7 +896,7 @@ sal_uInt16 addFieldInit( dynamic_cast< unoidl::EnumTypeEntity * >(ent.get())); assert(ent2.is()); code->loadLocalReference(0); - OStringBuffer descBuf; + OStringBuffer descBuf(128); translateUnoTypeToDescriptor( manager, sort, nucleus, 0, std::vector< OUString >(), false, false, dependencies, &descBuf, nullptr, nullptr, nullptr); @@ -917,7 +917,7 @@ sal_uInt16 addFieldInit( code->instrInvokespecial( codemaker::convertString(nucleus).replace('.', '/'), "<init>", "()V"); - OStringBuffer desc; + OStringBuffer desc(128); translateUnoTypeToDescriptor( manager, sort, nucleus, 0, args, false, false, dependencies, &desc, nullptr, nullptr, nullptr); @@ -947,13 +947,13 @@ sal_uInt16 addFieldInit( false)); } } else { - OStringBuffer desc; + OStringBuffer desc(128); translateUnoTypeToDescriptor( manager, sort, nucleus, rank - 1, std::vector< OUString >(), false, false, dependencies, &desc, nullptr, nullptr, nullptr); code->instrAnewarray(desc.makeStringAndClear()); } - OStringBuffer desc; + OStringBuffer desc(128); translateUnoTypeToDescriptor( manager, sort, nucleus, rank, std::vector< OUString >(), false, false, dependencies, &desc, nullptr, nullptr, nullptr); @@ -1440,7 +1440,8 @@ void handlePolyStructType( assert(entity.is()); OString className(codemaker::convertString(name).replace('.', '/')); std::map< OUString, sal_Int32 > typeParameters; - OStringBuffer sig("<"); + OStringBuffer sig(128); + sig.append("<"); sal_Int32 index = 0; for (const OUString& param : entity->getTypeParameters()) { diff --git a/comphelper/qa/unit/base64_test.cxx b/comphelper/qa/unit/base64_test.cxx index 60f6c68d5631..97f7b78aae7a 100644 --- a/comphelper/qa/unit/base64_test.cxx +++ b/comphelper/qa/unit/base64_test.cxx @@ -49,16 +49,18 @@ public: void Base64Test::testBase64Encode() { - OUStringBuffer aBuffer; + OUStringBuffer aBuffer(32); uno::Sequence<sal_Int8> inputSequence; inputSequence = { 0, 0, 0, 0, 0, 1, 2, 3 }; comphelper::Base64::encode(aBuffer, inputSequence); - CPPUNIT_ASSERT_EQUAL(OUString("AAAAAAABAgM="), aBuffer.makeStringAndClear()); + CPPUNIT_ASSERT_EQUAL(OUString("AAAAAAABAgM="), aBuffer.toString()); + aBuffer.setLength(0); inputSequence = { 5, 2, 3, 0, 0, 1, 2, 3 }; comphelper::Base64::encode(aBuffer, inputSequence); - CPPUNIT_ASSERT_EQUAL(OUString("BQIDAAABAgM="), aBuffer.makeStringAndClear()); + CPPUNIT_ASSERT_EQUAL(OUString("BQIDAAABAgM="), aBuffer.toString()); + aBuffer.setLength(0); inputSequence = { sal_Int8(sal_uInt8(200)), 31, 77, 111, 0, 1, 2, 3 }; comphelper::Base64::encode(aBuffer, inputSequence); @@ -84,16 +86,18 @@ void Base64Test::testBase64Decode() void Base64Test::testBase64EncodeForOStringBuffer() { - OStringBuffer aBuffer; + OStringBuffer aBuffer(32); uno::Sequence<sal_Int8> inputSequence; inputSequence = { 0, 0, 0, 0, 0, 1, 2, 3 }; comphelper::Base64::encode(aBuffer, inputSequence); - CPPUNIT_ASSERT_EQUAL(OString("AAAAAAABAgM="), aBuffer.makeStringAndClear()); + CPPUNIT_ASSERT_EQUAL(OString("AAAAAAABAgM="), aBuffer.toString()); + aBuffer.setLength(0); inputSequence = { 5, 2, 3, 0, 0, 1, 2, 3 }; comphelper::Base64::encode(aBuffer, inputSequence); - CPPUNIT_ASSERT_EQUAL(OString("BQIDAAABAgM="), aBuffer.makeStringAndClear()); + CPPUNIT_ASSERT_EQUAL(OString("BQIDAAABAgM="), aBuffer.toString()); + aBuffer.setLength(0); inputSequence = { sal_Int8(sal_uInt8(200)), 31, 77, 111, 0, 1, 2, 3 }; comphelper::Base64::encode(aBuffer, inputSequence); diff --git a/comphelper/source/misc/docpasswordhelper.cxx b/comphelper/source/misc/docpasswordhelper.cxx index cf665dd6c147..989863fefbc6 100644 --- a/comphelper/source/misc/docpasswordhelper.cxx +++ b/comphelper/source/misc/docpasswordhelper.cxx @@ -308,7 +308,7 @@ OUString DocPasswordHelper::GetOoxHashAsBase64( css::uno::Sequence<sal_Int8> aSeq( GetOoxHashAsSequence( rPassword, rSaltValue, nSpinCount, eIterCount, rAlgorithmName)); - OUStringBuffer aBuf; + OUStringBuffer aBuf((aSeq.getLength()+2)/3*4); comphelper::Base64::encode( aBuf, aSeq); return aBuf.makeStringAndClear(); } diff --git a/editeng/source/editeng/editdoc.cxx b/editeng/source/editeng/editdoc.cxx index 45c2cb163e06..ad71436ab89f 100644 --- a/editeng/source/editeng/editdoc.cxx +++ b/editeng/source/editeng/editdoc.cxx @@ -1629,7 +1629,7 @@ OUString ContentNode::GetExpandedText(sal_Int32 nStartPos, sal_Int32 nEndPos) co DBG_ASSERT( nStartPos <= nEndPos, "Start and End reversed?" ); sal_Int32 nIndex = nStartPos; - OUStringBuffer aStr; + OUStringBuffer aStr(256); const EditCharAttrib* pNextFeature = GetCharAttribs().FindFeature( nIndex ); while ( nIndex < nEndPos ) { diff --git a/editeng/source/editeng/impedit2.cxx b/editeng/source/editeng/impedit2.cxx index 5be0d3113ce5..c65dc164ea4a 100644 --- a/editeng/source/editeng/impedit2.cxx +++ b/editeng/source/editeng/impedit2.cxx @@ -287,7 +287,7 @@ OUString ImpEditEngine::GetSelected( const EditSelection& rSel ) const OSL_ENSURE( nStartNode <= nEndNode, "Selection not sorted ?" ); - OUStringBuffer aText; + OUStringBuffer aText(256); const OUString aSep = EditDoc::GetSepStr( LINEEND_LF ); // iterate over the paragraphs ... diff --git a/i18npool/qa/cppunit/test_breakiterator.cxx b/i18npool/qa/cppunit/test_breakiterator.cxx index 7daf9e98e573..a1d423879109 100644 --- a/i18npool/qa/cppunit/test_breakiterator.cxx +++ b/i18npool/qa/cppunit/test_breakiterator.cxx @@ -792,10 +792,10 @@ void TestBreakIterator::testWeak() for (sal_Int32 i = 0; i < aWeaks.getLength(); ++i) { sal_Int16 nScript = m_xBreak->getScriptType(aWeaks, i); - OStringBuffer aMsg; - aMsg.append("Char 0x"); - aMsg.append(static_cast<sal_Int32>(aWeaks[i]), 16); - aMsg.append(" should have been weak"); + OString aMsg = + "Char 0x" + + OString::number(static_cast<sal_Int32>(aWeaks[i]), 16) + + " should have been weak"; CPPUNIT_ASSERT_EQUAL_MESSAGE(aMsg.getStr(), i18n::ScriptType::WEAK, nScript); } @@ -831,10 +831,10 @@ void TestBreakIterator::testAsian() for (sal_Int32 i = 0; i < aAsians.getLength(); ++i) { sal_Int16 nScript = m_xBreak->getScriptType(aAsians, i); - OStringBuffer aMsg; - aMsg.append("Char 0x"); - aMsg.append(static_cast<sal_Int32>(aAsians[i]), 16); - aMsg.append(" should have been asian"); + OString aMsg = + "Char 0x" + + OString::number(static_cast<sal_Int32>(aAsians[i]), 16) + + " should have been asian"; CPPUNIT_ASSERT_EQUAL_MESSAGE(aMsg.getStr(), i18n::ScriptType::ASIAN, nScript); } diff --git a/i18npool/source/breakiterator/xdictionary.cxx b/i18npool/source/breakiterator/xdictionary.cxx index f21e377c68c0..b349066d06d7 100644 --- a/i18npool/source/breakiterator/xdictionary.cxx +++ b/i18npool/source/breakiterator/xdictionary.cxx @@ -165,13 +165,13 @@ void xdictionary::initDictionaryData(const sal_Char *pLang) aEntry.maLang = OString( pLang, strlen( pLang ) ); #ifdef SAL_DLLPREFIX - OUStringBuffer aBuf( sal::static_int_cast<int>(strlen(pLang) + 7 + 6) ); // mostly "lib*.so" (with * == dict_zh) - aBuf.append( SAL_DLLPREFIX ); + OString sModuleName = // mostly "lib*.so" (with * == dict_zh) + SAL_DLLPREFIX #else - OUStringBuffer aBuf( sal::static_int_cast<int>(strlen(pLang) + 7 + 4) ); // mostly "*.dll" (with * == dict_zh) + OString sModuleName = // mostly "*.dll" (with * == dict_zh) #endif - aBuf.append( "dict_" ).appendAscii( pLang ).append( SAL_DLLEXTENSION ); - aEntry.mhModule = osl_loadModuleRelative( &thisModule, aBuf.makeStringAndClear().pData, SAL_LOADMODULE_DEFAULT ); + "dict_" + rtl::OStringView(pLang) + SAL_DLLEXTENSION; + aEntry.mhModule = osl_loadModuleRelativeAscii( &thisModule, sModuleName.getStr(), SAL_LOADMODULE_DEFAULT ); if( aEntry.mhModule ) { oslGenericFunction func; func = osl_getAsciiFunctionSymbol( aEntry.mhModule, "getExistMark" ); diff --git a/i18npool/source/collator/gencoll_rule.cxx b/i18npool/source/collator/gencoll_rule.cxx index fb0349f19b84..33be2a5a2c56 100644 --- a/i18npool/source/collator/gencoll_rule.cxx +++ b/i18npool/source/collator/gencoll_rule.cxx @@ -88,8 +88,12 @@ SAL_IMPLEMENT_MAIN_WITH_ARGS(argc, argv) exit(1); } + fseek(fp, 0L, SEEK_END); + int fileSize = ftell(fp); + rewind(fp); + sal_Char str[1024]; - OUStringBuffer Obuf; + OUStringBuffer Obuf(fileSize); while (fgets(str, 1024, fp)) { // don't convert last new line character to Ostr. sal_Int32 len = strlen(str) - 1; diff --git a/i18npool/source/indexentry/genindex_data.cxx b/i18npool/source/indexentry/genindex_data.cxx index d5bad8b18def..128fad664bfb 100644 --- a/i18npool/source/indexentry/genindex_data.cxx +++ b/i18npool/source/indexentry/genindex_data.cxx @@ -49,7 +49,8 @@ SAL_IMPLEMENT_MAIN_WITH_ARGS(argc, argv) sal_Int32 address[MAX_ADDRESS]; for (i=0; i<MAX_ADDRESS; i++) address[i]=-1; OUString sep('|'); - OUStringBuffer result=sep; + OUStringBuffer result(64*1024); + result.append(sep); sal_Int32 max=0; sal_Char str[1024]; diff --git a/idlc/source/aststructinstance.cxx b/idlc/source/aststructinstance.cxx index e7723d19bd2d..878745793fd2 100644 --- a/idlc/source/aststructinstance.cxx +++ b/idlc/source/aststructinstance.cxx @@ -31,7 +31,8 @@ namespace { OString createName( AstType const * typeTemplate, DeclList const * typeArguments) { - OStringBuffer buf(typeTemplate->getScopedName()); + OStringBuffer buf(64); + buf.append(typeTemplate->getScopedName()); if (typeArguments != nullptr) { buf.append('<'); for (DeclList::const_iterator i(typeArguments->begin()); diff --git a/idlc/source/idlccompile.cxx b/idlc/source/idlccompile.cxx index 56dbfe4e77ec..8d3897890e0f 100644 --- a/idlc/source/idlccompile.cxx +++ b/idlc/source/idlccompile.cxx @@ -238,7 +238,6 @@ sal_Int32 compileFile(const OString * pathname) lCppArgs.emplace_back("-C"); lCppArgs.emplace_back("-zI"); - OStringBuffer cppArgs(256); Options* pOptions = idlc()->getOptions(); OString filePath; @@ -250,10 +249,9 @@ sal_Int32 compileFile(const OString * pathname) if ( !filePath.isEmpty() ) { - cppArgs.append("-I"); - cppArgs.append(filePath); + OString cppArgs = "-I" + filePath; lCppArgs.push_back(OStringToOUString( - cppArgs.makeStringAndClear().replace('\\', '/'), + cppArgs.replace('\\', '/'), RTL_TEXTENCODING_UTF8)); } } @@ -284,11 +282,9 @@ sal_Int32 compileFile(const OString * pathname) lCppArgs.emplace_back("-o"); - cppArgs.append(preprocFile); - lCppArgs.push_back(OStringToOUString(cppArgs.makeStringAndClear(), RTL_TEXTENCODING_UTF8)); + lCppArgs.push_back(OStringToOUString(preprocFile, RTL_TEXTENCODING_UTF8)); - cppArgs.append(tmpFile); - lCppArgs.push_back(OStringToOUString(cppArgs.makeStringAndClear(), RTL_TEXTENCODING_UTF8)); + lCppArgs.push_back(OStringToOUString(tmpFile, RTL_TEXTENCODING_UTF8)); OUString cpp; OUString startDir; diff --git a/idlc/source/idlcproduce.cxx b/idlc/source/idlcproduce.cxx index f87992d6b859..ff9ca2f2d47f 100644 --- a/idlc/source/idlcproduce.cxx +++ b/idlc/source/idlcproduce.cxx @@ -44,7 +44,7 @@ static std::list< OString >* pCreatedDirectories = nullptr; static bool checkOutputPath(const OString& completeName) { OString sysPathName = convertToAbsoluteSystemPath(completeName); - OStringBuffer buffer(sysPathName.getLength()); + OStringBuffer buffer(sysPathName.getLength()+16); if ( sysPathName.indexOf( SEPARATOR ) == -1 ) return true; diff --git a/include/comphelper/unwrapargs.hxx b/include/comphelper/unwrapargs.hxx index a7f7f0001898..77ef0ace16c1 100644 --- a/include/comphelper/unwrapargs.hxx +++ b/include/comphelper/unwrapargs.hxx @@ -79,13 +79,13 @@ namespace detail { } if( !fromAny( seq[nArg], &v ) ) { - OUStringBuffer buf; - buf.append( "Cannot extract ANY { " ); - buf.append( seq[nArg].getValueType().getTypeName() ); - buf.append( " } to " ); - buf.append( ::cppu::UnoType<T>::get().getTypeName() ); - buf.append( u'!' ); - return unwrapArgsError( buf.makeStringAndClear(), nArg, args... ); + OUString msg = + "Cannot extract ANY { " + + seq[nArg].getValueType().getTypeName() + + " } to " + + ::cppu::UnoType<T>::get().getTypeName() + + "!"; + return unwrapArgsError( msg, nArg, args... ); } return unwrapArgs( seq, ++nArg, args... ); } diff --git a/registry/source/keyimpl.cxx b/registry/source/keyimpl.cxx index d969cbaa32c5..d7baabe008da 100644 --- a/registry/source/keyimpl.cxx +++ b/registry/source/keyimpl.cxx @@ -970,7 +970,8 @@ OStoreDirectory ORegKey::getStoreDir() const OUString ORegKey::getFullPath(OUString const & path) const { OSL_ASSERT(!m_name.isEmpty() && !path.isEmpty()); - OUStringBuffer b(m_name); + OUStringBuffer b(32); + b.append(m_name); if (!b.isEmpty() && b[b.getLength() - 1] == '/') { if (path[0] == '/') { b.append(std::u16string_view(path).substr(1)); diff --git a/registry/source/regimpl.cxx b/registry/source/regimpl.cxx index ab7dcb09888e..43e12cb8f375 100644 --- a/registry/source/regimpl.cxx +++ b/registry/source/regimpl.cxx @@ -629,7 +629,7 @@ RegError ORegistry::createKey(RegKeyHandle hKey, const OUString& keyName, } OStoreDirectory rStoreDir; - OUStringBuffer sFullPath(sFullKeyName.getLength()); + OUStringBuffer sFullPath(sFullKeyName.getLength()+16); OUString token; sFullPath.append('/'); 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 ); diff --git a/tools/source/ref/globname.cxx b/tools/source/ref/globname.cxx index 6cbff020669c..eed9b8fd5a04 100644 --- a/tools/source/ref/globname.cxx +++ b/tools/source/ref/globname.cxx @@ -227,7 +227,7 @@ bool SvGlobalName::MakeId( const OUString & rIdStr ) OUString SvGlobalName::GetHexName() const { - OStringBuffer aHexBuffer; + OStringBuffer aHexBuffer(36); sal_Char buf[ 10 ]; sprintf( buf, "%8.8" SAL_PRIXUINT32, pImp->szData.Data1 ); diff --git a/xmloff/source/core/nmspmap.cxx b/xmloff/source/core/nmspmap.cxx index 44e619c0f348..7aa50542b5e8 100644 --- a/xmloff/source/core/nmspmap.cxx +++ b/xmloff/source/core/nmspmap.cxx @@ -235,9 +235,9 @@ OUString SvXMLNamespaceMap::GetQNameByKey( sal_uInt16 nKey, NameSpaceMap::const_iterator aIter = aNameMap.find ( nKey ); if ( aIter != aNameMap.end() ) { - OUStringBuffer sQName; // ...if it's in our map, make the prefix const OUString & prefix( (*aIter).second->sPrefix ); + OUStringBuffer sQName(prefix.getLength() + 1 + rLocalName.getLength()); if (!prefix.isEmpty()) // not default namespace { sQName.append( prefix ); |