[Libreoffice-commits] core.git: scaddins/source scripting/source sdext/source slideshow/source sot/source

Noel Grandin noel.grandin at collabora.co.uk
Mon Jun 26 12:01:21 UTC 2017


 scaddins/source/analysis/bessel.cxx                |    2 
 scaddins/source/pricing/black_scholes.cxx          |    2 
 scripting/source/basprov/basprov.cxx               |    5 --
 scripting/source/dlgprov/dlgprov.cxx               |    7 ---
 scripting/source/stringresource/stringresource.cxx |   45 ++++++---------------
 sdext/source/minimizer/configurationaccess.cxx     |    4 -
 sdext/source/presenter/PresenterAccessibility.cxx  |    3 -
 sdext/source/presenter/PresenterWindowManager.cxx  |    4 -
 slideshow/source/engine/opengl/TransitionImpl.cxx  |   24 +++++------
 sot/source/sdstor/ucbstorage.cxx                   |    3 -
 10 files changed, 35 insertions(+), 64 deletions(-)

New commits:
commit 2fb2d6efdb25f718ddd65709697bc68d81815a59
Author: Noel Grandin <noel.grandin at collabora.co.uk>
Date:   Mon Jun 26 11:44:49 2017 +0200

    loplugin:oncevar in scaddins..sot
    
    Change-Id: I657a131374b9f1153135e00ed429889518b91427
    Reviewed-on: https://gerrit.libreoffice.org/39258
    Reviewed-by: Noel Grandin <noel.grandin at collabora.co.uk>
    Tested-by: Noel Grandin <noel.grandin at collabora.co.uk>

diff --git a/scaddins/source/analysis/bessel.cxx b/scaddins/source/analysis/bessel.cxx
index 0369785987e3..b7fb5ab419d9 100644
--- a/scaddins/source/analysis/bessel.cxx
+++ b/scaddins/source/analysis/bessel.cxx
@@ -80,7 +80,7 @@ double BesselJ( double x, sal_Int32 N )
             throw NoConvergenceException();
     }
 
-    double epsilon = 1.0e-15; // relative error
+    double const epsilon = 1.0e-15; // relative error
     bool bHasfound = false;
     double k= 0.0;
     // e_{-1} = 0; e_0 = alpha_0 / b_2
