From 27f1827afa11ba9c5d912614dc84dd308ecf8b5f Mon Sep 17 00:00:00 2001 From: Noel Date: Fri, 2 Oct 2020 13:38:33 +0200 Subject: loplugin:reducevarscope in toolkit..unotools Change-Id: I439b9f456ac0bfaa3eb9bf17472053bd4787e828 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/103840 Tested-by: Jenkins Reviewed-by: Noel Grandin --- tools/source/datetime/ttime.cxx | 8 +++----- tools/source/zcodec/zcodec.cxx | 3 ++- 2 files changed, 5 insertions(+), 6 deletions(-) (limited to 'tools') diff --git a/tools/source/datetime/ttime.cxx b/tools/source/datetime/ttime.cxx index 7fbd361573de..356f1994ee4c 100644 --- a/tools/source/datetime/ttime.cxx +++ b/tools/source/datetime/ttime.cxx @@ -401,8 +401,6 @@ Time tools::Time::GetUTCOffset() sal_uInt64 nTicks = tools::Time::GetSystemTicks(); time_t nTime; tm aTM; - sal_Int32 nLocalTime; - sal_Int32 nUTC; short nTempTime; // determine value again if needed @@ -413,17 +411,17 @@ Time tools::Time::GetUTCOffset() { nTime = time( nullptr ); localtime_r( &nTime, &aTM ); - nLocalTime = mktime( &aTM ); + sal_Int32 nLocalTime = mktime( &aTM ); #if defined(__sun) // Solaris gmtime_r() seems not to handle daylight saving time // flags correctly nUTC = nLocalTime + ( aTM.tm_isdst == 0 ? timezone : altzone ); #elif defined( LINUX ) // Linux mktime() seems not to handle tm_isdst correctly - nUTC = nLocalTime - aTM.tm_gmtoff; + sal_Int32 nUTC = nLocalTime - aTM.tm_gmtoff; #else gmtime_r( &nTime, &aTM ); - nUTC = mktime( &aTM ); + sal_Int32 nUTC = mktime( &aTM ); #endif nCacheTicks = nTicks; nCacheSecOffset = (nLocalTime-nUTC) / 60; diff --git a/tools/source/zcodec/zcodec.cxx b/tools/source/zcodec/zcodec.cxx index 525834681ef8..36386b9bb498 100644 --- a/tools/source/zcodec/zcodec.cxx +++ b/tools/source/zcodec/zcodec.cxx @@ -331,7 +331,7 @@ void ZCodec::InitDecompress(SvStream & inStream) auto pStream = static_cast(mpsC_Stream); if ( mbStatus && mbGzLib ) { - sal_uInt8 n1, n2, j, nMethod, nFlags; + sal_uInt8 j, nMethod, nFlags; for (int i : gz_magic) // gz - magic number { inStream.ReadUChar( j ); @@ -349,6 +349,7 @@ void ZCodec::InitDecompress(SvStream & inStream) /* skip the extra field */ if ( nFlags & GZ_EXTRA_FIELD ) { + sal_uInt8 n1, n2; inStream.ReadUChar( n1 ).ReadUChar( n2 ); inStream.SeekRel( n1 + ( n2 << 8 ) ); } -- cgit v1.2.3