From 93124f771062eb2917212c16a64b0a67f5baaff4 Mon Sep 17 00:00:00 2001 From: Michael Weghorn Date: Sat, 6 Dec 2014 01:31:14 +0100 Subject: reduce scope of local variables This eliminates some of the warnings from Cppcheck report of 2014-11-29. Change-Id: Ic4bf3bd8f5982d2ea2f25a28c0dd61084c59af11 Reviewed-on: https://gerrit.libreoffice.org/13331 Reviewed-by: Samuel Mehrbrodt Tested-by: Samuel Mehrbrodt --- basic/source/classes/eventatt.cxx | 2 +- basic/source/classes/sbunoobj.cxx | 2 +- basic/source/comp/scanner.cxx | 3 +-- basic/source/runtime/ddectrl.cxx | 3 +-- basic/source/uno/namecont.cxx | 3 +-- 5 files changed, 5 insertions(+), 8 deletions(-) (limited to 'basic') diff --git a/basic/source/classes/eventatt.cxx b/basic/source/classes/eventatt.cxx index 3718e16de60a..d7f97ab7795c 100644 --- a/basic/source/classes/eventatt.cxx +++ b/basic/source/classes/eventatt.cxx @@ -464,9 +464,9 @@ void RTL_Impl_CreateUnoDialog( StarBASIC* pBasic, SbxArray& rPar, bool bWrite ) uno::Reference< beans::XPropertySet > xDlgModPropSet( xDialogModel, uno::UNO_QUERY ); if( xDlgModPropSet.is() ) { - bool bDecoration = true; try { + bool bDecoration = true; OUString aDecorationPropName("Decoration"); Any aDecorationAny = xDlgModPropSet->getPropertyValue( aDecorationPropName ); aDecorationAny >>= bDecoration; diff --git a/basic/source/classes/sbunoobj.cxx b/basic/source/classes/sbunoobj.cxx index 36e419eab68a..0627a7f3981d 100644 --- a/basic/source/classes/sbunoobj.cxx +++ b/basic/source/classes/sbunoobj.cxx @@ -3630,7 +3630,6 @@ void SbUnoService::SFX_NOTIFY( SfxBroadcaster& rBC, const TypeId& rBCType, // Parameter count -1 because of Param0 == this sal_uInt32 nParamCount = pParams ? ((sal_uInt32)pParams->Count() - 1) : 0; Sequence args; - bool bOutParams = false; Reference< XServiceConstructorDescription > xCtor = pUnoCtor->getServiceCtorDesc(); Sequence< Reference< XParameter > > aParameterSeq = xCtor->getParameters(); @@ -3689,6 +3688,7 @@ void SbUnoService::SFX_NOTIFY( SfxBroadcaster& rBC, const TypeId& rBCType, if( !bParameterError ) { + bool bOutParams = false; if( nAllocParamCount > 0 ) { args.realloc( nAllocParamCount ); diff --git a/basic/source/comp/scanner.cxx b/basic/source/comp/scanner.cxx index 6065e2692069..7708bc91ee1d 100644 --- a/basic/source/comp/scanner.cxx +++ b/basic/source/comp/scanner.cxx @@ -440,7 +440,6 @@ bool SbiScanner::NextSym() // Hex literals are signed Integers ( as defined by basic // e.g. -2,147,483,648 through 2,147,483,647 (signed) sal_uInt32 lu = 0; - int i; bool bBufOverflow = false; while(nCol < aLine.getLength() && theBasicCharClass::get().isAlphaNumeric(aLine[nCol] & 0xFF, bCompatible)) { @@ -461,7 +460,7 @@ bool SbiScanner::NextSym() *p = 0; for( p = buf; *p; ++p ) { - i = (*p & 0xFF) - '0'; + int i = (*p & 0xFF) - '0'; if( i > 9 ) i -= 7; lu = ( lu * base ) + i; if( !ndig-- ) diff --git a/basic/source/runtime/ddectrl.cxx b/basic/source/runtime/ddectrl.cxx index 96412890bd80..2557c9e9fafd 100644 --- a/basic/source/runtime/ddectrl.cxx +++ b/basic/source/runtime/ddectrl.cxx @@ -140,10 +140,9 @@ SbError SbiDdeControl::Terminate( size_t nChannel ) SbError SbiDdeControl::TerminateAll() { - DdeConnection *conv; for (size_t nChannel = 0; nChannel < aConvList.size(); ++nChannel) { - conv = aConvList[nChannel]; + DdeConnection *conv = aConvList[nChannel]; if (conv != DDE_FREECHANNEL) { diff --git a/basic/source/uno/namecont.cxx b/basic/source/uno/namecont.cxx index d95596d7bfc5..f9a5fd50bd1f 100644 --- a/basic/source/uno/namecont.cxx +++ b/basic/source/uno/namecont.cxx @@ -1681,11 +1681,10 @@ bool SfxLibraryContainer::implLoadLibraryIndexFile( SfxLibrary* pLib, { Reference< XParser > xParser = xml::sax::Parser::create(mxContext); - bool bLink = false; bool bStorage = false; if( pLib ) { - bLink = pLib->mbLink; + bool bLink = pLib->mbLink; bStorage = xStorage.is() && !bLink; } -- cgit