From 9742c9e40fc2e104eaa806b8f02014055d37ed68 Mon Sep 17 00:00:00 2001 From: Noel Date: Mon, 5 Oct 2020 09:28:25 +0200 Subject: loplugin:reducevarscope in extensions Change-Id: I6ba76a8e50d564cd72edc5a3438faef5f3c71bc6 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/103948 Tested-by: Jenkins Reviewed-by: Noel Grandin --- extensions/source/propctrlr/defaultforminspection.cxx | 2 +- extensions/source/propctrlr/formcomponenthandler.cxx | 5 ++--- extensions/source/propctrlr/objectinspectormodel.cxx | 2 +- extensions/source/update/check/updatecheck.cxx | 2 +- 4 files changed, 5 insertions(+), 6 deletions(-) (limited to 'extensions') diff --git a/extensions/source/propctrlr/defaultforminspection.cxx b/extensions/source/propctrlr/defaultforminspection.cxx index b4f491051f5b..809279330ae8 100644 --- a/extensions/source/propctrlr/defaultforminspection.cxx +++ b/extensions/source/propctrlr/defaultforminspection.cxx @@ -180,9 +180,9 @@ namespace pcr return; } - sal_Int32 nMinHelpTextLines( 0 ), nMaxHelpTextLines( 0 ); if ( arguments.size() == 2 ) { // constructor: "createWithHelpSection( long, long )" + sal_Int32 nMinHelpTextLines( 0 ), nMaxHelpTextLines( 0 ); if ( !( arguments[0] >>= nMinHelpTextLines ) || !( arguments[1] >>= nMaxHelpTextLines ) ) throw IllegalArgumentException( OUString(), *this, 0 ); createWithHelpSection( nMinHelpTextLines, nMaxHelpTextLines ); diff --git a/extensions/source/propctrlr/formcomponenthandler.cxx b/extensions/source/propctrlr/formcomponenthandler.cxx index fd71ce028da8..669aa0cacd6a 100644 --- a/extensions/source/propctrlr/formcomponenthandler.cxx +++ b/extensions/source/propctrlr/formcomponenthandler.cxx @@ -395,11 +395,10 @@ namespace pcr sal_Int32 nOldIdCount = aOldIdStrings.getLength(); for ( i = 0; i < nNewCount; ++i ) { - OUString aOldIdStr; OUString aOldPureIdStr; if( i < nOldIdCount ) { - aOldIdStr = pOldIdStrings[i]; + OUString aOldIdStr = pOldIdStrings[i]; aOldPureIdStr = aOldIdStr.copy( 1 ); } OUString aNewPureIdStr = pNewPureIds[i]; @@ -1681,7 +1680,6 @@ namespace pcr { bool bAccuracy = (PROPERTY_ID_DECIMAL_ACCURACY == nActuatingPropId); sal_uInt16 nNewDigits = 0; - bool bUseSep = false; if ( bAccuracy ) { if( ! (_rNewValue >>= nNewDigits) ) @@ -1689,6 +1687,7 @@ namespace pcr } else { + bool bUseSep = false; if( ! (_rNewValue >>= bUseSep) ) SAL_WARN("extensions.propctrlr", "actuatingPropertyChanged: unable to get property " << PROPERTY_ID_SHOWTHOUSANDSEP); } diff --git a/extensions/source/propctrlr/objectinspectormodel.cxx b/extensions/source/propctrlr/objectinspectormodel.cxx index 99447d5c8a3f..6ed1db687aa0 100644 --- a/extensions/source/propctrlr/objectinspectormodel.cxx +++ b/extensions/source/propctrlr/objectinspectormodel.cxx @@ -127,9 +127,9 @@ namespace pcr return; } - sal_Int32 nMinHelpTextLines( 0 ), nMaxHelpTextLines( 0 ); if ( arguments.size() == 3 ) { // constructor: "createWithHandlerFactoriesAndHelpSection( any[], long, long )" + sal_Int32 nMinHelpTextLines( 0 ), nMaxHelpTextLines( 0 ); impl_verifyArgument_throw( arguments[1] >>= nMinHelpTextLines, 2 ); impl_verifyArgument_throw( arguments[2] >>= nMaxHelpTextLines, 3 ); createWithHandlerFactoriesAndHelpSection( factories, nMinHelpTextLines, nMaxHelpTextLines ); diff --git a/extensions/source/update/check/updatecheck.cxx b/extensions/source/update/check/updatecheck.cxx index 485b4e140947..997dc7eccd60 100644 --- a/extensions/source/update/check/updatecheck.cxx +++ b/extensions/source/update/check/updatecheck.cxx @@ -1058,10 +1058,10 @@ UpdateCheck::enableDownload(bool enable, bool paused) { OSL_ASSERT(nullptr == m_pThread); - State eState = DISABLED; if( enable ) { m_pThread = new DownloadThread(m_aCondition, m_xContext, this, m_aUpdateInfo.Sources[0].URL ); + State eState = DISABLED; if( !paused ) { eState = DOWNLOADING; -- cgit