diff --git a/scaddins/source/pricing/black_scholes.cxx b/scaddins/source/pricing/black_scholes.cxx
index 8a8cd1eb88da..fe111f03858a 100644
--- a/scaddins/source/pricing/black_scholes.cxx
+++ b/scaddins/source/pricing/black_scholes.cxx
@@ -881,7 +881,7 @@ double barrier(double S, double vol, double rd, double rf,
 // discounting and we get the probability
 double prob_hit(double S, double vol, double mu,
                 double tau, double B1, double B2) {
-    double rd=0.0;
+    double const rd=0.0;
     double rf=-mu;
     return 1.0 - touch(S,vol,rd,rf,tau,B1,B2,types::Domestic,types::KnockOut,
                        types::Continuous, types::Value);
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;
diff --git a/sdext/source/minimizer/configurationaccess.cxx b/sdext/source/minimizer/configurationaccess.cxx
index 2206093bc1f7..11e3e8a6d034 100644
--- a/sdext/source/minimizer/configurationaccess.cxx
+++ b/sdext/source/minimizer/configurationaccess.cxx
@@ -113,9 +113,7 @@ void OptimizerSettings::SaveSettingsToConfiguration( const Reference< XNameRepla
 //          Any( maFilterName ),
             Any( mbOpenNewDocument ) };
 
-        sal_Int32 i, nCount = SAL_N_ELEMENTS( pNames );
-
-        for ( i = 0; i < nCount; i++ )
+        for ( int i = 0; i < int(SAL_N_ELEMENTS( pNames )); i++ )
         {
             try
             {
diff --git a/sdext/source/presenter/PresenterAccessibility.cxx b/sdext/source/presenter/PresenterAccessibility.cxx
index 3dd042d6cc79..93392a74c1c1 100644
--- a/sdext/source/presenter/PresenterAccessibility.cxx
+++ b/sdext/source/presenter/PresenterAccessibility.cxx
@@ -1492,8 +1492,7 @@ sal_Int32 SAL_CALL PresenterAccessible::AccessibleParagraph::getIndexAtPoint (
     const css::awt::Point& )
 {
     ThrowIfDisposed();
-    sal_Int32 nIndex (-1);
-    return nIndex;
+    return -1;
 }
 
 OUString SAL_CALL PresenterAccessible::AccessibleParagraph::getSelectedText()
diff --git a/sdext/source/presenter/PresenterWindowManager.cxx b/sdext/source/presenter/PresenterWindowManager.cxx
index f9de66cf2920..70687aac7afb 100644
--- a/sdext/source/presenter/PresenterWindowManager.cxx
+++ b/sdext/source/presenter/PresenterWindowManager.cxx
@@ -330,8 +330,6 @@ void SAL_CALL PresenterWindowManager::disposing (const lang::EventObject& rEvent
 
 bool PresenterWindowManager::PaintChildren (const awt::PaintEvent& rEvent) const
 {
-    bool bChildInvalidated (false);
-
     // Call windowPaint on all children that lie in or touch the
     // update rectangle.
     PresenterPaneContainer::PaneList::const_iterator iPane;
@@ -381,7 +379,7 @@ bool PresenterWindowManager::PaintChildren (const awt::PaintEvent& rEvent) const
         }
     }
 
-    return bChildInvalidated;
+    return false;
 }
 
 void PresenterWindowManager::SetLayoutMode (const LayoutMode eMode)
diff --git a/slideshow/source/engine/opengl/TransitionImpl.cxx b/slideshow/source/engine/opengl/TransitionImpl.cxx
index e28b17f02d89..ad83e50b5dc6 100644
--- a/slideshow/source/engine/opengl/TransitionImpl.cxx
+++ b/slideshow/source/engine/opengl/TransitionImpl.cxx
@@ -73,11 +73,11 @@ OGLTransitionImpl::~OGLTransitionImpl()
 void OGLTransitionImpl::uploadModelViewProjectionMatrices()
 {
     double EyePos(10.0);
-    double RealF(1.0);
-    double RealN(-1.0);
-    double RealL(-1.0);
+    double const RealF(1.0);
+    double const RealN(-1.0);
+    double const RealL(-1.0);
     double RealR(1.0);
-    double RealB(-1.0);
+    double const RealB(-1.0);
     double RealT(1.0);
     double ClipN(EyePos+5.0*RealN);
     double ClipF(EyePos+15.0*RealF);
@@ -1737,11 +1737,11 @@ void VortexTransition::prepareTransition( sal_Int32 glLeavingSlideTex, sal_Int32
     CHECK_GL_ERROR();
 
     double EyePos(10.0);
-    double RealF(1.0);
-    double RealN(-1.0);
-    double RealL(-2.0);
+    double const RealF(1.0);
+    double const RealN(-1.0);
+    double const RealL(-2.0);
     double RealR(2.0);
-    double RealB(-2.0);
+    double const RealB(-2.0);
     double RealT(2.0);
     double ClipN(EyePos+5.0*RealN);
     double ClipF(EyePos+15.0*RealF);
@@ -2135,11 +2135,11 @@ void HoneycombTransition::prepareTransition( sal_Int32 glLeavingSlideTex, sal_In
     CHECK_GL_ERROR();
 
     double EyePos(10.0);
-    double RealF(1.0);
-    double RealN(-1.0);
-    double RealL(-4.0);
+    double const RealF(1.0);
+    double const RealN(-1.0);
+    double const RealL(-4.0);
     double RealR(4.0);
-    double RealB(-4.0);
+    double const RealB(-4.0);
     double RealT(4.0);
     double ClipN(EyePos+5.0*RealN);
     double ClipF(EyePos+15.0*RealF);
diff --git a/sot/source/sdstor/ucbstorage.cxx b/sot/source/sdstor/ucbstorage.cxx
index 67c7582a3b05..25f3d60e4150 100644
--- a/sot/source/sdstor/ucbstorage.cxx
+++ b/sot/source/sdstor/ucbstorage.cxx
@@ -1716,7 +1716,6 @@ void UCBStorage_Impl::ReadContent()
     aProps[1] = "IsFolder";
     aProps[2] = "MediaType";
     aProps[3] = "Size";
-    ::ucbhelper::ResultSetInclude eInclude = ::ucbhelper::INCLUDE_FOLDERS_AND_DOCUMENTS;
 
     try
     {
@@ -1724,7 +1723,7 @@ void UCBStorage_Impl::ReadContent()
         if ( !m_pContent )
             return;
 
-        Reference< XResultSet > xResultSet = m_pContent->createCursor( aProps, eInclude );
+        Reference< XResultSet > xResultSet = m_pContent->createCursor( aProps, ::ucbhelper::INCLUDE_FOLDERS_AND_DOCUMENTS );
         Reference< XRow > xRow( xResultSet, UNO_QUERY );
         if ( xResultSet.is() )
         {


More information about the Libreoffice-commits mailing list