mirror of
https://github.com/tesseract-ocr/tesseract.git
synced 2024-12-12 07:29:07 +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)) {
|
||||
sarg = va_arg(ap, char *);
|
||||
}
|
||||
char *sp = sarg;
|
||||
unsigned length = 0;
|
||||
while (width--) {
|
||||
q = fgetc(stream);
|
||||
if (isspace(static_cast<unsigned char>(q)) || q <= 0) {
|
||||
ungetc(q, stream);
|
||||
break;
|
||||
}
|
||||
if (!(flags & FL_SPLAT)) *sp = q;
|
||||
sp++;
|
||||
if (!(flags & FL_SPLAT)) {
|
||||
sarg[length] = q;
|
||||
}
|
||||
length++;
|
||||
}
|
||||
if (sarg == sp) {
|
||||
if (length == 0) {
|
||||
bail = BAIL_EOF;
|
||||
} else if (!(flags & FL_SPLAT)) {
|
||||
*sp = '\0'; // Terminate output
|
||||
sarg[length] = '\0'; // Terminate output
|
||||
converted++;
|
||||
}
|
||||
}
|
||||
|
@ -354,7 +354,7 @@ static void ExtractFeaturesFromRun(
|
||||
denorm.NormTransform(root_denorm, prev_normed_pos, &prev_normed_pos);
|
||||
LLSQ points;
|
||||
LLSQ dirs;
|
||||
FCOORD normed_pos;
|
||||
FCOORD normed_pos(0.0f, 0.0f);
|
||||
int index = GatherPoints(outline, feature_length, denorm, root_denorm,
|
||||
start_index, end_index, &pos, &normed_pos,
|
||||
&points, &dirs);
|
||||
@ -366,7 +366,7 @@ static void ExtractFeaturesFromRun(
|
||||
// accumulators.
|
||||
LLSQ next_points;
|
||||
LLSQ next_dirs;
|
||||
FCOORD next_normed_pos;
|
||||
FCOORD next_normed_pos(0.0f, 0.0f);
|
||||
index = GatherPoints(outline, feature_length, denorm, root_denorm,
|
||||
index, end_index, &pos, &next_normed_pos,
|
||||
&next_points, &next_dirs);
|
||||
|
@ -84,7 +84,9 @@ ColumnFinder::ColumnFinder(int gridsize,
|
||||
min_gutter_width_(static_cast<int>(kMinGutterWidthGrid * gridsize)),
|
||||
mean_column_gap_(tright.x() - bleft.x()),
|
||||
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),
|
||||
text_rotation_(0.0f, 0.0f),
|
||||
best_columns_(nullptr), stroke_width_(nullptr),
|
||||
part_grid_(gridsize, bleft, tright), nontext_map_(nullptr),
|
||||
projection_(resolution),
|
||||
|
@ -55,7 +55,7 @@ class QuickTest : public testing::Test {
|
||||
return instance->classicProgress( progress );
|
||||
};
|
||||
monitor.cancel = []( void* ths, int words ) -> bool {
|
||||
((ClassicMockProgressSink*)ths)->cancel( words );
|
||||
return ((ClassicMockProgressSink*)ths)->cancel(words);
|
||||
};
|
||||
monitor.cancel_this = this;
|
||||
instance = this;
|
||||
|
Loading…
Reference in New Issue
Block a user