diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2019-10-14 14:27:57 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2019-10-15 14:33:57 +0200 |
commit | f13c6ad5f020a196a0e3aa6f28bda3dc185d465b (patch) | |
tree | f9aaab122974d36c134fb1723ec3c1c8df51eeef /desktop/source | |
parent | 9270f74466d0eb841babaa24997f608631c70341 (diff) |
new loplugin:bufferadd
look for OUStringBuffer append sequences that can be turned
into creating an OUString with + operations
Change-Id: Ica840dc096000307b4a105fb4d9ec7588a15ade6
Reviewed-on: https://gerrit.libreoffice.org/80809
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'desktop/source')
-rw-r--r-- | desktop/source/deployment/misc/dp_identifier.cxx | 5 | ||||
-rw-r--r-- | desktop/source/deployment/registry/configuration/dp_configuration.cxx | 6 | ||||
-rw-r--r-- | desktop/source/lib/init.cxx | 8 | ||||
-rw-r--r-- | desktop/source/pkgchk/unopkg/unopkg_misc.cxx | 14 |
4 files changed, 12 insertions, 21 deletions
diff --git a/desktop/source/deployment/misc/dp_identifier.cxx b/desktop/source/deployment/misc/dp_identifier.cxx index 2c429890d0e9..bb90b8bb0d2f 100644 --- a/desktop/source/deployment/misc/dp_identifier.cxx +++ b/desktop/source/deployment/misc/dp_identifier.cxx @@ -50,10 +50,7 @@ OUString getIdentifier( } OUString generateLegacyIdentifier(OUString const & fileName) { - OUStringBuffer b; - b.append("org.openoffice.legacy."); - b.append(fileName); - return b.makeStringAndClear(); + return "org.openoffice.legacy." + fileName; } } diff --git a/desktop/source/deployment/registry/configuration/dp_configuration.cxx b/desktop/source/deployment/registry/configuration/dp_configuration.cxx index d991f9b48071..40d0ee9c8b3c 100644 --- a/desktop/source/deployment/registry/configuration/dp_configuration.cxx +++ b/desktop/source/deployment/registry/configuration/dp_configuration.cxx @@ -229,9 +229,9 @@ BackendImpl::BackendImpl( } catch (const Exception &e) { - OUStringBuffer aStr( "Exception loading legacy package database: '" ); - aStr.append( e.Message ); - aStr.append( "' - ignoring file, please remove it.\n" ); + OUString aStr = "Exception loading legacy package database: '" + + e.Message + + "' - ignoring file, please remove it.\n"; dp_misc::writeConsole( aStr.getStr() ); } } diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx index 048b358175c4..cd604f939d8b 100644 --- a/desktop/source/lib/init.cxx +++ b/desktop/source/lib/init.cxx @@ -5127,10 +5127,10 @@ static void force_c_locale() static void aBasicErrorFunc(const OUString& rError, const OUString& rAction) { - OStringBuffer aBuffer("Unexpected dialog: "); - aBuffer.append(OUStringToOString(rAction, RTL_TEXTENCODING_ASCII_US)); - aBuffer.append(" Error: "); - aBuffer.append(OUStringToOString(rError, RTL_TEXTENCODING_ASCII_US)); + OString aBuffer = "Unexpected dialog: " + + OUStringToOString(rAction, RTL_TEXTENCODING_ASCII_US) + + " Error: " + + OUStringToOString(rError, RTL_TEXTENCODING_ASCII_US); fprintf(stderr, "Unexpected basic error dialog '%s'\n", aBuffer.getStr()); } diff --git a/desktop/source/pkgchk/unopkg/unopkg_misc.cxx b/desktop/source/pkgchk/unopkg/unopkg_misc.cxx index aebf71fc26d1..ff1b9dc6e0bf 100644 --- a/desktop/source/pkgchk/unopkg/unopkg_misc.cxx +++ b/desktop/source/pkgchk/unopkg/unopkg_misc.cxx @@ -356,12 +356,9 @@ Reference<XComponentContext> connectToOffice( bool verbose ) { OUString pipeId( ::dp_misc::generateRandomPipeId() ); - OUStringBuffer buf; - buf.append( "--accept=pipe,name=" ); - buf.append( pipeId ); - buf.append( ";urp;" ); + OUString acceptArg = "--accept=pipe,name=" + pipeId + ";urp;"; - Sequence<OUString> args { "--nologo", "--nodefault", buf.makeStringAndClear() }; + Sequence<OUString> args { "--nologo", "--nodefault", acceptArg }; OUString appURL( getExecutableDir() + "/soffice" ); if (verbose) @@ -377,13 +374,10 @@ Reference<XComponentContext> connectToOffice( if (verbose) dp_misc::writeConsole("OK. Connecting..."); - OSL_ASSERT( buf.isEmpty() ); - buf.append( "uno:pipe,name=" ); - buf.append( pipeId ); - buf.append( ";urp;StarOffice.ComponentContext" ); + OUString sUnoUrl = "uno:pipe,name=" + pipeId + ";urp;StarOffice.ComponentContext"; Reference<XComponentContext> xRet( ::dp_misc::resolveUnoURL( - buf.makeStringAndClear(), xLocalComponentContext ), + sUnoUrl, xLocalComponentContext ), UNO_QUERY_THROW ); if (verbose) dp_misc::writeConsole("OK.\n"); |