Skip to content

Commit 82ec76c

Browse files
committed
Merge pull request opencv#8990 from mshabunin:fix-static-2
2 parents 1c4fb41 + 32d4af3 commit 82ec76c

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

63 files changed

+238
-94
lines changed

3rdparty/protobuf/src/google/protobuf/io/coded_stream.cc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -577,7 +577,7 @@ std::pair<uint64, bool> CodedInputStream::ReadVarint64Fallback() {
577577
buffer_ = p.second;
578578
return std::make_pair(temp, true);
579579
} else {
580-
uint64 temp;
580+
uint64 temp = 0;
581581
bool success = ReadVarint64Slow(&temp);
582582
return std::make_pair(temp, success);
583583
}

cmake/OpenCVCompilerOptions.cmake

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -127,6 +127,8 @@ if(CMAKE_COMPILER_IS_GNUCXX)
127127
add_extra_compiler_option(-Wpointer-arith)
128128
add_extra_compiler_option(-Wshadow)
129129
add_extra_compiler_option(-Wsign-promo)
130+
add_extra_compiler_option(-Wuninitialized)
131+
add_extra_compiler_option(-Winit-self)
130132

131133
if(ENABLE_NOISY_WARNINGS)
132134
add_extra_compiler_option(-Wcast-align)

