summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorMichael Weghorn <m.weghorn@posteo.de>2015-01-17 00:37:31 +0100
committerNoel Grandin <noelgrandin@gmail.com>2015-01-19 06:18:37 +0000
commit5901827bd44dc3600bf66c83882e6847439d59d6 (patch)
tree3e4477e7a25cb10d836f6dcba1c49fcbb9e637d4 /tools
parenta1fb4ac1991a8da2e527b64a0a01a88a8f2959e3 (diff)
fdo#39440 reduce scope of local variables
This addresses some cppcheck warnings. Change-Id: I1cd8b118e2598b8b18fb445851a3bb41e554267b Reviewed-on: https://gerrit.libreoffice.org/13967 Tested-by: Jenkins <ci@libreoffice.org> Reviewed-by: Noel Grandin <noelgrandin@gmail.com>
Diffstat (limited to 'tools')
-rw-r--r--tools/source/generic/bigint.cxx6
-rw-r--r--tools/source/generic/poly.cxx5
2 files changed, 4 insertions, 7 deletions
diff --git a/tools/source/generic/bigint.cxx b/tools/source/generic/bigint.cxx
index 780459707a8b..cf0df72b08d4 100644
--- a/tools/source/generic/bigint.cxx
+++ b/tools/source/generic/bigint.cxx
@@ -310,7 +310,6 @@ void BigInt::MultLong( const BigInt& rB, BigInt& rErg ) const
void BigInt::DivLong( const BigInt& rB, BigInt& rErg ) const
{
int i, j;
- long nTmp;
sal_uInt16 nK, nQ, nMult;
short nLenB = rB.nLen;
short nLenB1 = rB.nLen - 1;
@@ -329,7 +328,7 @@ void BigInt::DivLong( const BigInt& rB, BigInt& rErg ) const
for (j = aTmpA.nLen - 1; j >= nLenB; j--)
{ // guess divisor
- nTmp = ( (long)aTmpA.nNum[j] << 16 ) + aTmpA.nNum[j - 1];
+ long nTmp = ( (long)aTmpA.nNum[j] << 16 ) + aTmpA.nNum[j - 1];
if (aTmpA.nNum[j] == aTmpB.nNum[nLenB1])
nQ = 0xFFFF;
else
@@ -379,7 +378,6 @@ void BigInt::DivLong( const BigInt& rB, BigInt& rErg ) const
void BigInt::ModLong( const BigInt& rB, BigInt& rErg ) const
{
short i, j;
- long nTmp;
sal_uInt16 nK, nQ, nMult;
short nLenB = rB.nLen;
short nLenB1 = rB.nLen - 1;
@@ -398,7 +396,7 @@ void BigInt::ModLong( const BigInt& rB, BigInt& rErg ) const
for (j = aTmpA.nLen - 1; j >= nLenB; j--)
{ // Guess divisor
- nTmp = ( (long)aTmpA.nNum[j] << 16 ) + aTmpA.nNum[j - 1];
+ long nTmp = ( (long)aTmpA.nNum[j] << 16 ) + aTmpA.nNum[j - 1];
if (aTmpA.nNum[j] == aTmpB.nNum[nLenB1])
nQ = 0xFFFF;
else
diff --git a/tools/source/generic/poly.cxx b/tools/source/generic/poly.cxx
index e949835f8b56..5df7ef3db1ff 100644
--- a/tools/source/generic/poly.cxx
+++ b/tools/source/generic/poly.cxx
@@ -1069,7 +1069,6 @@ void Polygon::Rotate( const Point& rCenter, double fSin, double fCos )
{
ImplMakeUnique();
- long nX, nY;
long nCenterX = rCenter.X();
long nCenterY = rCenter.Y();
@@ -1077,8 +1076,8 @@ void Polygon::Rotate( const Point& rCenter, double fSin, double fCos )
{
Point& rPt = mpImplPolygon->mpPointAry[ i ];
- nX = rPt.X() - nCenterX;
- nY = rPt.Y() - nCenterY;
+ const long nX = rPt.X() - nCenterX;
+ const long nY = rPt.Y() - nCenterY;
rPt.X() = (long) FRound( fCos * nX + fSin * nY ) + nCenterX;
rPt.Y() = -(long) FRound( fSin * nX - fCos * nY ) + nCenterY;
}