mirror of
https://github.com/tesseract-ocr/tesseract.git
synced 2024-12-13 07:59:04 +08:00
Merge pull request #1687 from stweil/cov
Fix 5 issues reported by Coverity Scan
This commit is contained in:
commit
b344dc14ad
@ -475,20 +475,22 @@ static int tvfscanf(FILE* stream, const char *format, va_list ap) {
|
|||||||
if (!(flags & FL_SPLAT)) {
|
if (!(flags & FL_SPLAT)) {
|
||||||
sarg = va_arg(ap, char *);
|
sarg = va_arg(ap, char *);
|
||||||
}
|
}
|
||||||
char *sp = sarg;
|
unsigned length = 0;
|
||||||
while (width--) {
|
while (width--) {
|
||||||
q = fgetc(stream);
|
q = fgetc(stream);
|
||||||
if (isspace(static_cast<unsigned char>(q)) || q <= 0) {
|
if (isspace(static_cast<unsigned char>(q)) || q <= 0) {
|
||||||
ungetc(q, stream);
|
ungetc(q, stream);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (!(flags & FL_SPLAT)) *sp = q;
|
if (!(flags & FL_SPLAT)) {
|
||||||
sp++;
|
sarg[length] = q;
|
||||||
}
|
}
|
||||||
if (sarg == sp) {
|
length++;
|
||||||
|
}
|
||||||
|
if (length == 0) {
|
||||||
bail = BAIL_EOF;
|
bail = BAIL_EOF;
|
||||||
} else if (!(flags & FL_SPLAT)) {
|
} else if (!(flags & FL_SPLAT)) {
|
||||||
*sp = '\0'; // Terminate output
|
sarg[length] = '\0'; // Terminate output
|
||||||
converted++;
|
converted++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -354,7 +354,7 @@ static void ExtractFeaturesFromRun(
|
|||||||
denorm.NormTransform(root_denorm, prev_normed_pos, &prev_normed_pos);
|
denorm.NormTransform(root_denorm, prev_normed_pos, &prev_normed_pos);
|
||||||
LLSQ points;
|
LLSQ points;
|
||||||
LLSQ dirs;
|
LLSQ dirs;
|
||||||
FCOORD normed_pos;
|
FCOORD normed_pos(0.0f, 0.0f);
|
||||||
int index = GatherPoints(outline, feature_length, denorm, root_denorm,
|
int index = GatherPoints(outline, feature_length, denorm, root_denorm,
|
||||||
start_index, end_index, &pos, &normed_pos,
|
start_index, end_index, &pos, &normed_pos,
|
||||||
&points, &dirs);
|
&points, &dirs);
|
||||||
@ -366,7 +366,7 @@ static void ExtractFeaturesFromRun(
|
|||||||
// accumulators.
|
// accumulators.
|
||||||
LLSQ next_points;
|
LLSQ next_points;
|
||||||
LLSQ next_dirs;
|
LLSQ next_dirs;
|
||||||
FCOORD next_normed_pos;
|
FCOORD next_normed_pos(0.0f, 0.0f);
|
||||||
index = GatherPoints(outline, feature_length, denorm, root_denorm,
|
index = GatherPoints(outline, feature_length, denorm, root_denorm,
|
||||||
index, end_index, &pos, &next_normed_pos,
|
index, end_index, &pos, &next_normed_pos,
|
||||||
&next_points, &next_dirs);
|
&next_points, &next_dirs);
|
||||||
|
@ -84,7 +84,9 @@ ColumnFinder::ColumnFinder(int gridsize,
|
|||||||
min_gutter_width_(static_cast<int>(kMinGutterWidthGrid * gridsize)),
|
min_gutter_width_(static_cast<int>(kMinGutterWidthGrid * gridsize)),
|
||||||
mean_column_gap_(tright.x() - bleft.x()),
|
mean_column_gap_(tright.x() - bleft.x()),
|
||||||
tabfind_aligned_gap_fraction_(aligned_gap_fraction),
|
tabfind_aligned_gap_fraction_(aligned_gap_fraction),
|
||||||
|
deskew_(0.0f, 0.0f),
|
||||||
reskew_(1.0f, 0.0f), rotation_(1.0f, 0.0f), rerotate_(1.0f, 0.0f),
|
reskew_(1.0f, 0.0f), rotation_(1.0f, 0.0f), rerotate_(1.0f, 0.0f),
|
||||||
|
text_rotation_(0.0f, 0.0f),
|
||||||
best_columns_(nullptr), stroke_width_(nullptr),
|
best_columns_(nullptr), stroke_width_(nullptr),
|
||||||
part_grid_(gridsize, bleft, tright), nontext_map_(nullptr),
|
part_grid_(gridsize, bleft, tright), nontext_map_(nullptr),
|
||||||
projection_(resolution),
|
projection_(resolution),
|
||||||
|
@ -55,7 +55,7 @@ class QuickTest : public testing::Test {
|
|||||||
return instance->classicProgress( progress );
|
return instance->classicProgress( progress );
|
||||||
};
|
};
|
||||||
monitor.cancel = []( void* ths, int words ) -> bool {
|
monitor.cancel = []( void* ths, int words ) -> bool {
|
||||||
((ClassicMockProgressSink*)ths)->cancel( words );
|
return ((ClassicMockProgressSink*)ths)->cancel(words);
|
||||||
};
|
};
|
||||||
monitor.cancel_this = this;
|
monitor.cancel_this = this;
|
||||||
instance = this;
|
instance = this;
|
||||||
|
Loading…
Reference in New Issue
Block a user