fixed various warnings and obvious errors reported by clang compiler and the coverity tool.

This commit is contained in:
Vadim Pisarevsky
2014-08-10 00:10:05 +04:00
parent 09907eeb62
commit 05e7c29de5
11 changed files with 15 additions and 21 deletions

View File

@@ -431,7 +431,7 @@ public:
break;
case GAUSSIAN:
for( i = 0; i < n; j++ )
for( i = 0; i < n; i++ )
{
double* data = sums.ptr<double>(i);
for( j = 0; j < cols; j++ )

View File

@@ -861,9 +861,9 @@ public:
void getValues( int vi, InputArray _sidx, float* values ) const
{
Mat sidx = _sidx.getMat();
int i, n, nsamples = getNSamples();
int i, n = sidx.checkVector(1, CV_32S), nsamples = getNSamples();
CV_Assert( 0 <= vi && vi < getNAllVars() );
CV_Assert( (n = sidx.checkVector(1, CV_32S)) >= 0 );
CV_Assert( n >= 0 );
const int* s = n > 0 ? sidx.ptr<int>() : 0;
if( n == 0 )
n = nsamples;
@@ -938,8 +938,8 @@ public:
{
CV_Assert(buf != 0 && 0 <= sidx && sidx < getNSamples());
Mat vidx = _vidx.getMat();
int i, n, nvars = getNAllVars();
CV_Assert( (n = vidx.checkVector(1, CV_32S)) >= 0 );
int i, n = vidx.checkVector(1, CV_32S), nvars = getNAllVars();
CV_Assert( n >= 0 );
const int* vptr = n > 0 ? vidx.ptr<int>() : 0;
if( n == 0 )
n = nvars;

View File

@@ -1335,9 +1335,9 @@ public:
_responses.convertTo(_yf, CV_32F);
bool ok =
(svmType == ONE_CLASS ? Solver::solve_one_class( _samples, params.nu, kernel, _alpha, sinfo, termCrit ) :
svmType == ONE_CLASS ? Solver::solve_one_class( _samples, params.nu, kernel, _alpha, sinfo, termCrit ) :
svmType == EPS_SVR ? Solver::solve_eps_svr( _samples, _yf, params.p, params.C, kernel, _alpha, sinfo, termCrit ) :
svmType == NU_SVR ? Solver::solve_nu_svr( _samples, _yf, params.nu, params.C, kernel, _alpha, sinfo, termCrit ) : false);
svmType == NU_SVR ? Solver::solve_nu_svr( _samples, _yf, params.nu, params.C, kernel, _alpha, sinfo, termCrit ) : false;
if( !ok )
return false;