Kaydet (Commit) b678dee6 authored tarafından Jochen Nitschke's avatar Jochen Nitschke Kaydeden (comit) Noel Grandin

cppcheck: variableScope in basic

use a range based loop in one case

Change-Id: I3d3acc35739634797e2b6e4d1cc2909b3fe33750
Reviewed-on: https://gerrit.libreoffice.org/60188
Tested-by: Jenkins
Reviewed-by: 's avatarNoel Grandin <noel.grandin@collabora.co.uk>
üst 85966810
......@@ -551,20 +551,18 @@ void BasicManager::SetLibraryContainerInfo( const LibraryContainerInfo& rInfo )
xLibContainer->addContainerListener( xLibContainerListener );
uno::Sequence< OUString > aScriptLibNames = xScriptCont->getElementNames();
const OUString* pScriptLibName = aScriptLibNames.getConstArray();
sal_Int32 i, nNameCount = aScriptLibNames.getLength();
if( nNameCount )
if( aScriptLibNames.hasElements() )
{
for( i = 0 ; i < nNameCount ; ++i, ++pScriptLibName )
for(const auto& rScriptLibName : aScriptLibNames)
{
uno::Any aLibAny = xScriptCont->getByName( *pScriptLibName );
uno::Any aLibAny = xScriptCont->getByName( rScriptLibName );
if ( *pScriptLibName == "Standard" || *pScriptLibName == "VBAProject")
xScriptCont->loadLibrary( *pScriptLibName );
if ( rScriptLibName == "Standard" || rScriptLibName == "VBAProject")
xScriptCont->loadLibrary( rScriptLibName );
BasMgrContainerListenerImpl::insertLibraryImpl
( xScriptCont, this, aLibAny, *pScriptLibName );
( xScriptCont, this, aLibAny, rScriptLibName );
}
}
else
......
......@@ -2150,7 +2150,6 @@ void SbUnoObject::Notify( SfxBroadcaster& rBC, const SfxHint& rHint )
sal_uInt32 nParamCount = pParams ? (static_cast<sal_uInt32>(pParams->Count()) - 1) : 0;
Sequence<Any> args;
bool bOutParams = false;
sal_uInt32 i;
if( !bInvocation && mxUnoAccess.is() )
{
......@@ -2173,7 +2172,7 @@ void SbUnoObject::Notify( SfxBroadcaster& rBC, const SfxHint& rHint )
{
// Check types
bool bError = false;
for( i = nParamCount ; i < nUnoParamCount ; i++ )
for( sal_uInt32 i = nParamCount ; i < nUnoParamCount ; i++ )
{
const ParamInfo& rInfo = pParamInfos[i];
const Reference< XIdlClass >& rxClass = rInfo.aType;
......@@ -2192,7 +2191,7 @@ void SbUnoObject::Notify( SfxBroadcaster& rBC, const SfxHint& rHint )
{
args.realloc( nAllocParamCount );
Any* pAnyArgs = args.getArray();
for( i = 0 ; i < nParamCount ; i++ )
for( sal_uInt32 i = 0 ; i < nParamCount ; i++ )
{
const ParamInfo& rInfo = pParamInfos[i];
const Reference< XIdlClass >& rxClass = rInfo.aType;
......
......@@ -4323,12 +4323,11 @@ void SbiRuntime::StepDCREATE_IMPL( sal_uInt32 nOp1, sal_uInt32 nOp2 )
sal_Int32 nTotalSize = 0;
// must be a one-dimensional array
sal_Int32 nLower, nUpper, nSize;
sal_Int32 i;
for( i = 0 ; i < nDims ; i++ )
sal_Int32 nLower, nUpper;
for( sal_Int32 i = 0 ; i < nDims ; ++i )
{
pArray->GetDim32( i+1, nLower, nUpper );
nSize = nUpper - nLower + 1;
sal_Int32 nSize = nUpper - nLower + 1;
if( i == 0 )
{
nTotalSize = nSize;
......@@ -4341,7 +4340,7 @@ void SbiRuntime::StepDCREATE_IMPL( sal_uInt32 nOp1, sal_uInt32 nOp2 )
// create objects and insert them into the array
OUString aClass( pImg->GetString( static_cast<short>( nOp2 ) ) );
for( i = 0 ; i < nTotalSize ; i++ )
for( sal_Int32 i = 0 ; i < nTotalSize ; ++i )
{
SbxObject *pClassObj = SbxBase::CreateObject( aClass );
if( !pClassObj )
......
......@@ -453,7 +453,6 @@ void SbxVariable::ClearComListener()
bool SbxVariable::LoadData( SvStream& rStrm, sal_uInt16 nVer )
{
sal_uInt16 nType;
sal_uInt8 cMark;
rStrm.ReadUChar( cMark );
if( cMark == 0xFF )
......@@ -470,6 +469,7 @@ bool SbxVariable::LoadData( SvStream& rStrm, sal_uInt16 nVer )
}
else
{
sal_uInt16 nType;
rStrm.SeekRel( -1 );
rStrm.ReadUInt16( nType );
maName = read_uInt16_lenPrefixed_uInt8s_ToOUString(rStrm,
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment