summaryrefslogtreecommitdiff
path: root/sc/source/core/tool/interpr8.cxx
diff options
context:
space:
mode:
authorJulien Nabet <serval2412@yahoo.fr>2017-04-16 09:14:39 +0200
committerJulien Nabet <serval2412@yahoo.fr>2017-04-16 10:37:00 +0200
commit22c775b05b37a89e8d64e36d1ec2fb5dfbfa5259 (patch)
treec98301c3fc75cb9fbfcfce52e4dd5199dc30050e /sc/source/core/tool/interpr8.cxx
parente81a35e1a86b6492a68f52ae53c41ee624981ee8 (diff)
cppcheck: arrayIndexThenCheck
Change-Id: Ie3ca646fae94ff5a06a29fc2823a1cacafc3deb1 Reviewed-on: https://gerrit.libreoffice.org/36575 Reviewed-by: Julien Nabet <serval2412@yahoo.fr> Tested-by: Julien Nabet <serval2412@yahoo.fr>
Diffstat (limited to 'sc/source/core/tool/interpr8.cxx')
-rw-r--r--sc/source/core/tool/interpr8.cxx12
1 files changed, 6 insertions, 6 deletions
diff --git a/sc/source/core/tool/interpr8.cxx b/sc/source/core/tool/interpr8.cxx
index 3c3ace2fb8d9..534da1e12b24 100644
--- a/sc/source/core/tool/interpr8.cxx
+++ b/sc/source/core/tool/interpr8.cxx
@@ -238,14 +238,14 @@ bool ScETSForecastCalculation::PreprocessDataRange( const ScMatrixRef& rMatX, co
switch ( nAggregation )
{
case 1 : // AVERAGE (default)
- while ( maRange[ i ].X == maRange[ i - 1 ].X && i < mnCount )
+ while ( i < mnCount && maRange[ i ].X == maRange[ i - 1 ].X )
{
maRange.erase( maRange.begin() + i );
--mnCount;
}
break;
case 7 : // SUM
- while ( maRange[ i ].X == maRange[ i - 1 ].X && i < mnCount )
+ while ( i < mnCount && maRange[ i ].X == maRange[ i - 1 ].X )
{
fTmp += maRange[ i ].Y;
maRange.erase( maRange.begin() + i );
@@ -256,7 +256,7 @@ bool ScETSForecastCalculation::PreprocessDataRange( const ScMatrixRef& rMatX, co
case 2 : // COUNT
case 3 : // COUNTA (same as COUNT as there are no non-numeric Y-values)
- while ( maRange[ i ].X == maRange[ i - 1 ].X && i < mnCount )
+ while ( i < mnCount && maRange[ i ].X == maRange[ i - 1 ].X )
{
nCounter++;
maRange.erase( maRange.begin() + i );
@@ -266,7 +266,7 @@ bool ScETSForecastCalculation::PreprocessDataRange( const ScMatrixRef& rMatX, co
break;
case 4 : // MAX
- while ( maRange[ i ].X == maRange[ i - 1 ].X && i < mnCount )
+ while ( i < mnCount && maRange[ i ].X == maRange[ i - 1 ].X )
{
if ( maRange[ i ].Y > fTmp )
fTmp = maRange[ i ].Y;
@@ -280,7 +280,7 @@ bool ScETSForecastCalculation::PreprocessDataRange( const ScMatrixRef& rMatX, co
{
std::vector< double > aTmp;
aTmp.push_back( maRange[ i - 1 ].Y );
- while ( maRange[ i ].X == maRange[ i - 1 ].X && i < mnCount )
+ while ( i < mnCount && maRange[ i ].X == maRange[ i - 1 ].X )
{
aTmp.push_back( maRange[ i ].Y );
nCounter++;
@@ -297,7 +297,7 @@ bool ScETSForecastCalculation::PreprocessDataRange( const ScMatrixRef& rMatX, co
break;
case 6 : // MIN
- while ( maRange[ i ].X == maRange[ i - 1 ].X && i < mnCount )
+ while ( i < mnCount && maRange[ i ].X == maRange[ i - 1 ].X )
{
if ( maRange[ i ].Y < fTmp )
fTmp = maRange[ i ].Y;