Skip to content

Commit

Permalink
Merge pull request tesseract-ocr#2465 from stweil/warnings
Browse files Browse the repository at this point in the history
Fix compiler warnings [-Wmissing-variable-declarations]
  • Loading branch information
zdenop authored May 26, 2019
2 parents 3c9691f + 8c8eb21 commit 3971562
Show file tree
Hide file tree
Showing 48 changed files with 321 additions and 398 deletions.
6 changes: 3 additions & 3 deletions src/api/baseapi.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@
#include "tprintf.h" // for tprintf
#include "werd.h" // for WERD, WERD_IT, W_FUZZY_NON, W_FUZZY_SP

BOOL_VAR(stream_filelist, false, "Stream a filelist from stdin");
static BOOL_VAR(stream_filelist, false, "Stream a filelist from stdin");

namespace tesseract {

Expand All @@ -110,11 +110,11 @@ const char kUNLVSuspect = '^';
* Filename used for input image file, from which to derive a name to search
* for a possible UNLV zone file, if none is specified by SetInputName.
*/
const char* kInputFile = "noname.tif";
static const char* kInputFile = "noname.tif";
/**
* Temp file used for storing current parameters before applying retry values.
*/
const char* kOldVarsFile = "failed_vars.txt";
static const char* kOldVarsFile = "failed_vars.txt";
/** Max string length of an int. */
const int kMaxIntSize = 22;

Expand Down
9 changes: 4 additions & 5 deletions src/ccmain/equationdetect.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
// File: equationdetect.cpp
// Description: Helper classes to detect equations.
// Author: Zongyi (Joe) Liu (joeliu@google.com)
// Created: Fri Aug 31 11:13:01 PST 2011
//
// (C) Copyright 2011, Google Inc.
// Licensed under the Apache License, Version 2.0 (the "License");
Expand Down Expand Up @@ -43,10 +42,10 @@
#include "tesseractclass.h"

// Config variables.
BOOL_VAR(equationdetect_save_bi_image, false, "Save input bi image");
BOOL_VAR(equationdetect_save_spt_image, false, "Save special character image");
BOOL_VAR(equationdetect_save_seed_image, false, "Save the seed image");
BOOL_VAR(equationdetect_save_merged_image, false, "Save the merged image");
static BOOL_VAR(equationdetect_save_bi_image, false, "Save input bi image");
static BOOL_VAR(equationdetect_save_spt_image, false, "Save special character image");
static BOOL_VAR(equationdetect_save_seed_image, false, "Save the seed image");
static BOOL_VAR(equationdetect_save_merged_image, false, "Save the merged image");

namespace tesseract {

Expand Down
8 changes: 3 additions & 5 deletions src/ccmain/pgedit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,6 @@
#define DESC_HEIGHT 0
#define MAXSPACING 128 /*max expected spacing in pix */

constexpr ERRCODE EMPTYBLOCKLIST("No blocks to edit");

enum CMD_EVENTS
{
NULL_CMD_EVENT,
Expand Down Expand Up @@ -117,13 +115,13 @@ static bool display_image = false;
static bool display_blocks = false;
static bool display_baselines = false;

PAGE_RES *current_page_res = nullptr;
static PAGE_RES *current_page_res = nullptr;

STRING_VAR(editor_image_win_name, "EditorImage",
"Editor image window name");
INT_VAR(editor_image_xpos, 590, "Editor image X Pos");
INT_VAR(editor_image_ypos, 10, "Editor image Y Pos");
INT_VAR(editor_image_menuheight, 50, "Add to image height for menu bar");
static INT_VAR(editor_image_menuheight, 50, "Add to image height for menu bar");
INT_VAR(editor_image_word_bb_color, ScrollView::BLUE,
"Word bounding box colour");
INT_VAR(editor_image_blob_bb_color, ScrollView::YELLOW,
Expand All @@ -144,7 +142,7 @@ INT_VAR(editor_word_ypos, 510, "Word window Y Pos");
INT_VAR(editor_word_height, 240, "Word window height");
INT_VAR(editor_word_width, 655, "Word window width");

STRING_VAR(editor_debug_config_file, "", "Config file to apply to single words");
static STRING_VAR(editor_debug_config_file, "", "Config file to apply to single words");

/**
* show_point()
Expand Down
3 changes: 1 addition & 2 deletions src/ccstruct/mod128.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
* File: mod128.cpp (Formerly dir128.c)
* Description: Code to convert a DIR128 to an ICOORD.
* Author: Ray Smith
* Created: Tue Oct 22 11:56:09 BST 1991
*
* (C) Copyright 1991, Hewlett-Packard Ltd.
** Licensed under the Apache License, Version 2.0 (the "License");
Expand Down Expand Up @@ -54,7 +53,7 @@ static const int16_t idirtab[] = {
980, -195, 989, -146, 995, -98, 998, -49
};

const ICOORD* dirtab = reinterpret_cast<const ICOORD*>(idirtab);
static const ICOORD* dirtab = reinterpret_cast<const ICOORD*>(idirtab);

/**********************************************************************
* DIR128::DIR128
Expand Down
4 changes: 2 additions & 2 deletions src/ccstruct/polyaprx.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,8 @@
#define EXTERN
#define FASTEDGELENGTH 256

EXTERN BOOL_VAR(poly_debug, false, "Debug old poly");
EXTERN BOOL_VAR(poly_wide_objects_better, true,
static BOOL_VAR(poly_debug, false, "Debug old poly");
static BOOL_VAR(poly_wide_objects_better, true,
"More accurate approx on wide things");

#define FIXED 4 /*OUTLINE point is fixed */
Expand Down
3 changes: 0 additions & 3 deletions src/ccstruct/werd.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,6 @@
#define LAST_COLOUR ScrollView::AQUAMARINE ///< last rainbow colour
#define CHILD_COLOUR ScrollView::BROWN ///< colour of children

constexpr ERRCODE CANT_SCALE_EDGESTEPS(
"Attempted to scale an edgestep format word");

ELIST2IZE(WERD)

/**
Expand Down
7 changes: 3 additions & 4 deletions src/ccutil/bits16.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,11 +24,10 @@

class DLLSYM BITS16 {
public:
uint16_t val;
uint16_t val = 0;

BITS16() { val = 0; } // constructor

BITS16(uint16_t init) { val = init; }
BITS16() = default;
BITS16(uint16_t init) : val(init) {}

void turn_on_bit( // flip specified bit
uint8_t bit_num) { // bit to flip 0..7
Expand Down
5 changes: 0 additions & 5 deletions src/ccutil/mainblk.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
* File: mainblk.cpp (Formerly main.c)
* Description: Function to call from main() to setup.
* Author: Ray Smith
* Created: Tue Oct 22 11:09:40 BST 1991
*
* (C) Copyright 1991, Hewlett-Packard Ltd.
** Licensed under the Apache License, Version 2.0 (the "License");
Expand All @@ -25,10 +24,6 @@
#include "fileerr.h"
#include "ccutil.h"

const ERRCODE NO_PATH =
"Warning:explicit path for executable will not be used for configs";
static const ERRCODE USAGE = "Usage";

namespace tesseract {
/**********************************************************************
* main_setup
Expand Down
3 changes: 0 additions & 3 deletions src/ccutil/strngs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,9 +31,6 @@ using tesseract::TFile;
// Size of buffer needed to host the decimal representation of the maximum
// possible length of an int (in 64 bits), being -<20 digits>.
const int kMaxIntSize = 22;
// Size of buffer needed to host the decimal representation of the maximum
// possible length of a %.8g being -1.2345678e+999<nul> = 16.
const int kMaxDoubleSize = 16;

/**********************************************************************
* STRING_HEADER provides metadata about the allocated buffer,
Expand Down
2 changes: 1 addition & 1 deletion src/ccutil/unicharcompress.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
namespace tesseract {

// String used to represent the null_id in direct_set.
const char* kNullChar = "<nul>";
static const char* kNullChar = "<nul>";
// Radix to make unique values from the stored radical codes.
const int kRadicalRadix = 29;

Expand Down
8 changes: 4 additions & 4 deletions src/ccutil/unicodes.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@

namespace tesseract {

constexpr const char *kLRM = "\u200E"; // Left-to-Right Mark
constexpr const char *kRLM = "\u200F"; // Right-to-Left Mark
constexpr const char *kRLE = "\u202A"; // Right-to-Left Embedding
constexpr const char *kPDF = "\u202C"; // Pop Directional Formatting
const char * const kLRM = "\u200E"; // Left-to-Right Mark
const char * const kRLM = "\u200F"; // Right-to-Left Mark
const char * const kRLE = "\u202A"; // Right-to-Left Embedding
const char * const kPDF = "\u202C"; // Pop Directional Formatting

} // namespace
5 changes: 2 additions & 3 deletions src/classify/blobclass.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
** Filename: blobclass.c
** Purpose: High level blob classification and training routines.
** Author: Dan Johnson
** History: 7/21/89, DSJ, Created.
**
** (c) Copyright Hewlett-Packard Company, 1988.
** Licensed under the Apache License, Version 2.0 (the "License");
Expand Down Expand Up @@ -32,8 +31,8 @@

static const char kUnknownFontName[] = "UnknownFont";

STRING_VAR(classify_font_name, kUnknownFontName,
"Default font name to be used in training");
static STRING_VAR(classify_font_name, kUnknownFontName,
"Default font name to be used in training");

namespace tesseract {
/**----------------------------------------------------------------------------
Expand Down
14 changes: 7 additions & 7 deletions src/classify/featdefs.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -18,21 +18,21 @@
Include Files and Type Defines
-----------------------------------------------------------------------------*/
#include "featdefs.h"
#include "emalloc.h"
#include "scanutils.h"

#include <cstring>
#include <cstdio>
#include "emalloc.h"
#include "picofeat.h" // for PicoFeatureLength
#include "scanutils.h"

#define PICO_FEATURE_LENGTH 0.05

/*-----------------------------------------------------------------------------
Global Data Definitions and Declarations
-----------------------------------------------------------------------------*/
constexpr const char* kMicroFeatureType = "mf";
constexpr const char* kCNFeatureType = "cn";
constexpr const char* kIntFeatureType = "if";
constexpr const char* kGeoFeatureType = "tb";
const char* const kMicroFeatureType = "mf";
const char* const kCNFeatureType = "cn";
const char* const kIntFeatureType = "if";
const char* const kGeoFeatureType = "tb";

// Define all of the parameters for the MicroFeature type.
StartParamDesc(MicroFeatureParams)
Expand Down
5 changes: 2 additions & 3 deletions src/classify/intfx.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,15 +41,14 @@ using tesseract::TrainingSample;
// The entries are in binary degrees where a full circle is 256 binary degrees.
static float cos_table[INT_CHAR_NORM_RANGE];
static float sin_table[INT_CHAR_NORM_RANGE];
// Guards write access to AtanTable so we don't create it more than once.
tesseract::CCUtilMutex atan_table_mutex;


/**----------------------------------------------------------------------------
Public Code
----------------------------------------------------------------------------**/

void InitIntegerFX() {
// Guards write access to AtanTable so we don't create it more than once.
static tesseract::CCUtilMutex atan_table_mutex;
static bool atan_table_init = false;
atan_table_mutex.Lock();
if (!atan_table_init) {
Expand Down
38 changes: 19 additions & 19 deletions src/classify/intproto.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -172,31 +172,31 @@ int TruncateParam(float Param, int Min, int Max, char *Id);
-----------------------------------------------------------------------------*/

/* global display lists used to display proto and feature match information*/
ScrollView *IntMatchWindow = nullptr;
ScrollView *FeatureDisplayWindow = nullptr;
ScrollView *ProtoDisplayWindow = nullptr;
static ScrollView* IntMatchWindow = nullptr;
static ScrollView* FeatureDisplayWindow = nullptr;
static ScrollView* ProtoDisplayWindow = nullptr;

/*-----------------------------------------------------------------------------
Variables
-----------------------------------------------------------------------------*/

/* control knobs */
INT_VAR(classify_num_cp_levels, 3, "Number of Class Pruner Levels");
double_VAR(classify_cp_angle_pad_loose, 45.0,
"Class Pruner Angle Pad Loose");
double_VAR(classify_cp_angle_pad_medium, 20.0,
"Class Pruner Angle Pad Medium");
double_VAR(classify_cp_angle_pad_tight, 10.0,
"CLass Pruner Angle Pad Tight");
double_VAR(classify_cp_end_pad_loose, 0.5, "Class Pruner End Pad Loose");
double_VAR(classify_cp_end_pad_medium, 0.5, "Class Pruner End Pad Medium");
double_VAR(classify_cp_end_pad_tight, 0.5, "Class Pruner End Pad Tight");
double_VAR(classify_cp_side_pad_loose, 2.5, "Class Pruner Side Pad Loose");
double_VAR(classify_cp_side_pad_medium, 1.2, "Class Pruner Side Pad Medium");
double_VAR(classify_cp_side_pad_tight, 0.6, "Class Pruner Side Pad Tight");
double_VAR(classify_pp_angle_pad, 45.0, "Proto Pruner Angle Pad");
double_VAR(classify_pp_end_pad, 0.5, "Proto Prune End Pad");
double_VAR(classify_pp_side_pad, 2.5, "Proto Pruner Side Pad");
static INT_VAR(classify_num_cp_levels, 3, "Number of Class Pruner Levels");
static double_VAR(classify_cp_angle_pad_loose, 45.0,
"Class Pruner Angle Pad Loose");
static double_VAR(classify_cp_angle_pad_medium, 20.0,
"Class Pruner Angle Pad Medium");
static double_VAR(classify_cp_angle_pad_tight, 10.0,
"CLass Pruner Angle Pad Tight");
static double_VAR(classify_cp_end_pad_loose, 0.5, "Class Pruner End Pad Loose");
static double_VAR(classify_cp_end_pad_medium, 0.5, "Class Pruner End Pad Medium");
static double_VAR(classify_cp_end_pad_tight, 0.5, "Class Pruner End Pad Tight");
static double_VAR(classify_cp_side_pad_loose, 2.5, "Class Pruner Side Pad Loose");
static double_VAR(classify_cp_side_pad_medium, 1.2, "Class Pruner Side Pad Medium");
static double_VAR(classify_cp_side_pad_tight, 0.6, "Class Pruner Side Pad Tight");
static double_VAR(classify_pp_angle_pad, 45.0, "Proto Pruner Angle Pad");
static double_VAR(classify_pp_end_pad, 0.5, "Proto Prune End Pad");
static double_VAR(classify_pp_side_pad, 2.5, "Proto Pruner Side Pad");

/*-----------------------------------------------------------------------------
Public Code
Expand Down
2 changes: 1 addition & 1 deletion src/lstm/recodebeam.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ const int RecodeBeamSearch::kBeamWidths[RecodedCharID::kMaxCodeLen + 1] = {
5, 10, 16, 16, 16, 16, 16, 16, 16, 16,
};

const char* kNodeContNames[] = {"Anything", "OnlyDup", "NoDup"};
static const char* kNodeContNames[] = {"Anything", "OnlyDup", "NoDup"};

// Prints debug details of the node.
void RecodeNode::Print(int null_char, const UNICHARSET& unicharset,
Expand Down
9 changes: 4 additions & 5 deletions src/textord/alignedblob.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
// File: alignedblob.cpp
// Description: Subclass of BBGrid to find vertically aligned blobs.
// Author: Ray Smith
// Created: Fri Mar 21 15:03:01 PST 2008
//
// (C) Copyright 2008, Google Inc.
// Licensed under the Apache License, Version 2.0 (the "License");
Expand All @@ -27,10 +26,10 @@

INT_VAR(textord_debug_tabfind, 0, "Debug tab finding");
INT_VAR(textord_debug_bugs, 0, "Turn on output related to bugs in tab finding");
INT_VAR(textord_testregion_left, -1, "Left edge of debug reporting rectangle");
INT_VAR(textord_testregion_top, -1, "Top edge of debug reporting rectangle");
INT_VAR(textord_testregion_right, INT32_MAX, "Right edge of debug rectangle");
INT_VAR(textord_testregion_bottom, INT32_MAX, "Bottom edge of debug rectangle");
static INT_VAR(textord_testregion_left, -1, "Left edge of debug reporting rectangle");
static INT_VAR(textord_testregion_top, -1, "Top edge of debug reporting rectangle");
static INT_VAR(textord_testregion_right, INT32_MAX, "Right edge of debug rectangle");
static INT_VAR(textord_testregion_bottom, INT32_MAX, "Bottom edge of debug rectangle");
BOOL_VAR(textord_debug_printable, false, "Make debug windows printable");

namespace tesseract {
Expand Down
3 changes: 1 addition & 2 deletions src/textord/bbgrid.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
// Description: Class to hold BLOBNBOXs in a grid for fast access
// to neighbours.
// Author: Ray Smith
// Created: Wed Jun 06 17:22:01 PDT 2007
//
// (C) Copyright 2007, Google Inc.
// Licensed under the Apache License, Version 2.0 (the "License");
Expand Down Expand Up @@ -100,7 +99,7 @@ void IntGrid::Clear() {
void IntGrid::Rotate(const FCOORD& rotation) {
ASSERT_HOST(rotation.x() == 0.0f || rotation.y() == 0.0f);
ICOORD old_bleft(bleft());
ICOORD old_tright(tright());
//ICOORD old_tright(tright());
int old_width = gridwidth();
int old_height = gridheight();
TBOX box(bleft(), tright());
Expand Down
6 changes: 3 additions & 3 deletions src/textord/cjkpitch.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@
#include <algorithm>
#include <vector> // for std::vector

BOOL_VAR(textord_space_size_is_variable, false,
"If true, word delimiter spaces are assumed to have "
"variable width, even though characters have fixed pitch.");
static BOOL_VAR(textord_space_size_is_variable, false,
"If true, word delimiter spaces are assumed to have "
"variable width, even though characters have fixed pitch.");

namespace {

Expand Down
18 changes: 9 additions & 9 deletions src/textord/colfind.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -53,15 +53,15 @@ const double kMinGutterWidthGrid = 0.5;
// adding noise blobs.
const double kMaxDistToPartSizeRatio = 1.5;

BOOL_VAR(textord_tabfind_show_initial_partitions,
false, "Show partition bounds");
BOOL_VAR(textord_tabfind_show_reject_blobs,
false, "Show blobs rejected as noise");
INT_VAR(textord_tabfind_show_partitions, 0,
"Show partition bounds, waiting if >1");
BOOL_VAR(textord_tabfind_show_columns, false, "Show column bounds");
BOOL_VAR(textord_tabfind_show_blocks, false, "Show final block bounds");
BOOL_VAR(textord_tabfind_find_tables, true, "run table detection");
static BOOL_VAR(textord_tabfind_show_initial_partitions,
false, "Show partition bounds");
static BOOL_VAR(textord_tabfind_show_reject_blobs,
false, "Show blobs rejected as noise");
static INT_VAR(textord_tabfind_show_partitions, 0,
"Show partition bounds, waiting if >1");
static BOOL_VAR(textord_tabfind_show_columns, false, "Show column bounds");
static BOOL_VAR(textord_tabfind_show_blocks, false, "Show final block bounds");
static BOOL_VAR(textord_tabfind_find_tables, true, "run table detection");

ScrollView* ColumnFinder::blocks_win_ = nullptr;

Expand Down
Loading

0 comments on commit 3971562

Please sign in to comment.