diff options
author | Noel <noelgrandin@gmail.com> | 2020-10-01 14:01:16 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2020-10-01 16:12:20 +0200 |
commit | 38786f1df9ed8324a44c9f2afacb245744b54ebc (patch) | |
tree | 0d346ab1653836a2ac8beebcefa1ecabd005958b /basic | |
parent | 18d4e89fdd63479e20d096c3a578153aa4328aee (diff) |
loplugin:reducevarscope in basctl,basic
Change-Id: I32595921bf5ed26699bced3637302692c407d624
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/103760
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'basic')
-rw-r--r-- | basic/qa/cppunit/basictest.cxx | 2 | ||||
-rw-r--r-- | basic/source/classes/image.cxx | 10 | ||||
-rw-r--r-- | basic/source/runtime/methods.cxx | 3 | ||||
-rw-r--r-- | basic/source/runtime/runtime.cxx | 7 | ||||
-rw-r--r-- | basic/source/uno/scriptcont.cxx | 2 |
5 files changed, 11 insertions, 13 deletions
diff --git a/basic/qa/cppunit/basictest.cxx b/basic/qa/cppunit/basictest.cxx index 4122885ba10c..f1e169ab8acc 100644 --- a/basic/qa/cppunit/basictest.cxx +++ b/basic/qa/cppunit/basictest.cxx @@ -48,11 +48,11 @@ void MacroSnippet::LoadSourceFromFile( const OUString& sMacroFileURL ) if(aFile.open(osl_File_OpenFlag_Read) == osl::FileBase::E_None) { sal_uInt64 size; - sal_uInt64 size_read; if(aFile.getSize(size) == osl::FileBase::E_None) { void* buffer = calloc(1, size+1); CPPUNIT_ASSERT(buffer); + sal_uInt64 size_read; if(aFile.read( buffer, size, size_read) == osl::FileBase::E_None) { if(size == size_read) diff --git a/basic/source/classes/image.cxx b/basic/source/classes/image.cxx index eb127e755f1f..6ce3b8894ca9 100644 --- a/basic/source/classes/image.cxx +++ b/basic/source/classes/image.cxx @@ -117,15 +117,15 @@ bool SbiImage::Load( SvStream& r, sal_uInt32& nVersion ) // Read Master-Record r.ReadUInt16( nSign ).ReadUInt32( nLen ).ReadUInt16( nCount ); sal_uInt64 nLast = r.Tell() + nLen; - sal_uInt32 nCharSet; // System charset - sal_uInt32 lDimBase; - sal_uInt16 nReserved1; - sal_uInt32 nReserved2; - sal_uInt32 nReserved3; bool bBadVer = false; if( nSign == static_cast<sal_uInt16>( FileOffset::Module ) ) { + sal_uInt32 nCharSet; // System charset + sal_uInt32 lDimBase; sal_uInt16 nTmpFlags; + sal_uInt16 nReserved1; + sal_uInt32 nReserved2; + sal_uInt32 nReserved3; r.ReadUInt32( nVersion ).ReadUInt32( nCharSet ).ReadUInt32( lDimBase ) .ReadUInt16( nTmpFlags ).ReadUInt16( nReserved1 ).ReadUInt32( nReserved2 ).ReadUInt32( nReserved3 ); nFlags = static_cast<SbiImageFlags>(nTmpFlags); diff --git a/basic/source/runtime/methods.cxx b/basic/source/runtime/methods.cxx index 78dcbf5097d6..3e8f8d23cd42 100644 --- a/basic/source/runtime/methods.cxx +++ b/basic/source/runtime/methods.cxx @@ -4107,8 +4107,6 @@ void SbRtl_StrConv(StarBASIC *, SbxArray & rPar, bool) OUString aOldStr = rPar.Get32(1)->GetOUString(); sal_Int32 nConversion = rPar.Get32(2)->GetLong(); - LanguageType nLanguage = LANGUAGE_SYSTEM; - sal_Int32 nOldLen = aOldStr.getLength(); if( nOldLen == 0 ) { @@ -4153,6 +4151,7 @@ void SbRtl_StrConv(StarBASIC *, SbxArray & rPar, bool) uno::Reference< uno::XComponentContext > xContext = getProcessComponentContext(); ::utl::TransliterationWrapper aTransliterationWrapper( xContext, nType ); uno::Sequence<sal_Int32> aOffsets; + LanguageType nLanguage = LANGUAGE_SYSTEM; aTransliterationWrapper.loadModuleIfNeeded( nLanguage ); aNewStr = aTransliterationWrapper.transliterate( aOldStr, nLanguage, 0, nOldLen, &aOffsets ); } diff --git a/basic/source/runtime/runtime.cxx b/basic/source/runtime/runtime.cxx index 89fc75f31e8e..498c71628dba 100644 --- a/basic/source/runtime/runtime.cxx +++ b/basic/source/runtime/runtime.cxx @@ -784,7 +784,7 @@ bool SbiRuntime::Step() } SbiOpcode eOp = static_cast<SbiOpcode>( *pCode++ ); - sal_uInt32 nOp1, nOp2; + sal_uInt32 nOp1; if (eOp <= SbiOpcode::SbOP0_END) { (this->*( aStep0[ int(eOp) ] ) )(); @@ -798,7 +798,7 @@ bool SbiRuntime::Step() else if (eOp >= SbiOpcode::SbOP2_START && eOp <= SbiOpcode::SbOP2_END) { nOp1 = *pCode++; nOp1 |= *pCode++ << 8; nOp1 |= *pCode++ << 16; nOp1 |= *pCode++ << 24; - nOp2 = *pCode++; nOp2 |= *pCode++ << 8; nOp2 |= *pCode++ << 16; nOp2 |= *pCode++ << 24; + sal_uInt32 nOp2 = *pCode++; nOp2 |= *pCode++ << 8; nOp2 |= *pCode++ << 16; nOp2 |= *pCode++ << 24; (this->*( aStep2[ int(eOp) - int(SbiOpcode::SbOP2_START) ] ) )( nOp1, nOp2 ); } else @@ -2430,7 +2430,6 @@ void SbiRuntime::StepARGV() void SbiRuntime::StepINPUT() { OUStringBuffer sin; - OUString s; char ch = 0; ErrCode err; // Skip whitespace @@ -2482,7 +2481,7 @@ void SbiRuntime::StepINPUT() } if( !err ) { - s = sin.makeStringAndClear(); + OUString s = sin.makeStringAndClear(); SbxVariableRef pVar = GetTOS(); // try to fill the variable with a numeric value first, // then with a string value diff --git a/basic/source/uno/scriptcont.cxx b/basic/source/uno/scriptcont.cxx index a5d7d02a1931..070d3cbbd74b 100644 --- a/basic/source/uno/scriptcont.cxx +++ b/basic/source/uno/scriptcont.cxx @@ -1026,9 +1026,9 @@ bool SfxScriptLibraryContainer::implLoadPasswordLibrary if( bLoadSource || bVerifyPasswordOnly ) { // Access encrypted source stream - OUString aSourceStreamName( "source.xml" ); try { + OUString aSourceStreamName( "source.xml" ); uno::Reference< io::XStream > xSourceStream = xElementRootStorage->openEncryptedStreamElement( aSourceStreamName, embed::ElementModes::READ, |