Skip to content

Commit 3248518

Browse files
committed
Merge pull request opencv#9025 from mshabunin:fix-static-3
2 parents 20f603a + a769d69 commit 3248518

35 files changed

+113
-66
lines changed

modules/calib3d/src/fisheye.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@
4242

4343
#include "precomp.hpp"
4444
#include "fisheye.hpp"
45+
#include <limits>
4546

4647
namespace cv { namespace
4748
{
@@ -760,7 +761,7 @@ double cv::fisheye::calibrate(InputArrayOfArrays objectPoints, InputArrayOfArray
760761

761762

762763
//-------------------------------Optimization
763-
for(int iter = 0; ; ++iter)
764+
for(int iter = 0; iter <= std::numeric_limits<int>::max(); ++iter)
764765
{
765766
if ((criteria.type == 1 && iter >= criteria.maxCount) ||
766767
(criteria.type == 2 && change <= criteria.epsilon) ||

modules/core/src/command_line_parser.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -276,10 +276,10 @@ CommandLineParser& CommandLineParser::operator = (const CommandLineParser& parse
276276
{
277277
if( this != &parser )
278278
{
279+
CV_XADD(&parser.impl->refcount, 1);
279280
if(CV_XADD(&impl->refcount, -1) == 1)
280281
delete impl;
281282
impl = parser.impl;
282-
CV_XADD(&impl->refcount, 1);
283283
}
284284
return *this;
285285
}

modules/core/src/copy.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -283,8 +283,9 @@ void Mat::copyTo( OutputArray _dst ) const
283283
}
284284
_dst.create( dims, size.p, type() );
285285
UMat dst = _dst.getUMat();
286-
286+
CV_Assert(dst.u != NULL);
287287
size_t i, sz[CV_MAX_DIM] = {0}, dstofs[CV_MAX_DIM], esz = elemSize();
288+
CV_Assert(dims >= 0 && dims < CV_MAX_DIM);
288289
for( i = 0; i < (size_t)dims; i++ )
289290
sz[i] = size.p[i];
290291
sz[dims-1] *= esz;

modules/core/src/datastructs.cpp

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2547,6 +2547,7 @@ cvSetAdd( CvSet* set, CvSetElem* element, CvSetElem** inserted_element )
25472547
CV_IMPL void
25482548
cvSetRemove( CvSet* set, int index )
25492549
{
2550+
CV_Assert(set != NULL);
25502551
CvSetElem* elem = cvGetSetElem( set, index );
25512552
if( elem )
25522553
cvSetRemoveByPtr( set, elem );

modules/core/src/matrix.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1129,7 +1129,7 @@ Mat Mat::diag(const Mat& d)
11291129

11301130
int Mat::checkVector(int _elemChannels, int _depth, bool _requireContinuous) const
11311131
{
1132-
return (depth() == _depth || _depth <= 0) &&
1132+
return data && (depth() == _depth || _depth <= 0) &&
11331133
(isContinuous() || !_requireContinuous) &&
11341134
((dims == 2 && (((rows == 1 || cols == 1) && channels() == _elemChannels) ||
11351135
(cols == _elemChannels && channels() == 1))) ||

modules/core/src/persistence.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -804,7 +804,7 @@ cvGetFileNode( CvFileStorage* fs, CvFileNode* _map_node,
804804

805805
if( !map_node )
806806
map_node = (CvFileNode*)cvGetSeqElem( fs->roots, k );
807-
807+
CV_Assert(map_node != NULL);
808808
if( !CV_NODE_IS_MAP(map_node->tag) )
809809
{
810810
if( (!CV_NODE_IS_SEQ(map_node->tag) || map_node->data.seq->total != 0) &&
@@ -6777,6 +6777,7 @@ cvLoad( const char* filename, CvMemStorage* memstorage,
67776777
CvSeqReader reader;
67786778

67796779
node = (CvFileNode*)cvGetSeqElem( (*fs)->roots, k );
6780+
CV_Assert(node != NULL);
67806781
if( !CV_NODE_IS_MAP( node->tag ))
67816782
return 0;
67826783
seq = node->data.seq;

modules/core/src/system.cpp

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1193,10 +1193,13 @@ Mutex::Mutex(const Mutex& m)
11931193

11941194
Mutex& Mutex::operator = (const Mutex& m)
11951195
{
1196-
CV_XADD(&m.impl->refcount, 1);
1197-
if( CV_XADD(&impl->refcount, -1) == 1 )
1198-
delete impl;
1199-
impl = m.impl;
1196+
if (this != &m)
1197+
{
1198+
CV_XADD(&m.impl->refcount, 1);
1199+
if( CV_XADD(&impl->refcount, -1) == 1 )
1200+
delete impl;
1201+
impl = m.impl;
1202+
}
12001203
return *this;
12011204
}
12021205

modules/core/src/trace.cpp

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -225,6 +225,11 @@ Region::LocationExtraData::LocationExtraData(const LocationStaticStorage& locati
225225
ittHandle_name = __itt_string_handle_create(location.name);
226226
ittHandle_filename = __itt_string_handle_create(location.filename);
227227
}
228+
else
229+
{
230+
ittHandle_name = 0;
231+
ittHandle_filename = 0;
232+
}
228233
#endif
229234
}
230235

@@ -1019,6 +1024,10 @@ struct TraceArg::ExtraData
10191024
// Consecutive calls to __itt_string_handle_create with the same name return the same value.
10201025
ittHandle_name = __itt_string_handle_create(arg.name);
10211026
}
1027+
else
1028+
{
1029+
ittHandle_name = 0;
1030+
}
10221031
#endif
10231032
}
10241033
};

modules/dnn/src/dnn.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -317,9 +317,9 @@ class BackendWrapManager
317317

318318
struct LayerData
319319
{
320-
LayerData() {}
320+
LayerData() : id(-1), flag(0) {}
321321
LayerData(int _id, const String &_name, const String &_type, LayerParams &_params)
322-
: id(_id), name(_name), type(_type), params(_params)
322+
: id(_id), name(_name), type(_type), params(_params), flag(0)
323323
{
324324
//add logging info
325325
params.name = name;

modules/dnn/src/layers/convolution_layer.cpp

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -287,7 +287,10 @@ class ConvolutionLayerImpl : public BaseConvolutionLayerImpl
287287
bool is1x1_;
288288
bool useAVX2;
289289

290-
ParallelConv() {}
290+
ParallelConv()
291+
: input_(0), weights_(0), output_(0), ngroups_(0), nstripes_(0),
292+
is1x1_(false), useAVX2(false)
293+
{}
291294

292295
static void run( const Mat& input, Mat& output, const Mat& weights,
293296
const std::vector<float>& biasvec,
@@ -921,7 +924,11 @@ class DeConvolutionLayerImpl : public BaseConvolutionLayerImpl
921924
int nstripes;
922925
bool is1x1;
923926

924-
Col2ImInvoker() {}
927+
Col2ImInvoker()
928+
: data_col(0), biasvec(0), channels(0), height(0), width(0),
929+
kernel_h(0), kernel_w(0), pad_h(0), pad_w(0), stride_h(0), stride_w(0), data_im(0),
930+
height_col(0), width_col(0), nstripes(0), is1x1(0)
931+
{}
925932

926933
static void run(const float* data_col,
927934
int channels, int height, int width,

0 commit comments

Comments
 (0)