summaryrefslogtreecommitdiff
path: root/basegfx
diff options
context:
space:
mode:
authorƁukasz Hryniuk <lukasz.hryniuk@wp.pl>2015-01-04 22:50:05 +0100
committerNoel Grandin <noelgrandin@gmail.com>2015-01-07 06:47:04 +0000
commit9fd89a5952a48b473cee03a2681eb5d4cd6d1742 (patch)
tree1fbf98ba46e86989826adf5d559f51c82d59a5e5 /basegfx
parenta527ad98e58a7fc9af482f9088687d82e5c52cca (diff)
fdo#39440 reduce scope of local variables
Beside scope changes, it fixes lack of initialization in a few places. Change-Id: Ia09fdb9845d8ac17256330a5ec5168401c84f0f2 Reviewed-on: https://gerrit.libreoffice.org/13755 Reviewed-by: Noel Grandin <noelgrandin@gmail.com> Tested-by: Noel Grandin <noelgrandin@gmail.com>
Diffstat (limited to 'basegfx')
-rw-r--r--basegfx/source/workbench/gauss.hxx20
1 files changed, 10 insertions, 10 deletions
diff --git a/basegfx/source/workbench/gauss.hxx b/basegfx/source/workbench/gauss.hxx
index b6a784cbfc6c..fc352fe7e675 100644
--- a/basegfx/source/workbench/gauss.hxx
+++ b/basegfx/source/workbench/gauss.hxx
@@ -49,14 +49,14 @@ bool eliminate( Matrix& matrix,
const BaseType& minPivot )
{
BaseType temp;
- int max, i, j, k; /* *must* be signed, when looping like: j>=0 ! */
+ /* i, j, k *must* be signed, when looping like: j>=0 ! */
/* eliminate below main diagonal */
- for(i=0; i<cols-1; ++i)
+ for(int i=0; i<cols-1; ++i)
{
/* find best pivot */
- max = i;
- for(j=i+1; j<rows; ++j)
+ int max = i;
+ for(int j=i+1; j<rows; ++j)
if( fabs(matrix[ j*cols + i ]) > fabs(matrix[ max*cols + i ]) )
max = j;
@@ -65,7 +65,7 @@ bool eliminate( Matrix& matrix,
return false; /* pivot too small! */
/* interchange rows 'max' and 'i' */
- for(k=0; k<cols; ++k)
+ for(int k=0; k<cols; ++k)
{
temp = matrix[ i*cols + k ];
matrix[ i*cols + k ] = matrix[ max*cols + k ];
@@ -73,8 +73,8 @@ bool eliminate( Matrix& matrix,
}
/* eliminate column */
- for(j=i+1; j<rows; ++j)
- for(k=cols-1; k>=i; --k)
+ for(int j=i+1; j<rows; ++j)
+ for(int k=cols-1; k>=i; --k)
matrix[ j*cols + k ] -= matrix[ i*cols + k ] *
matrix[ j*cols + i ] / matrix[ i*cols + i ];
}
@@ -110,13 +110,13 @@ bool substitute( const Matrix& matrix,
Vector& result )
{
BaseType temp;
- int j,k; /* *must* be signed, when looping like: j>=0 ! */
+ /* j, k *must* be signed, when looping like: j>=0 ! */
/* substitute backwards */
- for(j=rows-1; j>=0; --j)
+ for(int j=rows-1; j>=0; --j)
{
temp = 0.0;
- for(k=j+1; k<cols-1; ++k)
+ for(int k=j+1; k<cols-1; ++k)
temp += matrix[ j*cols + k ] * result[k];
if( matrix[ j*cols + j ] == 0.0 )