Skip to content

Commit

Permalink
Fixing some static analysis issues
Browse files Browse the repository at this point in the history
  • Loading branch information
mshabunin committed Jun 27, 2017
1 parent b991665 commit 32d4af3
Show file tree
Hide file tree
Showing 63 changed files with 238 additions and 94 deletions.
2 changes: 1 addition & 1 deletion 3rdparty/protobuf/src/google/protobuf/io/coded_stream.cc
Original file line number Diff line number Diff line change
Expand Up @@ -577,7 +577,7 @@ std::pair<uint64, bool> CodedInputStream::ReadVarint64Fallback() {
buffer_ = p.second;
return std::make_pair(temp, true);
} else {
uint64 temp;
uint64 temp = 0;
bool success = ReadVarint64Slow(&temp);
return std::make_pair(temp, success);
}
Expand Down
2 changes: 2 additions & 0 deletions cmake/OpenCVCompilerOptions.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,8 @@ if(CMAKE_COMPILER_IS_GNUCXX)
add_extra_compiler_option(-Wpointer-arith)
add_extra_compiler_option(-Wshadow)
add_extra_compiler_option(-Wsign-promo)
add_extra_compiler_option(-Wuninitialized)
add_extra_compiler_option(-Winit-self)

if(ENABLE_NOISY_WARNINGS)
add_extra_compiler_option(-Wcast-align)
Expand Down
12 changes: 6 additions & 6 deletions modules/calib3d/src/calibration.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -252,7 +252,7 @@ CV_IMPL int cvRodrigues2( const CvMat* src, CvMat* dst, CvMat* jacobian )
{
int depth, elem_size;
int i, k;
double J[27];
double J[27] = {0};
CvMat matJ = cvMat( 3, 9, CV_64F, J );

if( !CV_IS_MAT(src) )
Expand Down Expand Up @@ -1189,7 +1189,7 @@ CV_IMPL void cvInitIntrinsicParams2D( const CvMat* objectPoints,

int i, j, pos, nimages, ni = 0;
double a[9] = { 0, 0, 0, 0, 0, 0, 0, 0, 1 };
double H[9], f[2];
double H[9] = {0}, f[2] = {0};
CvMat _a = cvMat( 3, 3, CV_64F, a );
CvMat matH = cvMat( 3, 3, CV_64F, H );
CvMat _f = cvMat( 2, 1, CV_64F, f );
Expand Down Expand Up @@ -1731,7 +1731,7 @@ void cvCalibrationMatrixValues( const CvMat *calibMatr, CvSize imgSize,
if(!CV_IS_MAT(calibMatr))
CV_Error(CV_StsUnsupportedFormat, "Input parameters must be a matrices!");

double dummy;
double dummy = .0;
Point2d pp;
cv::calibrationMatrixValues(cvarrToMat(calibMatr), imgSize, apertureWidth, apertureHeight,
fovx ? *fovx : dummy,
Expand Down Expand Up @@ -2281,7 +2281,7 @@ void cvStereoRectify( const CvMat* _cameraMatrix1, const CvMat* _cameraMatrix2,
CvMat* matQ, int flags, double alpha, CvSize newImgSize,
CvRect* roi1, CvRect* roi2 )
{
double _om[3], _t[3], _uu[3]={0,0,0}, _r_r[3][3], _pp[3][4];
double _om[3], _t[3] = {0}, _uu[3]={0,0,0}, _r_r[3][3], _pp[3][4];
double _ww[3], _wr[3][3], _z[3] = {0,0,0}, _ri[3][3];
cv::Rect_<float> inner1, inner2, outer1, outer2;

Expand Down Expand Up @@ -2574,7 +2574,7 @@ CV_IMPL int cvStereoRectifyUncalibrated(

int i, j, npoints;
double cx, cy;
double u[9], v[9], w[9], f[9], h1[9], h2[9], h0[9], e2[3];
double u[9], v[9], w[9], f[9], h1[9], h2[9], h0[9], e2[3] = {0};
CvMat E2 = cvMat( 3, 1, CV_64F, e2 );
CvMat U = cvMat( 3, 3, CV_64F, u );
CvMat V = cvMat( 3, 3, CV_64F, v );
Expand Down Expand Up @@ -2722,7 +2722,7 @@ CV_IMPL int cvStereoRectifyUncalibrated(
cvPerspectiveTransform( _m1, _m1, &H0 );
cvPerspectiveTransform( _m2, _m2, &H2 );
CvMat A = cvMat( 1, npoints, CV_64FC3, lines1 ), BxBy, B;
double x[3];
double x[3] = {0};
CvMat X = cvMat( 3, 1, CV_64F, x );
cvConvertPointsHomogeneous( _m1, &A );
cvReshape( &A, &A, 1, npoints );
Expand Down
2 changes: 1 addition & 1 deletion modules/calib3d/src/dls.h
Original file line number Diff line number Diff line change
Expand Up @@ -720,7 +720,7 @@ class EigenvalueDecomposition {

public:
EigenvalueDecomposition()
: n(0) { }
: n(0), cdivr(0), cdivi(0), d(0), e(0), ort(0), V(0), H(0) {}

// Initializes & computes the Eigenvalue Decomposition for a general matrix
// given in src. This function is a port of the EigenvalueSolver in JAMA,
Expand Down
12 changes: 6 additions & 6 deletions modules/calib3d/src/epnp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ void epnp::choose_control_points(void)
// Take C1, C2, and C3 from PCA on the reference points:
CvMat * PW0 = cvCreateMat(number_of_correspondences, 3, CV_64F);

double pw0tpw0[3 * 3], dc[3], uct[3 * 3];
double pw0tpw0[3 * 3], dc[3] = {0}, uct[3 * 3] = {0};
CvMat PW0tPW0 = cvMat(3, 3, CV_64F, pw0tpw0);
CvMat DC = cvMat(3, 1, CV_64F, dc);
CvMat UCt = cvMat(3, 3, CV_64F, uct);
Expand Down Expand Up @@ -240,7 +240,7 @@ void epnp::estimate_R_and_t(double R[3][3], double t[3])
pw0[j] /= number_of_correspondences;
}

double abt[3 * 3], abt_d[3], abt_u[3 * 3], abt_v[3 * 3];
double abt[3 * 3] = {0}, abt_d[3], abt_u[3 * 3], abt_v[3 * 3];
CvMat ABt = cvMat(3, 3, CV_64F, abt);
CvMat ABt_D = cvMat(3, 1, CV_64F, abt_d);
CvMat ABt_U = cvMat(3, 3, CV_64F, abt_u);
Expand Down Expand Up @@ -332,7 +332,7 @@ double epnp::reprojection_error(const double R[3][3], const double t[3])
void epnp::find_betas_approx_1(const CvMat * L_6x10, const CvMat * Rho,
double * betas)
{
double l_6x4[6 * 4], b4[4];
double l_6x4[6 * 4], b4[4] = {0};
CvMat L_6x4 = cvMat(6, 4, CV_64F, l_6x4);
CvMat B4 = cvMat(4, 1, CV_64F, b4);

Expand Down Expand Up @@ -364,7 +364,7 @@ void epnp::find_betas_approx_1(const CvMat * L_6x10, const CvMat * Rho,
void epnp::find_betas_approx_2(const CvMat * L_6x10, const CvMat * Rho,
double * betas)
{
double l_6x3[6 * 3], b3[3];
double l_6x3[6 * 3], b3[3] = {0};
CvMat L_6x3 = cvMat(6, 3, CV_64F, l_6x3);
CvMat B3 = cvMat(3, 1, CV_64F, b3);

Expand Down Expand Up @@ -396,7 +396,7 @@ void epnp::find_betas_approx_2(const CvMat * L_6x10, const CvMat * Rho,
void epnp::find_betas_approx_3(const CvMat * L_6x10, const CvMat * Rho,
double * betas)
{
double l_6x5[6 * 5], b5[5];
double l_6x5[6 * 5], b5[5] = {0};
CvMat L_6x5 = cvMat(6, 5, CV_64F, l_6x5);
CvMat B5 = cvMat(5, 1, CV_64F, b5);

Expand Down Expand Up @@ -506,7 +506,7 @@ void epnp::gauss_newton(const CvMat * L_6x10, const CvMat * Rho, double betas[4]
{
const int iterations_number = 5;

double a[6*4], b[6], x[4];
double a[6*4], b[6], x[4] = {0};
CvMat A = cvMat(6, 4, CV_64F, a);
CvMat B = cvMat(6, 1, CV_64F, b);
CvMat X = cvMat(4, 1, CV_64F, x);
Expand Down
4 changes: 2 additions & 2 deletions modules/calib3d/src/fundam.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -423,7 +423,7 @@ namespace cv

static int run7Point( const Mat& _m1, const Mat& _m2, Mat& _fmatrix )
{
double a[7*9], w[7], u[9*9], v[9*9], c[4], r[3];
double a[7*9], w[7], u[9*9], v[9*9], c[4], r[3] = {0};
double* f1, *f2;
double t0, t1, t2;
Mat A( 7, 9, CV_64F, a );
Expand Down Expand Up @@ -766,7 +766,7 @@ void cv::computeCorrespondEpilines( InputArray _points, int whichImage,
{
CV_INSTRUMENT_REGION()

double f[9];
double f[9] = {0};
Mat tempF(3, 3, CV_64F, f);
Mat points = _points.getMat(), F = _Fmat.getMat();

Expand Down
48 changes: 48 additions & 0 deletions modules/calib3d/src/rho.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -556,7 +556,55 @@ unsigned rhoHest(Ptr<RHO_HEST> p, /* Homography estimation context. */
*/

RHO_HEST_REFC::RHO_HEST_REFC() : initialized(0){
arg.src = 0;
arg.dst = 0;
arg.inl = 0;
arg.N = 0;
arg.maxD = 0;
arg.maxI = 0;
arg.rConvg = 0;
arg.cfd = 0;
arg.minInl = 0;
arg.beta = 0;
arg.flags = 0;
arg.guessH = 0;
arg.finalH = 0;

ctrl.i = 0;
ctrl.phNum = 0;
ctrl.phEndI = 0;
ctrl.phEndFpI = 0;
ctrl.phMax = 0;
ctrl.phNumInl = 0;
ctrl.numModels = 0;
ctrl.smpl = 0;

curr.pkdPts = 0;
curr.H = 0;
curr.inl = 0;
curr.numInl = 0;

best.H = 0;
best.inl = 0;
best.numInl = 0;

nr.size = 0;
nr.beta = 0;

eval.t_M = 0;
eval.m_S = 0;
eval.epsilon = 0;
eval.delta = 0;
eval.A = 0;
eval.Ntested = 0;
eval.Ntestedtotal = 0;
eval.good = 0;
eval.lambdaAccept = 0;
eval.lambdaReject = 0;

lm.JtJ = 0;
lm.tmp1 = 0;
lm.Jte = 0;
}

/**
Expand Down
4 changes: 2 additions & 2 deletions modules/calib3d/src/upnp.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ void upnp::estimate_R_and_t(double R[3][3], double t[3])
pw0[j] /= number_of_correspondences;
}

double abt[3 * 3], abt_d[3], abt_u[3 * 3], abt_v[3 * 3];
double abt[3 * 3] = {0}, abt_d[3], abt_u[3 * 3], abt_v[3 * 3];
Mat ABt = Mat(3, 3, CV_64F, abt);
Mat ABt_D = Mat(3, 1, CV_64F, abt_d);
Mat ABt_U = Mat(3, 3, CV_64F, abt_u);
Expand Down Expand Up @@ -575,7 +575,7 @@ void upnp::gauss_newton(const Mat * L_6x12, const Mat * Rho, double betas[4], do
{
const int iterations_number = 50;

double a[6*4], b[6], x[4];
double a[6*4], b[6], x[4] = {0};
Mat * A = new Mat(6, 4, CV_64F, a);
Mat * B = new Mat(6, 1, CV_64F, b);
Mat * X = new Mat(4, 1, CV_64F, x);
Expand Down
22 changes: 11 additions & 11 deletions modules/core/include/opencv2/core/hal/intrin_sse.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ struct v_uint8x16
typedef uchar lane_type;
enum { nlanes = 16 };

v_uint8x16() {}
v_uint8x16() : val(_mm_setzero_si128()) {}
explicit v_uint8x16(__m128i v) : val(v) {}
v_uint8x16(uchar v0, uchar v1, uchar v2, uchar v3, uchar v4, uchar v5, uchar v6, uchar v7,
uchar v8, uchar v9, uchar v10, uchar v11, uchar v12, uchar v13, uchar v14, uchar v15)
Expand All @@ -86,7 +86,7 @@ struct v_int8x16
typedef schar lane_type;
enum { nlanes = 16 };

v_int8x16() {}
v_int8x16() : val(_mm_setzero_si128()) {}
explicit v_int8x16(__m128i v) : val(v) {}
v_int8x16(schar v0, schar v1, schar v2, schar v3, schar v4, schar v5, schar v6, schar v7,
schar v8, schar v9, schar v10, schar v11, schar v12, schar v13, schar v14, schar v15)
Expand All @@ -109,7 +109,7 @@ struct v_uint16x8
typedef ushort lane_type;
enum { nlanes = 8 };

v_uint16x8() {}
v_uint16x8() : val(_mm_setzero_si128()) {}
explicit v_uint16x8(__m128i v) : val(v) {}
v_uint16x8(ushort v0, ushort v1, ushort v2, ushort v3, ushort v4, ushort v5, ushort v6, ushort v7)
{
Expand All @@ -129,7 +129,7 @@ struct v_int16x8
typedef short lane_type;
enum { nlanes = 8 };

v_int16x8() {}
v_int16x8() : val(_mm_setzero_si128()) {}
explicit v_int16x8(__m128i v) : val(v) {}
v_int16x8(short v0, short v1, short v2, short v3, short v4, short v5, short v6, short v7)
{
Expand All @@ -148,7 +148,7 @@ struct v_uint32x4
typedef unsigned lane_type;
enum { nlanes = 4 };

v_uint32x4() {}
v_uint32x4() : val(_mm_setzero_si128()) {}
explicit v_uint32x4(__m128i v) : val(v) {}
v_uint32x4(unsigned v0, unsigned v1, unsigned v2, unsigned v3)
{
Expand All @@ -166,7 +166,7 @@ struct v_int32x4
typedef int lane_type;
enum { nlanes = 4 };

v_int32x4() {}
v_int32x4() : val(_mm_setzero_si128()) {}
explicit v_int32x4(__m128i v) : val(v) {}
v_int32x4(int v0, int v1, int v2, int v3)
{
Expand All @@ -184,7 +184,7 @@ struct v_float32x4
typedef float lane_type;
enum { nlanes = 4 };

v_float32x4() {}
v_float32x4() : val(_mm_setzero_ps()) {}
explicit v_float32x4(__m128 v) : val(v) {}
v_float32x4(float v0, float v1, float v2, float v3)
{
Expand All @@ -202,7 +202,7 @@ struct v_uint64x2
typedef uint64 lane_type;
enum { nlanes = 2 };

v_uint64x2() {}
v_uint64x2() : val(_mm_setzero_si128()) {}
explicit v_uint64x2(__m128i v) : val(v) {}
v_uint64x2(uint64 v0, uint64 v1)
{
Expand All @@ -222,7 +222,7 @@ struct v_int64x2
typedef int64 lane_type;
enum { nlanes = 2 };

v_int64x2() {}
v_int64x2() : val(_mm_setzero_si128()) {}
explicit v_int64x2(__m128i v) : val(v) {}
v_int64x2(int64 v0, int64 v1)
{
Expand All @@ -242,7 +242,7 @@ struct v_float64x2
typedef double lane_type;
enum { nlanes = 2 };

v_float64x2() {}
v_float64x2() : val(_mm_setzero_pd()) {}
explicit v_float64x2(__m128d v) : val(v) {}
v_float64x2(double v0, double v1)
{
Expand All @@ -261,7 +261,7 @@ struct v_float16x4
typedef short lane_type;
enum { nlanes = 4 };

v_float16x4() {}
v_float16x4() : val(_mm_setzero_si128()) {}
explicit v_float16x4(__m128i v) : val(v) {}
v_float16x4(short v0, short v1, short v2, short v3)
{
Expand Down
Loading

0 comments on commit 32d4af3

Please sign in to comment.