Squash some warnings in MSVC build.

In particular, "defined but not used" (caused by GRAPHICS_DISABLED),
double constants being truncated to floats, and implicit casts.
This commit is contained in:
Robin Watts 2020-07-15 20:02:33 +01:00
parent 7fa200bfb7
commit 150e2e54fe
6 changed files with 14 additions and 15 deletions

View File

@ -74,9 +74,6 @@ void Tesseract::recog_pseudo_word(PAGE_RES* page_res,
* @param pr_it the page results iterator
*/
bool Tesseract::recog_interactive(PAGE_RES_IT* pr_it) {
int16_t char_qual;
int16_t good_char_qual;
WordData word_data(*pr_it);
SetupWordPassN(2, &word_data);
// LSTM doesn't run on pass2, but we want to run pass2 for tesseract.
@ -89,6 +86,8 @@ bool Tesseract::recog_interactive(PAGE_RES_IT* pr_it) {
}
#ifndef DISABLED_LEGACY_ENGINE
if (tessedit_debug_quality_metrics) {
int16_t char_qual;
int16_t good_char_qual;
WERD_RES* word_res = pr_it->word();
word_char_quality(word_res, &char_qual, &good_char_qual);
tprintf("\n%d chars; word_blob_quality: %d; outline_errs: %d; "

View File

@ -71,7 +71,7 @@ class ICOORD
///find sq length
float sqlength() const {
return xcoord * xcoord + ycoord * ycoord;
return (float)(xcoord * xcoord + ycoord * ycoord);
}
///find length
@ -95,7 +95,7 @@ class ICOORD
///find angle
float angle() const {
return std::atan2(ycoord, xcoord);
return (float)std::atan2(ycoord, xcoord);
}
///test equality

View File

@ -456,7 +456,7 @@ void WERD_CHOICE::string_and_lengths(STRING *word_str,
const char *ch = unicharset_->id_to_unichar_ext(unichar_ids_[i]);
*word_str += ch;
if (word_lengths_str != nullptr) {
*word_lengths_str += strlen(ch);
*word_lengths_str += (char)strlen(ch);
}
}
}

View File

@ -32,11 +32,11 @@ static BOOL_VAR(textord_space_size_is_variable, false,
namespace {
// Allow +/-10% error for character pitch / body size.
static const float kFPTolerance = 0.1;
static const float kFPTolerance = 0.1f;
// Minimum ratio of "good" character pitch for a row to be considered
// to be fixed-pitch.
static const float kFixedPitchThreshold = 0.35;
static const float kFixedPitchThreshold = 0.35f;
// rank statistics for a small collection of float values.
class SimpleStats {
@ -1020,7 +1020,7 @@ void FPAnalyzer::EstimatePitch(bool pass1) {
} else if (row.num_chars() > 1) {
float estimated_pitch =
pitch_height_stats.EstimateYFor(row.height() + row.gap(),
0.1);
0.1f);
// CJK characters are more likely to be fragmented than poorly
// chopped. So trust the page-level estimation of character
// pitch only if it's larger than row-level estimation or

View File

@ -583,7 +583,7 @@ float jumplimit /*guess half descenders */
}
}
jumplimit *= 1.2;
jumplimit *= 1.2f;
/*must be wavy */
if (maxmax - minmin > jumplimit) {
ycount = segment; /*no of segments */

View File

@ -417,10 +417,8 @@ bool try_doc_fixed( //determine pitch
int16_t projection_right;
int16_t row_left; //edges of row
int16_t row_right;
ICOORDELT_LIST *master_cells; //cells for page
float master_y; //uniform shifts
float shift_factor; //page skew correction
float row_shift; //shift for row
float final_pitch; //output pitch
float row_y; //baseline
STATS projection; //entire page
@ -512,6 +510,8 @@ bool try_doc_fixed( //determine pitch
#ifndef GRAPHICS_DISABLED
if (textord_show_page_cuts && to_win != nullptr) {
float row_shift; //shift for row
ICOORDELT_LIST *master_cells; //cells for page
master_cells = &row->char_cells;
for (block_it.mark_cycle_pt (); !block_it.cycled_list ();
block_it.forward ()) {
@ -871,7 +871,7 @@ bool find_row_pitch( //find lines
if (!count_pitch_stats (row, &gap_stats, &pitch_stats,
initial_pitch, min_space, true, false, dm_gap)) {
dm_gap_iqr = 0.0001;
dm_gap_iqr = 0.0001f;
dm_pitch_iqr = maxwidth * 2.0f;
dm_pitch = initial_pitch;
}
@ -884,7 +884,7 @@ bool find_row_pitch( //find lines
pitch_stats.clear ();
if (!count_pitch_stats (row, &gap_stats, &pitch_stats,
initial_pitch, min_space, true, false, 0)) {
gap_iqr = 0.0001;
gap_iqr = 0.0001f;
pitch_iqr = maxwidth * 3.0f;
}
else {