1
0
mirror of https://github.com/opencv/opencv.git synced 2026-07-29 23:33:05 +04:00

Fixed some issues found by static analysis (4th round)

This commit is contained in:
Maksim Shabunin
2017-06-29 16:40:22 +03:00
parent 64b483c65b
commit e0393f8557
29 changed files with 168 additions and 46 deletions
+16
View File
@@ -5699,13 +5699,20 @@ double norm( const SparseMat& src, int normType )
{
if( normType == NORM_INF )
for( i = 0; i < N; i++, ++it )
{
CV_Assert(it.ptr);
result = std::max(result, std::abs((double)it.value<float>()));
}
else if( normType == NORM_L1 )
for( i = 0; i < N; i++, ++it )
{
CV_Assert(it.ptr);
result += std::abs(it.value<float>());
}
else
for( i = 0; i < N; i++, ++it )
{
CV_Assert(it.ptr);
double v = it.value<float>();
result += v*v;
}
@@ -5714,13 +5721,20 @@ double norm( const SparseMat& src, int normType )
{
if( normType == NORM_INF )
for( i = 0; i < N; i++, ++it )
{
CV_Assert(it.ptr);
result = std::max(result, std::abs(it.value<double>()));
}
else if( normType == NORM_L1 )
for( i = 0; i < N; i++, ++it )
{
CV_Assert(it.ptr);
result += std::abs(it.value<double>());
}
else
for( i = 0; i < N; i++, ++it )
{
CV_Assert(it.ptr);
double v = it.value<double>();
result += v*v;
}
@@ -5747,6 +5761,7 @@ void minMaxLoc( const SparseMat& src, double* _minval, double* _maxval, int* _mi
float minval = FLT_MAX, maxval = -FLT_MAX;
for( i = 0; i < N; i++, ++it )
{
CV_Assert(it.ptr);
float v = it.value<float>();
if( v < minval )
{
@@ -5769,6 +5784,7 @@ void minMaxLoc( const SparseMat& src, double* _minval, double* _maxval, int* _mi
double minval = DBL_MAX, maxval = -DBL_MAX;
for( i = 0; i < N; i++, ++it )
{
CV_Assert(it.ptr);
double v = it.value<double>();
if( v < minval )
{