Merge pull request #2466 from stweil/warnings

Fix more compiler warnings (mostly unused macros, unused methods)
This commit is contained in:
Egor Pugin 2019-05-26 22:06:28 +03:00 committed by GitHub
commit 4db6b9ebc6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
26 changed files with 64 additions and 155 deletions

View File

@ -45,9 +45,6 @@
#include "tessvars.h"
#include "werdit.h"
#define MIN_FONT_ROW_COUNT 8
#define MAX_XHEIGHT_DIFF 3
const char* const kBackUpConfigFile = "tempconfigdata.config";
// Min believable x-height for any text when refitting as a fraction of
// original x-height

View File

@ -42,7 +42,6 @@ class BLOCK;
class ROW;
#define PERFECT_WERDS 999
#define MAXSPACING 128 /*max expected spacing in pix */
namespace tesseract {

View File

@ -29,14 +29,7 @@
#include "reject.h"
#endif
#define EPAPER_EXT ".ep"
#define PAGE_YSIZE 3508
#define CTRL_INSET '\024' //dc4=text inset
#define CTRL_FONT '\016' //so=font change
#define CTRL_DEFAULT '\017' //si=default font
#define CTRL_SHIFT '\022' //dc2=x shift
#define CTRL_TAB '\011' //tab
#define CTRL_NEWLINE '\012' //newline
#define CTRL_NEWLINE '\012' //newline
#define CTRL_HARDLINE '\015' //cr
namespace tesseract {

View File

@ -42,7 +42,6 @@
#define X_HEIGHT (kBlnBaselineOffset + kBlnXHeight)
#define BL_HEIGHT kBlnBaselineOffset
#define DESC_HEIGHT 0
#define MAXSPACING 128 /*max expected spacing in pix */
enum CMD_EVENTS
{

View File

@ -41,9 +41,6 @@
# include "lstmrecognizer.h"
#endif
// config under api
#define API_CONFIG "configs/api_config"
namespace tesseract {
// Read a "config" file containing a set of variable, value pairs.

View File

@ -22,8 +22,6 @@
#include "stepblob.h"
#include "tprintf.h"
#define BLOCK_LABEL_HEIGHT 150 //char height of block id
ELISTIZE (BLOCK)
/**
* BLOCK::BLOCK

View File

@ -28,7 +28,6 @@
#include "tprintf.h" // for tprintf
#include "vecfuncs.h" // for LENGTH, point_diff, CROSS
#define EXTERN
#define FASTEDGELENGTH 256
static BOOL_VAR(poly_debug, false, "Debug old poly");

View File

@ -31,7 +31,6 @@
#define PLUS '+' //flag states
#define MINUS '-'
#define EQUAL '='
tesseract::ParamsVectors *GlobalParams() {
static tesseract::ParamsVectors global_params = tesseract::ParamsVectors();

View File

@ -27,8 +27,6 @@
#include "serialis.h"
#include "unichar.h"
#define REALLY_QUOTE_IT(x) QUOTE_IT(x)
#define MAX_CUTOFF 1000
namespace tesseract {

View File

@ -18,9 +18,7 @@
Include Files and Type Defines
----------------------------------------------------------------------------*/
#define _USE_MATH_DEFINES // for M_PI
#include "mfx.h"
#include <cmath> // for M_PI
#include "mfdefs.h"
#include "mfoutline.h"
#include "clusttool.h" //NEEDED
@ -38,12 +36,6 @@ double_VAR(classify_min_slope, 0.414213562,
double_VAR(classify_max_slope, 2.414213562,
"Slope above which lines are called vertical");
/*----------------------------------------------------------------------------
Macros
----------------------------------------------------------------------------*/
/* miscellaneous macros */
#define NormalizeAngle(A) ((((A) < 0) ? ((A) + 2 * M_PI) : (A)) / (2 * M_PI))
/*----------------------------------------------------------------------------
Private Function Prototypes
-----------------------------------------------------------------------------*/

View File

@ -61,23 +61,6 @@
#include "errcode.h" // for ASSERT_HOST
#include "structures.h"
/*----------------------------------------------------------------------
M a c r o s
----------------------------------------------------------------------*/
#define add_on(l, x) l = push(l, first_node(x))
#define next_one(l) l = list_rest(l)
/**********************************************************************
* c o p y f i r s t
*
* Do the appropriate kind a push operation to copy the first node from
* one list to another.
*
**********************************************************************/
#define copy_first(l1,l2) \
(l2=push(l2, first_node(l1)))
/*----------------------------------------------------------------------
F u n c t i o n s
----------------------------------------------------------------------*/

View File

@ -29,12 +29,10 @@
#define TO_WIN_NAME "Textord"
//title of window
#define EXTERN
EXTERN BOOL_VAR (textord_show_fixed_cuts, false,
BOOL_VAR (textord_show_fixed_cuts, false,
"Draw fixed pitch cell boundaries");
EXTERN ScrollView* to_win = nullptr;
ScrollView* to_win = nullptr;
/**********************************************************************
* create_to_win

View File

@ -26,8 +26,6 @@
#include "config_auto.h"
#endif
#define EXTERN
// Control parameters used in outline_complexity(), which rejects an outline
// if any one of the 3 conditions is satisfied:
// - number of children exceeds edges_max_children_per_outline

View File

@ -28,11 +28,9 @@
#include "config_auto.h"
#endif
#define EXTERN
EXTERN INT_VAR (textord_fp_chop_error, 2,
INT_VAR (textord_fp_chop_error, 2,
"Max allowed bending of chop cells");
EXTERN double_VAR (textord_fp_chop_snap, 0.5,
double_VAR (textord_fp_chop_snap, 0.5,
"Max distance of chop pt from vertex");
ELISTIZE(C_OUTLINE_FRAG)

View File

@ -1,7 +1,7 @@
/**********************************************************************
* File: oldbasel.cpp (Formerly oldbl.c)
* Description: A re-implementation of the old baseline algorithm.
* Author: Ray Smith
* Author: Ray Smith
*
* (C) Copyright 1993, Hewlett-Packard Ltd.
** Licensed under the Apache License, Version 2.0 (the "License");
@ -34,11 +34,9 @@
#include <algorithm>
#define EXTERN
static BOOL_VAR (textord_really_old_xheight, false,
"Use original wiseowl xheight");
EXTERN BOOL_VAR (textord_oldbl_debug, false, "Debug old baseline generation");
BOOL_VAR (textord_oldbl_debug, false, "Debug old baseline generation");
static BOOL_VAR (textord_debug_baselines, false, "Debug baseline generation");
static BOOL_VAR (textord_oldbl_paradef, true, "Use para default mechanism");
static BOOL_VAR (textord_oldbl_split_splines, true, "Split stepped splines");
@ -65,9 +63,6 @@ static double_VAR (textord_oldbl_jumplimit, 0.15,
#define MAXOVERLAP 0.1 /*max 10% missed overlap */
#define MAXBADRUN 2 /*max non best for failed */
#define HEIGHTBUCKETS 200 /* Num of buckets */
#define DELTAHEIGHT 5.0 /* Small amount of diff */
#define GOODHEIGHT 5
#define MAXLOOPS 10
#define MODENUM 10
#define MAXPARTS 6
#define SPLINESIZE 23

View File

@ -25,8 +25,6 @@
#include "pithsync.h"
#include "tprintf.h"
#define PROJECTION_MARGIN 10 //arbitrary
/**********************************************************************
* FPCUTPT::setup
*

View File

@ -57,7 +57,7 @@ void block_edges(Pix *t_pix, // thresholded image
std::unique_ptr<uint8_t[]> bwline(new uint8_t[width]);
uint8_t margin = WHITE_PIX;
const uint8_t margin = WHITE_PIX;
for (int y = tright.y() - 1; y >= bleft.y() - 1; y--) {
if (y >= bleft.y() && y < tright.y()) {
@ -149,7 +149,6 @@ void line_edges(int16_t x, // coord of line start
C_OUTLINE_IT* outline_it) {
CrackPos pos = {free_cracks, x, y };
int xmax; // max x coord
int colour; // of current pixel
int prevcolour; // of previous pixel
CRACKEDGE *current; // current h edge
CRACKEDGE *newcurrent; // new h edge
@ -160,7 +159,7 @@ void line_edges(int16_t x, // coord of line start
// do each pixel
for (; pos.x < xmax; pos.x++, prevline++) {
colour = *bwpos++; // current pixel
const int colour = *bwpos++; // current pixel
if (*prevline != nullptr) {
// changed above
// change colour

View File

@ -34,28 +34,25 @@
#include <memory>
#define EXTERN
static BOOL_VAR (textord_all_prop, false, "All doc is proportial text");
EXTERN BOOL_VAR (textord_debug_pitch_test, false,
BOOL_VAR (textord_debug_pitch_test, false,
"Debug on fixed pitch test");
static BOOL_VAR (textord_disable_pitch_test, false,
"Turn off dp fixed pitch algorithm");
EXTERN BOOL_VAR (textord_fast_pitch_test, false,
BOOL_VAR (textord_fast_pitch_test, false,
"Do even faster pitch algorithm");
EXTERN BOOL_VAR (textord_debug_pitch_metric, false,
BOOL_VAR (textord_debug_pitch_metric, false,
"Write full metric stuff");
EXTERN BOOL_VAR (textord_show_row_cuts, false, "Draw row-level cuts");
EXTERN BOOL_VAR (textord_show_page_cuts, false, "Draw page-level cuts");
EXTERN BOOL_VAR (textord_pitch_cheat, false,
BOOL_VAR (textord_show_row_cuts, false, "Draw row-level cuts");
BOOL_VAR (textord_show_page_cuts, false, "Draw page-level cuts");
BOOL_VAR (textord_pitch_cheat, false,
"Use correct answer for fixed/prop");
EXTERN BOOL_VAR (textord_blockndoc_fixed, false,
BOOL_VAR (textord_blockndoc_fixed, false,
"Attempt whole doc/block fixed pitch");
EXTERN double_VAR (textord_projection_scale, 0.200, "Ding rate for mid-cuts");
EXTERN double_VAR (textord_balance_factor, 1.0,
double_VAR (textord_projection_scale, 0.200, "Ding rate for mid-cuts");
double_VAR (textord_balance_factor, 1.0,
"Ding rate for unbalanced char cells");
#define FIXED_WIDTH_MULTIPLE 5
#define BLOCK_STATS_CLUSTERS 10
#define MAX_ALLOWED_PITCH 100 //max pixel pitch.

View File

@ -20,64 +20,62 @@
#include "tovars.h"
#include "params.h"
#define EXTERN
EXTERN BOOL_VAR (textord_show_initial_words, false, "Display separate words");
EXTERN BOOL_VAR (textord_show_new_words, false, "Display separate words");
EXTERN BOOL_VAR (textord_show_fixed_words, false,
BOOL_VAR (textord_show_initial_words, false, "Display separate words");
BOOL_VAR (textord_show_new_words, false, "Display separate words");
BOOL_VAR (textord_show_fixed_words, false,
"Display forced fixed pitch words");
EXTERN BOOL_VAR (textord_blocksall_fixed, false, "Moan about prop blocks");
EXTERN BOOL_VAR (textord_blocksall_prop, false,
BOOL_VAR (textord_blocksall_fixed, false, "Moan about prop blocks");
BOOL_VAR (textord_blocksall_prop, false,
"Moan about fixed pitch blocks");
EXTERN BOOL_VAR (textord_blocksall_testing, false, "Dump stats when moaning");
EXTERN BOOL_VAR (textord_test_mode, false, "Do current test");
EXTERN INT_VAR (textord_dotmatrix_gap, 3,
BOOL_VAR (textord_blocksall_testing, false, "Dump stats when moaning");
BOOL_VAR (textord_test_mode, false, "Do current test");
INT_VAR (textord_dotmatrix_gap, 3,
"Max pixel gap for broken pixed pitch");
EXTERN INT_VAR (textord_debug_block, 0, "Block to do debug on");
EXTERN INT_VAR (textord_pitch_range, 2, "Max range test on pitch");
EXTERN double_VAR (textord_wordstats_smooth_factor, 0.05,
INT_VAR (textord_debug_block, 0, "Block to do debug on");
INT_VAR (textord_pitch_range, 2, "Max range test on pitch");
double_VAR (textord_wordstats_smooth_factor, 0.05,
"Smoothing gap stats");
EXTERN double_VAR (textord_width_smooth_factor, 0.10,
double_VAR (textord_width_smooth_factor, 0.10,
"Smoothing width stats");
EXTERN double_VAR (textord_words_width_ile, 0.4,
double_VAR (textord_words_width_ile, 0.4,
"Ile of blob widths for space est");
EXTERN double_VAR (textord_words_maxspace, 4.0, "Multiple of xheight");
EXTERN double_VAR (textord_words_default_maxspace, 3.5,
double_VAR (textord_words_maxspace, 4.0, "Multiple of xheight");
double_VAR (textord_words_default_maxspace, 3.5,
"Max believable third space");
EXTERN double_VAR (textord_words_default_minspace, 0.6,
double_VAR (textord_words_default_minspace, 0.6,
"Fraction of xheight");
EXTERN double_VAR (textord_words_min_minspace, 0.3, "Fraction of xheight");
EXTERN double_VAR (textord_words_default_nonspace, 0.2,
double_VAR (textord_words_min_minspace, 0.3, "Fraction of xheight");
double_VAR (textord_words_default_nonspace, 0.2,
"Fraction of xheight");
EXTERN double_VAR(textord_words_initial_lower, 0.25,
double_VAR(textord_words_initial_lower, 0.25,
"Max initial cluster size");
EXTERN double_VAR (textord_words_initial_upper, 0.15,
double_VAR (textord_words_initial_upper, 0.15,
"Min initial cluster spacing");
EXTERN double_VAR (textord_words_minlarge, 0.75,
double_VAR (textord_words_minlarge, 0.75,
"Fraction of valid gaps needed");
EXTERN double_VAR (textord_words_pitchsd_threshold, 0.040,
double_VAR (textord_words_pitchsd_threshold, 0.040,
"Pitch sync threshold");
EXTERN double_VAR (textord_words_def_fixed, 0.016,
double_VAR (textord_words_def_fixed, 0.016,
"Threshold for definite fixed");
EXTERN double_VAR (textord_words_def_prop, 0.090,
double_VAR (textord_words_def_prop, 0.090,
"Threshold for definite prop");
EXTERN INT_VAR (textord_words_veto_power, 5,
INT_VAR (textord_words_veto_power, 5,
"Rows required to outvote a veto");
EXTERN double_VAR (textord_pitch_rowsimilarity, 0.08,
double_VAR (textord_pitch_rowsimilarity, 0.08,
"Fraction of xheight for sameness");
EXTERN BOOL_VAR (textord_pitch_scalebigwords, false,
BOOL_VAR (textord_pitch_scalebigwords, false,
"Scale scores on big words");
EXTERN double_VAR(words_initial_lower, 0.5, "Max initial cluster size");
EXTERN double_VAR (words_initial_upper, 0.15, "Min initial cluster spacing");
EXTERN double_VAR (words_default_prop_nonspace, 0.25, "Fraction of xheight");
EXTERN double_VAR (words_default_fixed_space, 0.75, "Fraction of xheight");
EXTERN double_VAR (words_default_fixed_limit, 0.6, "Allowed size variance");
EXTERN double_VAR (textord_words_definite_spread, 0.30,
double_VAR(words_initial_lower, 0.5, "Max initial cluster size");
double_VAR (words_initial_upper, 0.15, "Min initial cluster spacing");
double_VAR (words_default_prop_nonspace, 0.25, "Fraction of xheight");
double_VAR (words_default_fixed_space, 0.75, "Fraction of xheight");
double_VAR (words_default_fixed_limit, 0.6, "Allowed size variance");
double_VAR (textord_words_definite_spread, 0.30,
"Non-fuzzy spacing region");
EXTERN double_VAR (textord_spacesize_ratiofp, 2.8,
double_VAR (textord_spacesize_ratiofp, 2.8,
"Min ratio space/nonspace");
EXTERN double_VAR (textord_spacesize_ratioprop, 2.0,
double_VAR (textord_spacesize_ratioprop, 2.0,
"Min ratio space/nonspace");
EXTERN double_VAR (textord_fpiqr_ratio, 1.5, "Pitch IQR/Gap IQR threshold");
EXTERN double_VAR (textord_max_pitch_iqr, 0.20, "Xh fraction noise in pitch");
EXTERN double_VAR (textord_fp_min_width, 0.5, "Min width of decent blobs");
double_VAR (textord_fpiqr_ratio, 1.5, "Pitch IQR/Gap IQR threshold");
double_VAR (textord_max_pitch_iqr, 0.20, "Xh fraction noise in pitch");
double_VAR (textord_fp_min_width, 0.5, "Min width of decent blobs");

View File

@ -18,12 +18,8 @@
#include "underlin.h"
#define PROJECTION_MARGIN 10 //arbitrary
#define EXTERN
EXTERN double_VAR (textord_underline_offset, 0.1, "Fraction of x to ignore");
EXTERN BOOL_VAR (textord_restore_underlines, true,
"Chop underlines & put back");
double_VAR (textord_underline_offset, 0.1, "Fraction of x to ignore");
BOOL_VAR (textord_restore_underlines, true, "Chop underlines & put back");
/**********************************************************************
* restore_underlined_blobs

View File

@ -33,15 +33,12 @@
#include "config_auto.h"
#endif
#define EXTERN
EXTERN BOOL_VAR(textord_fp_chopping, true, "Do fixed pitch chopping");
EXTERN BOOL_VAR(textord_force_make_prop_words, false,
BOOL_VAR(textord_fp_chopping, true, "Do fixed pitch chopping");
BOOL_VAR(textord_force_make_prop_words, false,
"Force proportional word segmentation on all rows");
EXTERN BOOL_VAR(textord_chopper_test, false,
BOOL_VAR(textord_chopper_test, false,
"Chopper is being tested.");
#define FIXED_WIDTH_MULTIPLE 5
#define BLOCK_STATS_CLUSTERS 10

View File

@ -55,8 +55,6 @@ using tesseract::MasterTrainer;
using tesseract::Shape;
using tesseract::ShapeTable;
#define PROGRAM_FEATURE_TYPE "mf"
// Max length of a fake shape label.
const int kMaxShapeLabelLength = 10;

View File

@ -32,23 +32,13 @@
#define FXDEMOYSIZE 256
#define BLN_MAX 512 //max coord for bln
#define WERDWIDTH (BLN_MAX*20)
#define DECENT_WERD_WIDTH (5*kBlnXHeight)
//title of window
#define DEBUG_WIN_NAME "FXDebug"
#define DEBUG_XPOS 0
#define DEBUG_YPOS 120
#define DEBUG_XSIZE 80
#define DEBUG_YSIZE 32
#define YMAX 3508
#define XMAX 2550
#define MAXEDGELENGTH 1024 //max steps inoutline
#define EXTERN
STRING_VAR(fx_debugfile, DEBUG_WIN_NAME, "Name of debugfile");
EXTERN STRING_VAR (fx_debugfile, DEBUG_WIN_NAME, "Name of debugfile");
EXTERN ScrollView* fx_win = nullptr;
EXTERN FILE *fx_debug = nullptr;
ScrollView* fx_win = nullptr;
FILE* fx_debug = nullptr;
/**********************************************************************
* create_fx_win

View File

@ -48,7 +48,6 @@
/* How many to keep */
#define MAX_NUM_SEAMS 150
/* How many to keep */
#define MAX_OLD_SEAMS 150
#define NO_FULL_PRIORITY -1/* Special marker for pri. */
/* Evaluate right away */
#define BAD_PRIORITY 9999.0

View File

@ -32,9 +32,6 @@ class ApplyBoxTest : public testing::Test {
return file::JoinPath(TESTING_DIR, name);
}
std::string TessdataPath() { return TESSDATA_DIR; }
std::string OutputNameToPath(const std::string& name) {
return file::JoinPath(FLAGS_test_tmpdir, name);
}
ApplyBoxTest() { src_pix_ = nullptr; }
~ApplyBoxTest() { pixDestroy(&src_pix_); }

View File

@ -171,9 +171,6 @@ class MasterTrainerTest : public testing::Test {
std::string TestDataNameToPath(const std::string& name) {
return file::JoinPath(TESTING_DIR, name);
}
std::string TessdataPath() {
return TESSDATA_DIR;
}
std::string TmpNameToPath(const std::string& name) {
return file::JoinPath(FLAGS_test_tmpdir, name);
}