summaryrefslogtreecommitdiff
path: root/scripting
diff options
context:
space:
mode:
authorNoel Grandin <noel.grandin@collabora.co.uk>2017-06-26 11:44:49 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2017-06-26 14:00:59 +0200
commit2fb2d6efdb25f718ddd65709697bc68d81815a59 (patch)
treea73b80fb06b773204613b1446256355baea01b51 /scripting
parent3b9d2501b390dfaec7d0a189742fb3305f3742d9 (diff)
loplugin:oncevar in scaddins..sot
Change-Id: I657a131374b9f1153135e00ed429889518b91427 Reviewed-on: https://gerrit.libreoffice.org/39258 Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk> Tested-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'scripting')
-rw-r--r--scripting/source/basprov/basprov.cxx5
-rw-r--r--scripting/source/dlgprov/dlgprov.cxx7
-rw-r--r--scripting/source/stringresource/stringresource.cxx45
3 files changed, 17 insertions, 40 deletions
diff --git a/scripting/source/basprov/basprov.cxx b/scripting/source/basprov/basprov.cxx
index a66367c7382f..4fac2f9cbb51 100644
--- a/scripting/source/basprov/basprov.cxx
+++ b/scripting/source/basprov/basprov.cxx
@@ -158,9 +158,8 @@ namespace basprov
OSL_VERIFY( aFileItem.getFileStatus( aFileStatus ) == osl::FileBase::E_None );
OUString aCanonicalFileURL( aFileStatus.getFileURL() );
- OUString aSearchURL1( "share/basic" );
- OUString aSearchURL2( "share/uno_packages" );
- if( aCanonicalFileURL.indexOf( aSearchURL1 ) != -1 || aCanonicalFileURL.indexOf( aSearchURL2 ) != -1 )
+ if( aCanonicalFileURL.indexOf( "share/basic" ) != -1
+ || aCanonicalFileURL.indexOf( "share/uno_packages" ) != -1 )
bIsShared = true;
}
}
diff --git a/scripting/source/dlgprov/dlgprov.cxx b/scripting/source/dlgprov/dlgprov.cxx
index 883a10d55593..78330cab7785 100644
--- a/scripting/source/dlgprov/dlgprov.cxx
+++ b/scripting/source/dlgprov/dlgprov.cxx
@@ -91,13 +91,12 @@ namespace dlgprov
OUString aDlgName = aInetObj.GetBase();
aInetObj.removeSegment();
OUString aDlgLocation = aInetObj.GetMainURL( INetURLObject::DecodeMechanism::NONE );
- bool bReadOnly = true;
css::lang::Locale aLocale = Application::GetSettings().GetUILanguageTag().getLocale();
OUString aComment;
Sequence<Any> aArgs( 6 );
aArgs[0] <<= aDlgLocation;
- aArgs[1] <<= bReadOnly;
+ aArgs[1] <<= true; // bReadOnly
aArgs[2] <<= aLocale;
aArgs[3] <<= aDlgName;
aArgs[4] <<= aComment;
@@ -242,9 +241,7 @@ namespace dlgprov
throw RuntimeException("No information to create dialog" );
Reference< resource::XStringResourceManager > xStringResourceManager = getStringResourceFromDialogLibrary( m_BasicInfo->mxDlgLib );
- OUString aURL("" );
- Any aDialogSourceURL;
- aDialogSourceURL <<= aURL;
+ Any aDialogSourceURL((OUString()));
Reference< XControlModel > xCtrlModel( createDialogModel( m_BasicInfo->mxInput, xStringResourceManager, aDialogSourceURL ), UNO_QUERY_THROW );
return xCtrlModel;
}
diff --git a/scripting/source/stringresource/stringresource.cxx b/scripting/source/stringresource/stringresource.cxx
index bf151c477311..41579a1cded1 100644
--- a/scripting/source/stringresource/stringresource.cxx
+++ b/scripting/source/stringresource/stringresource.cxx
@@ -345,8 +345,7 @@ void StringResourceImpl::implSetCurrentLocale( const Locale& locale,
void StringResourceImpl::setCurrentLocale( const Locale& locale, sal_Bool FindClosestMatch )
{
- bool bUseDefaultIfNoMatch = false;
- implSetCurrentLocale( locale, FindClosestMatch, bUseDefaultIfNoMatch );
+ implSetCurrentLocale( locale, FindClosestMatch, false/*bUseDefaultIfNoMatch*/ );
}
void StringResourceImpl::setDefaultLocale( const Locale& locale )
@@ -528,8 +527,7 @@ void StringResourceImpl::removeLocale( const Locale& locale )
}
if( m_pCurrentLocaleItem == pRemoveItem )
{
- bool FindClosestMatch = false;
- setCurrentLocale( pFallbackItem->m_locale, FindClosestMatch );
+ setCurrentLocale( pFallbackItem->m_locale, false/*FindClosestMatch*/ );
}
if( m_pDefaultLocaleItem == pRemoveItem )
{
@@ -632,8 +630,7 @@ LocaleItem* StringResourceImpl::getItemForLocale
if( pRetItem == nullptr && bException )
{
- OUString errorMsg("StringResourceImpl: Invalid locale");
- throw IllegalArgumentException( errorMsg, Reference< XInterface >(), 0 );
+ throw IllegalArgumentException( "StringResourceImpl: Invalid locale", Reference< XInterface >(), 0 );
}
return pRetItem;
}
@@ -777,9 +774,7 @@ void StringResourcePersistenceImpl::implInitializeCommonParameters
implScanLocales();
- bool FindClosestMatch = true;
- bool bUseDefaultIfNoMatch = true;
- implSetCurrentLocale( aCurrentLocale, FindClosestMatch, bUseDefaultIfNoMatch );
+ implSetCurrentLocale( aCurrentLocale, true/*FindClosestMatch*/, true/*bUseDefaultIfNoMatch*/ );
}
@@ -902,9 +897,7 @@ void StringResourcePersistenceImpl::storeToStorage( const Reference< XStorage >&
{
::osl::MutexGuard aGuard( getMutex() );
- bool bUsedForStore = false;
- bool bStoreAll = true;
- implStoreAtStorage( NameBase, Comment, Storage, bUsedForStore, bStoreAll );
+ implStoreAtStorage( NameBase, Comment, Storage, false/*bUsedForStore*/, true/*bStoreAll*/ );
}
void StringResourcePersistenceImpl::implStoreAtStorage
@@ -954,13 +947,12 @@ void StringResourcePersistenceImpl::implStoreAtStorage
Storage->openStreamElement( aStreamName, ElementModes::READWRITE );
OUString aPropName("MediaType");
- OUString aMime("text/plain");
uno::Reference< beans::XPropertySet > xProps( xElementStream, uno::UNO_QUERY );
OSL_ENSURE( xProps.is(), "The StorageStream must implement XPropertySet interface!" );
if ( xProps.is() )
{
- xProps->setPropertyValue( aPropName, uno::makeAny( aMime ) );
+ xProps->setPropertyValue( aPropName, uno::makeAny( OUString("text/plain") ) );
aPropName = "UseCommonStoragePasswordEncryption";
xProps->setPropertyValue( aPropName, uno::makeAny( true ) );
@@ -1025,14 +1017,11 @@ void StringResourcePersistenceImpl::storeToURL( const OUString& URL,
{
::osl::MutexGuard aGuard( getMutex() );
- bool bUsedForStore = false;
- bool bStoreAll = true;
-
Reference< ucb::XSimpleFileAccess3 > xFileAccess = ucb::SimpleFileAccess::create(m_xContext);
if( xFileAccess.is() && Handler.is() )
xFileAccess->setInteractionHandler( Handler );
- implStoreAtLocation( URL, NameBase, Comment, xFileAccess, bUsedForStore, bStoreAll );
+ implStoreAtLocation( URL, NameBase, Comment, xFileAccess, false/*bUsedForStore*/, true/*bStoreAll*/ );
}
void StringResourcePersistenceImpl::implKillRemovedLocaleFiles
@@ -1310,10 +1299,9 @@ Sequence< sal_Int8 > StringResourcePersistenceImpl::exportBinary( )
}
// Write header
- sal_Int16 nVersion = 0;
sal_Int16 nLocaleCount16 = (sal_Int16)nLocaleCount;
sal_Int16 iDefault16 = (sal_Int16)iDefault;
- aOut.writeInt16( nVersion );
+ aOut.writeInt16( 0 ); // nVersion
aOut.writeInt16( nLocaleCount16 );
aOut.writeInt16( iDefault16 );
@@ -2323,13 +2311,12 @@ void StringResourceWithStorageImpl::store()
::osl::MutexGuard aGuard( getMutex() );
implCheckReadOnly( "StringResourceWithStorageImpl::store(): Read only" );
- bool bUsedForStore = true;
bool bStoreAll = m_bStorageChanged;
m_bStorageChanged = false;
if( !m_bModified && !bStoreAll )
return;
- implStoreAtStorage( m_aNameBase, m_aComment, m_xStorage, bUsedForStore, bStoreAll );
+ implStoreAtStorage( m_aNameBase, m_aComment, m_xStorage, true/*bUsedForStore*/, bStoreAll );
m_bModified = false;
}
@@ -2512,16 +2499,14 @@ void StringResourceWithLocationImpl::initialize( const Sequence< Any >& aArgumen
if( !bOk )
{
- OUString errorMsg("XInitialization::initialize: invalid URL");
- throw IllegalArgumentException( errorMsg, Reference< XInterface >(), 0 );
+ throw IllegalArgumentException( "XInitialization::initialize: invalid URL", Reference< XInterface >(), 0 );
}
bOk = (aArguments[5] >>= m_xInteractionHandler);
if( !bOk )
{
- OUString errorMsg("StringResourceWithStorageImpl::initialize: invalid type");
- throw IllegalArgumentException( errorMsg, Reference< XInterface >(), 5 );
+ throw IllegalArgumentException( "StringResourceWithStorageImpl::initialize: invalid type", Reference< XInterface >(), 5 );
}
implInitializeCommonParameters( aArguments );
@@ -2629,7 +2614,6 @@ void StringResourceWithLocationImpl::store()
::osl::MutexGuard aGuard( getMutex() );
implCheckReadOnly( "StringResourceWithLocationImpl::store(): Read only" );
- bool bUsedForStore = true;
bool bStoreAll = m_bLocationChanged;
m_bLocationChanged = false;
if( !m_bModified && !bStoreAll )
@@ -2637,7 +2621,7 @@ void StringResourceWithLocationImpl::store()
Reference< ucb::XSimpleFileAccess3 > xFileAccess = getFileAccess();
implStoreAtLocation( m_aLocation, m_aNameBase, m_aComment,
- xFileAccess, bUsedForStore, bStoreAll );
+ xFileAccess, true/*bUsedForStore*/, bStoreAll );
m_bModified = false;
}
@@ -2694,11 +2678,8 @@ void StringResourceWithLocationImpl::setURL( const OUString& URL )
implLoadAllLocales();
// Delete files at old location
- bool bUsedForStore = false;
- bool bStoreAll = false;
- bool bKillAll = true;
implStoreAtLocation( m_aLocation, m_aNameBase, m_aComment,
- getFileAccess(), bUsedForStore, bStoreAll, bKillAll );
+ getFileAccess(), false/*bUsedForStore*/, false/*bStoreAll*/, true/*bKillAll*/ );
m_aLocation = URL;
m_bLocationChanged = true;