Skip to content

Commit

Permalink
Fixs several problems found by static analysis
Browse files Browse the repository at this point in the history
  • Loading branch information
mshabunin committed Mar 16, 2020
1 parent 2a52e44 commit 7e7bb30
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 1 deletion.
4 changes: 3 additions & 1 deletion modules/calib3d/src/chessboard.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2215,11 +2215,13 @@ int Chessboard::Board::detectMarkers(cv::InputArray image)
cv::Mat mask = cv::Mat::zeros(DUMMY_FIELD_SIZE,DUMMY_FIELD_SIZE,CV_8UC1);
cv::circle(mask,cv::Point(DUMMY_FIELD_SIZE/2,DUMMY_FIELD_SIZE/2),DUMMY_FIELD_SIZE/7,cv::Scalar::all(255),-1);
int signal_size = cv::countNonZero(mask);
CV_Assert(signal_size > 0);

cv::Mat mask2 = cv::Mat::zeros(DUMMY_FIELD_SIZE,DUMMY_FIELD_SIZE,CV_8UC1);
cv::circle(mask2,cv::Point(DUMMY_FIELD_SIZE/2,DUMMY_FIELD_SIZE/2),DUMMY_FIELD_SIZE/2,cv::Scalar::all(255),-1);
cv::circle(mask2,cv::Point(DUMMY_FIELD_SIZE/2,DUMMY_FIELD_SIZE/2),DUMMY_FIELD_SIZE/5,cv::Scalar::all(0),-1);
int noise_size = cv::countNonZero(mask2);
CV_Assert(noise_size > 0);

std::vector<cv::Point2f> dst,src;
dst.push_back(cv::Point2f(0.0F,0.0F));
Expand Down Expand Up @@ -3369,7 +3371,7 @@ cv::Scalar Chessboard::Board::calcEdgeSharpness(cv::InputArray _img,float rise_d
value += patch.at<uint8_t>(0,0);
++count2;
}
values.push_back(uint8_t(value/count2));
values.push_back(count2 > 0 ? uint8_t(value/count2) : 0);
}

float val = calcSharpness(values,rise_distance);
Expand Down
1 change: 1 addition & 0 deletions modules/core/src/persistence.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -704,6 +704,7 @@ class FileStorage::Impl : public FileStorage_API
const char* json_signature = "{";
const char* xml_signature = "<?xml";
char* buf = this->gets(16);
CV_Assert(buf);
char* bufPtr = cv_skip_BOM(buf);
size_t bufOffset = bufPtr - buf;

Expand Down
1 change: 1 addition & 0 deletions modules/features2d/src/kaze/AKAZEFeatures.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1323,6 +1323,7 @@ void quantized_counting_sort(const float a[], const int n,
const float quantum, const int nkeys,
int idx[/*n*/], int cum[/*nkeys + 1*/])
{
CV_Assert(nkeys > 0);
memset(cum, 0, sizeof(cum[0]) * (nkeys + 1));

// Count up the quantized values
Expand Down
2 changes: 2 additions & 0 deletions modules/objdetect/src/qrcode.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1593,6 +1593,8 @@ bool QRDetectMulti::checkPoints(const vector<Point2f>& quadrangle_points)
li2++;
}
}
if (count_w == 0)
return false;

double frac = double(count_b) / double(count_w);
double bottom_bound = 0.76;
Expand Down

0 comments on commit 7e7bb30

Please sign in to comment.