diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2017-07-30 12:16:31 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2017-07-31 08:25:07 +0200 |
commit | c9253818ec8252169c20450b41878be459568d95 (patch) | |
tree | 1f271151725042f33c3c8aa3988343bcd7f89e12 /scripting | |
parent | 242a796a71e29a1d8cdc4dd71d2465b898db32ab (diff) |
loplugin:oncevar
extend oncevar to any POD type
Change-Id: Ia98ee0a67f183e40fb0c38477760124b2c411dc0
Reviewed-on: https://gerrit.libreoffice.org/40564
Tested-by: Jenkins <ci@libreoffice.org>
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'scripting')
-rw-r--r-- | scripting/source/protocolhandler/scripthandler.cxx | 5 | ||||
-rw-r--r-- | scripting/source/provider/ActiveMSPList.cxx | 3 | ||||
-rw-r--r-- | scripting/source/provider/ProviderCache.cxx | 10 | ||||
-rw-r--r-- | scripting/source/stringresource/stringresource.cxx | 27 |
4 files changed, 16 insertions, 29 deletions
diff --git a/scripting/source/protocolhandler/scripthandler.cxx b/scripting/source/protocolhandler/scripthandler.cxx index 7fa2a3d990b9..03e2d148bd9a 100644 --- a/scripting/source/protocolhandler/scripthandler.cxx +++ b/scripting/source/protocolhandler/scripthandler.cxx @@ -247,10 +247,9 @@ void SAL_CALL ScriptProtocolHandler::dispatchWithNotification( } else { - OUString reason( - "ScriptProtocolHandler::dispatchWithNotification failed, ScriptProtocolHandler not initialised" + invokeResult <<= OUString( + "ScriptProtocolHandler::dispatchWithNotification failed, ScriptProtocolHandler not initialised" ); - invokeResult <<= reason; } if ( bCaughtException ) diff --git a/scripting/source/provider/ActiveMSPList.cxx b/scripting/source/provider/ActiveMSPList.cxx index b5d083353f0f..3699af968a8f 100644 --- a/scripting/source/provider/ActiveMSPList.cxx +++ b/scripting/source/provider/ActiveMSPList.cxx @@ -53,12 +53,11 @@ ActiveMSPList::~ActiveMSPList() Reference< provider::XScriptProvider > ActiveMSPList::createNewMSP( const uno::Any& context ) { - OUString serviceName("com.sun.star.script.provider.MasterScriptProvider"); Sequence< Any > args( &context, 1 ); Reference< provider::XScriptProvider > msp( m_xContext->getServiceManager()->createInstanceWithArgumentsAndContext( - serviceName, args, m_xContext ), UNO_QUERY ); + "com.sun.star.script.provider.MasterScriptProvider", args, m_xContext ), UNO_QUERY ); return msp; } diff --git a/scripting/source/provider/ProviderCache.cxx b/scripting/source/provider/ProviderCache.cxx index 65b4fa4f5f02..f4ad90358785 100644 --- a/scripting/source/provider/ProviderCache.cxx +++ b/scripting/source/provider/ProviderCache.cxx @@ -136,7 +136,7 @@ ProviderCache::populateCache() ::osl::Guard< osl::Mutex > aGuard( m_mutex ); try { - OUString languageProviderName( "com.sun.star.script.provider.LanguageScriptProvider" ); + OUString const languageProviderName( "com.sun.star.script.provider.LanguageScriptProvider" ); Reference< container::XContentEnumerationAccess > xEnumAccess( m_xMgr, UNO_QUERY_THROW ); Reference< container::XEnumeration > xEnum = xEnumAccess->createContentEnumeration ( languageProviderName ); @@ -151,11 +151,10 @@ ProviderCache::populateCache() if ( serviceNames.getLength() > 0 ) { - OUString searchString( "com.sun.star.script.provider.ScriptProviderFor" ); - for ( sal_Int32 index = 0; index < serviceNames.getLength(); index++ ) { - if ( serviceNames[ index ].startsWith( searchString ) && !isInBlackList( serviceNames[ index ] ) ) + if ( serviceNames[ index ].startsWith( "com.sun.star.script.provider.ScriptProviderFor" ) + && !isInBlackList( serviceNames[ index ] ) ) { serviceName = serviceNames[ index ]; ProviderDetails details; @@ -186,8 +185,7 @@ ProviderCache::createProvider( ProviderDetails& details ) } catch ( const Exception& e ) { - OUString temp("ProviderCache::createProvider() Error creating provider from factory!!!\n"); - throw RuntimeException( temp.concat( e.Message ) ); + throw RuntimeException( "ProviderCache::createProvider() Error creating provider from factory. " + e.Message ); } return details.provider; diff --git a/scripting/source/stringresource/stringresource.cxx b/scripting/source/stringresource/stringresource.cxx index 4d328e22d716..100af7be69ea 100644 --- a/scripting/source/stringresource/stringresource.cxx +++ b/scripting/source/stringresource/stringresource.cxx @@ -441,8 +441,7 @@ void StringResourceImpl::newLocale( const Locale& locale ) if( getItemForLocale( locale, false ) != nullptr ) { - OUString errorMsg("StringResourceImpl: locale already exists"); - throw ElementExistException( errorMsg ); + throw ElementExistException( "StringResourceImpl: locale already exists" ); } // TODO?: Check if locale is valid? How? @@ -593,8 +592,7 @@ sal_Int32 StringResourceImpl::getUniqueNumericId( ) if( m_nNextUniqueNumericId < UNIQUE_NUMBER_NEEDS_INITIALISATION ) { - OUString errorMsg("getUniqueNumericId: Extended sal_Int32 range"); - throw NoSupportException( errorMsg ); + throw NoSupportException( "getUniqueNumericId: Extended sal_Int32 range" ); } return m_nNextUniqueNumericId; } @@ -739,23 +737,20 @@ void StringResourcePersistenceImpl::implInitializeCommonParameters bool bReadOnlyOk = (aArguments[1] >>= m_bReadOnly); if( !bReadOnlyOk ) { - OUString errorMsg("XInitialization::initialize: Expected ReadOnly flag"); - throw IllegalArgumentException( errorMsg, Reference< XInterface >(), 1 ); + throw IllegalArgumentException( "XInitialization::initialize: Expected ReadOnly flag", Reference< XInterface >(), 1 ); } css::lang::Locale aCurrentLocale; bool bLocaleOk = (aArguments[2] >>= aCurrentLocale); if( !bLocaleOk ) { - OUString errorMsg("XInitialization::initialize: Expected Locale"); - throw IllegalArgumentException( errorMsg, Reference< XInterface >(), 2 ); + throw IllegalArgumentException( "XInitialization::initialize: Expected Locale", Reference< XInterface >(), 2 ); } bool bNameBaseOk = (aArguments[3] >>= m_aNameBase); if( !bNameBaseOk ) { - OUString errorMsg("XInitialization::initialize: Expected NameBase string"); - throw IllegalArgumentException( errorMsg, Reference< XInterface >(), 3 ); + throw IllegalArgumentException( "XInitialization::initialize: Expected NameBase string", Reference< XInterface >(), 3 ); } if( m_aNameBase.isEmpty() ) m_aNameBase = aNameBaseDefaultStr; @@ -763,8 +758,7 @@ void StringResourcePersistenceImpl::implInitializeCommonParameters bool bCommentOk = (aArguments[4] >>= m_aComment); if( !bCommentOk ) { - OUString errorMsg("XInitialization::initialize: Expected Comment string"); - throw IllegalArgumentException( errorMsg, Reference< XInterface >(), 4 ); + throw IllegalArgumentException( "XInitialization::initialize: Expected Comment string", Reference< XInterface >(), 4 ); } implScanLocales(); @@ -2191,8 +2185,7 @@ void StringResourceWithStorageImpl::initialize( const Sequence< Any >& aArgument if( !bOk ) { - OUString errorMsg("StringResourceWithStorageImpl::initialize: invalid storage"); - throw IllegalArgumentException( errorMsg, Reference< XInterface >(), 0 ); + throw IllegalArgumentException( "StringResourceWithStorageImpl::initialize: invalid storage", Reference< XInterface >(), 0 ); } implInitializeCommonParameters( aArguments ); @@ -2352,8 +2345,7 @@ void StringResourceWithStorageImpl::setStorage( const Reference< XStorage >& Sto if( !Storage.is() ) { - OUString errorMsg( "StringResourceWithStorageImpl::setStorage: invalid storage" ); - throw IllegalArgumentException( errorMsg, Reference< XInterface >(), 0 ); + throw IllegalArgumentException( "StringResourceWithStorageImpl::setStorage: invalid storage", Reference< XInterface >(), 0 ); } implLoadAllLocales(); @@ -2660,8 +2652,7 @@ void StringResourceWithLocationImpl::setURL( const OUString& URL ) sal_Int32 nLen = URL.getLength(); if( nLen == 0 ) { - OUString errorMsg( "StringResourceWithLocationImpl::setURL: invalid URL" ); - throw IllegalArgumentException( errorMsg, Reference< XInterface >(), 0 ); + throw IllegalArgumentException( "StringResourceWithLocationImpl::setURL: invalid URL", Reference< XInterface >(), 0 ); } implLoadAllLocales(); |