1
0
mirror of https://github.com/opencv/opencv.git synced 2026-07-31 00:03:03 +04:00

Fixed several issues found by static analysis

This commit is contained in:
Maksim Shabunin
2017-06-28 16:26:55 +03:00
parent bbb14d3746
commit a769d69a9d
35 changed files with 113 additions and 66 deletions
+2 -2
View File
@@ -317,9 +317,9 @@ private:
struct LayerData
{
LayerData() {}
LayerData() : id(-1), flag(0) {}
LayerData(int _id, const String &_name, const String &_type, LayerParams &_params)
: id(_id), name(_name), type(_type), params(_params)
: id(_id), name(_name), type(_type), params(_params), flag(0)
{
//add logging info
params.name = name;
+9 -2
View File
@@ -287,7 +287,10 @@ public:
bool is1x1_;
bool useAVX2;
ParallelConv() {}
ParallelConv()
: input_(0), weights_(0), output_(0), ngroups_(0), nstripes_(0),
is1x1_(false), useAVX2(false)
{}
static void run( const Mat& input, Mat& output, const Mat& weights,
const std::vector<float>& biasvec,
@@ -921,7 +924,11 @@ public:
int nstripes;
bool is1x1;
Col2ImInvoker() {}
Col2ImInvoker()
: data_col(0), biasvec(0), channels(0), height(0), width(0),
kernel_h(0), kernel_w(0), pad_h(0), pad_w(0), stride_h(0), stride_w(0), data_im(0),
height_col(0), width_col(0), nstripes(0), is1x1(0)
{}
static void run(const float* data_col,
int channels, int height, int width,
@@ -105,7 +105,7 @@ public:
}
};
ElementWiseLayer(const Func &f=Func()) { func = f; }
ElementWiseLayer(const Func &f=Func()) : run_parallel(false) { func = f; }
virtual bool supportBackend(int backendId)
{
+1 -1
View File
@@ -83,10 +83,10 @@ public:
}
PermuteLayerImpl(const LayerParams &params)
: _count(0), _needsPermute(false), _numAxes(0)
{
if (!params.has("order"))
{
_needsPermute = false;
return;
}
@@ -160,6 +160,7 @@ public:
}
PriorBoxLayerImpl(const LayerParams &params)
: _boxWidth(0), _boxHeight(0)
{
setParamsFrom(params);
_minSize = getParameter<unsigned>(params, "min_size");
@@ -94,6 +94,7 @@ class LSTMLayerImpl : public LSTMLayer
public:
LSTMLayerImpl(const LayerParams& params)
: numTimeStamps(0), numSamples(0)
{
setParamsFrom(params);
type = "LSTM";
@@ -307,6 +308,7 @@ class RNNLayerImpl : public RNNLayer
public:
RNNLayerImpl(const LayerParams& params)
: numX(0), numH(0), numO(0), numSamples(0), numTimestamps(0), numSamplesTotal(0), dtype(0)
{
setParamsFrom(params);
type = "RNN";
+2
View File
@@ -556,6 +556,8 @@ static long THDiskFile_readString(THFile *self, const char *format, char **str_)
total += TBRS_BSZ;
p = (char*)THRealloc(p, total);
}
if (p == NULL)
THError("read error: failed to allocate buffer");
if (fgets(p+pos, total-pos, dfself->handle) == NULL) /* eof? */
{
if(pos == 0L)
+1 -1
View File
@@ -876,7 +876,7 @@ struct TorchImporter : public ::cv::dnn::Importer
return mergeId;
}
else if (module->thName == "ConcatTable") {
int newId, splitId;
int newId = -1, splitId;
LayerParams splitParams;
splitId = net.addLayer(generateLayerName("torchSplit"), "Split", splitParams);