modules/calib3d/src/calibration.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -252,7 +252,7 @@ CV_IMPL int cvRodrigues2( const CvMat* src, CvMat* dst, CvMat* jacobian )
252252
{
253253
int depth, elem_size;
254254
int i, k;
255-
double J[27];
255+
double J[27] = {0};
256256
CvMat matJ = cvMat( 3, 9, CV_64F, J );
257257

258258
if( !CV_IS_MAT(src) )
@@ -1189,7 +1189,7 @@ CV_IMPL void cvInitIntrinsicParams2D( const CvMat* objectPoints,
11891189

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

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

@@ -2574,7 +2574,7 @@ CV_IMPL int cvStereoRectifyUncalibrated(
25742574

25752575
int i, j, npoints;
25762576
double cx, cy;
2577-
double u[9], v[9], w[9], f[9], h1[9], h2[9], h0[9], e2[3];
2577+
double u[9], v[9], w[9], f[9], h1[9], h2[9], h0[9], e2[3] = {0};
25782578
CvMat E2 = cvMat( 3, 1, CV_64F, e2 );
25792579
CvMat U = cvMat( 3, 3, CV_64F, u );
25802580
CvMat V = cvMat( 3, 3, CV_64F, v );
@@ -2722,7 +2722,7 @@ CV_IMPL int cvStereoRectifyUncalibrated(
27222722
cvPerspectiveTransform( _m1, _m1, &H0 );
27232723
cvPerspectiveTransform( _m2, _m2, &H2 );
27242724
CvMat A = cvMat( 1, npoints, CV_64FC3, lines1 ), BxBy, B;
2725-
double x[3];
2725+
double x[3] = {0};
27262726
CvMat X = cvMat( 3, 1, CV_64F, x );
27272727
cvConvertPointsHomogeneous( _m1, &A );
27282728
cvReshape( &A, &A, 1, npoints );

modules/calib3d/src/dls.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -720,7 +720,7 @@ class EigenvalueDecomposition {
720720

721721
public:
722722
EigenvalueDecomposition()
723-
: n(0) { }
723+
: n(0), cdivr(0), cdivi(0), d(0), e(0), ort(0), V(0), H(0) {}
724724

725725
// Initializes & computes the Eigenvalue Decomposition for a general matrix
726726
// given in src. This function is a port of the EigenvalueSolver in JAMA,

modules/calib3d/src/epnp.cpp

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ void epnp::choose_control_points(void)
6060
// Take C1, C2, and C3 from PCA on the reference points:
6161
CvMat * PW0 = cvCreateMat(number_of_correspondences, 3, CV_64F);
6262

63-
double pw0tpw0[3 * 3], dc[3], uct[3 * 3];
63+
double pw0tpw0[3 * 3], dc[3] = {0}, uct[3 * 3] = {0};
6464
CvMat PW0tPW0 = cvMat(3, 3, CV_64F, pw0tpw0);
6565
CvMat DC = cvMat(3, 1, CV_64F, dc);
6666
CvMat UCt = cvMat(3, 3, CV_64F, uct);
@@ -240,7 +240,7 @@ void epnp::estimate_R_and_t(double R[3][3], double t[3])
240240
pw0[j] /= number_of_correspondences;
241241
}
242242

243-
double abt[3 * 3], abt_d[3], abt_u[3 * 3], abt_v[3 * 3];
243+
double abt[3 * 3] = {0}, abt_d[3], abt_u[3 * 3], abt_v[3 * 3];
244244
CvMat ABt = cvMat(3, 3, CV_64F, abt);
245245
CvMat ABt_D = cvMat(3, 1, CV_64F, abt_d);
246246
CvMat ABt_U = cvMat(3, 3, CV_64F, abt_u);
@@ -332,7 +332,7 @@ double epnp::reprojection_error(const double R[3][3], const double t[3])
332332
void epnp::find_betas_approx_1(const CvMat * L_6x10, const CvMat * Rho,
333333
double * betas)
334334
{
335-
double l_6x4[6 * 4], b4[4];
335+
double l_6x4[6 * 4], b4[4] = {0};
336336
CvMat L_6x4 = cvMat(6, 4, CV_64F, l_6x4);
337337
CvMat B4 = cvMat(4, 1, CV_64F, b4);
338338

@@ -364,7 +364,7 @@ void epnp::find_betas_approx_1(const CvMat * L_6x10, const CvMat * Rho,
364364
void epnp::find_betas_approx_2(const CvMat * L_6x10, const CvMat * Rho,
365365
double * betas)
366366
{
367-
double l_6x3[6 * 3], b3[3];
367+
double l_6x3[6 * 3], b3[3] = {0};
368368
CvMat L_6x3 = cvMat(6, 3, CV_64F, l_6x3);
369369
CvMat B3 = cvMat(3, 1, CV_64F, b3);
370370

@@ -396,7 +396,7 @@ void epnp::find_betas_approx_2(const CvMat * L_6x10, const CvMat * Rho,
396396
void epnp::find_betas_approx_3(const CvMat * L_6x10, const CvMat * Rho,
397397
double * betas)
398398
{
399-
double l_6x5[6 * 5], b5[5];
399+
double l_6x5[6 * 5], b5[5] = {0};
400400
CvMat L_6x5 = cvMat(6, 5, CV_64F, l_6x5);
401401
CvMat B5 = cvMat(5, 1, CV_64F, b5);
402402

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

509-
double a[6*4], b[6], x[4];
509+
double a[6*4], b[6], x[4] = {0};
510510
CvMat A = cvMat(6, 4, CV_64F, a);
511511
CvMat B = cvMat(6, 1, CV_64F, b);
512512
CvMat X = cvMat(4, 1, CV_64F, x);

modules/calib3d/src/fundam.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -423,7 +423,7 @@ namespace cv
423423

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

769-
double f[9];
769+
double f[9] = {0};
770770
Mat tempF(3, 3, CV_64F, f);
771771
Mat points = _points.getMat(), F = _Fmat.getMat();
772772

modules/calib3d/src/rho.cpp

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -556,7 +556,55 @@ unsigned rhoHest(Ptr<RHO_HEST> p, /* Homography estimation context. */
556556
*/
557557

558558
RHO_HEST_REFC::RHO_HEST_REFC() : initialized(0){
559+
arg.src = 0;
560+
arg.dst = 0;
561+
arg.inl = 0;
562+
arg.N = 0;
563+
arg.maxD = 0;
564+
arg.maxI = 0;
565+
arg.rConvg = 0;
566+
arg.cfd = 0;
567+
arg.minInl = 0;
568+
arg.beta = 0;
569+
arg.flags = 0;
570+
arg.guessH = 0;
571+
arg.finalH = 0;
572+
573+
ctrl.i = 0;
574+
ctrl.phNum = 0;
575+
ctrl.phEndI = 0;
576+
ctrl.phEndFpI = 0;
577+
ctrl.phMax = 0;
578+
ctrl.phNumInl = 0;
579+
ctrl.numModels = 0;
580+
ctrl.smpl = 0;
581+
582+
curr.pkdPts = 0;
583+
curr.H = 0;
584+
curr.inl = 0;
585+
curr.numInl = 0;
586+
587+
best.H = 0;
588+
best.inl = 0;
589+
best.numInl = 0;
590+
591+
nr.size = 0;
592+
nr.beta = 0;
593+
594+
eval.t_M = 0;
595+
eval.m_S = 0;
596+
eval.epsilon = 0;
597+
eval.delta = 0;
598+
eval.A = 0;
599+
eval.Ntested = 0;
600+
eval.Ntestedtotal = 0;
601+
eval.good = 0;
602+
eval.lambdaAccept = 0;
603+
eval.lambdaReject = 0;
559604

605+
lm.JtJ = 0;
606+
lm.tmp1 = 0;
607+
lm.Jte = 0;
560608
}
561609

562610
/**

modules/calib3d/src/upnp.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,7 @@ void upnp::estimate_R_and_t(double R[3][3], double t[3])
175175
pw0[j] /= number_of_correspondences;
176176
}
177177

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

578-
double a[6*4], b[6], x[4];
578+
double a[6*4], b[6], x[4] = {0};
579579
Mat * A = new Mat(6, 4, CV_64F, a);
580580
Mat * B = new Mat(6, 1, CV_64F, b);
581581
Mat * X = new Mat(4, 1, CV_64F, x);

modules/core/include/opencv2/core/hal/intrin_sse.hpp

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,7 @@ struct v_uint8x16
6363
typedef uchar lane_type;
6464
enum { nlanes = 16 };
6565

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

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

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

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

151-
v_uint32x4() {}
151+
v_uint32x4() : val(_mm_setzero_si128()) {}
152152
explicit v_uint32x4(__m128i v) : val(v) {}
153153
v_uint32x4(unsigned v0, unsigned v1, unsigned v2, unsigned v3)
154154
{
@@ -166,7 +166,7 @@ struct v_int32x4
166166
typedef int lane_type;
167167
enum { nlanes = 4 };
168168

169-
v_int32x4() {}
169+
v_int32x4() : val(_mm_setzero_si128()) {}
170170
explicit v_int32x4(__m128i v) : val(v) {}
171171
v_int32x4(int v0, int v1, int v2, int v3)
172172
{
@@ -184,7 +184,7 @@ struct v_float32x4
184184
typedef float lane_type;
185185
enum { nlanes = 4 };
186186

187-
v_float32x4() {}
187+
v_float32x4() : val(_mm_setzero_ps()) {}
188188
explicit v_float32x4(__m128 v) : val(v) {}
189189
v_float32x4(float v0, float v1, float v2, float v3)
190190
{
@@ -202,7 +202,7 @@ struct v_uint64x2
202202
typedef uint64 lane_type;
203203
enum { nlanes = 2 };
204204

205-
v_uint64x2() {}
205+
v_uint64x2() : val(_mm_setzero_si128()) {}
206206
explicit v_uint64x2(__m128i v) : val(v) {}
207207
v_uint64x2(uint64 v0, uint64 v1)
208208
{
@@ -222,7 +222,7 @@ struct v_int64x2
222222
typedef int64 lane_type;
223223
enum { nlanes = 2 };
224224

225-
v_int64x2() {}
225+
v_int64x2() : val(_mm_setzero_si128()) {}
226226
explicit v_int64x2(__m128i v) : val(v) {}
227227
v_int64x2(int64 v0, int64 v1)
228228
{
@@ -242,7 +242,7 @@ struct v_float64x2
242242
typedef double lane_type;
243243
enum { nlanes = 2 };
244244

245-
v_float64x2() {}
245+
v_float64x2() : val(_mm_setzero_pd()) {}
246246
explicit v_float64x2(__m128d v) : val(v) {}
247247
v_float64x2(double v0, double v1)
248248
{
@@ -261,7 +261,7 @@ struct v_float16x4
261261
typedef short lane_type;
262262
enum { nlanes = 4 };
263263

264-
v_float16x4() {}
264+
v_float16x4() : val(_mm_setzero_si128()) {}
265265
explicit v_float16x4(__m128i v) : val(v) {}
266266
v_float16x4(short v0, short v1, short v2, short v3)
267267
{

0 commit comments

Comments
 (0)