- Since t/step can be negative number, min = static_cast<int>(t/step); and
if( min < 0) might cause unexpected behavior.
- Introduce new float tLocation variable instead of direct assigning
t/step to unsigned min variable.
<Prevent message>
CID 436228 (#1 of 1): Unsigned compared against 0 (NO_EFFECT)
unsigned_compare: This less-than-zero comparison of an unsigned value is never true. min < 0U.
95 if( min < 0)
Change-Id: Id1be5aaf7a03f04f9cf61b1ad947f08bacb78563
if( mProgress.Size() < valueCount )
{
float step = 1.0f / (valueCount-1.0f);
- min = static_cast<int>(t/step);
- max = min+1;
- if( min < 0)
+ float tLocation = t/step;
+ if( tLocation < 0)
{
min = 0;
max = 1;
}
- else if( min >= valueCount-1)
+ else if( tLocation >= valueCount-1 )
{
min = max = valueCount-1;
}
+ else
+ {
+ min = static_cast<size_t>(tLocation);
+ max = min+1;
+ }
tLocal =(t - min*step) / step;
}