mirror of
https://github.com/tesseract-ocr/tesseract.git
synced 2025-01-23 02:24:09 +08:00
Fix compiler warnings in TWERD::MergeBlobs and optimize code
Signed-off-by: Stefan Weil <sw@weilnetz.de>
This commit is contained in:
parent
0cdcd0f02b
commit
4c36e2e29a
@ -871,12 +871,15 @@ TBOX TWERD::bounding_box() const {
|
||||
|
||||
// Merges the blobs from start to end, not including end, and deletes
|
||||
// the blobs between start and end.
|
||||
void TWERD::MergeBlobs(int start, int end) {
|
||||
if (start >= blobs.size() - 1) {
|
||||
void TWERD::MergeBlobs(unsigned start, unsigned end) {
|
||||
if (end > blobs.size()) {
|
||||
end = blobs.size();
|
||||
}
|
||||
if (start >= end) {
|
||||
return; // Nothing to do.
|
||||
}
|
||||
TESSLINE *outline = blobs[start]->outlines;
|
||||
for (int i = start + 1; i < end && i < blobs.size(); ++i) {
|
||||
for (auto i = start + 1; i < end; ++i) {
|
||||
TBLOB *next_blob = blobs[i];
|
||||
// Take the outlines from the next blob.
|
||||
if (outline == nullptr) {
|
||||
@ -895,7 +898,7 @@ void TWERD::MergeBlobs(int start, int end) {
|
||||
}
|
||||
// Remove dead blobs from the vector.
|
||||
// TODO: optimize.
|
||||
for (int i = start + 1; i < end && start + 1 < blobs.size(); ++i) {
|
||||
for (auto i = start + 1; i < end && start + 1 < blobs.size(); ++i) {
|
||||
blobs.erase(blobs.begin() + start + 1);
|
||||
}
|
||||
}
|
||||
|
@ -453,7 +453,7 @@ struct TWERD {
|
||||
|
||||
// Merges the blobs from start to end, not including end, and deletes
|
||||
// the blobs between start and end.
|
||||
void MergeBlobs(int start, int end);
|
||||
void MergeBlobs(unsigned start, unsigned end);
|
||||
|
||||
#ifndef GRAPHICS_DISABLED
|
||||
void plot(ScrollView *window);
|
||||
|
Loading…
Reference in New Issue
Block a user