diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2019-10-16 10:13:30 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2019-10-16 12:12:31 +0200 |
commit | 4a96fb8ec0130e1036913093836bcf28bc37a49b (patch) | |
tree | e7aad9be4ca417e9e64f688cc99bee0638037741 | |
parent | f33b6e341fb7dd1ab3acd4fe5457b716be316e89 (diff) |
loplugin:bufferadd loosen some constraints
and extend O*StringView to have a constructor that takes a pointer and a
length
Change-Id: I6120e96280f030757e855a6596efdae438b7e1e8
Reviewed-on: https://gerrit.libreoffice.org/80872
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
54 files changed, 269 insertions, 403 deletions
diff --git a/bridges/source/jni_uno/jni_data.cxx b/bridges/source/jni_uno/jni_data.cxx index feb9674563c5..daff48a48492 100644 --- a/bridges/source/jni_uno/jni_data.cxx +++ b/bridges/source/jni_uno/jni_data.cxx @@ -1786,11 +1786,7 @@ void Bridge::map_to_java( if (in_param) { // call static <enum_class>.fromInt( int ) - OStringBuffer sig_buf( 5 + class_name.getLength() ); - sig_buf.append( "(I)L" ); - sig_buf.append( class_name.replace( '.', '/' ) ); - sig_buf.append( ';' ); - OString sig( sig_buf.makeStringAndClear() ); + OString sig = "(I)L" + class_name.replace( '.', '/' ) + ";"; jmethodID method_id = jni->GetStaticMethodID( static_cast<jclass>(jo_enum_class.get()), "fromInt", sig.getStr() ); jni.ensure_no_exception(); @@ -2275,11 +2271,7 @@ void Bridge::map_to_java( if (0 < nElements) { // call static <enum_class>.fromInt( int ) - OStringBuffer sig_buf( 5 + class_name.getLength() ); - sig_buf.append( "(I)L" ); - sig_buf.append( class_name.replace( '.', '/' ) ); - sig_buf.append( ';' ); - OString sig( sig_buf.makeStringAndClear() ); + OString sig = "(I)L" + class_name.replace( '.', '/' ) + ";"; jmethodID method_id = jni->GetStaticMethodID( static_cast<jclass>(jo_enum_class.get()), "fromInt", sig.getStr() ); jni.ensure_no_exception(); diff --git a/compilerplugins/clang/bufferadd.cxx b/compilerplugins/clang/bufferadd.cxx index deb97bb35c11..a1c9738f0041 100644 --- a/compilerplugins/clang/bufferadd.cxx +++ b/compilerplugins/clang/bufferadd.cxx @@ -51,6 +51,8 @@ public: return false; if (loplugin::isSamePathname(fn, SRCDIR "/writerfilter/source/dmapper/GraphicImport.cxx")) return false; + if (loplugin::isSamePathname(fn, SRCDIR "/sdext/source/pdfimport/pdfparse/pdfparse.cxx")) + return false; return true; } @@ -174,14 +176,15 @@ void BufferAdd::findBufferAssignOrAdd(const Stmt* parentStmt, Stmt const* stmt) return; } auto tc2 = loplugin::TypeCheck(cxxConstructExpr->getArg(0)->getType()); - if (cxxConstructExpr->getArg(0)->getType()->isBuiltinType() - || tc2.LvalueReference().Class("OUStringBuffer") + if (tc2.LvalueReference().Class("OUStringBuffer") || tc2.LvalueReference().Class("OStringBuffer") || tc2.Class("OUStringBuffer") || tc2.Class("OStringBuffer")) { badMap.insert(varDeclLHS); return; } + addToGoodMap(varDeclLHS, parentStmt); + return; } if (!isSideEffectFree(varDeclLHS->getInit())) badMap.insert(varDeclLHS); @@ -289,32 +292,6 @@ bool BufferAdd::isMethodOkToMerge(CXXMemberCallExpr const* memberCall) return false; auto rhs = memberCall->getArg(0); - - if (loplugin::TypeCheck(memberCall->getType()) - .Class("OStringBuffer") - .Namespace("rtl") - .GlobalNamespace()) - { - // because we have no OStringLiteral1 - if (tc2.Char()) - return false; - // Can't see how to make the call to append(sal_Unicode*pStart, sal_Unicode*pEnd) work - if (memberCall->getNumArgs() == 2 && loplugin::TypeCheck(rhs->getType()).Pointer()) - return false; - } - if (loplugin::TypeCheck(memberCall->getType()) - .Class("OUStringBuffer") - .Namespace("rtl") - .GlobalNamespace()) - { - // character literals we do with OUStringBuffer, not variables of type sal_Unicode/char - if (tc2.Typedef("sal_Unicode").GlobalNamespace() && !isa<CharacterLiteral>(rhs)) - return false; - // Can't see how to make the call to append(sal_Unicode*pStart, sal_Unicode*pEnd) work - if (memberCall->getNumArgs() == 2 - && loplugin::TypeCheck(memberCall->getArg(0)->getType()).Pointer()) - return false; - } if (!isSideEffectFree(rhs)) return false; return true; @@ -357,7 +334,8 @@ bool BufferAdd::isSideEffectFree(Expr const* expr) if (calleeMethodDecl && calleeMethodDecl->getIdentifier()) { auto name = calleeMethodDecl->getName(); - if (name == "number" || name == "unacquired") + if (callExpr->getNumArgs() > 0 + && (name == "number" || name == "unacquired" || name == "boolean")) { auto tc = loplugin::TypeCheck(calleeMethodDecl->getParent()); if (tc.Class("OUString") || tc.Class("OString")) diff --git a/compilerplugins/clang/test/bufferadd.cxx b/compilerplugins/clang/test/bufferadd.cxx index 1b08dcacb1bf..7d8d9a693b9f 100644 --- a/compilerplugins/clang/test/bufferadd.cxx +++ b/compilerplugins/clang/test/bufferadd.cxx @@ -29,6 +29,23 @@ void f2() OUStringBuffer v; v.append("xxx").append("aaaa"); } +void f3(OString class_name) +{ + // expected-error@+1 {{convert this append sequence into a *String + sequence [loplugin:bufferadd]}} + OStringBuffer sig_buf(5 + class_name.getLength()); + sig_buf.append("(I)L"); + //sig_buf.append( class_name.replace( '.', '/' ) ); + sig_buf.append(';'); + OString sig(sig_buf.makeStringAndClear()); + (void)sig; +} +void f4(sal_Unicode const* pPathBegin) +{ + // expected-error@+1 {{convert this append sequence into a *String + sequence [loplugin:bufferadd]}} + OUStringBuffer v; + v.append(pPathBegin, 12); + v.append("aaaa"); +} } namespace test2 diff --git a/cui/source/customize/CustomNotebookbarGenerator.cxx b/cui/source/customize/CustomNotebookbarGenerator.cxx index a839667e7449..f19e4c9f3c06 100644 --- a/cui/source/customize/CustomNotebookbarGenerator.cxx +++ b/cui/source/customize/CustomNotebookbarGenerator.cxx @@ -260,9 +260,9 @@ void CustomNotebookbarGenerator::createCustomizedUIFile() Sequence<OUString> CustomNotebookbarGenerator::getCustomizedUIItem(OUString sNotebookbarConfigType) { - OUStringBuffer aPath = getAppNameRegistryPath(); - const utl::OConfigurationTreeRoot aAppNode(::comphelper::getProcessComponentContext(), - aPath.makeStringAndClear(), false); + OUString aPath = getAppNameRegistryPath(); + const utl::OConfigurationTreeRoot aAppNode(::comphelper::getProcessComponentContext(), aPath, + false); const utl::OConfigurationNode aModesNode = aAppNode.openNode("Modes"); const utl::OConfigurationNode aModeNode(aModesNode.openNode(sNotebookbarConfigType)); @@ -275,9 +275,9 @@ Sequence<OUString> CustomNotebookbarGenerator::getCustomizedUIItem(OUString sNot void CustomNotebookbarGenerator::setCustomizedUIItem(Sequence<OUString> sUIItemProperties, OUString sNotebookbarConfigType) { - OUStringBuffer aPath = getAppNameRegistryPath(); - const utl::OConfigurationTreeRoot aAppNode(::comphelper::getProcessComponentContext(), - aPath.makeStringAndClear(), true); + OUString aPath = getAppNameRegistryPath(); + const utl::OConfigurationTreeRoot aAppNode(::comphelper::getProcessComponentContext(), aPath, + true); const utl::OConfigurationNode aModesNode = aAppNode.openNode("Modes"); const utl::OConfigurationNode aModeNode(aModesNode.openNode(sNotebookbarConfigType)); diff --git a/dbaccess/source/ui/app/AppControllerDnD.cxx b/dbaccess/source/ui/app/AppControllerDnD.cxx index 8e285146644c..ae1d4725c205 100644 --- a/dbaccess/source/ui/app/AppControllerDnD.cxx +++ b/dbaccess/source/ui/app/AppControllerDnD.cxx @@ -241,10 +241,9 @@ void OApplicationController::deleteObjects( ElementType _eType, const std::vecto // which may also be a part of the list // #i33353# OSL_ENSURE( aThisRound->getLength() - 1 >= 0, "OApplicationController::deleteObjects: empty name?" ); - OUStringBuffer sSmallestSiblingName( *aThisRound ); - sSmallestSiblingName.append( sal_Unicode( '/' + 1) ); + OUString sSmallestSiblingName = *aThisRound + OUStringLiteral1( sal_Unicode( '/' + 1) ); - std::set< OUString >::const_iterator aUpperChildrenBound = aDeleteNames.lower_bound( sSmallestSiblingName.makeStringAndClear() ); + std::set< OUString >::const_iterator aUpperChildrenBound = aDeleteNames.lower_bound( sSmallestSiblingName ); for ( std::set< OUString >::const_iterator aObsolete = aThisRound; aObsolete != aUpperChildrenBound; ) diff --git a/desktop/source/deployment/manager/dp_activepackages.cxx b/desktop/source/deployment/manager/dp_activepackages.cxx index f520e3301ea0..ab2cbf0d4a9f 100644 --- a/desktop/source/deployment/manager/dp_activepackages.cxx +++ b/desktop/source/deployment/manager/dp_activepackages.cxx @@ -47,18 +47,14 @@ namespace { -static char const separator = static_cast< char >( - static_cast< unsigned char >(0xFF)); +constexpr const char separator[] = "\xff"; OString oldKey(OUString const & fileName) { return OUStringToOString(fileName, RTL_TEXTENCODING_UTF8); } OString newKey(OUString const & id) { - OStringBuffer b; - b.append(separator); - b.append(OUStringToOString(id, RTL_TEXTENCODING_UTF8)); - return b.makeStringAndClear(); + return separator + OUStringToOString(id, RTL_TEXTENCODING_UTF8); } ::dp_manager::ActivePackages::Data decodeOldData( @@ -168,7 +164,7 @@ ActivePackages::Entries ActivePackages::getEntries() const { ::dp_misc::t_string2string_map m(m_map.getEntries()); for (auto const& elem : m) { - if (!elem.first.isEmpty() && elem.first[0] == separator) { + if (!elem.first.isEmpty() && elem.first[0] == separator[0]) { es.emplace_back( OUString( elem.first.getStr() + 1, elem.first.getLength() - 1, @@ -190,18 +186,17 @@ ActivePackages::Entries ActivePackages::getEntries() const { void ActivePackages::put(OUString const & id, Data const & data) { #if HAVE_FEATURE_EXTENSIONS - OStringBuffer b; - b.append( - OUStringToOString(data.temporaryName, RTL_TEXTENCODING_UTF8)); - b.append(separator); - b.append(OUStringToOString(data.fileName, RTL_TEXTENCODING_UTF8)); - b.append(separator); - b.append(OUStringToOString(data.mediaType, RTL_TEXTENCODING_UTF8)); - b.append(separator); - b.append(OUStringToOString(data.version, RTL_TEXTENCODING_UTF8)); - b.append(separator); - b.append(OUStringToOString(data.failedPrerequisites, RTL_TEXTENCODING_UTF8)); - m_map.put(newKey(id), b.makeStringAndClear()); + OString b = + OUStringToOString(data.temporaryName, RTL_TEXTENCODING_UTF8) + + separator + + OUStringToOString(data.fileName, RTL_TEXTENCODING_UTF8) + + separator + + OUStringToOString(data.mediaType, RTL_TEXTENCODING_UTF8) + + separator + + OUStringToOString(data.version, RTL_TEXTENCODING_UTF8) + + separator + + OUStringToOString(data.failedPrerequisites, RTL_TEXTENCODING_UTF8); + m_map.put(newKey(id), b); #else (void) id; (void) data; diff --git a/desktop/source/deployment/registry/component/dp_component.cxx b/desktop/source/deployment/registry/component/dp_component.cxx index 42de7f9dd042..54ac54daa987 100644 --- a/desktop/source/deployment/registry/component/dp_component.cxx +++ b/desktop/source/deployment/registry/component/dp_component.cxx @@ -916,14 +916,13 @@ void BackendImpl::unorc_flush( Reference<XCommandEnvironment> const & xCmdEnv ) space = true; // write native rc: - OStringBuffer buf2; - buf2.append("ORIGIN="); - buf2.append(osOrigin); - buf2.append(LF); - buf2.append( "UNO_SERVICES=?$ORIGIN/" ); - buf2.append( OUStringToOString( - sNativeRDB, RTL_TEXTENCODING_ASCII_US ) ); - buf2.append(LF); + OString buf2 = + "ORIGIN=" + + osOrigin + + OString(LF) + + "UNO_SERVICES=?$ORIGIN/" + + OUStringToOString( sNativeRDB, RTL_TEXTENCODING_ASCII_US ) + + OString(LF); const Reference<io::XInputStream> xData( ::xmlscript::createInputStream( diff --git a/desktop/source/deployment/registry/dp_backenddb.cxx b/desktop/source/deployment/registry/dp_backenddb.cxx index 606479447c2a..6361742576b1 100644 --- a/desktop/source/deployment/registry/dp_backenddb.cxx +++ b/desktop/source/deployment/registry/dp_backenddb.cxx @@ -156,15 +156,15 @@ void BackendDb::removeEntry(OUString const & url) { const OUString sKeyElement = getKeyElementName(); const OUString sPrefix = getNSPrefix(); - OUStringBuffer sExpression(500); - sExpression.append(sPrefix); - sExpression.append(":"); - sExpression.append(sKeyElement); - sExpression.append("[@url = \""); - sExpression.append(url); - sExpression.append("\"]"); - - removeElement(sExpression.makeStringAndClear()); + OUString sExpression = + sPrefix + + ":" + + sKeyElement + + "[@url = \"" + + url + + "\"]"; + + removeElement(sExpression); } void BackendDb::revokeEntry(OUString const & url) @@ -242,18 +242,18 @@ Reference<css::xml::dom::XNode> BackendDb::getKeyElement( { const OUString sPrefix = getNSPrefix(); const OUString sKeyElement = getKeyElementName(); - OUStringBuffer sExpression(500); - sExpression.append(sPrefix); - sExpression.append(":"); - sExpression.append(sKeyElement); - sExpression.append("[@url = \""); - sExpression.append(url); - sExpression.append("\"]"); + OUString sExpression = + sPrefix + + ":" + + sKeyElement + + "[@url = \"" + + url + + "\"]"; const Reference<css::xml::dom::XDocument> doc = getDocument(); const Reference<css::xml::dom::XNode> root = doc->getFirstChild(); const Reference<css::xml::xpath::XXPathAPI> xpathApi = getXPathAPI(); - return xpathApi->selectSingleNode(root, sExpression.makeStringAndClear()); + return xpathApi->selectSingleNode(root, sExpression); } catch(const css::uno::Exception &) { @@ -575,18 +575,18 @@ std::vector<OUString> BackendDb::getOneChildFromAllEntries( Reference<css::xml::xpath::XXPathAPI> xpathApi = getXPathAPI(); const OUString sPrefix = getNSPrefix(); const OUString sKeyElement = getKeyElementName(); - OUStringBuffer buf(512); - buf.append(sPrefix); - buf.append(":"); - buf.append(sKeyElement); - buf.append("/"); - buf.append(sPrefix); - buf.append(":"); - buf.append(name); - buf.append("/text()"); + OUString sNodeSelectExpr = + sPrefix + + ":" + + sKeyElement + + "/" + + sPrefix + + ":" + + name + + "/text()"; Reference<css::xml::dom::XNodeList> nodes = - xpathApi->selectNodeList(root, buf.makeStringAndClear()); + xpathApi->selectNodeList(root, sNodeSelectExpr); if (nodes.is()) { sal_Int32 length = nodes->getLength(); diff --git a/desktop/source/splash/splash.cxx b/desktop/source/splash/splash.cxx index b5b3568e12e3..c34673f3e881 100644 --- a/desktop/source/splash/splash.cxx +++ b/desktop/source/splash/splash.cxx @@ -477,16 +477,13 @@ void SplashScreen::SetScreenBitmap(BitmapEx &rBitmap) // create file name from screen resolution information OStringBuffer aStrBuf( 128 ); - OStringBuffer aResBuf( 32 ); aStrBuf.append( "intro_" ); if ( !_sAppName.isEmpty() ) { aStrBuf.append( OUStringToOString(_sAppName, RTL_TEXTENCODING_UTF8) ); aStrBuf.append( "_" ); } - aResBuf.append( OString::number( nWidth )); - aResBuf.append( "x" ); - aResBuf.append( OString::number( nHeight )); + OString aResBuf = OString::number( nWidth ) + "x" + OString::number( nHeight ); aStrBuf.append( aResBuf.getStr() ); if (Application::LoadBrandBitmap (aStrBuf.makeStringAndClear().getStr(), rBitmap)) @@ -494,7 +491,7 @@ void SplashScreen::SetScreenBitmap(BitmapEx &rBitmap) aStrBuf.append( "intro_" ); aStrBuf.append( aResBuf.getStr() ); - if (Application::LoadBrandBitmap (aResBuf.makeStringAndClear().getStr(), rBitmap)) + if (Application::LoadBrandBitmap (aResBuf.getStr(), rBitmap)) return; (void)Application::LoadBrandBitmap ("intro", rBitmap); diff --git a/editeng/source/items/bulitem.cxx b/editeng/source/items/bulitem.cxx index 46f6271f2c33..97b9b5370064 100644 --- a/editeng/source/items/bulitem.cxx +++ b/editeng/source/items/bulitem.cxx @@ -122,10 +122,7 @@ bool SvxBulletItem::operator==( const SfxPoolItem& rItem ) const OUString SvxBulletItem::GetFullText() const { - OUStringBuffer aStr(aPrevText); - aStr.append(cSymbol); - aStr.append(aFollowText); - return aStr.makeStringAndClear(); + return aPrevText + OUStringLiteral1(cSymbol) + aFollowText; } diff --git a/framework/source/jobs/helponstartup.cxx b/framework/source/jobs/helponstartup.cxx index 69dc69eacc0d..4233c502d57f 100644 --- a/framework/source/jobs/helponstartup.cxx +++ b/framework/source/jobs/helponstartup.cxx @@ -334,14 +334,7 @@ OUString HelpOnStartup::ist_createHelpURL(const OUString& sBaseURL, const OUString& sLocale , const OUString& sSystem ) { - OUStringBuffer sHelpURL(256); - sHelpURL.append (sBaseURL ); - sHelpURL.append("?Language="); - sHelpURL.append (sLocale ); - sHelpURL.append("&System=" ); - sHelpURL.append (sSystem ); - - return sHelpURL.makeStringAndClear(); + return sBaseURL + "?Language=" + sLocale + "&System=" + sSystem; } } // namespace framework diff --git a/framework/source/layoutmanager/toolbarlayoutmanager.cxx b/framework/source/layoutmanager/toolbarlayoutmanager.cxx index d0bbafde032c..e5484c7ed4c7 100644 --- a/framework/source/layoutmanager/toolbarlayoutmanager.cxx +++ b/framework/source/layoutmanager/toolbarlayoutmanager.cxx @@ -974,11 +974,9 @@ void ToolbarLayoutManager::childWindowEvent( VclSimpleEvent const * pEvent ) OUString aToolbarName = retrieveToolbarNameFromHelpURL( pToolBox ); if ( !aToolbarName.isEmpty() ) { - OUStringBuffer aBuf(100); - aBuf.append( "private:resource/toolbar/" ); - aBuf.append( aToolbarName ); + OUString aToolbarUrl = "private:resource/toolbar/" + aToolbarName; - UIElement aToolbar = implts_findToolbar( aBuf.makeStringAndClear() ); + UIElement aToolbar = implts_findToolbar( aToolbarUrl ); if ( aToolbar.m_xUIElement.is() && !aToolbar.m_bFloating ) { implts_setLayoutDirty(); diff --git a/framework/source/services/desktop.cxx b/framework/source/services/desktop.cxx index 1a1352bcf526..c2cf82709ad1 100644 --- a/framework/source/services/desktop.cxx +++ b/framework/source/services/desktop.cxx @@ -116,14 +116,12 @@ void Desktop::constructorInit() InterceptionHelper* pInterceptionHelper = new InterceptionHelper( this, xDispatchProvider ); m_xDispatchHelper.set( static_cast< ::cppu::OWeakObject* >(pInterceptionHelper), css::uno::UNO_QUERY ); - OUStringBuffer sUntitledPrefix (256); - sUntitledPrefix.append (FwkResId(STR_UNTITLED_DOCUMENT)); - sUntitledPrefix.append (" "); + OUString sUntitledPrefix = FwkResId(STR_UNTITLED_DOCUMENT) + " "; ::comphelper::NumberedCollection* pNumbers = new ::comphelper::NumberedCollection (); m_xTitleNumberGenerator.set(static_cast< ::cppu::OWeakObject* >(pNumbers), css::uno::UNO_QUERY_THROW); pNumbers->setOwner ( static_cast< ::cppu::OWeakObject* >(this) ); - pNumbers->setUntitledPrefix ( sUntitledPrefix.makeStringAndClear () ); + pNumbers->setUntitledPrefix ( sUntitledPrefix ); // Safe impossible cases // We can't work without this helper! diff --git a/i18npool/source/breakiterator/breakiteratorImpl.cxx b/i18npool/source/breakiterator/breakiteratorImpl.cxx index 41ef28fe0162..30a2d9105459 100644 --- a/i18npool/source/breakiterator/breakiteratorImpl.cxx +++ b/i18npool/source/breakiterator/breakiteratorImpl.cxx @@ -581,27 +581,26 @@ BreakIteratorImpl::getLocaleSpecificBreakIterator(const Locale& rLocale) return xBI = listItem.xBI; } - sal_Unicode under = '_'; + OUStringLiteral under("_"); sal_Int32 l = rLocale.Language.getLength(); sal_Int32 c = rLocale.Country.getLength(); sal_Int32 v = rLocale.Variant.getLength(); - OUStringBuffer aBuf(l+c+v+3); if ((l > 0 && c > 0 && v > 0 && // load service with name <base>_<lang>_<country>_<variant> - createLocaleSpecificBreakIterator(aBuf.append(rLocale.Language).append(under).append( - rLocale.Country).append(under).append(rLocale.Variant).makeStringAndClear())) || + createLocaleSpecificBreakIterator(rLocale.Language + under + + rLocale.Country + under + rLocale.Variant)) || (l > 0 && c > 0 && // load service with name <base>_<lang>_<country> - createLocaleSpecificBreakIterator(aBuf.append(rLocale.Language).append(under).append( - rLocale.Country).makeStringAndClear())) || + createLocaleSpecificBreakIterator(rLocale.Language + under + + rLocale.Country)) || (l > 0 && c > 0 && rLocale.Language == "zh" && (rLocale.Country == "HK" || rLocale.Country == "MO" ) && // if the country code is HK or MO, one more step to try TW. - createLocaleSpecificBreakIterator(aBuf.append(rLocale.Language).append(under).append( - "TW").makeStringAndClear())) || + createLocaleSpecificBreakIterator(rLocale.Language + under + + "TW")) || (l > 0 && // load service with name <base>_<lang> createLocaleSpecificBreakIterator(rLocale.Language)) || diff --git a/i18npool/source/breakiterator/breakiterator_unicode.cxx b/i18npool/source/breakiterator/breakiterator_unicode.cxx index 6312d1feecd5..fee0b19dae38 100644 --- a/i18npool/source/breakiterator/breakiterator_unicode.cxx +++ b/i18npool/source/breakiterator/breakiterator_unicode.cxx @@ -195,10 +195,7 @@ void BreakIterator_Unicode::loadICUBreakIterator(const css::lang::Locale& rLocal } status = U_ZERO_ERROR; - OStringBuffer aUDName(64); - aUDName.append(rule); - aUDName.append('_'); - aUDName.append( aLanguage); + OString aUDName = rtl::OStringView(rule) + "_" + aLanguage; UDataMemory* pUData = udata_open("OpenOffice", "brk", aUDName.getStr(), &status); if( U_SUCCESS(status) ) rbi.reset(new OOoRuleBasedBreakIterator( pUData, status)); diff --git a/include/rtl/stringconcat.hxx b/include/rtl/stringconcat.hxx index c075a29d9c80..96b018d23d7a 100644 --- a/include/rtl/stringconcat.hxx +++ b/include/rtl/stringconcat.hxx @@ -497,6 +497,7 @@ struct ToStringHelper< OUStringNumber< T > > class OStringView { public: explicit OStringView(char const * s): view_(s) {} + explicit OStringView(char const * s, size_t len): view_(s, len) {} std::size_t length() const { return view_.length(); } @@ -518,6 +519,7 @@ struct ToStringHelper< OStringView > class OUStringView { public: explicit OUStringView(sal_Unicode const * s): view_(s) {} + explicit OUStringView(sal_Unicode const * s, size_t len): view_(s, len) {} std::size_t length() const { return view_.length(); } diff --git a/sc/source/core/tool/addincol.cxx b/sc/source/core/tool/addincol.cxx index 59a7cb6bb648..56e2c421d8c8 100644 --- a/sc/source/core/tool/addincol.cxx +++ b/sc/source/core/tool/addincol.cxx @@ -389,11 +389,7 @@ void ScUnoAddInCollection::ReadConfiguration() ppFuncData[nFuncPos+nOld] = nullptr; // stored function name: (service name).(function) - OUStringBuffer aFuncNameBuffer( aServiceName.getLength()+1+pFuncNameArray[nFuncPos].getLength()); - aFuncNameBuffer.append(aServiceName); - aFuncNameBuffer.append('.'); - aFuncNameBuffer.append(pFuncNameArray[nFuncPos]); - OUString aFuncName = aFuncNameBuffer.makeStringAndClear(); + OUString aFuncName = aServiceName + "." + pFuncNameArray[nFuncPos]; // skip the function if already known (read from old AddIn service) @@ -786,11 +782,7 @@ void ScUnoAddInCollection::ReadFromAddIn( const uno::Reference<uno::XInterface>& OUString aFuncU = xFunc->getName(); // stored function name: (service name).(function) - OUStringBuffer aFuncNameBuffer( aServiceName.getLength()+1+aFuncU.getLength()); - aFuncNameBuffer.append(aServiceName); - aFuncNameBuffer.append('.'); - aFuncNameBuffer.append(aFuncU); - OUString aFuncName = aFuncNameBuffer.makeStringAndClear(); + OUString aFuncName = aServiceName + "." + aFuncU; bool bValid = true; long nVisibleCount = 0; @@ -988,11 +980,7 @@ void ScUnoAddInCollection::UpdateFromAddIn( const uno::Reference<uno::XInterface OUString aFuncU = xFunc->getName(); // stored function name: (service name).(function) - OUStringBuffer aFuncNameBuffer( rServiceName.getLength()+1+aFuncU.getLength()); - aFuncNameBuffer.append(rServiceName); - aFuncNameBuffer.append('.'); - aFuncNameBuffer.append(aFuncU); - OUString aFuncName = aFuncNameBuffer.makeStringAndClear(); + OUString aFuncName = rServiceName + "." + aFuncU; // internal names are skipped because no FuncData exists ScUnoAddInFuncData* pOldData = const_cast<ScUnoAddInFuncData*>( GetFuncData( aFuncName ) ); diff --git a/sc/source/core/tool/interpr1.cxx b/sc/source/core/tool/interpr1.cxx index df8821b84531..1c0e0237ad53 100644 --- a/sc/source/core/tool/interpr1.cxx +++ b/sc/source/core/tool/interpr1.cxx @@ -9144,7 +9144,7 @@ void ScInterpreter::ScFindB() else { // create a string from sStr starting at nStart - OUStringBuffer aBuf( lcl_RightB( aStr, nLen - nStart + 1 ) ); + OUString aBuf = lcl_RightB( aStr, nLen - nStart + 1 ); // search aBuf for asStr sal_Int32 nPos = aBuf.indexOf( asStr, 0 ); if ( nPos == -1 ) @@ -9152,7 +9152,7 @@ void ScInterpreter::ScFindB() else { // obtain byte value of nPos - int nBytePos = lcl_getLengthB( aBuf.makeStringAndClear(), nPos ); + int nBytePos = lcl_getLengthB( aBuf, nPos ); PushDouble( nBytePos + nStart ); } } diff --git a/sc/source/core/tool/unitconv.cxx b/sc/source/core/tool/unitconv.cxx index 354c1ca5ab36..9451db9c1809 100644 --- a/sc/source/core/tool/unitconv.cxx +++ b/sc/source/core/tool/unitconv.cxx @@ -37,10 +37,7 @@ ScUnitConverterData::ScUnitConverterData( OUString ScUnitConverterData::BuildIndexString( const OUString& rFromUnit, const OUString& rToUnit ) { - OUStringBuffer aBuf(rFromUnit); - aBuf.append(cDelim); - aBuf.append(rToUnit); - return aBuf.makeStringAndClear(); + return rFromUnit + OUStringLiteral1(cDelim) + rToUnit; } // ScUnitConverter diff --git a/sc/source/filter/excel/xehelper.cxx b/sc/source/filter/excel/xehelper.cxx index aeffdfa0b4c2..a6e41f742ed8 100644 --- a/sc/source/filter/excel/xehelper.cxx +++ b/sc/source/filter/excel/xehelper.cxx @@ -975,9 +975,7 @@ OUString XclExpUrlHelper::EncodeUrl( const XclExpRoot& rRoot, const OUString& rA OUString XclExpUrlHelper::EncodeDde( const OUString& rApplic, const OUString& rTopic ) { - OUStringBuffer aBuf; - aBuf.append(rApplic).append(EXC_DDE_DELIM).append(rTopic); - return aBuf.makeStringAndClear(); + return rApplic + OUStringLiteral1(EXC_DDE_DELIM) + rTopic; } // Cached Value Lists ========================================================= diff --git a/sc/source/filter/html/htmlexp.cxx b/sc/source/filter/html/htmlexp.cxx index 646b3d281c47..f40bea0967b7 100644 --- a/sc/source/filter/html/htmlexp.cxx +++ b/sc/source/filter/html/htmlexp.cxx @@ -1064,10 +1064,9 @@ void ScHTMLExport::WriteCell( sc::ColumnBlockPosition& rBlockPos, SCCOL nCol, SC if (pNote) { //create the comment indicator - OStringBuffer aStr(OOO_STRING_SVTOOLS_HTML_anchor); - aStr.append(' ').append(OOO_STRING_SVTOOLS_HTML_O_class) - .append("=\"").append("comment-indicator").append("\""); - TAG_ON(aStr.makeStringAndClear().getStr()); + OString aStr = OOO_STRING_SVTOOLS_HTML_anchor " " + OOO_STRING_SVTOOLS_HTML_O_class "=\"comment-indicator\""; + TAG_ON(aStr.getStr()); TAG_OFF(OOO_STRING_SVTOOLS_HTML_anchor); OUT_LF(); diff --git a/sc/source/ui/view/viewutil.cxx b/sc/source/ui/view/viewutil.cxx index ee13c2628c8b..2cbc0ec22ffe 100644 --- a/sc/source/ui/view/viewutil.cxx +++ b/sc/source/ui/view/viewutil.cxx @@ -148,13 +148,9 @@ bool ScViewUtil::IsActionShown( const ScChangeAction& rAction, if ( rSettings.HasComment() ) { - OUStringBuffer aBuf(rAction.GetComment()); - aBuf.append(" ("); OUString aTmp; rAction.GetDescription(aTmp, &rDocument); - aBuf.append(aTmp); - aBuf.append(')'); - OUString aComStr = aBuf.makeStringAndClear(); + OUString aComStr = rAction.GetComment() + " (" + aTmp + ")"; if(!rSettings.IsValidComment(&aComStr)) return false; diff --git a/sd/source/ui/unoidl/UnoDocumentSettings.cxx b/sd/source/ui/unoidl/UnoDocumentSettings.cxx index 666122868a57..b765dc59a0dc 100644 --- a/sd/source/ui/unoidl/UnoDocumentSettings.cxx +++ b/sd/source/ui/unoidl/UnoDocumentSettings.cxx @@ -362,9 +362,9 @@ uno::Sequence<beans::PropertyValue> { // Such specific path construction is grim. - OUStringBuffer aName( getNameOfType( t ) ); + OUString aName( getNameOfType( t ) ); OUString aResult; - if( pList->SaveTo( xSubStorage, aName.makeStringAndClear(), &aResult ) ) + if( pList->SaveTo( xSubStorage, aName, &aResult ) ) { OUString aRealPath = "Settings/" + aResult; aRet[i].Value <<= aRealPath; diff --git a/sdext/source/pdfimport/misc/pdfihelper.cxx b/sdext/source/pdfimport/misc/pdfihelper.cxx index 2936a62965d8..3c6c85538158 100644 --- a/sdext/source/pdfimport/misc/pdfihelper.cxx +++ b/sdext/source/pdfimport/misc/pdfihelper.cxx @@ -101,10 +101,7 @@ OUString pdfi::getColorString( const rendering::ARGBColor& rCol ) OUString pdfi::getPercentString(double value) { - OUStringBuffer buf(32); - buf.append(value); - buf.append("%"); - return buf.makeStringAndClear(); + return OUString::number(value) + "%"; } OUString pdfi::unitMMString( double fMM ) diff --git a/sdext/source/pdfimport/pdfparse/pdfentries.cxx b/sdext/source/pdfimport/pdfparse/pdfentries.cxx index 92cb45ab5a12..e57cf3f701b7 100644 --- a/sdext/source/pdfimport/pdfparse/pdfentries.cxx +++ b/sdext/source/pdfimport/pdfparse/pdfentries.cxx @@ -428,12 +428,12 @@ PDFObjectRef::~PDFObjectRef() bool PDFObjectRef::emit( EmitContext& rWriteContext ) const { - OStringBuffer aBuf( 16 ); - aBuf.append( ' ' ); - aBuf.append( sal_Int32( m_nNumber ) ); - aBuf.append( ' ' ); - aBuf.append( sal_Int32( m_nGeneration ) ); - aBuf.append( " R" ); + OString aBuf = + " " + + OString::number( sal_Int32( m_nNumber ) ) + + " " + + OString::number( sal_Int32( m_nGeneration ) ) + + " R"; return rWriteContext.write( aBuf.getStr(), aBuf.getLength() ); } @@ -806,11 +806,11 @@ bool PDFObject::emit( EmitContext& rWriteContext ) const if( pEData ) pEData->insertXref( m_nNumber, m_nGeneration, rWriteContext.getCurPos() ); - OStringBuffer aBuf( 32 ); - aBuf.append( sal_Int32( m_nNumber ) ); - aBuf.append( ' ' ); - aBuf.append( sal_Int32( m_nGeneration ) ); - aBuf.append( " obj\n" ); + OString aBuf = + OString::number( sal_Int32( m_nNumber ) ) + + " " + + OString::number( sal_Int32( m_nGeneration ) ) + + " obj\n"; if( ! rWriteContext.write( aBuf.getStr(), aBuf.getLength() ) ) return false; @@ -1426,12 +1426,12 @@ bool PDFFile::emit( EmitContext& rWriteContext ) const { setEmitData( rWriteContext, new EmitImplData( this ) ); - OStringBuffer aBuf( 32 ); - aBuf.append( "%PDF-" ); - aBuf.append( sal_Int32( m_nMajor ) ); - aBuf.append( '.' ); - aBuf.append( sal_Int32( m_nMinor ) ); - aBuf.append( "\n" ); + OString aBuf = + "%PDF-" + + OString::number( sal_Int32( m_nMajor ) ) + + "." + + OString::number( sal_Int32( m_nMinor ) ) + + "\n"; if( ! rWriteContext.write( aBuf.getStr(), aBuf.getLength() ) ) return false; return emitSubElements( rWriteContext ); diff --git a/sdext/source/pdfimport/sax/emitcontext.cxx b/sdext/source/pdfimport/sax/emitcontext.cxx index 4b1f7de41172..48c91811f23d 100644 --- a/sdext/source/pdfimport/sax/emitcontext.cxx +++ b/sdext/source/pdfimport/sax/emitcontext.cxx @@ -60,10 +60,7 @@ SaxEmitter::SaxEmitter( const uno::Reference< xml::sax::XDocumentHandler >& xDoc OUString aStr( OStringToOUString( pDir, RTL_TEXTENCODING_UTF8 ) ); OUString aFileURL; osl_getFileURLFromSystemPath( aStr.pData, &aFileURL.pData ); - OUStringBuffer aBuf( 256 ); - aBuf.append( aFileURL ); - aBuf.append( "/pdfimport.xml" ); - pStream = new osl::File( aBuf.makeStringAndClear() ); + pStream = new osl::File( aFileURL + "/pdfimport.xml" ); if( pStream->open( osl_File_OpenFlag_Write | osl_File_OpenFlag_Create ) ) { pStream->open( osl_File_OpenFlag_Write ); @@ -168,10 +165,7 @@ void SaxEmitter::endTag( const char* pTag ) for( int i = 0; i < nIndent; i++ ) pStream->write( " ", 4, nWritten ); - OStringBuffer aBuf( 1024 ); - aBuf.append( "</" ); - aBuf.append( pTag ); - aBuf.append( ">\n" ); + OString aBuf = "</" + rtl::OStringView(pTag) + ">\n"; pStream->write( aBuf.getStr(), aBuf.getLength(), nWritten ); nIndent--; #endif diff --git a/sdext/source/pdfimport/tree/drawtreevisiting.cxx b/sdext/source/pdfimport/tree/drawtreevisiting.cxx index 3985d07fdeb8..f4376d41af25 100644 --- a/sdext/source/pdfimport/tree/drawtreevisiting.cxx +++ b/sdext/source/pdfimport/tree/drawtreevisiting.cxx @@ -813,10 +813,7 @@ void DrawXmlFinalizer::visit( HyperlinkElement&, const std::list< std::unique_pt static void SetFontsizeProperties(PropertyMap& props, double fontSize) { - OUStringBuffer aBuf(32); - aBuf.append(fontSize * 72 / PDFI_OUTDEV_RESOLUTION); - aBuf.append("pt"); - OUString aFSize = aBuf.makeStringAndClear(); + OUString aFSize = OUString::number(fontSize * 72 / PDFI_OUTDEV_RESOLUTION) + "pt"; props["fo:font-size"] = aFSize; props["style:font-size-asian"] = aFSize; props["style:font-size-complex"] = aFSize; diff --git a/sdext/source/pdfimport/tree/writertreevisiting.cxx b/sdext/source/pdfimport/tree/writertreevisiting.cxx index dd30b0f91c61..00cbad2ac47c 100644 --- a/sdext/source/pdfimport/tree/writertreevisiting.cxx +++ b/sdext/source/pdfimport/tree/writertreevisiting.cxx @@ -925,10 +925,7 @@ void WriterXmlFinalizer::visit( TextElement& elem, const std::list< std::unique_ aFontProps[ "style:text-outline" ] = "true"; } // size - OUStringBuffer aBuf( 32 ); - aBuf.append( rFont.size*72/PDFI_OUTDEV_RESOLUTION ); - aBuf.append( "pt" ); - OUString aFSize = aBuf.makeStringAndClear(); + OUString aFSize = OUString::number( rFont.size*72/PDFI_OUTDEV_RESOLUTION ) + "pt"; aFontProps[ "fo:font-size" ] = aFSize; aFontProps[ "style:font-size-asian" ] = aFSize; aFontProps[ "style:font-size-complex" ] = aFSize; diff --git a/sfx2/source/appl/appuno.cxx b/sfx2/source/appl/appuno.cxx index d5e315147957..e947abd17d61 100644 --- a/sfx2/source/appl/appuno.cxx +++ b/sfx2/source/appl/appuno.cxx @@ -257,8 +257,7 @@ void TransformParameters( sal_uInt16 nSlotId, const uno::Sequence<beans::Propert for ( nSub=0; nSub<nSubCount; nSub++ ) { // search sub item by name - OStringBuffer aStr; - aStr.append(pSlot->pUnoName).append('.').append(pType->aAttrib[nSub].pName); + OString aStr = rtl::OStringView(pSlot->pUnoName) + "." + pType->aAttrib[nSub].pName; if ( rPropValue.Name.equalsAsciiL(aStr.getStr(), aStr.getLength()) ) { sal_uInt8 nSubId = static_cast<sal_uInt8>(static_cast<sal_Int8>(pType->aAttrib[nSub].nAID)); @@ -364,8 +363,7 @@ void TransformParameters( sal_uInt16 nSlotId, const uno::Sequence<beans::Propert for ( sal_uInt16 nSub=0; nSub<nSubCount; nSub++ ) { // search sub item by name - OStringBuffer aStr; - aStr.append(rArg.pName).append('.').append(pType->aAttrib[nSub].pName); + OString aStr = rtl::OStringView(rArg.pName) + "." + pType->aAttrib[nSub].pName; if ( rProp.Name.equalsAsciiL(aStr.getStr(), aStr.getLength()) ) { // at least one member found ... diff --git a/sfx2/source/bastyp/frmhtmlw.cxx b/sfx2/source/bastyp/frmhtmlw.cxx index b36539f3a8c3..09dcd0cfe85c 100644 --- a/sfx2/source/bastyp/frmhtmlw.cxx +++ b/sfx2/source/bastyp/frmhtmlw.cxx @@ -120,10 +120,9 @@ void SfxFrameHTMLWriter::Out_DocInfo( SvStream& rStrm, const OUString& rBaseURL, if( pIndent ) rStrm.WriteCharPtr( pIndent ); - OStringBuffer sOut; - sOut.append('<').append(OOO_STRING_SVTOOLS_HTML_base).append(' ') - .append(OOO_STRING_SVTOOLS_HTML_O_target).append("=\""); - rStrm.WriteOString( sOut.makeStringAndClear() ); + OString sOut = "<" OOO_STRING_SVTOOLS_HTML_base " " + OOO_STRING_SVTOOLS_HTML_O_target "=\""; + rStrm.WriteOString( sOut ); HTMLOutFuncs::Out_String( rStrm, rTarget, eDestEnc, pNonConvertableChars ) .WriteCharPtr( "\">" ); } diff --git a/sfx2/source/dialog/filedlghelper.cxx b/sfx2/source/dialog/filedlghelper.cxx index 958ff03dc230..ea3d7a821cec 100644 --- a/sfx2/source/dialog/filedlghelper.cxx +++ b/sfx2/source/dialog/filedlghelper.cxx @@ -1780,19 +1780,19 @@ void FileDialogHelper_Impl::addFilters( const OUString& rFactory, m_nDontFlags |= nDont; // create the list of filters - OUStringBuffer sQuery(256); - sQuery.append("getSortedFilterList()"); - sQuery.append(":module="); - sQuery.append(rFactory); // use long name here ! - sQuery.append(":iflags="); - sQuery.append(OUString::number(static_cast<sal_Int32>(m_nMustFlags))); - sQuery.append(":eflags="); - sQuery.append(OUString::number(static_cast<sal_Int32>(m_nDontFlags))); + OUString sQuery = + "getSortedFilterList()" + ":module=" + + rFactory + // use long name here ! + ":iflags=" + + OUString::number(static_cast<sal_Int32>(m_nMustFlags)) + + ":eflags=" + + OUString::number(static_cast<sal_Int32>(m_nDontFlags)); uno::Reference< XEnumeration > xResult; try { - xResult = xFilterCont->createSubSetEnumerationByQuery(sQuery.makeStringAndClear()); + xResult = xFilterCont->createSubSetEnumerationByQuery(sQuery); } catch( const uno::Exception& ) { diff --git a/sfx2/source/view/classificationhelper.cxx b/sfx2/source/view/classificationhelper.cxx index 23e737900614..57c6a50df38f 100644 --- a/sfx2/source/view/classificationhelper.cxx +++ b/sfx2/source/view/classificationhelper.cxx @@ -441,8 +441,7 @@ void SfxClassificationHelper::Impl::setStartValidity(SfxClassificationPolicyType { // The policy left the start date unchanged, replace it with the system time. util::DateTime aDateTime = DateTime(DateTime::SYSTEM).GetUNODateTime(); - OUStringBuffer aBuffer = utl::toISO8601(aDateTime); - it->second = aBuffer.toString(); + it->second = utl::toISO8601(aDateTime); } } } diff --git a/stoc/source/security/file_policy.cxx b/stoc/source/security/file_policy.cxx index 9d8edc2bf102..08d97cfdbf44 100644 --- a/stoc/source/security/file_policy.cxx +++ b/stoc/source/security/file_policy.cxx @@ -172,11 +172,8 @@ void PolicyReader::assureToken( sal_Unicode token ) sal_Unicode c = get(); if (c == token) return; - OUStringBuffer buf( 16 ); - buf.append( "expected >" ); - buf.append( c ); - buf.append( "<!" ); - error( buf.makeStringAndClear() ); + OUString msg = "expected >" + OUStringLiteral1(c) + "<!"; + error( msg ); } OUString PolicyReader::assureQuotedToken() diff --git a/stoc/source/security/permissions.cxx b/stoc/source/security/permissions.cxx index ab70ac1e051b..9568602c1fb4 100644 --- a/stoc/source/security/permissions.cxx +++ b/stoc/source/security/permissions.cxx @@ -435,11 +435,8 @@ bool RuntimePermission::implies( Permission const & perm ) const OUString RuntimePermission::toString() const { - OUStringBuffer buf( 48 ); - buf.append( "com.sun.star.security.RuntimePermission (name=\"" ); - buf.append( m_name ); - buf.append( "\")" ); - return buf.makeStringAndClear(); + return "com.sun.star.security.RuntimePermission (name=\"" + + m_name + "\")"; } diff --git a/svtools/source/svhtml/htmlout.cxx b/svtools/source/svhtml/htmlout.cxx index 2a69acfbf725..841ff9f1f65c 100644 --- a/svtools/source/svhtml/htmlout.cxx +++ b/svtools/source/svhtml/htmlout.cxx @@ -923,9 +923,8 @@ SvStream& HTMLOutFuncs::Out_Events( SvStream& rStrm, if( pStr ) { - OStringBuffer sOut; - sOut.append(' ').append(pStr).append("=\""); - rStrm.WriteOString( sOut.makeStringAndClear() ); + OString sOut = " " + rtl::OStringView(pStr) + "=\""; + rStrm.WriteOString( sOut ); Out_String( rStrm, pMacro->GetMacName(), eDestEnc, pNonConvertableChars ).WriteChar( '\"' ); } diff --git a/sw/source/filter/html/htmlbas.cxx b/sw/source/filter/html/htmlbas.cxx index aaa7dbbbaa89..7be428fe3957 100644 --- a/sw/source/filter/html/htmlbas.cxx +++ b/sw/source/filter/html/htmlbas.cxx @@ -278,14 +278,14 @@ void SwHTMLWriter::OutBasic() { bFirst = false; OutNewLine(); - OStringBuffer sOut; - sOut.append('<').append(OOO_STRING_SVTOOLS_HTML_meta) - .append(' ').append(OOO_STRING_SVTOOLS_HTML_O_httpequiv) - .append("=\"") - .append(OOO_STRING_SVTOOLS_HTML_META_content_script_type) - .append("\" ").append(OOO_STRING_SVTOOLS_HTML_O_content) - .append("=\"text/x-"); - Strm().WriteOString( sOut.makeStringAndClear() ); + OString sOut = + "<" OOO_STRING_SVTOOLS_HTML_meta + " " OOO_STRING_SVTOOLS_HTML_O_httpequiv + "=\"" + OOO_STRING_SVTOOLS_HTML_META_content_script_type + "\" " OOO_STRING_SVTOOLS_HTML_O_content + "=\"text/x-"; + Strm().WriteOString( sOut ); // Entities aren't welcome here Strm().WriteOString( OUStringToOString(sLang, m_eDestEnc) ) .WriteCharPtr( "\">" ); diff --git a/sw/source/filter/html/htmlfldw.cxx b/sw/source/filter/html/htmlfldw.cxx index 0a581c6e06e9..2f153fdd3b79 100644 --- a/sw/source/filter/html/htmlfldw.cxx +++ b/sw/source/filter/html/htmlfldw.cxx @@ -509,12 +509,13 @@ Writer& OutHTML_SwFormatField( Writer& rWrt, const SfxPoolItem& rHt ) if( !bWritten ) { OUString sComment(convertLineEnd(rComment, GetSystemLineEnd())); - OStringBuffer sOut; // TODO: ??? - sOut.append('<').append(OOO_STRING_SVTOOLS_HTML_comment) - .append(' ').append(OUStringToOString(sComment, - static_cast<SwHTMLWriter&>(rWrt).m_eDestEnc)).append(" -->"); - rWrt.Strm().WriteOString( sOut.makeStringAndClear() ); + OString sOut = + "<" OOO_STRING_SVTOOLS_HTML_comment + " " + + OUStringToOString(sComment, static_cast<SwHTMLWriter&>(rWrt).m_eDestEnc) + + " -->"; + rWrt.Strm().WriteOString( sOut ); } } else if( SwFieldIds::Script == pFieldTyp->Which() ) diff --git a/sw/source/filter/html/htmlflywriter.cxx b/sw/source/filter/html/htmlflywriter.cxx index 8f2465c06871..09d9593a5f12 100644 --- a/sw/source/filter/html/htmlflywriter.cxx +++ b/sw/source/filter/html/htmlflywriter.cxx @@ -1660,11 +1660,11 @@ static Writer& OutHTML_FrameFormatAsSpacer( Writer& rWrt, const SwFrameFormat& r if( rHTMLWrt.m_bLFPossible ) rHTMLWrt.OutNewLine( true ); - OStringBuffer sOut; - sOut.append('<').append(OOO_STRING_SVTOOLS_HTML_spacer).append(' ') - .append(OOO_STRING_SVTOOLS_HTML_O_type).append("=\"") - .append(OOO_STRING_SVTOOLS_HTML_SPTYPE_block).append("\""); - rWrt.Strm().WriteOString( sOut.makeStringAndClear() ); + OString sOut = + "<" OOO_STRING_SVTOOLS_HTML_spacer " " + OOO_STRING_SVTOOLS_HTML_O_type "=\"" + OOO_STRING_SVTOOLS_HTML_SPTYPE_block "\""; + rWrt.Strm().WriteOString( sOut ); // ALIGN, WIDTH, HEIGHT OString aEndTags = rHTMLWrt.OutFrameFormatOptions(rFrameFormat, OUString(), HTML_FRMOPTS_SPACER); diff --git a/sw/source/filter/html/htmlftn.cxx b/sw/source/filter/html/htmlftn.cxx index 85b5ffcb057e..f0f2f6c5ac0f 100644 --- a/sw/source/filter/html/htmlftn.cxx +++ b/sw/source/filter/html/htmlftn.cxx @@ -333,10 +333,10 @@ void SwHTMLWriter::OutFootEndNotes() if( m_bLFPossible ) OutNewLine(); - OStringBuffer sOut; - sOut.append('<').append(OOO_STRING_SVTOOLS_HTML_division) - .append(' ').append(OOO_STRING_SVTOOLS_HTML_O_id).append("=\""); - Strm().WriteOString( sOut.makeStringAndClear() ); + OString sOut = + "<" OOO_STRING_SVTOOLS_HTML_division + " " OOO_STRING_SVTOOLS_HTML_O_id "=\""; + Strm().WriteOString( sOut ); HTMLOutFuncs::Out_String( Strm(), sFootnoteName, m_eDestEnc, &m_aNonConvertableCharacters ); Strm().WriteCharPtr( "\">" ); @@ -510,11 +510,11 @@ static void lcl_html_outFootEndNoteInfo( Writer& rWrt, OUString const *pParts, } rHTMLWrt.OutNewLine(); - OStringBuffer sOut; - sOut.append('<').append(OOO_STRING_SVTOOLS_HTML_meta).append(' ') - .append(OOO_STRING_SVTOOLS_HTML_O_name).append("=\"").append(pName) - .append("\" ").append(OOO_STRING_SVTOOLS_HTML_O_content).append("=\""); - rWrt.Strm().WriteOString( sOut.makeStringAndClear() ); + OString sOut = + "<" OOO_STRING_SVTOOLS_HTML_meta " " + OOO_STRING_SVTOOLS_HTML_O_name "=\"" + rtl::OStringView(pName) + + "\" " OOO_STRING_SVTOOLS_HTML_O_content "=\""; + rWrt.Strm().WriteOString( sOut ); HTMLOutFuncs::Out_String( rWrt.Strm(), aContent.makeStringAndClear(), rHTMLWrt.m_eDestEnc, &rHTMLWrt.m_aNonConvertableCharacters ); rWrt.Strm().WriteCharPtr( "\">" ); } diff --git a/sw/source/filter/html/htmltabw.cxx b/sw/source/filter/html/htmltabw.cxx index da33a4bbb6eb..c0ce2183f00a 100644 --- a/sw/source/filter/html/htmltabw.cxx +++ b/sw/source/filter/html/htmltabw.cxx @@ -1063,9 +1063,9 @@ Writer& OutHTML_SwTableNode( Writer& rWrt, SwTableNode & rNode, HTMLOutFuncs::Out_AsciiTag( rWrt.Strm(), rHTMLWrt.GetNamespace() + OOO_STRING_SVTOOLS_HTML_center ); else { - OStringBuffer sOut(OOO_STRING_SVTOOLS_HTML_division); - sOut.append(' ').append(OOO_STRING_SVTOOLS_HTML_O_align).append("=\"") - .append(OOO_STRING_SVTOOLS_HTML_AL_right).append("\""); + OString sOut = OOO_STRING_SVTOOLS_HTML_division + " " OOO_STRING_SVTOOLS_HTML_O_align "=\"" + OOO_STRING_SVTOOLS_HTML_AL_right "\""; HTMLOutFuncs::Out_AsciiTag( rWrt.Strm(), rHTMLWrt.GetNamespace() + sOut.getStr() ); } rHTMLWrt.IncIndentLevel(); // indent content of <CENTER> diff --git a/sw/source/filter/html/wrthtml.cxx b/sw/source/filter/html/wrthtml.cxx index 2ccdcc932ab9..9fc8d8298dd5 100644 --- a/sw/source/filter/html/wrthtml.cxx +++ b/sw/source/filter/html/wrthtml.cxx @@ -410,12 +410,11 @@ ErrCode SwHTMLWriter::WriteStream() pSNd->GetSection().GetSectionName(), m_eDestEnc, &m_aNonConvertableCharacters ); - OStringBuffer sOut; - sOut.append('<').append(OOO_STRING_SVTOOLS_HTML_division) - .append(' ').append(OOO_STRING_SVTOOLS_HTML_O_id) - .append("=\"").append(aName).append('\"').append('>') - .append(aStartTags); - aStartTags = sOut.makeStringAndClear(); + aStartTags = + "<" OOO_STRING_SVTOOLS_HTML_division + " " OOO_STRING_SVTOOLS_HTML_O_id + "=\"" + aName + "\">" + + aStartTags; } // FindSectionNode() on a SectionNode return the same! pSNd = pSNd->StartOfSectionNode()->FindSectionNode(); @@ -1261,9 +1260,9 @@ void SwHTMLWriter::OutBackground( const SvxBrushItem *pBrushItem, bool bGraphic /// only checking, if transparency is not set. if( rBackColor != COL_TRANSPARENT ) { - OStringBuffer sOut; - sOut.append(' ').append(OOO_STRING_SVTOOLS_HTML_O_bgcolor).append('='); - Strm().WriteOString( sOut.makeStringAndClear() ); + OString sOut = + " " OOO_STRING_SVTOOLS_HTML_O_bgcolor "="; + Strm().WriteOString( sOut ); HTMLOutFuncs::Out_Color( Strm(), rBackColor); } @@ -1375,10 +1374,10 @@ void SwHTMLWriter::OutDirection( SvxFrameDirection nDir ) OString sConverted = convertDirection(nDir); if (!sConverted.isEmpty()) { - OStringBuffer sOut; - sOut.append(' ').append(OOO_STRING_SVTOOLS_HTML_O_dir) - .append("=\"").append(sConverted).append('\"'); - Strm().WriteOString( sOut.makeStringAndClear() ); + OString sOut = + " " OOO_STRING_SVTOOLS_HTML_O_dir + "=\"" + sConverted + "\""; + Strm().WriteOString( sOut ); } } diff --git a/sw/source/uibase/app/applab.cxx b/sw/source/uibase/app/applab.cxx index da1e18009143..d59ad9cd171e 100644 --- a/sw/source/uibase/app/applab.cxx +++ b/sw/source/uibase/app/applab.cxx @@ -340,11 +340,11 @@ void SwModule::InsertLab(SfxRequest& rReq, bool bLabel) { SwSectionData aSect(FILE_LINK_SECTION, pSh->GetUniqueSectionName()); - OUStringBuffer sLinkName; - sLinkName.append(sfx2::cTokenSeparator); - sLinkName.append(sfx2::cTokenSeparator); - sLinkName.append(MASTER_LABEL); - aSect.SetLinkFileName(sLinkName.makeStringAndClear()); + OUString sLinkName = + OUStringLiteral1(sfx2::cTokenSeparator) + + OUStringLiteral1(sfx2::cTokenSeparator) + + MASTER_LABEL; + aSect.SetLinkFileName(sLinkName); aSect.SetProtectFlag(true); pSh->Insert("."); // Dummytext to allocate the Section pSh->StartOfSection(); diff --git a/tools/source/fsys/urlobj.cxx b/tools/source/fsys/urlobj.cxx index 37f3791a4d30..91fe51a9e283 100644 --- a/tools/source/fsys/urlobj.cxx +++ b/tools/source/fsys/urlobj.cxx @@ -4193,12 +4193,11 @@ bool INetURLObject::removeExtension(sal_Int32 nIndex, bool bIgnoreFinalSlash) if (!pExtension) return true; - OUStringBuffer aNewPath; - aNewPath.append(pPathBegin, pExtension - pPathBegin); - aNewPath.append(p, pPathEnd - p); + OUString aNewPath = + rtl::OUStringView(pPathBegin, pExtension - pPathBegin) + + rtl::OUStringView(p, pPathEnd - p); - return setPath(aNewPath.makeStringAndClear(), EncodeMechanism::NotCanonical, - RTL_TEXTENCODING_UTF8); + return setPath(aNewPath, EncodeMechanism::NotCanonical, RTL_TEXTENCODING_UTF8); } bool INetURLObject::hasFinalSlash() const @@ -4223,12 +4222,9 @@ bool INetURLObject::setFinalSlash() if (pPathEnd > pPathBegin && pPathEnd[-1] == '/') return true; - OUStringBuffer aNewPath; - aNewPath.append(pPathBegin, pPathEnd - pPathBegin); - aNewPath.append('/'); + OUString aNewPath = rtl::OUStringView(pPathBegin, pPathEnd - pPathBegin) + "/"; - return setPath(aNewPath.makeStringAndClear(), EncodeMechanism::NotCanonical, - RTL_TEXTENCODING_UTF8); + return setPath(aNewPath, EncodeMechanism::NotCanonical, RTL_TEXTENCODING_UTF8); } bool INetURLObject::removeFinalSlash() diff --git a/vcl/source/gdi/pdfwriter_impl.cxx b/vcl/source/gdi/pdfwriter_impl.cxx index 47d90025172a..b2c885086ead 100644 --- a/vcl/source/gdi/pdfwriter_impl.cxx +++ b/vcl/source/gdi/pdfwriter_impl.cxx @@ -367,11 +367,7 @@ void PDFWriterImpl::createWidgetFieldName( sal_Int32 i_nWidgetIndex, const PDFWr if( nLastTokenIndex > 0 ) { aDomain = aFullName.copy( 0, nLastTokenIndex-1 ); - OStringBuffer aBuf( aDomain.getLength() + 1 + aPartialName.getLength() ); - aBuf.append( aDomain ); - aBuf.append( '.' ); - aBuf.append( aPartialName ); - aFullName = aBuf.makeStringAndClear(); + aFullName = aDomain + "." + aPartialName; } else aFullName = aPartialName; @@ -1666,10 +1662,7 @@ void PDFWriterImpl::appendLiteralStringEncrypt( const OUString& rInString, const void PDFWriterImpl::emitComment( const char* pComment ) { - OStringBuffer aLine( 64 ); - aLine.append( "% " ); - aLine.append( pComment ); - aLine.append( "\n" ); + OString aLine = "% " + rtl::OStringView(pComment) + "\n"; writeBuffer( aLine.getStr(), aLine.getLength() ); } @@ -2016,23 +2009,22 @@ OString PDFWriterImpl::emitStructureAttributes( PDFStructureElement& i_rEle ) if( nLink >= 0 && nLink < static_cast<sal_Int32>(m_aLinks.size()) ) { // update struct parent of link - OStringBuffer aStructParentEntry( 32 ); - aStructParentEntry.append( i_rEle.m_nObject ); - aStructParentEntry.append( " 0 R" ); - m_aStructParentTree.push_back( aStructParentEntry.makeStringAndClear() ); + OString aStructParentEntry = + OString::number( i_rEle.m_nObject ) + + " 0 R"; + m_aStructParentTree.push_back( aStructParentEntry ); m_aLinks[ nLink ].m_nStructParent = m_aStructParentTree.size()-1; sal_Int32 nRefObject = createObject(); - OStringBuffer aRef( 256 ); - aRef.append( nRefObject ); - aRef.append( " 0 obj\n" - "<</Type/OBJR/Obj " ); - aRef.append( m_aLinks[ nLink ].m_nObject ); - aRef.append( " 0 R>>\n" - "endobj\n\n" - ); if (updateObject(nRefObject)) { + OString aRef = + OString::number( nRefObject ) + + " 0 obj\n" + "<</Type/OBJR/Obj " + + OString::number( m_aLinks[ nLink ].m_nObject ) + + " 0 R>>\n" + "endobj\n\n"; writeBuffer( aRef.getStr(), aRef.getLength() ); } @@ -3806,8 +3798,7 @@ void PDFWriterImpl::createDefaultEditAppearance( PDFWidget& rEdit, const PDFWrit relies on /NeedAppearances in the AcroForm dictionary set to "true" */ beginRedirect( pEditStream, rEdit.m_aRect ); - OStringBuffer aAppearance( 32 ); - aAppearance.append( "/Tx BMC\nEMC\n" ); + OString aAppearance = "/Tx BMC\nEMC\n"; writeBuffer( aAppearance.getStr(), aAppearance.getLength() ); endRedirect(); @@ -3830,14 +3821,13 @@ void PDFWriterImpl::createDefaultListBoxAppearance( PDFWidget& rBox, const PDFWr sal_Int32 nBest = getSystemFont( aFont ); beginRedirect( pListBoxStream, rBox.m_aRect ); - OStringBuffer aAppearance( 64 ); setLineColor( COL_TRANSPARENT ); setFillColor( replaceColor( rWidget.BackgroundColor, rSettings.GetFieldColor() ) ); drawRectangle( rBox.m_aRect ); // empty appearance, see createDefaultEditAppearance for reference - aAppearance.append( "/Tx BMC\nEMC\n" ); + OString aAppearance = "/Tx BMC\nEMC\n"; writeBuffer( aAppearance.getStr(), aAppearance.getLength() ); endRedirect(); @@ -4940,9 +4930,7 @@ bool PDFWriterImpl::finalizeSignature() // 2- overwrite the value to the m_nSignatureLastByteRangeNoOffset position sal_uInt64 nWritten = 0; CHECK_RETURN( (osl::File::E_None == m_aFile.setPos(osl_Pos_Absolut, m_nSignatureLastByteRangeNoOffset) ) ); - OStringBuffer aByteRangeNo( 256 ); - aByteRangeNo.append( nLastByteRangeNo ); - aByteRangeNo.append( " ]" ); + OString aByteRangeNo = OString::number( nLastByteRangeNo ) + " ]"; if (m_aFile.write(aByteRangeNo.getStr(), aByteRangeNo.getLength(), nWritten) != osl::File::E_None) { @@ -7423,13 +7411,13 @@ void PDFWriterImpl::drawTransparent( const tools::PolyPolygon& rPolyPoly, sal_uI aObjName.append( m_aTransparentObjects.back().m_nExtGStateObject ); OString aExtName( aObjName.makeStringAndClear() ); - OStringBuffer aLine( 80 ); + OString aLine = // insert XObject - aLine.append( "q /" ); - aLine.append( aExtName ); - aLine.append( " gs /" ); - aLine.append( aTrName ); - aLine.append( " Do Q\n" ); + "q /" + + aExtName + + " gs /" + + aTrName + + " Do Q\n"; writeBuffer( aLine.getStr(), aLine.getLength() ); pushResource( ResXObject, aTrName, m_aTransparentObjects.back().m_nObject ); @@ -7556,13 +7544,13 @@ void PDFWriterImpl::endTransparencyGroup( const tools::Rectangle& rBoundingBox, aObjName.append( m_aTransparentObjects.back().m_nExtGStateObject ); OString aExtName( aObjName.makeStringAndClear() ); - OStringBuffer aLine( 80 ); + OString aLine = // insert XObject - aLine.append( "q /" ); - aLine.append( aExtName ); - aLine.append( " gs /" ); - aLine.append( aTrName ); - aLine.append( " Do Q\n" ); + "q /" + + aExtName + + " gs /" + + aTrName + + " Do Q\n"; writeBuffer( aLine.getStr(), aLine.getLength() ); pushResource( ResXObject, aTrName, m_aTransparentObjects.back().m_nObject ); @@ -9443,10 +9431,8 @@ void PDFWriterImpl::drawJPGBitmap( SvStream& rDCTData, bool bIsTrueColor, const } writeBuffer( aLine.getStr(), aLine.getLength() ); - OStringBuffer aObjName( 16 ); - aObjName.append( "Im" ); - aObjName.append(nObject); - pushResource( ResXObject, aObjName.makeStringAndClear(), nObject ); + OString aObjName = "Im" + OString::number(nObject); + pushResource( ResXObject, aObjName, nObject ); } @@ -9521,11 +9507,9 @@ const PDFWriterImpl::BitmapEmit& PDFWriterImpl::createBitmapEmit( const BitmapEx it = m_aBitmaps.begin(); } - OStringBuffer aObjName( 16 ); - aObjName.append( "Im" ); sal_Int32 nObject = it->m_aReferenceXObject.getObject(); - aObjName.append(nObject); - pushResource( ResXObject, aObjName.makeStringAndClear(), nObject ); + OString aObjName = "Im" + OString::number(nObject); + pushResource( ResXObject, aObjName, nObject ); return *it; } @@ -9727,10 +9711,7 @@ void PDFWriterImpl::drawWallpaper( const tools::Rectangle& rRect, const Wallpape tools::Rectangle aConvertRect( aBmpPos, aBmpSize ); m_aPages.back().convertRect( aConvertRect ); - OStringBuffer aNameBuf(16); - aNameBuf.append( "Im" ); - aNameBuf.append( rEmit.m_nObject ); - OString aImageName( aNameBuf.makeStringAndClear() ); + OString aImageName = "Im" + OString::number( rEmit.m_nObject ); // push the pattern OStringBuffer aTilingStream( 32 ); @@ -10345,8 +10326,7 @@ void PDFWriterImpl::beginStructureElementMCSeq() ! m_aStructure[ m_nCurrentStructElement ].m_bOpenMCSeq // already opened sequence ) { - OStringBuffer aLine( 128 ); - aLine.append( "/Artifact BMC\n" ); + OString aLine = "/Artifact BMC\n"; writeBuffer( aLine.getStr(), aLine.getLength() ); // mark element MC sequence as open m_aStructure[ m_nCurrentStructElement ].m_bOpenMCSeq = true; diff --git a/vcl/unx/generic/print/printerjob.cxx b/vcl/unx/generic/print/printerjob.cxx index 73dedc5a2415..7d805ef942e5 100644 --- a/vcl/unx/generic/print/printerjob.cxx +++ b/vcl/unx/generic/print/printerjob.cxx @@ -211,18 +211,14 @@ createSpoolDir () do { - OUStringBuffer aDir( aTmpDir.getLength() + 16 ); - aDir.append( aTmpDir ); - aDir.append( "/psp" ); - aDir.append(nRand); - OUString aResult = aDir.makeStringAndClear(); - if( osl::Directory::create( aResult ) == osl::FileBase::E_None ) + OUString aDir = aTmpDir + "/psp" + OUString::number(nRand); + if( osl::Directory::create( aDir ) == osl::FileBase::E_None ) { - osl::File::setAttributes( aResult, + osl::File::setAttributes( aDir, osl_File_Attribute_OwnWrite | osl_File_Attribute_OwnRead | osl_File_Attribute_OwnExe ); - return aResult; + return aDir; } nRand++; } while( nRand ); diff --git a/vcl/unx/generic/printer/cpdmgr.cxx b/vcl/unx/generic/printer/cpdmgr.cxx index 5a2e1b01d271..cae2a4e1ab03 100644 --- a/vcl/unx/generic/printer/cpdmgr.cxx +++ b/vcl/unx/generic/printer/cpdmgr.cxx @@ -206,9 +206,6 @@ void CPDManager::addNewPrinter(const OUString& aPrinterName, const OUString& aUn rtl_TextEncoding aEncoding = osl_getThreadTextEncoding(); aPrinter.m_aInfo.m_aComment = OStringToOUString(pDest->info, aEncoding); aPrinter.m_aInfo.m_aLocation = OStringToOUString(pDest->location, aEncoding); - OUStringBuffer aBuf( 256 ); - aBuf.append( "CPD:" ); - aBuf.append( aUniqueName ); // note: the parser that goes with the PrinterInfo // is created implicitly by the JobData::operator=() // when it detects the NULL ptr m_pParser. @@ -225,7 +222,7 @@ void CPDManager::addNewPrinter(const OUString& aPrinterName, const OUString& aUn aPrinter.m_aInfo.m_aContext = c_it->second; } aPrinter.m_aInfo.setDefaultBackend(true); - aPrinter.m_aInfo.m_aDriverName = aBuf.makeStringAndClear(); + aPrinter.m_aInfo.m_aDriverName = "CPD:" + aUniqueName; m_aPrinters[ aUniqueName ] = aPrinter; } #endif diff --git a/vcl/unx/generic/printer/cupsmgr.cxx b/vcl/unx/generic/printer/cupsmgr.cxx index a6d1ccbad7bb..12482b2ba878 100644 --- a/vcl/unx/generic/printer/cupsmgr.cxx +++ b/vcl/unx/generic/printer/cupsmgr.cxx @@ -312,11 +312,8 @@ void CUPSManager::initialize() OUString aPrinterName = OStringToOUString( pDest->name, aEncoding ); if( pDest->instance && *pDest->instance ) { - OUStringBuffer aBuf( 256 ); - aBuf.append( aPrinterName ); - aBuf.append( '/' ); - aBuf.append( OStringToOUString( pDest->instance, aEncoding ) ); - aPrinterName = aBuf.makeStringAndClear(); + aPrinterName += "/" + + OStringToOUString( pDest->instance, aEncoding ); } // initialize printer with possible configuration from psprint.conf @@ -338,9 +335,6 @@ void CUPSManager::initialize() aPrinter.m_aInfo.m_aAuthInfoRequired=OStringToOUString(pDest->options[k].value, aEncoding); } - OUStringBuffer aBuf( 256 ); - aBuf.append( "CUPS:" ); - aBuf.append( aPrinterName ); // note: the parser that goes with the PrinterInfo // is created implicitly by the JobData::operator=() // when it detects the NULL ptr m_pParser. @@ -357,7 +351,7 @@ void CUPSManager::initialize() aPrinter.m_aInfo.m_aContext = c_it->second; } aPrinter.m_aInfo.setDefaultBackend(bUsePDF); - aPrinter.m_aInfo.m_aDriverName = aBuf.makeStringAndClear(); + aPrinter.m_aInfo.m_aDriverName = "CUPS:" + aPrinterName; m_aPrinters[ aPrinter.m_aInfo.m_aPrinterName ] = aPrinter; m_aCUPSDestMap[ aPrinter.m_aInfo.m_aPrinterName ] = nPrinter; diff --git a/vcl/unx/generic/printer/ppdparser.cxx b/vcl/unx/generic/printer/ppdparser.cxx index 0d520e09d219..880a7d958000 100644 --- a/vcl/unx/generic/printer/ppdparser.cxx +++ b/vcl/unx/generic/printer/ppdparser.cxx @@ -620,10 +620,10 @@ PPDParser::PPDParser(const OUString& rFile, const std::vector<PPDKey*>& keys) pwg_media_t *pPWGMedia = pwgMediaForPWG(o.pData->buffer); if (pPWGMedia != nullptr) { OUStringBuffer aBuf( 256 ); - aBuf.append( "0 0 " ); - aBuf.append( PWG_TO_POINTS(pPWGMedia -> width) ); - aBuf.append( " " ); - aBuf.append( PWG_TO_POINTS(pPWGMedia -> length) ); + aBuf = "0 0 " + + OUString::number(PWG_TO_POINTS(pPWGMedia -> width)) + + " " + + OUString::number(PWG_TO_POINTS(pPWGMedia -> length)); if ( pImageableAreaValue ) pImageableAreaValue->m_aValue = aBuf.makeStringAndClear(); aBuf.append( PWG_TO_POINTS(pPWGMedia -> width) ); diff --git a/vcl/unx/generic/printer/printerinfomanager.cxx b/vcl/unx/generic/printer/printerinfomanager.cxx index 1977a80b5e7f..8ba1df9810bb 100644 --- a/vcl/unx/generic/printer/printerinfomanager.cxx +++ b/vcl/unx/generic/printer/printerinfomanager.cxx @@ -846,12 +846,10 @@ void SystemQueueInfo::run() for(const auto & rParm : aParms) { aLines.clear(); - OStringBuffer aCmdLine( 128 ); - aCmdLine.append( rParm.pQueueCommand ); #if OSL_DEBUG_LEVEL > 1 fprintf( stderr, "trying print queue command \"%s\" ... ", rParm.pQueueCommand ); #endif - aCmdLine.append( " 2>/dev/null" ); + OString aCmdLine = rParm.pQueueCommand + OStringLiteral(" 2>/dev/null"); FILE *pPipe; if( (pPipe = popen( aCmdLine.getStr(), "r" )) ) { diff --git a/vcl/unx/generic/window/salframe.cxx b/vcl/unx/generic/window/salframe.cxx index 370b47cbdb6b..87b795513367 100644 --- a/vcl/unx/generic/window/salframe.cxx +++ b/vcl/unx/generic/window/salframe.cxx @@ -2881,10 +2881,7 @@ bool X11SalFrame::appendUnicodeSequence( sal_Unicode c ) (c >= 'a' && c <= 'f') || (c >= 'A' && c <= 'F') ) { - OUStringBuffer aBuf( rSeq.getLength() + 1 ); - aBuf.append( rSeq ); - aBuf.append( c ); - rSeq = aBuf.makeStringAndClear(); + rSeq += OUStringLiteral1(c); std::vector<ExtTextInputAttr> attribs( rSeq.getLength(), ExtTextInputAttr::Underline ); SalExtTextInputEvent aEv; diff --git a/vcl/workben/svpclient.cxx b/vcl/workben/svpclient.cxx index 744b38138239..8ef179b0c1a2 100644 --- a/vcl/workben/svpclient.cxx +++ b/vcl/workben/svpclient.cxx @@ -180,11 +180,10 @@ void MyWin::parseList( const OString& rList ) aElementType = OStringToOUString( aLine.copy( 13 ), RTL_TEXTENCODING_ASCII_US ); else { - OUStringBuffer aNewElement( 64 ); - aNewElement.append( aElementType ); - aNewElement.append( ": " ); - aNewElement.append( OStringToOUString( aLine, RTL_TEXTENCODING_ASCII_US ) ); - m_aSvpBitmaps->InsertEntry( aNewElement.makeStringAndClear() ); + OUString aNewElement = + aElementType + ": " + + OStringToOUString( aLine, RTL_TEXTENCODING_ASCII_US ); + m_aSvpBitmaps->InsertEntry( aNewElement ); } } } diff --git a/vcl/workben/svptest.cxx b/vcl/workben/svptest.cxx index a79cda4df507..72ff179821a8 100644 --- a/vcl/workben/svptest.cxx +++ b/vcl/workben/svptest.cxx @@ -238,13 +238,11 @@ void MyWin::Paint(vcl::RenderContext& rRenderContext, const tools::Rectangle& rR sal_uInt8 nBlue = (i << 2) & 0xC0; rRenderContext.SetTextColor(Color(nRed, nGreen, nBlue)); - OUStringBuffer aPrintText(1024); - - aPrintText.append( "SVP test program" ); + OUString aPrintText = "SVP test program"; rRenderContext.DrawText(tools::Rectangle(Point((aPaperSize.Width() - 4000) / 2, 2000), Size(aPaperSize.Width() - 2100, aPaperSize.Height() - 4000)), - aPrintText.makeStringAndClear(), + aPrintText, DrawTextFlags::MultiLine); } diff --git a/writerfilter/source/dmapper/TextEffectsHandler.cxx b/writerfilter/source/dmapper/TextEffectsHandler.cxx index 30fdd7b9cc5b..fcefb30295a3 100644 --- a/writerfilter/source/dmapper/TextEffectsHandler.cxx +++ b/writerfilter/source/dmapper/TextEffectsHandler.cxx @@ -514,7 +514,7 @@ void TextEffectsHandler::lcl_attribute(Id aName, Value& aValue) break; case NS_ooxml::LN_CT_SRgbColor_val: { - OUStringBuffer aBuffer = OUString::number(aValue.getInt(), 16); + OUString aBuffer = OUString::number(aValue.getInt(), 16); OUStringBuffer aString; comphelper::string::padToLength(aString, 6 - aBuffer.getLength(), '0'); aString.append(aBuffer.getStr()); diff --git a/xmloff/source/style/xmlnumi.cxx b/xmloff/source/style/xmlnumi.cxx index 02e58ba4ecad..ed6304d00d84 100644 --- a/xmloff/source/style/xmlnumi.cxx +++ b/xmloff/source/style/xmlnumi.cxx @@ -517,10 +517,9 @@ Sequence<beans::PropertyValue> SvxXMLListLevelStyleContext_Impl::GetProperties() // Must append 'cBullet' even if it is zero // if 'bBullet' is true and 'cBullet' is zero - BulletChar property must be 0. - OUStringBuffer sTmp(1); - sTmp.append( cBullet ); + OUString sTmp = OUStringLiteral1( cBullet ); pProps[nPos].Name = "BulletChar"; - pProps[nPos++].Value <<= sTmp.makeStringAndClear(); + pProps[nPos++].Value <<= sTmp; pProps[nPos].Name = "BulletFont"; pProps[nPos++].Value <<= aFDesc; @@ -1249,10 +1248,9 @@ void SvxXMLListStyleContext::SetDefaultStyle( pProps->Name = "BulletFont"; (pProps++)->Value <<= aFDesc; - OUStringBuffer sTmp(1); - sTmp.append( sal_Unicode(0xF000 + 149) ); + OUString sTmp = OUStringLiteral1(sal_Unicode(0xF000 + 149)); pProps->Name = "BulletChar"; - (pProps++)->Value <<= sTmp.makeStringAndClear(); + (pProps++)->Value <<= sTmp; pProps->Name = "CharStyleName"; (pProps++)->Value <<= OUString( "Numbering Symbols" ); } |