summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorNoel <noelgrandin@gmail.com>2020-10-02 13:38:33 +0200
committerNoel Grandin <noel.grandin@collabora.co.uk>2020-10-04 14:06:14 +0200
commit27f1827afa11ba9c5d912614dc84dd308ecf8b5f (patch)
tree1c1970f9f2d2eacc2c57ccd0fb1b7e8687652241 /tools
parent2a338d521618333a0630a31b46fd0fc9decbe0e5 (diff)
loplugin:reducevarscope in toolkit..unotools
Change-Id: I439b9f456ac0bfaa3eb9bf17472053bd4787e828 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/103840 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'tools')
-rw-r--r--tools/source/datetime/ttime.cxx8
-rw-r--r--tools/source/zcodec/zcodec.cxx3
2 files changed, 5 insertions, 6 deletions
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<z_stream*>(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 ) );
}