From 04aafba860f613c20e7078d038cc83eb02de0b54 Mon Sep 17 00:00:00 2001 From: Noel Grandin Date: Thu, 29 Apr 2021 12:24:31 +0200 Subject: loplugin:stringadd simplify some *StringBuffer operations pulled from a larger patch which I created with a more permissive variant of this plugin Change-Id: I7abf1f3f09e84703b6e0e52fe9587dff691b2187 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/114875 Tested-by: Jenkins Reviewed-by: Noel Grandin --- scripting/source/provider/MasterScriptProvider.cxx | 13 +++++------ scripting/source/provider/URIHelper.cxx | 26 +++++++--------------- 2 files changed, 14 insertions(+), 25 deletions(-) (limited to 'scripting') diff --git a/scripting/source/provider/MasterScriptProvider.cxx b/scripting/source/provider/MasterScriptProvider.cxx index 282d631a6f21..041f77a65c40 100644 --- a/scripting/source/provider/MasterScriptProvider.cxx +++ b/scripting/source/provider/MasterScriptProvider.cxx @@ -141,15 +141,14 @@ void SAL_CALL MasterScriptProvider::initialize( const Sequence < Any >& args ) { Any aError( ::cppu::getCaughtException() ); - OUStringBuffer buf; - buf.append( "MasterScriptProvider::initialize: caught " ); - buf.append( aError.getValueTypeName() ); - buf.append( ":" ); - Exception aException; aError >>= aException; - buf.append ( aException.Message ); - throw lang::WrappedTargetException( buf.makeStringAndClear(), *this, aError ); + OUString buf = + "MasterScriptProvider::initialize: caught " + + aError.getValueTypeName() + + ":" + + aException.Message; + throw lang::WrappedTargetException( buf, *this, aError ); } if ( m_xInvocationContext.is() && m_xInvocationContext != m_xModel ) diff --git a/scripting/source/provider/URIHelper.cxx b/scripting/source/provider/URIHelper.cxx index 94d0e1fd041c..9247f4b9fa98 100644 --- a/scripting/source/provider/URIHelper.cxx +++ b/scripting/source/provider/URIHelper.cxx @@ -190,16 +190,13 @@ ScriptingFrameworkURIHelper::getLanguagePath(const OUString& rLanguagePart) OUString SAL_CALL ScriptingFrameworkURIHelper::getScriptURI(const OUString& rStorageURI) { - OUStringBuffer buf(120); - - buf.append("vnd.sun.star.script:"); - buf.append(getLanguagePart(rStorageURI)); - buf.append("?language="); - buf.append(m_sLanguage); - buf.append("&location="); - buf.append(m_sLocation); - - return buf.makeStringAndClear(); + return + "vnd.sun.star.script:" + + getLanguagePart(rStorageURI) + + "?language=" + + m_sLanguage + + "&location=" + + m_sLocation; } OUString SAL_CALL @@ -219,14 +216,7 @@ ScriptingFrameworkURIHelper::getStorageURI(const OUString& rScriptURI) uno::Reference< uno::XInterface >(), 1 ); } - OUStringBuffer buf(120); - buf.append(m_sBaseURI); - buf.append("/"); - buf.append(getLanguagePath(sLanguagePart)); - - OUString result = buf.makeStringAndClear(); - - return result; + return m_sBaseURI + "/" + getLanguagePath(sLanguagePart); } OUString SAL_CALL -- cgit