Skip to content

Commit fbba190

Browse files
authored
Merge pull request #4071 from stweil/clean
Clean code
2 parents c9895db + a9ad360 commit fbba190

File tree

3 files changed

+5
-5
lines changed

3 files changed

+5
-5
lines changed

src/api/baseapi.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -412,7 +412,7 @@ int TessBaseAPI::Init(const char *data, int data_size, const char *language, Ocr
412412
if (data_size != 0) {
413413
mgr.LoadMemBuffer(language, data, data_size);
414414
}
415-
if (tesseract_->init_tesseract(datapath.c_str(), output_file_.c_str(), language, oem, configs,
415+
if (tesseract_->init_tesseract(datapath, output_file_, language, oem, configs,
416416
configs_size, vars_vec, vars_values, set_only_non_debug_params,
417417
&mgr) != 0) {
418418
return -1;
@@ -2176,7 +2176,7 @@ int TessBaseAPI::FindLines() {
21762176
" but data path is undefined\n");
21772177
delete osd_tesseract_;
21782178
osd_tesseract_ = nullptr;
2179-
} else if (osd_tesseract_->init_tesseract(datapath_.c_str(), "", "osd", OEM_TESSERACT_ONLY,
2179+
} else if (osd_tesseract_->init_tesseract(datapath_, "", "osd", OEM_TESSERACT_ONLY,
21802180
nullptr, 0, nullptr, nullptr, false, &mgr) == 0) {
21812181
osd_tess = osd_tesseract_;
21822182
osd_tesseract_->set_source_resolution(thresholder_->GetSourceYResolution());

src/ccstruct/dppoint.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ int64_t DPPoint::CostWithVariance(const DPPoint *prev) {
7676
int delta = this - prev;
7777
int32_t n = prev->n_ + 1;
7878
int32_t sig_x = prev->sig_x_ + delta;
79-
int64_t sig_xsq = prev->sig_xsq_ + delta * delta;
79+
int64_t sig_xsq = prev->sig_xsq_ + static_cast<int64_t>(delta) * delta;
8080
int64_t cost = (sig_xsq - sig_x * sig_x / n) / n;
8181
cost += prev->total_cost_;
8282
UpdateIfBetter(cost, prev->total_steps_ + 1, prev, n, sig_x, sig_xsq);

src/training/pango/boxchar.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -278,8 +278,8 @@ bool BoxChar::MostlyVertical(const std::vector<BoxChar *> &boxes) {
278278
int dx = boxes[i]->box_->x - boxes[i - 1]->box_->x;
279279
int dy = boxes[i]->box_->y - boxes[i - 1]->box_->y;
280280
if (abs(dx) > abs(dy) * kMinNewlineRatio || abs(dy) > abs(dx) * kMinNewlineRatio) {
281-
total_dx += dx * dx;
282-
total_dy += dy * dy;
281+
total_dx += static_cast<int64_t>(dx) * dx;
282+
total_dy += static_cast<int64_t>(dy) * dy;
283283
}
284284
}
285285
}

0 commit comments

Comments
 (0)