store/source/stordata.cxx | 4 ++-- svgio/source/svgreader/svgcharacternode.cxx | 2 +- svl/source/numbers/zforfind.cxx | 3 +-- svl/source/numbers/zforlist.cxx | 6 ++---- svtools/source/control/tabbar.cxx | 3 +-- svtools/source/misc/imagemgr.cxx | 4 ++-- svtools/source/misc/langtab.cxx | 6 +++--- svtools/source/svrtf/svparser.cxx | 2 +- svtools/source/uno/popupmenucontrollerbase.cxx | 3 +-- 9 files changed, 14 insertions(+), 19 deletions(-)
New commits: commit a36ada7c5400735b6d03d7215a32ea7e98aacd63 Author: Noel <noelgran...@gmail.com> AuthorDate: Fri Oct 2 13:37:58 2020 +0200 Commit: Noel Grandin <noel.gran...@collabora.co.uk> CommitDate: Sun Oct 4 14:06:37 2020 +0200 loplugin:reducevarscope in store..svtools Change-Id: Iaa6c6eac15cb73fc2a76ba1c5241297c94d297cf Reviewed-on: https://gerrit.libreoffice.org/c/core/+/103839 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk> diff --git a/store/source/stordata.cxx b/store/source/stordata.cxx index 7e989bc43352..f8da50d1a65e 100644 --- a/store/source/stordata.cxx +++ b/store/source/stordata.cxx @@ -590,7 +590,7 @@ OStoreDirectoryPageObject::scope ( { page const & rPage = PAGE(); - sal_uInt32 index0, index1, index2, index3; + sal_uInt32 index0, index1, index2; // direct. sal_uInt32 nCount = OStoreDirectoryDataBlock::directCount; @@ -682,7 +682,7 @@ OStoreDirectoryPageObject::scope ( sal_uInt32 n = nPage; // Reduce to triple indirect i(3), double indirect n. - index3 = n / (nCapacity * nCapacity * nCapacity); + sal_uInt32 index3 = n / (nCapacity * nCapacity * nCapacity); n = n % (nCapacity * nCapacity * nCapacity); // Reduce to double indirect i(2), single indirect n. diff --git a/svgio/source/svgreader/svgcharacternode.cxx b/svgio/source/svgreader/svgcharacternode.cxx index bc4e739eccb8..419a887cc55f 100644 --- a/svgio/source/svgreader/svgcharacternode.cxx +++ b/svgio/source/svgreader/svgcharacternode.cxx @@ -225,11 +225,11 @@ namespace svgio::svgreader { // prepare retval, index and length drawinglayer::primitive2d::TextSimplePortionPrimitive2D* pRetval = nullptr; - sal_uInt32 nIndex(0); sal_uInt32 nLength(getText().getLength()); if(nLength) { + sal_uInt32 nIndex(0); // prepare FontAttribute const SvgStringVector& rFontFamilyVector = rSvgStyleAttributes.getFontFamily(); OUString aFontFamily = rFontFamilyVector.empty() ? diff --git a/svl/source/numbers/zforfind.cxx b/svl/source/numbers/zforfind.cxx index 57a3f0233d45..dfa10d79a41c 100644 --- a/svl/source/numbers/zforfind.cxx +++ b/svl/source/numbers/zforfind.cxx @@ -3698,7 +3698,6 @@ bool ImpSvNumberInputScan::IsNumberFormat( const OUString& rString, // s const SvNumberformat* pFormat, // maybe a number format to match against SvNumInputOptions eInputOptions ) { - OUString aString; bool res; // return value sal_uInt16 k; eSetType = F_Type; // old type set @@ -3714,7 +3713,7 @@ bool ImpSvNumberInputScan::IsNumberFormat( const OUString& rString, // s else { // NoMoreUpperNeeded, all comparisons on UpperCase - aString = pFormatter->GetCharClass()->uppercase( rString ); + OUString aString = pFormatter->GetCharClass()->uppercase( rString ); // convert native number to ASCII if necessary TransformInput(pFormatter, aString); res = IsNumberFormatMain( aString, pFormat ); diff --git a/svl/source/numbers/zforlist.cxx b/svl/source/numbers/zforlist.cxx index de29679297aa..cced64f86d8c 100644 --- a/svl/source/numbers/zforlist.cxx +++ b/svl/source/numbers/zforlist.cxx @@ -1718,7 +1718,6 @@ bool SvNumberFormatter::GetPreviewString(const OUString& sFormatString, { return false; } - sal_uInt32 nKey; if (eLnge == LANGUAGE_DONTKNOW) { eLnge = IniLnge; @@ -1735,7 +1734,7 @@ bool SvNumberFormatter::GetPreviewString(const OUString& sFormatString, if (nCheckPos == 0) // String ok { sal_uInt32 CLOffset = ImpGenerateCL(eLnge); // create new standard formats if necessary - nKey = ImpIsEntry(p_Entry->GetFormatstring(),CLOffset, eLnge); + sal_uInt32 nKey = ImpIsEntry(p_Entry->GetFormatstring(),CLOffset, eLnge); if (nKey != NUMBERFORMAT_ENTRY_NOT_FOUND) // already present { GetOutputString(fPreviewNumber, nKey, sOutString, ppColor, bUseStarFormat); @@ -1872,7 +1871,6 @@ bool SvNumberFormatter::GetPreviewString( const OUString& sFormatString, { return false; } - sal_uInt32 nKey; if (eLnge == LANGUAGE_DONTKNOW) { eLnge = IniLnge; @@ -1890,7 +1888,7 @@ bool SvNumberFormatter::GetPreviewString( const OUString& sFormatString, { // May have to create standard formats for this locale. sal_uInt32 CLOffset = ImpGenerateCL(eLnge); - nKey = ImpIsEntry( p_Entry->GetFormatstring(), CLOffset, eLnge); + sal_uInt32 nKey = ImpIsEntry( p_Entry->GetFormatstring(), CLOffset, eLnge); if (nKey != NUMBERFORMAT_ENTRY_NOT_FOUND) // already present { GetOutputString( sPreviewString, nKey, sOutString, ppColor); diff --git a/svtools/source/control/tabbar.cxx b/svtools/source/control/tabbar.cxx index a6ea801b5e10..14a8e05251f0 100644 --- a/svtools/source/control/tabbar.cxx +++ b/svtools/source/control/tabbar.cxx @@ -2296,7 +2296,6 @@ bool TabBar::StartDrag(const CommandEvent& rCEvt, vcl::Region& rRegion) sal_uInt16 TabBar::ShowDropPos(const Point& rPos) { - sal_uInt16 nDropId; sal_uInt16 nNewDropPos; sal_uInt16 nItemCount = mpImpl->getItemSize(); sal_Int16 nScroll = 0; @@ -2325,7 +2324,7 @@ sal_uInt16 TabBar::ShowDropPos(const Point& rPos) } else { - nDropId = GetPageId(rPos); + sal_uInt16 nDropId = GetPageId(rPos); if (nDropId) { nNewDropPos = GetPagePos(nDropId); diff --git a/svtools/source/misc/imagemgr.cxx b/svtools/source/misc/imagemgr.cxx index 06fc2edfc253..2a3932ac86a5 100644 --- a/svtools/source/misc/imagemgr.cxx +++ b/svtools/source/misc/imagemgr.cxx @@ -323,9 +323,9 @@ static bool GetVolumeProperties_Impl( ::ucbhelper::Content& rContent, svtools::V static SvImageId GetFolderImageId_Impl( const OUString& rURL ) { SvImageId nRet = SvImageId::Folder; - ::svtools::VolumeInfo aVolumeInfo; try { + ::svtools::VolumeInfo aVolumeInfo; ::ucbhelper::Content aCnt( rURL, css::uno::Reference< css::ucb::XCommandEnvironment >(), comphelper::getProcessComponentContext() ); if ( GetVolumeProperties_Impl( aCnt, aVolumeInfo ) ) { @@ -455,10 +455,10 @@ static OUString GetDescriptionByFactory_Impl( const OUString& rFactory ) static const char* GetFolderDescriptionId_Impl( const OUString& rURL ) { const char* pRet = STR_DESCRIPTION_FOLDER; - svtools::VolumeInfo aVolumeInfo; try { ::ucbhelper::Content aCnt( rURL, css::uno::Reference< css::ucb::XCommandEnvironment >(), comphelper::getProcessComponentContext() ); + svtools::VolumeInfo aVolumeInfo; if ( GetVolumeProperties_Impl( aCnt, aVolumeInfo ) ) { if ( aVolumeInfo.m_bIsRemote ) diff --git a/svtools/source/misc/langtab.cxx b/svtools/source/misc/langtab.cxx index 7c655b1f04f6..c5df133b1daf 100644 --- a/svtools/source/misc/langtab.cxx +++ b/svtools/source/misc/langtab.cxx @@ -82,9 +82,9 @@ OUString ApplyLreOrRleEmbedding( const OUString &rText ) if (nLen == 0) return OUString(); - const sal_Unicode cLRE_Embedding = 0x202A; // the start char of an LRE embedding - const sal_Unicode cRLE_Embedding = 0x202B; // the start char of an RLE embedding - const sal_Unicode cPopDirectionalFormat = 0x202C; // the unicode PDF (POP_DIRECTIONAL_FORMAT) char that terminates an LRE/RLE embedding + constexpr sal_Unicode cLRE_Embedding = 0x202A; // the start char of an LRE embedding + constexpr sal_Unicode cRLE_Embedding = 0x202B; // the start char of an RLE embedding + constexpr sal_Unicode cPopDirectionalFormat = 0x202C; // the unicode PDF (POP_DIRECTIONAL_FORMAT) char that terminates an LRE/RLE embedding // check if there are already embedding characters at the strings start // if so change nothing diff --git a/svtools/source/svrtf/svparser.cxx b/svtools/source/svrtf/svparser.cxx index 429e9e045f91..b3aea78145a0 100644 --- a/svtools/source/svrtf/svparser.cxx +++ b/svtools/source/svrtf/svparser.cxx @@ -250,7 +250,6 @@ sal_uInt32 SvParser<T>::GetNextChar() if( RTL_TEXTENCODING_UCS2 == eSrcEnc ) { - sal_Unicode cUC = USHRT_MAX; unsigned char c1, c2; rInput.ReadUChar( c1 ).ReadUChar( c2 ); @@ -262,6 +261,7 @@ sal_uInt32 SvParser<T>::GetNextChar() bErr = !rInput.good(); if( !bErr ) { + sal_Unicode cUC = USHRT_MAX; if( bUCS2BSrcEnc ) cUC = (sal_Unicode(c1) << 8) | c2; else diff --git a/svtools/source/uno/popupmenucontrollerbase.cxx b/svtools/source/uno/popupmenucontrollerbase.cxx index 1b2f6df58c0b..066deda28830 100644 --- a/svtools/source/uno/popupmenucontrollerbase.cxx +++ b/svtools/source/uno/popupmenucontrollerbase.cxx @@ -278,7 +278,6 @@ void SAL_CALL PopupMenuControllerBase::removeStatusListener( OUString PopupMenuControllerBase::determineBaseURL( const OUString& aURL ) { // Just use the main part of the URL for popup menu controllers - sal_Int32 nQueryPart( 0 ); sal_Int32 nSchemePart( 0 ); OUString aMainURL( "vnd.sun.star.popup:" ); @@ -286,7 +285,7 @@ OUString PopupMenuControllerBase::determineBaseURL( const OUString& aURL ) if (( nSchemePart > 0 ) && ( aURL.getLength() > ( nSchemePart+1 ))) { - nQueryPart = aURL.indexOf( '?', nSchemePart ); + sal_Int32 nQueryPart = aURL.indexOf( '?', nSchemePart ); if ( nQueryPart > 0 ) aMainURL += aURL.copy( nSchemePart, nQueryPart-nSchemePart ); else if ( nQueryPart == -1 ) _______________________________________________ Libreoffice-commits mailing list libreoffice-comm...@lists.freedesktop.org https://lists.freedesktop.org/mailman/listinfo/libreoffice-commits