diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2022-06-27 09:46:16 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2022-06-27 12:04:02 +0200 |
commit | 69485e422c906a3bb290797725a0784f73d94b9f (patch) | |
tree | 86a94f6bee0582870d173ea66e8f3cc0f239fb4f /stoc | |
parent | 04073c5fedd33654f242fecb7e39afb07cf0e273 (diff) |
clang-tidy modernize-pass-by-value in stoc
Change-Id: Ia628b2af646e576d52b6c72352255710a885c23f
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/136452
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'stoc')
-rw-r--r-- | stoc/source/corereflection/base.hxx | 4 | ||||
-rw-r--r-- | stoc/source/corereflection/crbase.cxx | 10 | ||||
-rw-r--r-- | stoc/source/implementationregistration/mergekeys.cxx | 7 | ||||
-rw-r--r-- | stoc/source/inspect/introspection.cxx | 15 | ||||
-rw-r--r-- | stoc/source/javaloader/javaloader.cxx | 7 | ||||
-rw-r--r-- | stoc/source/javavm/interact.cxx | 5 | ||||
-rw-r--r-- | stoc/source/javavm/interact.hxx | 2 | ||||
-rw-r--r-- | stoc/source/javavm/javavm.cxx | 5 | ||||
-rw-r--r-- | stoc/source/javavm/javavm.hxx | 2 | ||||
-rw-r--r-- | stoc/source/proxy_factory/proxyfac.cxx | 27 | ||||
-rw-r--r-- | stoc/source/security/access_controller.cxx | 5 | ||||
-rw-r--r-- | stoc/source/security/file_policy.cxx | 7 | ||||
-rw-r--r-- | stoc/source/security/permissions.h | 9 | ||||
-rw-r--r-- | stoc/source/servicemanager/servicemanager.cxx | 5 | ||||
-rw-r--r-- | stoc/source/simpleregistry/simpleregistry.cxx | 5 | ||||
-rw-r--r-- | stoc/source/uriproc/UriReference.cxx | 9 | ||||
-rw-r--r-- | stoc/source/uriproc/UriReference.hxx | 4 | ||||
-rw-r--r-- | stoc/source/uriproc/UriReferenceFactory.cxx | 4 | ||||
-rw-r--r-- | stoc/source/uriproc/VndSunStarPkgUrlReferenceFactory.cxx | 5 |
19 files changed, 76 insertions, 61 deletions
diff --git a/stoc/source/corereflection/base.hxx b/stoc/source/corereflection/base.hxx index 16d42213ddcd..d0793c1877aa 100644 --- a/stoc/source/corereflection/base.hxx +++ b/stoc/source/corereflection/base.hxx @@ -153,7 +153,7 @@ public: // Ctor IdlClassImpl( IdlReflectionServiceImpl * pReflection, - const OUString & rName, typelib_TypeClass eTypeClass, + OUString aName, typelib_TypeClass eTypeClass, typelib_TypeDescription * pTypeDescr ); virtual ~IdlClassImpl() override; @@ -338,7 +338,7 @@ public: { return _pDeclTypeDescr; } // ctor/ dtor - IdlMemberImpl( IdlReflectionServiceImpl * pReflection, const OUString & rName, + IdlMemberImpl( IdlReflectionServiceImpl * pReflection, OUString aName, typelib_TypeDescription * pTypeDescr, typelib_TypeDescription * pDeclTypeDescr ); virtual ~IdlMemberImpl() override; diff --git a/stoc/source/corereflection/crbase.cxx b/stoc/source/corereflection/crbase.cxx index 75e802c96045..439ee5b2229f 100644 --- a/stoc/source/corereflection/crbase.cxx +++ b/stoc/source/corereflection/crbase.cxx @@ -19,6 +19,8 @@ #include <uno/any2.h> +#include <utility> + #include "base.hxx" using namespace css::reflection; @@ -41,10 +43,10 @@ ClassNameVector g_aClassNames; IdlClassImpl::IdlClassImpl( IdlReflectionServiceImpl * pReflection, - const OUString & rName, typelib_TypeClass eTypeClass, + OUString aName, typelib_TypeClass eTypeClass, typelib_TypeDescription * pTypeDescr ) : m_xReflection( pReflection ) - , _aName( rName ) + , _aName(std::move( aName )) , _eTypeClass( static_cast<TypeClass>(eTypeClass) ) , _pTypeDescr( pTypeDescr ) { @@ -201,11 +203,11 @@ Reference< XIdlArray > IdlClassImpl::getArray() } -IdlMemberImpl::IdlMemberImpl( IdlReflectionServiceImpl * pReflection, const OUString & rName, +IdlMemberImpl::IdlMemberImpl( IdlReflectionServiceImpl * pReflection, OUString aName, typelib_TypeDescription * pTypeDescr, typelib_TypeDescription * pDeclTypeDescr ) : m_xReflection( pReflection ) - , _aName( rName ) + , _aName(std::move( aName )) , _pTypeDescr( pTypeDescr ) , _pDeclTypeDescr( pDeclTypeDescr ) { diff --git a/stoc/source/implementationregistration/mergekeys.cxx b/stoc/source/implementationregistration/mergekeys.cxx index da7da509ebce..dde219b9ada7 100644 --- a/stoc/source/implementationregistration/mergekeys.cxx +++ b/stoc/source/implementationregistration/mergekeys.cxx @@ -18,6 +18,7 @@ */ +#include <utility> #include <vector> #include <osl/diagnose.h> @@ -40,9 +41,9 @@ struct Link OUString m_name; OUString m_target; - Link( OUString const & name, OUString const & target ) - : m_name( name ) - , m_target( target ) + Link( OUString name, OUString target ) + : m_name(std::move( name )) + , m_target(std::move( target )) {} }; diff --git a/stoc/source/inspect/introspection.cxx b/stoc/source/inspect/introspection.cxx index 1a92d5b4cc34..c219e8030f0c 100644 --- a/stoc/source/inspect/introspection.cxx +++ b/stoc/source/inspect/introspection.cxx @@ -64,6 +64,7 @@ #include <rtl/ref.hxx> #include <rtl/ustrbuf.hxx> #include <unordered_map> +#include <utility> using namespace css::uno; using namespace css::lang; @@ -687,7 +688,7 @@ class ImplIntrospectionAccess : public IntrospectionAccessHelper void cacheXIndexContainer(); public: - ImplIntrospectionAccess( const Any& obj, rtl::Reference< IntrospectionAccessStatic_Impl > const & pStaticImpl_ ); + ImplIntrospectionAccess( Any obj, rtl::Reference< IntrospectionAccessStatic_Impl > pStaticImpl_ ); // Methods from XIntrospectionAccess virtual sal_Int32 SAL_CALL getSuppliedMethodConcepts() override; @@ -772,8 +773,8 @@ public: }; ImplIntrospectionAccess::ImplIntrospectionAccess - ( const Any& obj, rtl::Reference< IntrospectionAccessStatic_Impl > const & pStaticImpl_ ) - : maInspectedObject( obj ), mpStaticImpl( pStaticImpl_ ) , + ( Any obj, rtl::Reference< IntrospectionAccessStatic_Impl > pStaticImpl_ ) + : maInspectedObject(std::move( obj )), mpStaticImpl(std::move( pStaticImpl_ )) , mnLastPropertyConcept(-1), mnLastMethodConcept(-1) //, maAdapter() { // Save object as an interface if possible @@ -1430,9 +1431,9 @@ OUString ImplIntrospectionAccess::getExactName( const OUString& rApproximateName struct TypeKey { TypeKey( - css::uno::Reference<css::beans::XPropertySetInfo> const & theProperties, + css::uno::Reference<css::beans::XPropertySetInfo> theProperties, std::vector<css::uno::Type> const & theTypes): - properties(theProperties) + properties(std::move(theProperties)) { //TODO: Could even sort the types lexicographically first, to increase // the chance of matches between different implementations' getTypes(), @@ -1500,8 +1501,8 @@ public: private: struct Data { explicit Data( - rtl::Reference<IntrospectionAccessStatic_Impl> const & theAccess): - access(theAccess), hits(1) + rtl::Reference<IntrospectionAccessStatic_Impl> theAccess): + access(std::move(theAccess)), hits(1) {} rtl::Reference<IntrospectionAccessStatic_Impl> access; diff --git a/stoc/source/javaloader/javaloader.cxx b/stoc/source/javaloader/javaloader.cxx index 9b9195fbda66..f463e8791985 100644 --- a/stoc/source/javaloader/javaloader.cxx +++ b/stoc/source/javaloader/javaloader.cxx @@ -67,6 +67,7 @@ // this one is header-only #include <comphelper/sequence.hxx> +#include <utility> namespace com::sun::star::registry { class XRegistryKey; } @@ -258,7 +259,7 @@ class JavaComponentLoader public: /// @throws RuntimeException - explicit JavaComponentLoader(const css::uno::Reference<XComponentContext> & xCtx); + explicit JavaComponentLoader(css::uno::Reference<XComponentContext> xCtx); public: // XServiceInfo @@ -495,9 +496,9 @@ const css::uno::Reference<XImplementationLoader> & JavaComponentLoader::getJavaL return m_javaLoader; } -JavaComponentLoader::JavaComponentLoader(const css::uno::Reference<XComponentContext> & xCtx) +JavaComponentLoader::JavaComponentLoader(css::uno::Reference<XComponentContext> xCtx) : WeakComponentImplHelper(m_aMutex) - , m_xComponentContext(xCtx) + , m_xComponentContext(std::move(xCtx)) { } diff --git a/stoc/source/javavm/interact.cxx b/stoc/source/javavm/interact.cxx index d1399c065a89..49f223383ab7 100644 --- a/stoc/source/javavm/interact.cxx +++ b/stoc/source/javavm/interact.cxx @@ -24,6 +24,7 @@ #include <com/sun/star/task/XInteractionRetry.hpp> #include <cppuhelper/implbase.hxx> #include <mutex> +#include <utility> namespace com::sun::star::task { class XInteractionContinuation; } @@ -78,8 +79,8 @@ bool InteractionRequest::RetryContinuation::isSelected() const return m_bSelected; } -InteractionRequest::InteractionRequest(css::uno::Any const & rRequest): - m_aRequest(rRequest) +InteractionRequest::InteractionRequest(css::uno::Any aRequest): + m_aRequest(std::move(aRequest)) { m_xRetryContinuation = new RetryContinuation; m_aContinuations = { new AbortContinuation, m_xRetryContinuation }; diff --git a/stoc/source/javavm/interact.hxx b/stoc/source/javavm/interact.hxx index 35aa97b97b76..42fa373a338a 100644 --- a/stoc/source/javavm/interact.hxx +++ b/stoc/source/javavm/interact.hxx @@ -36,7 +36,7 @@ class InteractionRequest: public cppu::WeakImplHelper< css::task::XInteractionRequest > { public: - explicit InteractionRequest(css::uno::Any const & rRequest); + explicit InteractionRequest(css::uno::Any aRequest); virtual css::uno::Any SAL_CALL getRequest() override; diff --git a/stoc/source/javavm/javavm.cxx b/stoc/source/javavm/javavm.cxx index 4ed1293f9195..12bcc2c904b7 100644 --- a/stoc/source/javavm/javavm.cxx +++ b/stoc/source/javavm/javavm.cxx @@ -67,6 +67,7 @@ #include <string.h> #include <time.h> #include <memory> +#include <utility> #include <vector> // Properties of the javavm can be put @@ -470,9 +471,9 @@ private: } JavaVirtualMachine::JavaVirtualMachine( - css::uno::Reference< css::uno::XComponentContext > const & rContext): + css::uno::Reference< css::uno::XComponentContext > xContext): WeakComponentImplHelper(m_aMutex), - m_xContext(rContext), + m_xContext(std::move(xContext)), m_bDisposed(false), m_pJavaVm(nullptr), m_aAttachGuards(destroyAttachGuards) // TODO check for validity diff --git a/stoc/source/javavm/javavm.hxx b/stoc/source/javavm/javavm.hxx index e3551b29220f..b4f79d1f9f34 100644 --- a/stoc/source/javavm/javavm.hxx +++ b/stoc/source/javavm/javavm.hxx @@ -61,7 +61,7 @@ class JavaVirtualMachine: public: explicit JavaVirtualMachine( css::uno::Reference< - css::uno::XComponentContext > const & rContext); + css::uno::XComponentContext > xContext); // XInitialization virtual void SAL_CALL diff --git a/stoc/source/proxy_factory/proxyfac.cxx b/stoc/source/proxy_factory/proxyfac.cxx index 107d37160d41..6745d0163c70 100644 --- a/stoc/source/proxy_factory/proxyfac.cxx +++ b/stoc/source/proxy_factory/proxyfac.cxx @@ -36,6 +36,7 @@ #include <com/sun/star/reflection/XProxyFactory.hpp> #include <com/sun/star/uno/RuntimeException.hpp> #include <com/sun/star/uno/XComponentContext.hpp> +#include <utility> using namespace ::com::sun::star; @@ -133,7 +134,7 @@ struct ProxyRoot : public ::cppu::OWeakAggObject // XAggregation virtual Any SAL_CALL queryAggregation( Type const & rType ) override; - ProxyRoot( ::rtl::Reference< FactoryImpl > const & factory, + ProxyRoot( ::rtl::Reference< FactoryImpl > factory, Reference< XInterface > const & xTarget ); ::rtl::Reference< FactoryImpl > m_factory; @@ -152,9 +153,9 @@ struct binuno_Proxy : public uno_Interface TypeDescription m_typeDescr; binuno_Proxy( - ::rtl::Reference< ProxyRoot > const & root, - UnoInterfaceReference const & target, - OUString const & oid, TypeDescription const & typeDescr ); + ::rtl::Reference< ProxyRoot > root, + UnoInterfaceReference target, + OUString oid, TypeDescription typeDescr ); }; extern "C" @@ -251,14 +252,14 @@ static void binuno_proxy_dispatch( binuno_Proxy::binuno_Proxy( - ::rtl::Reference< ProxyRoot > const & root, - UnoInterfaceReference const & target, - OUString const & oid, TypeDescription const & typeDescr ) + ::rtl::Reference< ProxyRoot > root, + UnoInterfaceReference target, + OUString oid, TypeDescription typeDescr ) : m_nRefCount( 1 ), - m_root( root ), - m_target( target ), - m_oid( oid ), - m_typeDescr( typeDescr ) + m_root(std::move( root )), + m_target(std::move( target )), + m_oid(std::move( oid )), + m_typeDescr(std::move( typeDescr )) { uno_Interface::acquire = binuno_proxy_acquire; uno_Interface::release = binuno_proxy_release; @@ -266,9 +267,9 @@ binuno_Proxy::binuno_Proxy( } ProxyRoot::ProxyRoot( - ::rtl::Reference< FactoryImpl > const & factory, + ::rtl::Reference< FactoryImpl > factory, Reference< XInterface > const & xTarget ) - : m_factory( factory ) + : m_factory(std::move( factory )) { m_factory->m_cpp2uno.mapInterface( reinterpret_cast< void ** >( &m_target.m_pUnoI ), xTarget.get(), diff --git a/stoc/source/security/access_controller.cxx b/stoc/source/security/access_controller.cxx index c96f1f61f945..a62742692e5c 100644 --- a/stoc/source/security/access_controller.cxx +++ b/stoc/source/security/access_controller.cxx @@ -18,6 +18,7 @@ */ +#include <utility> #include <vector> #include <osl/diagnose.h> @@ -174,8 +175,8 @@ class acc_Policy public: explicit acc_Policy( - PermissionCollection const & permissions ) - : m_permissions( permissions ) + PermissionCollection permissions ) + : m_permissions(std::move( permissions )) {} // XAccessControlContext impl diff --git a/stoc/source/security/file_policy.cxx b/stoc/source/security/file_policy.cxx index 91f75092bc22..1a8e8a2b86c9 100644 --- a/stoc/source/security/file_policy.cxx +++ b/stoc/source/security/file_policy.cxx @@ -38,6 +38,7 @@ #include <string_view> #include <unordered_map> +#include <utility> constexpr OUStringLiteral IMPL_NAME = u"com.sun.star.security.comp.stoc.FilePolicy"; @@ -152,7 +153,7 @@ class PolicyReader { return (';' == c || ',' == c || '{' == c || '}' == c); } public: - PolicyReader( OUString const & file, AccessControl & ac ); + PolicyReader( OUString file, AccessControl & ac ); ~PolicyReader(); void error( std::u16string_view msg ); @@ -328,8 +329,8 @@ void PolicyReader::error( std::u16string_view msg ) "] " + msg); } -PolicyReader::PolicyReader( OUString const & fileName, AccessControl & ac ) - : m_fileName( fileName ) +PolicyReader::PolicyReader( OUString fileName, AccessControl & ac ) + : m_fileName(std::move( fileName )) , m_linepos( 0 ) , m_pos( 1 ) // force readline , m_back( '\0' ) diff --git a/stoc/source/security/permissions.h b/stoc/source/security/permissions.h index eb0b307787a4..99c558463507 100644 --- a/stoc/source/security/permissions.h +++ b/stoc/source/security/permissions.h @@ -22,6 +22,7 @@ #include <rtl/ref.hxx> #include <rtl/ustring.hxx> #include <salhelper/simplereferenceobject.hxx> +#include <utility> namespace com::sun::star::uno { class Any; } namespace com::sun::star::uno { template <class E> class Sequence; } @@ -38,8 +39,8 @@ public: Permission( t_type type, - ::rtl::Reference< Permission > const & next ) - : m_next( next ) + ::rtl::Reference< Permission > next ) + : m_next(std::move( next )) , m_type( type ) {} @@ -66,8 +67,8 @@ class PermissionCollection public: PermissionCollection() {} - explicit PermissionCollection( ::rtl::Reference< Permission > const & single ) - : m_head( single ) + explicit PermissionCollection( ::rtl::Reference< Permission > single ) + : m_head(std::move( single )) {} PermissionCollection( css::uno::Sequence< css::uno::Any > const & permissions, diff --git a/stoc/source/servicemanager/servicemanager.cxx b/stoc/source/servicemanager/servicemanager.cxx index 77651b0f007d..c42e97a9160d 100644 --- a/stoc/source/servicemanager/servicemanager.cxx +++ b/stoc/source/servicemanager/servicemanager.cxx @@ -55,6 +55,7 @@ #include <string_view> #include <unordered_map> #include <unordered_set> +#include <utility> using namespace com::sun::star; using namespace css::uno; @@ -205,8 +206,8 @@ sal_Bool PropertySetInfo_Impl::hasPropertyByName( OUString const & name ) class ImplementationEnumeration_Impl : public WeakImplHelper< XEnumeration > { public: - explicit ImplementationEnumeration_Impl( const HashSet_Ref & rImplementationMap ) - : aImplementationMap( rImplementationMap ) + explicit ImplementationEnumeration_Impl( HashSet_Ref xImplementationMap ) + : aImplementationMap(std::move( xImplementationMap )) , aIt( aImplementationMap.begin() ) {} diff --git a/stoc/source/simpleregistry/simpleregistry.cxx b/stoc/source/simpleregistry/simpleregistry.cxx index b87310233ef2..e66ecf8580a0 100644 --- a/stoc/source/simpleregistry/simpleregistry.cxx +++ b/stoc/source/simpleregistry/simpleregistry.cxx @@ -21,6 +21,7 @@ #include <cstdlib> #include <mutex> +#include <utility> #include <vector> #include <com/sun/star/lang/XServiceInfo.hpp> @@ -100,9 +101,9 @@ private: class Key: public cppu::WeakImplHelper< css::registry::XRegistryKey > { public: Key( - rtl::Reference< SimpleRegistry > const & registry, + rtl::Reference< SimpleRegistry > registry, RegistryKey const & key): - registry_(registry), key_(key) {} + registry_(std::move(registry)), key_(key) {} private: virtual OUString SAL_CALL getKeyName() override; diff --git a/stoc/source/uriproc/UriReference.cxx b/stoc/source/uriproc/UriReference.cxx index e8f7db0bfc4a..9c7c7962c66a 100644 --- a/stoc/source/uriproc/UriReference.cxx +++ b/stoc/source/uriproc/UriReference.cxx @@ -25,16 +25,17 @@ #include <rtl/ustrbuf.hxx> #include <rtl/ustring.hxx> +#include <utility> #include <sal/types.h> using stoc::uriproc::UriReference; UriReference::UriReference( - OUString const & scheme, bool bHasAuthority, - OUString const & authority, OUString const & path, + OUString scheme, bool bHasAuthority, + OUString const & authority, OUString path, bool bHasQuery, OUString const & query): - m_path(path), - m_scheme(scheme), + m_path(std::move(path)), + m_scheme(std::move(scheme)), m_authority(authority), m_query(query), m_hasAuthority(bHasAuthority), diff --git a/stoc/source/uriproc/UriReference.hxx b/stoc/source/uriproc/UriReference.hxx index e1645372038a..1b373f56a7e0 100644 --- a/stoc/source/uriproc/UriReference.hxx +++ b/stoc/source/uriproc/UriReference.hxx @@ -30,8 +30,8 @@ namespace stoc::uriproc { class UriReference { public: UriReference( - OUString const & scheme, bool hasAuthority, - OUString const & authority, OUString const & path, + OUString scheme, bool hasAuthority, + OUString const & authority, OUString path, bool hasQuery, OUString const & query); ~UriReference(); diff --git a/stoc/source/uriproc/UriReferenceFactory.cxx b/stoc/source/uriproc/UriReferenceFactory.cxx index 254097c179fe..ed739cdc32cf 100644 --- a/stoc/source/uriproc/UriReferenceFactory.cxx +++ b/stoc/source/uriproc/UriReferenceFactory.cxx @@ -284,8 +284,8 @@ class Factory: { public: explicit Factory( - css::uno::Reference< css::uno::XComponentContext > const & context): - m_context(context) {} + css::uno::Reference< css::uno::XComponentContext > context): + m_context(std::move(context)) {} Factory(const Factory&) = delete; Factory& operator=(const Factory&) = delete; diff --git a/stoc/source/uriproc/VndSunStarPkgUrlReferenceFactory.cxx b/stoc/source/uriproc/VndSunStarPkgUrlReferenceFactory.cxx index 2a3211a08856..7520c460f16d 100644 --- a/stoc/source/uriproc/VndSunStarPkgUrlReferenceFactory.cxx +++ b/stoc/source/uriproc/VndSunStarPkgUrlReferenceFactory.cxx @@ -31,6 +31,7 @@ #include <rtl/uri.h> #include <rtl/uri.hxx> #include <rtl/ustring.hxx> +#include <utility> #include <sal/types.h> namespace com::sun::star::uno { class XComponentContext; } @@ -44,8 +45,8 @@ class Factory: { public: explicit Factory( - css::uno::Reference< css::uno::XComponentContext > const & context): - m_context(context) {} + css::uno::Reference< css::uno::XComponentContext > context): + m_context(std::move(context)) {} Factory(const Factory&) = delete; Factory& operator=(const Factory&) = delete; |