summaryrefslogtreecommitdiff
path: root/desktop
diff options
context:
space:
mode:
authorNoel <noelgrandin@gmail.com>2020-10-02 09:36:35 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2020-10-02 10:46:46 +0200
commit268a49f473c1830be269a7db5f561e3681134bbd (patch)
tree259debcc224b3f211125ca6615b4fc25b2dcdeb2 /desktop
parenta282c9700806bc17710e8b2186b306d2a90928ee (diff)
loplugin:reducevarscope in desktop..emfio
Change-Id: I25ca760ae15114ada621d928997a7117401c75d1 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/103811 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'desktop')
-rw-r--r--desktop/source/app/app.cxx2
-rw-r--r--desktop/source/app/dispatchwatcher.cxx2
-rw-r--r--desktop/source/deployment/gui/dp_gui_extlistbox.cxx2
-rw-r--r--desktop/source/deployment/gui/dp_gui_service.cxx2
-rw-r--r--desktop/source/deployment/registry/help/dp_help.cxx2
-rw-r--r--desktop/source/lib/init.cxx7
-rw-r--r--desktop/source/migration/services/oo3extensionmigration.cxx3
-rw-r--r--desktop/source/splash/splash.cxx6
8 files changed, 11 insertions, 15 deletions
diff --git a/desktop/source/app/app.cxx b/desktop/source/app/app.cxx
index dd38a74aa89e..1276a2c598f2 100644
--- a/desktop/source/app/app.cxx
+++ b/desktop/source/app/app.cxx
@@ -632,7 +632,6 @@ OUString Desktop::CreateErrorMsgString(
const OUString& aFileURL )
{
OUString aMsg;
- OUString aFilePath;
bool bFileInfo = true;
switch ( nFailureCode )
@@ -708,6 +707,7 @@ OUString Desktop::CreateErrorMsgString(
if ( bFileInfo )
{
OUString aMsgString( aMsg );
+ OUString aFilePath;
osl::File::getSystemPathFromFileURL( aFileURL, aFilePath );
diff --git a/desktop/source/app/dispatchwatcher.cxx b/desktop/source/app/dispatchwatcher.cxx
index 450fd0e1e207..ec566181ce52 100644
--- a/desktop/source/app/dispatchwatcher.cxx
+++ b/desktop/source/app/dispatchwatcher.cxx
@@ -216,10 +216,10 @@ void scriptCat(const Reference< XModel >& xDoc )
{
OUString &rObjectName = aObjectNames[j];
- OUString aCodeString;
try
{
Any aCode = xContainer->getByName( rObjectName );
+ OUString aCodeString;
if (! (aCode >>= aCodeString ) )
std::cout << "[" << rObjectName << "] - error fetching code\n";
diff --git a/desktop/source/deployment/gui/dp_gui_extlistbox.cxx b/desktop/source/deployment/gui/dp_gui_extlistbox.cxx
index 89aaed148346..ccf546d713b7 100644
--- a/desktop/source/deployment/gui/dp_gui_extlistbox.cxx
+++ b/desktop/source/deployment/gui/dp_gui_extlistbox.cxx
@@ -894,7 +894,6 @@ void ExtensionBox_Impl::addEventListenerOnce(
void ExtensionBox_Impl::addEntry( const uno::Reference< deployment::XPackage > &xPackage,
bool bLicenseMissing )
{
- long nPos = 0;
PackageState eState = TheExtensionManager::getPackageState( xPackage );
bool bLocked = m_pManager->isReadOnly( xPackage );
@@ -906,6 +905,7 @@ void ExtensionBox_Impl::addEntry( const uno::Reference< deployment::XPackage > &
{
osl::MutexGuard guard(m_entriesMutex);
+ long nPos = 0;
if (m_vEntries.empty())
{
addEventListenerOnce(xPackage);
diff --git a/desktop/source/deployment/gui/dp_gui_service.cxx b/desktop/source/deployment/gui/dp_gui_service.cxx
index 0d0315f0daaa..fb36589e01c5 100644
--- a/desktop/source/deployment/gui/dp_gui_service.cxx
+++ b/desktop/source/deployment/gui/dp_gui_service.cxx
@@ -140,9 +140,9 @@ ServiceImpl::ServiceImpl( Sequence<Any> const& args,
m_bShowUpdateOnly( false )
{
/* if true then this service is running in a unopkg process and not in an office process */
- std::optional<sal_Bool> unopkg;
std::optional<OUString> view;
try {
+ std::optional<sal_Bool> unopkg;
comphelper::unwrapArgs( args, m_parent, view, unopkg );
return;
} catch ( const css::lang::IllegalArgumentException & ) {
diff --git a/desktop/source/deployment/registry/help/dp_help.cxx b/desktop/source/deployment/registry/help/dp_help.cxx
index 594196155db8..49be2a23f87d 100644
--- a/desktop/source/deployment/registry/help/dp_help.cxx
+++ b/desktop/source/deployment/registry/help/dp_help.cxx
@@ -507,9 +507,9 @@ void BackendImpl::implProcessHelp(
sal_Unicode const nCR = 13, nLF = 10;
sal_Int32 nSearchCR = aErrMsg.indexOf( nCR );
sal_Int32 nSearchLF = aErrMsg.indexOf( nLF );
- sal_Int32 nCopy;
if( nSearchCR != -1 || nSearchLF != -1 )
{
+ sal_Int32 nCopy;
if( nSearchCR == -1 )
nCopy = nSearchLF;
else if( nSearchLF == -1 )
diff --git a/desktop/source/lib/init.cxx b/desktop/source/lib/init.cxx
index e56a925ccb39..d8a7f0b4291f 100644
--- a/desktop/source/lib/init.cxx
+++ b/desktop/source/lib/init.cxx
@@ -317,7 +317,6 @@ static uno::Any jsonToUnoAny(const boost::property_tree::ptree& aTree)
uno::Any aAny;
uno::Any aValue;
sal_Int32 nFields;
- uno::TypeClass aTypeClass;
uno::Reference< reflection::XIdlField > aField;
boost::property_tree::ptree aNodeNull, aNodeValue, aNodeField;
const std::string& rType = aTree.get<std::string>("type", "");
@@ -327,7 +326,7 @@ static uno::Any jsonToUnoAny(const boost::property_tree::ptree& aTree)
css::reflection::theCoreReflection::get(comphelper::getProcessComponentContext())->forName(OUString::fromUtf8(rType.c_str()));
if (xIdlClass.is())
{
- aTypeClass = xIdlClass->getTypeClass();
+ uno::TypeClass aTypeClass = xIdlClass->getTypeClass();
xIdlClass->createObject(aAny);
aFields = xIdlClass->getFields();
nFields = aFields.getLength();
@@ -787,8 +786,7 @@ void ExecuteOrientationChange()
std::unique_ptr<SvxLongULSpaceItem> pPageULMarginItem(new SvxLongULSpaceItem( 0, 0, SID_ATTR_PAGE_ULSPACE ));
// 1mm in twips rounded
// This should be in sync with MINBODY in sw/source/uibase/sidebar/PageMarginControl.hxx
- const long MINBODY = 56;
- bool bIsLandscape = false;
+ constexpr long MINBODY = 56;
css::uno::Reference< css::document::XUndoManager > mxUndoManager(
getUndoManager( SfxViewFrame::Current()->GetFrame().GetFrameInterface() ) );
@@ -815,6 +813,7 @@ void ExecuteOrientationChange()
{
+ bool bIsLandscape = false;
if ( pPageSizeItem->GetSize().Width() > pPageSizeItem->GetSize().Height())
bIsLandscape = true;
diff --git a/desktop/source/migration/services/oo3extensionmigration.cxx b/desktop/source/migration/services/oo3extensionmigration.cxx
index a9e045ca0a77..6b68272db60a 100644
--- a/desktop/source/migration/services/oo3extensionmigration.cxx
+++ b/desktop/source/migration/services/oo3extensionmigration.cxx
@@ -118,12 +118,11 @@ OO3ExtensionMigration::ScanResult OO3ExtensionMigration::scanExtensionFolder( co
{
if (item.getFileStatus(fs) == osl::FileBase::E_None)
{
- OUString aDirEntryURL;
if (fs.getFileType() == osl::FileStatus::Directory)
aDirectories.push_back( fs.getFileURL() );
else
{
- aDirEntryURL = fs.getFileURL();
+ OUString aDirEntryURL = fs.getFileURL();
if ( aDirEntryURL.indexOf( "/description.xml" ) > 0 )
aResult = scanDescriptionXml( aDirEntryURL ) ? SCANRESULT_MIGRATE_EXTENSION : SCANRESULT_DONTMIGRATE_EXTENSION;
}
diff --git a/desktop/source/splash/splash.cxx b/desktop/source/splash/splash.cxx
index 34c77e9bd827..a71224b985af 100644
--- a/desktop/source/splash/splash.cxx
+++ b/desktop/source/splash/splash.cxx
@@ -495,8 +495,6 @@ void SplashScreen::determineProgressRatioValues(
double& rXRelPos, double& rYRelPos,
double& rRelWidth, double& rRelHeight )
{
- sal_Int32 nWidth( 0 );
- sal_Int32 nHeight( 0 );
sal_Int32 nScreenRatio( 0 );
// determine desktop resolution
@@ -505,8 +503,8 @@ void SplashScreen::determineProgressRatioValues(
{
// retrieve size from first screen
tools::Rectangle aScreenArea = Application::GetScreenPosSizePixel(static_cast<unsigned int>(0));
- nWidth = aScreenArea.GetWidth();
- nHeight = aScreenArea.GetHeight();
+ sal_Int32 nWidth = aScreenArea.GetWidth();
+ sal_Int32 nHeight = aScreenArea.GetHeight();
nScreenRatio = nHeight ? sal_Int32( rtl::math::round( double( nWidth ) / double( nHeight ), 2 ) * 100 ) : 0;
}