Skip to content

Commit

Permalink
Merge pull request #2007 from stweil/lgtm
Browse files Browse the repository at this point in the history
Fix some issues reported by LGTM
  • Loading branch information
zdenop committed Oct 19, 2018
2 parents d1d73b9 + 830b9c7 commit 06a4f15
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 6 deletions.
2 changes: 1 addition & 1 deletion src/ccstruct/blobbox.h
Expand Up @@ -519,7 +519,7 @@ class BLOBNBOX:public ELIST_LINK
C_BLOB *cblob_ptr; // edgestep blob
TBOX box; // bounding box
TBOX red_box; // bounding box
int area:30; // enclosed area
signed int area:30; // enclosed area
unsigned joined : 1; // joined to prev
unsigned reduced : 1; // reduced box set
int repeated_set_; // id of the set of repeated blobs
Expand Down
10 changes: 5 additions & 5 deletions src/classify/cluster.cpp
Expand Up @@ -1086,8 +1086,8 @@ PROTOTYPE *TestEllipticalProto(CLUSTERER *Clusterer,
int TotalDims = Left->SampleCount + Right->SampleCount;
if (TotalDims < N + 1 || TotalDims < 2)
return nullptr;
std::vector<float> Covariance(N * N);
std::vector<float> Inverse(N * N);
std::vector<float> Covariance(static_cast<size_t>(N) * N);
std::vector<float> Inverse(static_cast<size_t>(N) * N);
std::vector<float> Delta(N);
// Compute a new covariance matrix that only uses essential features.
for (int i = 0; i < N; ++i) {
Expand Down Expand Up @@ -1126,7 +1126,7 @@ PROTOTYPE *TestEllipticalProto(CLUSTERER *Clusterer,
for (int x = 0; x < N; ++x) {
double temp = 0.0;
for (int y = 0; y < N; ++y) {
temp += Inverse[y + N*x] * Delta[y];
temp += static_cast<double>(Inverse[y + N * x]) * Delta[y];
}
Tsq += Delta[x] * temp;
}
Expand Down Expand Up @@ -1368,7 +1368,7 @@ ComputeStatistics (int16_t N, PARAM_DESC ParamDesc[], CLUSTER * Cluster) {

// allocate memory to hold the statistics results
Statistics = (STATISTICS *) Emalloc (sizeof (STATISTICS));
Statistics->CoVariance = (float *) Emalloc (N * N * sizeof (float));
Statistics->CoVariance = (float *)Emalloc(sizeof(float) * N * N);
Statistics->Min = (float *) Emalloc (N * sizeof (float));
Statistics->Max = (float *) Emalloc (N * sizeof (float));

Expand Down Expand Up @@ -2483,7 +2483,7 @@ double InvertMatrix(const float* input, int size, float* inv) {
for (col = 0; col < size; col++) {
double sum = 0.0;
for (int k = 0; k < size; ++k) {
sum += input[row*size + k] * inv[k *size + col];
sum += static_cast<double>(input[row * size + k]) * inv[k * size + col];
}
if (row != col) {
error_sum += Abs(sum);
Expand Down

0 comments on commit 06a4f15

Please sign in to comment.