From 49fdae5bb4f584d26cea958e554678154bedf379 Mon Sep 17 00:00:00 2001 From: Noel Grandin Date: Tue, 21 Jun 2022 10:18:15 +0200 Subject: [PATCH] clang-tidy modernize-pass-by-value in io..jvmfwk Change-Id: I6e19d4d03957c35caa79a231927eae04ae630442 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/136209 Tested-by: Jenkins Reviewed-by: Noel Grandin --- io/source/acceptor/acc_pipe.cxx | 13 +++++++------ io/source/acceptor/acc_socket.cxx | 15 ++++++++------- io/source/acceptor/acceptor.hxx | 6 +++--- io/source/connector/connector.hxx | 4 ++-- io/source/connector/ctr_pipe.cxx | 5 +++-- io/source/connector/ctr_socket.cxx | 5 +++-- javaunohelper/source/vm.cxx | 5 +++-- .../plugins/sunmajor/pluginlib/sunjavaplugin.cxx | 4 ++-- jvmfwk/plugins/sunmajor/pluginlib/util.hxx | 5 +++-- jvmfwk/source/framework.hxx | 5 +++-- 10 files changed, 37 insertions(+), 30 deletions(-) diff --git a/io/source/acceptor/acc_pipe.cxx b/io/source/acceptor/acc_pipe.cxx index db43c58db103..c3af874498de 100644 --- a/io/source/acceptor/acc_pipe.cxx +++ b/io/source/acceptor/acc_pipe.cxx @@ -26,6 +26,7 @@ #include #include #include +#include using namespace ::osl; using namespace ::cppu; @@ -43,7 +44,7 @@ namespace io_acceptor public WeakImplHelper< XConnection > { public: - explicit PipeConnection( const OUString &sConnectionDescription); + explicit PipeConnection( OUString sConnectionDescription); virtual sal_Int32 SAL_CALL read( Sequence< sal_Int8 >& aReadBytes, sal_Int32 nBytesToRead ) override; virtual void SAL_CALL write( const Sequence< sal_Int8 >& aData ) override; @@ -58,9 +59,9 @@ namespace io_acceptor } - PipeConnection::PipeConnection( const OUString &sConnectionDescription) : + PipeConnection::PipeConnection( OUString sConnectionDescription) : m_nStatus( 0 ), - m_sDescription( sConnectionDescription ) + m_sDescription(std::move( sConnectionDescription )) { // make it unique m_sDescription += ",uniqueValue="; @@ -121,9 +122,9 @@ namespace io_acceptor /*************** * PipeAcceptor **************/ - PipeAcceptor::PipeAcceptor( const OUString &sPipeName , const OUString & sConnectionDescription) : - m_sPipeName( sPipeName ), - m_sConnectionDescription( sConnectionDescription ), + PipeAcceptor::PipeAcceptor( OUString sPipeName , OUString sConnectionDescription) : + m_sPipeName(std::move( sPipeName )), + m_sConnectionDescription(std::move( sConnectionDescription )), m_bClosed( false ) { } diff --git a/io/source/acceptor/acc_socket.cxx b/io/source/acceptor/acc_socket.cxx index d52fdc423bdf..c211acdc3ab5 100644 --- a/io/source/acceptor/acc_socket.cxx +++ b/io/source/acceptor/acc_socket.cxx @@ -28,6 +28,7 @@ #include #include #include +#include using namespace ::osl; using namespace ::cppu; @@ -49,7 +50,7 @@ namespace io_acceptor { { public: - explicit SocketConnection( const OUString & sConnectionDescription ); + explicit SocketConnection( OUString sConnectionDescription ); virtual sal_Int32 SAL_CALL read( css::uno::Sequence< sal_Int8 >& aReadBytes, sal_Int32 nBytesToRead ) override; @@ -129,9 +130,9 @@ namespace io_acceptor { } - SocketConnection::SocketConnection( const OUString &sConnectionDescription) : + SocketConnection::SocketConnection( OUString sConnectionDescription) : m_nStatus( 0 ), - m_sDescription( sConnectionDescription ), + m_sDescription(std::move( sConnectionDescription )), _started(false), _closed(false), _error(false) @@ -264,12 +265,12 @@ namespace io_acceptor { _listeners.erase(aListener); } - SocketAcceptor::SocketAcceptor( const OUString &sSocketName, + SocketAcceptor::SocketAcceptor( OUString sSocketName, sal_uInt16 nPort, bool bTcpNoDelay, - const OUString &sConnectionDescription) : - m_sSocketName( sSocketName ), - m_sConnectionDescription( sConnectionDescription ), + OUString sConnectionDescription) : + m_sSocketName(std::move( sSocketName )), + m_sConnectionDescription(std::move( sConnectionDescription )), m_nPort( nPort ), m_bTcpNoDelay( bTcpNoDelay ), m_bClosed( false ) diff --git a/io/source/acceptor/acceptor.hxx b/io/source/acceptor/acceptor.hxx index 9214a10b7509..9dc3690166cc 100644 --- a/io/source/acceptor/acceptor.hxx +++ b/io/source/acceptor/acceptor.hxx @@ -32,7 +32,7 @@ namespace io_acceptor { class PipeAcceptor { public: - PipeAcceptor( const OUString &sPipeName , const OUString &sConnectionDescription ); + PipeAcceptor( OUString sPipeName, OUString sConnectionDescription ); void init(); css::uno::Reference < css::connection::XConnection > accept( ); @@ -49,10 +49,10 @@ namespace io_acceptor { class SocketAcceptor { public: - SocketAcceptor( const OUString & sSocketName , + SocketAcceptor( OUString sSocketName , sal_uInt16 nPort, bool bTcpNoDelay, - const OUString &sConnectionDescription ); + OUString sConnectionDescription ); void init(); css::uno::Reference < css::connection::XConnection > accept(); diff --git a/io/source/connector/connector.hxx b/io/source/connector/connector.hxx index 691fc7a885df..1d70b55ddcc6 100644 --- a/io/source/connector/connector.hxx +++ b/io/source/connector/connector.hxx @@ -39,7 +39,7 @@ namespace stoc_connector { public: - explicit PipeConnection( const OUString &sConnectionDescription ); + explicit PipeConnection( OUString sConnectionDescription ); virtual ~PipeConnection() override; virtual sal_Int32 SAL_CALL read( css::uno::Sequence< sal_Int8 >& aReadBytes, @@ -59,7 +59,7 @@ namespace stoc_connector { public: - explicit SocketConnection( const OUString & sConnectionDescription ); + explicit SocketConnection( OUString sConnectionDescription ); virtual ~SocketConnection() override; virtual sal_Int32 SAL_CALL read( css::uno::Sequence< sal_Int8 >& aReadBytes, diff --git a/io/source/connector/ctr_pipe.cxx b/io/source/connector/ctr_pipe.cxx index 5ee0b70bc970..ba3ca7fb761b 100644 --- a/io/source/connector/ctr_pipe.cxx +++ b/io/source/connector/ctr_pipe.cxx @@ -23,6 +23,7 @@ #include "connector.hxx" #include +#include using namespace ::osl; using namespace ::com::sun::star::uno; @@ -32,9 +33,9 @@ using namespace ::com::sun::star::connection; namespace stoc_connector { - PipeConnection::PipeConnection( const OUString & sConnectionDescription ) : + PipeConnection::PipeConnection( OUString sConnectionDescription ) : m_nStatus( 0 ), - m_sDescription( sConnectionDescription ) + m_sDescription(std::move( sConnectionDescription )) { // make it unique m_sDescription += ",uniqueValue="; diff --git a/io/source/connector/ctr_socket.cxx b/io/source/connector/ctr_socket.cxx index dcdeef07ff83..0edb32ffc2d0 100644 --- a/io/source/connector/ctr_socket.cxx +++ b/io/source/connector/ctr_socket.cxx @@ -20,6 +20,7 @@ #include "connector.hxx" #include +#include using namespace ::osl; using namespace ::com::sun::star::uno; @@ -80,9 +81,9 @@ namespace stoc_connector { } - SocketConnection::SocketConnection( const OUString &sConnectionDescription ) : + SocketConnection::SocketConnection( OUString sConnectionDescription ) : m_nStatus( 0 ), - m_sDescription( sConnectionDescription ), + m_sDescription(std::move( sConnectionDescription )), _started(false), _closed(false), _error(false) diff --git a/javaunohelper/source/vm.cxx b/javaunohelper/source/vm.cxx index e634c55961ff..7191e5860273 100644 --- a/javaunohelper/source/vm.cxx +++ b/javaunohelper/source/vm.cxx @@ -29,6 +29,7 @@ #include #include #include +#include namespace { @@ -43,9 +44,9 @@ protected: virtual void SAL_CALL disposing() override; public: - explicit SingletonFactory( ::rtl::Reference< ::jvmaccess::UnoVirtualMachine > const & vm_access ) + explicit SingletonFactory( ::rtl::Reference< ::jvmaccess::UnoVirtualMachine > vm_access ) : t_impl( m_aMutex ), - m_vm_access( vm_access ) + m_vm_access(std::move( vm_access )) {} // XSingleComponentFactory impl diff --git a/jvmfwk/plugins/sunmajor/pluginlib/sunjavaplugin.cxx b/jvmfwk/plugins/sunmajor/pluginlib/sunjavaplugin.cxx index 72c3a2424f63..45feea3b1db1 100644 --- a/jvmfwk/plugins/sunmajor/pluginlib/sunjavaplugin.cxx +++ b/jvmfwk/plugins/sunmajor/pluginlib/sunjavaplugin.cxx @@ -695,8 +695,8 @@ javaPluginError jfw_plugin_startJavaVirtualMachine( JavaVMInitArgs vm_args; struct Option { - Option(OString const & theOptionString, void * theExtraInfo): - optionString(theOptionString), extraInfo(theExtraInfo) + Option(OString theOptionString, void * theExtraInfo): + optionString(std::move(theOptionString)), extraInfo(theExtraInfo) {} OString optionString; diff --git a/jvmfwk/plugins/sunmajor/pluginlib/util.hxx b/jvmfwk/plugins/sunmajor/pluginlib/util.hxx index 9ba0055832ed..0f4b1dac0f42 100644 --- a/jvmfwk/plugins/sunmajor/pluginlib/util.hxx +++ b/jvmfwk/plugins/sunmajor/pluginlib/util.hxx @@ -20,6 +20,7 @@ #define INCLUDED_JVMFWK_PLUGINS_SUNMAJOR_PLUGINLIB_UTIL_HXX #include +#include #include #include @@ -63,7 +64,7 @@ bool makeDriveLetterSame(OUString * fileURL); struct InfoFindSame { OUString sJava; - explicit InfoFindSame(const OUString& sJavaHome):sJava(sJavaHome){} + explicit InfoFindSame(OUString sJavaHome):sJava(std::move(sJavaHome)){} bool operator () (const rtl::Reference & aVendorInfo) { @@ -74,7 +75,7 @@ struct InfoFindSame struct SameOrSubDirJREMap { OUString s1; - explicit SameOrSubDirJREMap(const OUString& s):s1(s){ + explicit SameOrSubDirJREMap(OUString s):s1(std::move(s)){ } bool operator () (const std::pair > & s2) diff --git a/jvmfwk/source/framework.hxx b/jvmfwk/source/framework.hxx index 39bda148b24a..2ab126614868 100644 --- a/jvmfwk/source/framework.hxx +++ b/jvmfwk/source/framework.hxx @@ -20,6 +20,7 @@ #define INCLUDED_JVMFWK_SOURCE_FRAMEWORK_HXX #include +#include namespace jfw { @@ -28,8 +29,8 @@ class FrameworkException : public std::exception { public: - FrameworkException(javaFrameworkError err, const OString& msg): - errorCode(err), message(msg) + FrameworkException(javaFrameworkError err, OString msg): + errorCode(err), message(std::move(msg)) { } javaFrameworkError errorCode;