Skip to content

Commit

Permalink
Fix warnings from LGTM
Browse files Browse the repository at this point in the history
Signed-off-by: Stefan Weil <sw@weilnetz.de>
  • Loading branch information
stweil committed May 19, 2021
1 parent eb8f13b commit 28809d7
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 14 deletions.
17 changes: 6 additions & 11 deletions src/textord/blkocc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -50,16 +50,11 @@ bool test_underline( // look for underlines
int16_t baseline, ///< coords of baseline
int16_t xheight ///< height of line
) {
int16_t occ;
int16_t blob_width; // width of blob
TBOX blob_box; // bounding box
int32_t desc_occ;
int32_t x_occ;
int32_t asc_occ;
int32_t occ;
STATS projection;

blob_box = blob->bounding_box();
blob_width = blob->bounding_box().width();
auto blob_box = blob->bounding_box();
auto blob_width = blob->bounding_box().width();
projection.set_range(blob_box.bottom(), blob_box.top() + 1);
if (testing_on) {
// blob->plot(to_win,GOLDENROD,GOLDENROD);
Expand All @@ -73,21 +68,21 @@ bool test_underline( // look for underlines
blob->bounding_box().right(), blob->bounding_box().top(), baseline);
}
horizontal_cblob_projection(blob, &projection);
desc_occ = 0;
int32_t desc_occ = 0;
for (occ = blob_box.bottom(); occ < baseline; occ++) {
if (occ <= blob_box.top() && projection.pile_count(occ) > desc_occ) {
// max in region
desc_occ = projection.pile_count(occ);
}
}
x_occ = 0;
int32_t x_occ = 0;
for (occ = baseline; occ <= baseline + xheight; occ++) {
if (occ >= blob_box.bottom() && occ <= blob_box.top() && projection.pile_count(occ) > x_occ) {
// max in region
x_occ = projection.pile_count(occ);
}
}
asc_occ = 0;
int32_t asc_occ = 0;
for (occ = baseline + xheight + 1; occ <= blob_box.top(); occ++) {
if (occ >= blob_box.bottom() && projection.pile_count(occ) > asc_occ) {
asc_occ = projection.pile_count(occ);
Expand Down
6 changes: 3 additions & 3 deletions src/textord/underlin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,6 @@ void find_underlined_blobs( // get chop points
float baseline_offset, // amount to shrinke it
ICOORDELT_LIST *chop_cells // places to chop
) {
int16_t x, y; // sides of blob
ICOORD blob_chop; // sides of blob
TBOX blob_box = u_line->bounding_box();
// cell iterator
Expand All @@ -180,9 +179,10 @@ void find_underlined_blobs( // get chop points
&middle_proj, &upper_proj);
}

for (x = blob_box.left(); x < blob_box.right(); x++) {
for (auto x = blob_box.left(); x < blob_box.right(); x++) {
if (middle_proj.pile_count(x) > 0) {
for (y = x + 1; y < blob_box.right() && middle_proj.pile_count(y) > 0; y++) {
auto y = x + 1;
for (; y < blob_box.right() && middle_proj.pile_count(y) > 0; y++) {
;
}
blob_chop = ICOORD(x, y);
Expand Down

0 comments on commit 28809d7

Please sign in to comment.