summaryrefslogtreecommitdiff
path: root/vcl/source/filter/sgvspln.cxx
diff options
context:
space:
mode:
authorNoel Grandin <noelgrandin@gmail.com>2015-10-14 02:51:05 +0200
committerNoel Grandin <noelgrandin@gmail.com>2015-10-15 06:49:23 +0000
commitb4b7703e4335460cf48bfd6440f116359994c8ff (patch)
tree66b6ab43d6fb13d037160d7384d1a7a93d92940b /vcl/source/filter/sgvspln.cxx
parent90d82f73b89d8a0b0b13d224dbd1a741a10a7fd9 (diff)
cppcheck:variableScope
Change-Id: I9b671637fbe0f32e695d22b74bfb40a39a9fe884 Reviewed-on: https://gerrit.libreoffice.org/19364 Reviewed-by: Noel Grandin <noelgrandin@gmail.com> Tested-by: Noel Grandin <noelgrandin@gmail.com>
Diffstat (limited to 'vcl/source/filter/sgvspln.cxx')
-rw-r--r--vcl/source/filter/sgvspln.cxx16
1 files changed, 8 insertions, 8 deletions
diff --git a/vcl/source/filter/sgvspln.cxx b/vcl/source/filter/sgvspln.cxx
index 1cfaa41f7a8d..58a7a3e25a7f 100644
--- a/vcl/source/filter/sgvspln.cxx
+++ b/vcl/source/filter/sgvspln.cxx
@@ -486,7 +486,7 @@ sal_uInt16 PeriodicSpline(sal_uInt16 n, double* x, double* y,
{ // array dimensions should range from [0..n]!
sal_uInt16 Error;
sal_uInt16 i,im1,nm1; //integer
- double hr,hl;
+ double hl;
std::unique_ptr<double[]> a;
std::unique_ptr<double[]> lowrow;
std::unique_ptr<double[]> ricol;
@@ -506,6 +506,7 @@ sal_uInt16 PeriodicSpline(sal_uInt16 n, double* x, double* y,
c[1]=c[1]/(x[2]-x[0]);
c[2]=-c[1];
} else {
+ double hr;
for (i=1;i<=nm1;i++) {
im1=i-1;
hl=x[i]-x[im1];
@@ -550,8 +551,7 @@ sal_uInt16 ParaSpline(sal_uInt16 n, double* x, double* y, sal_uInt8 MargCond,
{
sal_uInt16 Error;
sal_uInt16 i;
- double deltX,deltY,delt,
- alphX = 0,alphY = 0,
+ double alphX = 0,alphY = 0,
betX = 0,betY = 0;
if (n<2) return 1;
@@ -559,6 +559,7 @@ sal_uInt16 ParaSpline(sal_uInt16 n, double* x, double* y, sal_uInt8 MargCond,
if (!CondT) {
T[0]=0.0;
for (i=0;i<n;i++) {
+ double deltX,deltY,delt;
deltX=x[i+1]-x[i]; deltY=y[i+1]-y[i];
delt =deltX*deltX+deltY*deltY;
if (delt<=0.0) return 3; // two identical adjacent points!
@@ -677,8 +678,8 @@ bool CalcSpline(tools::Polygon& rPoly, bool Periodic, sal_uInt16& n,
bool Spline2Poly(tools::Polygon& rSpln, bool Periodic, tools::Polygon& rPoly)
{
- short MinKoord=-32000; // to prevent
- short MaxKoord=32000; // overflows
+ const short MinKoord = -32000; // to prevent
+ const short MaxKoord = 32000; // overflows
double* ax; // coefficients of the polynoms
double* ay;
@@ -690,8 +691,6 @@ bool Spline2Poly(tools::Polygon& rSpln, bool Periodic, tools::Polygon& rPoly)
double* dy;
double* tv;
- double Step; // stepsize for t
- double dt1,dt2,dt3; // delta t, y, ^3
sal_uInt16 n; // number of partial polynoms to draw
sal_uInt16 i; // actual partial polynom
bool bOk; // all still ok?
@@ -699,7 +698,7 @@ bool Spline2Poly(tools::Polygon& rSpln, bool Periodic, tools::Polygon& rPoly)
bOk=CalcSpline(rSpln,Periodic,n,ax,ay,bx,by,cx,cy,dx,dy,tv);
if (bOk) {
- Step =10;
+ const double Step = 10; // stepsize for t
rPoly.SetSize(1);
rPoly.SetPoint(Point(short(ax[0]),short(ay[0])),0); // first point
@@ -708,6 +707,7 @@ bool Spline2Poly(tools::Polygon& rSpln, bool Periodic, tools::Polygon& rPoly)
double t=tv[i]+Step;
bool bEnd=false; // partial polynom ended?
while (!bEnd) { // extrapolate one partial polynom
+ double dt1,dt2,dt3; // delta t, y, ^3
bEnd=t>=tv[i+1];
if (bEnd) t=tv[i+1];
dt1=t-tv[i]; dt2=dt1*dt1; dt3=dt2*dt1;