Skip to content

Commit 28809d7

Browse files
committed
Fix warnings from LGTM
Signed-off-by: Stefan Weil <[email protected]>
1 parent eb8f13b commit 28809d7

File tree

2 files changed

+9
-14
lines changed

2 files changed

+9
-14
lines changed

Diff for: src/textord/blkocc.cpp

+6-11
Original file line numberDiff line numberDiff line change
@@ -50,16 +50,11 @@ bool test_underline( // look for underlines
5050
int16_t baseline, ///< coords of baseline
5151
int16_t xheight ///< height of line
5252
) {
53-
int16_t occ;
54-
int16_t blob_width; // width of blob
55-
TBOX blob_box; // bounding box
56-
int32_t desc_occ;
57-
int32_t x_occ;
58-
int32_t asc_occ;
53+
int32_t occ;
5954
STATS projection;
6055

61-
blob_box = blob->bounding_box();
62-
blob_width = blob->bounding_box().width();
56+
auto blob_box = blob->bounding_box();
57+
auto blob_width = blob->bounding_box().width();
6358
projection.set_range(blob_box.bottom(), blob_box.top() + 1);
6459
if (testing_on) {
6560
// blob->plot(to_win,GOLDENROD,GOLDENROD);
@@ -73,21 +68,21 @@ bool test_underline( // look for underlines
7368
blob->bounding_box().right(), blob->bounding_box().top(), baseline);
7469
}
7570
horizontal_cblob_projection(blob, &projection);
76-
desc_occ = 0;
71+
int32_t desc_occ = 0;
7772
for (occ = blob_box.bottom(); occ < baseline; occ++) {
7873
if (occ <= blob_box.top() && projection.pile_count(occ) > desc_occ) {
7974
// max in region
8075
desc_occ = projection.pile_count(occ);
8176
}
8277
}
83-
x_occ = 0;
78+
int32_t x_occ = 0;
8479
for (occ = baseline; occ <= baseline + xheight; occ++) {
8580
if (occ >= blob_box.bottom() && occ <= blob_box.top() && projection.pile_count(occ) > x_occ) {
8681
// max in region
8782
x_occ = projection.pile_count(occ);
8883
}
8984
}
90-
asc_occ = 0;
85+
int32_t asc_occ = 0;
9186
for (occ = baseline + xheight + 1; occ <= blob_box.top(); occ++) {
9287
if (occ >= blob_box.bottom() && projection.pile_count(occ) > asc_occ) {
9388
asc_occ = projection.pile_count(occ);

Diff for: src/textord/underlin.cpp

+3-3
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,6 @@ void find_underlined_blobs( // get chop points
162162
float baseline_offset, // amount to shrinke it
163163
ICOORDELT_LIST *chop_cells // places to chop
164164
) {
165-
int16_t x, y; // sides of blob
166165
ICOORD blob_chop; // sides of blob
167166
TBOX blob_box = u_line->bounding_box();
168167
// cell iterator
@@ -180,9 +179,10 @@ void find_underlined_blobs( // get chop points
180179
&middle_proj, &upper_proj);
181180
}
182181

183-
for (x = blob_box.left(); x < blob_box.right(); x++) {
182+
for (auto x = blob_box.left(); x < blob_box.right(); x++) {
184183
if (middle_proj.pile_count(x) > 0) {
185-
for (y = x + 1; y < blob_box.right() && middle_proj.pile_count(y) > 0; y++) {
184+
auto y = x + 1;
185+
for (; y < blob_box.right() && middle_proj.pile_count(y) > 0; y++) {
186186
;
187187
}
188188
blob_chop = ICOORD(x, y);

0 commit comments

Comments
 (0)