diff options
Diffstat (limited to 'cpputools/source/unoexe/unoexe.cxx')
-rw-r--r-- | cpputools/source/unoexe/unoexe.cxx | 28 |
1 files changed, 15 insertions, 13 deletions
diff --git a/cpputools/source/unoexe/unoexe.cxx b/cpputools/source/unoexe/unoexe.cxx index b9dca78b67ce..c6e5f0966c6c 100644 --- a/cpputools/source/unoexe/unoexe.cxx +++ b/cpputools/source/unoexe/unoexe.cxx @@ -18,6 +18,7 @@ */ #include <stdio.h> +#include <mutex> #include <string_view> #include <sal/main.h> @@ -45,6 +46,7 @@ #include <com/sun/star/connection/XConnection.hpp> #include <com/sun/star/bridge/XBridgeFactory.hpp> #include <com/sun/star/bridge/XBridge.hpp> +#include <utility> using namespace osl; using namespace cppu; @@ -88,7 +90,7 @@ const char arUsingText[] = static bool readOption( OUString * pValue, const char * pOpt, sal_uInt32 * pnIndex, const OUString & aArg) { - static const OUStringLiteral dash(u"-"); + static constexpr OUString dash(u"-"_ustr); if(!aArg.startsWith(dash)) return false; @@ -170,14 +172,14 @@ static Reference< XInterface > loadComponent( Reference< XImplementationLoader > xLoader; - OUString aExt( rLocation.copy( nDot +1 ) ); + std::u16string_view aExt( rLocation.subView( nDot +1 ) ); - if (aExt == "dll" || aExt == "exe" || aExt == "dylib" || aExt == "so") + if (aExt == u"dll" || aExt == u"exe" || aExt == u"dylib" || aExt == u"so") { createInstance( xLoader, xContext, "com.sun.star.loader.SharedLibrary" ); } - else if (aExt == "jar" || aExt == "class") + else if (aExt == u"jar" || aExt == u"class") { createInstance( xLoader, xContext, "com.sun.star.loader.Java" ); @@ -229,7 +231,7 @@ class OInstanceProvider { Reference< XComponentContext > _xContext; - Mutex _aSingleInstanceMutex; + std::mutex _aSingleInstanceMutex; Reference< XInterface > _xSingleInstance; bool _bSingleInstance; @@ -245,16 +247,16 @@ class OInstanceProvider public: OInstanceProvider( const Reference< XComponentContext > & xContext, - const OUString & rImplName, const OUString & rLocation, - const OUString & rServiceName, const Sequence< Any > & rInitParams, - bool bSingleInstance, const OUString & rInstanceName ) + OUString aImplName, OUString aLocation, + OUString aServiceName, const Sequence< Any > & rInitParams, + bool bSingleInstance, OUString aInstanceName ) : _xContext( xContext ) , _bSingleInstance( bSingleInstance ) - , _aImplName( rImplName ) - , _aLocation( rLocation ) - , _aServiceName( rServiceName ) + , _aImplName(std::move( aImplName )) + , _aLocation(std::move( aLocation )) + , _aServiceName(std::move( aServiceName )) , _aInitParams( rInitParams ) - , _aInstanceName( rInstanceName ) + , _aInstanceName(std::move( aInstanceName )) {} // XInstanceProvider @@ -296,7 +298,7 @@ Reference< XInterface > OInstanceProvider::getInstance( const OUString & rName ) { if (! _xSingleInstance.is()) { - MutexGuard aGuard( _aSingleInstanceMutex ); + std::lock_guard aGuard( _aSingleInstanceMutex ); if (! _xSingleInstance.is()) { _xSingleInstance = createInstance(); |