Skip to content

Commit

Permalink
Add missing static attributes
Browse files Browse the repository at this point in the history
This fixes lots of compiler warnings like these ones:

    src/api/baseapi.cpp:113:13: warning: no previous extern declaration for non-static variable 'kInputFile' [-Wmissing-variable-declarations]
    src/api/baseapi.cpp:117:13: warning: no previous extern declaration for non-static variable 'kOldVarsFile' [-Wmissing-variable-declarations]
    src/api/baseapi.cpp:97:10: warning: no previous extern declaration for non-static variable 'stream_filelist' [-Wmissing-variable-declarations]
    src/ccmain/equationdetect.cpp:46:10: warning: no previous extern declaration for non-static variable 'equationdetect_save_bi_image' [-Wmissing-variable-declarations]

Signed-off-by: Stefan Weil <sw@weilnetz.de>
  • Loading branch information
stweil committed May 26, 2019
1 parent 7e7811f commit 4bec4a6
Show file tree
Hide file tree
Showing 27 changed files with 109 additions and 150 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
6 changes: 3 additions & 3 deletions src/ccmain/pgedit.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -117,13 +117,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 +144,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
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
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
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
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
3 changes: 0 additions & 3 deletions src/textord/colfind.h
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
// File: colfind.h
// Description: Class to find columns in the grid of BLOBNBOXes.
// Author: Ray Smith
// Created: Thu Feb 21 14:04:01 PST 2008
//
// (C) Copyright 2008, Google Inc.
// Licensed under the Apache License, Version 2.0 (the "License");
Expand Down Expand Up @@ -38,8 +37,6 @@ class TO_BLOCK;

namespace tesseract {

extern BOOL_VAR_H(textord_tabfind_find_tables, false, "run table detection");

class ColPartitionSet;
class ColPartitionSet_LIST;
class ColSegment_LIST;
Expand Down
3 changes: 1 addition & 2 deletions src/textord/colpartitiongrid.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
// File: colpartitiongrid.cpp
// Description: Class collecting code that acts on a BBGrid of ColPartitions.
// Author: Ray Smith
// Created: Mon Oct 05 08:42:01 PDT 2009
//
// (C) Copyright 2009, Google Inc.
// Licensed under the Apache License, Version 2.0 (the "License");
Expand All @@ -29,7 +28,7 @@

namespace tesseract {

BOOL_VAR(textord_tabfind_show_color_fit, false, "Show stroke widths");
static BOOL_VAR(textord_tabfind_show_color_fit, false, "Show stroke widths");

// Max pad factor used to search the neighbourhood of a partition to smooth
// partition types.
Expand Down
24 changes: 11 additions & 13 deletions src/textord/edgblob.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
* File: edgblob.cpp (Formerly edgeloop.c)
* Description: Functions to clean up an outline before approximation.
* Author: Ray Smith
* Created: Tue Mar 26 16:56:25 GMT 1991
*
*(C) Copyright 1991, Hewlett-Packard Ltd.
** Licensed under the Apache License, Version 2.0(the "License");
Expand Down Expand Up @@ -34,29 +33,28 @@
// - number of children exceeds edges_max_children_per_outline
// - number of nested layers exceeds edges_max_children_layers
// - joint complexity exceeds edges_children_count_limit(as in child_count())
EXTERN BOOL_VAR(edges_use_new_outline_complexity, false,
static BOOL_VAR(edges_use_new_outline_complexity, false,
"Use the new outline complexity module");
EXTERN INT_VAR(edges_max_children_per_outline, 10,
static INT_VAR(edges_max_children_per_outline, 10,
"Max number of children inside a character outline");
EXTERN INT_VAR(edges_max_children_layers, 5,
static INT_VAR(edges_max_children_layers, 5,
"Max layers of nested children inside a character outline");
EXTERN BOOL_VAR(edges_debug, false,
static BOOL_VAR(edges_debug, false,
"turn on debugging for this module");


EXTERN INT_VAR(edges_children_per_grandchild, 10,
static INT_VAR(edges_children_per_grandchild, 10,
"Importance ratio for chucking outlines");
EXTERN INT_VAR(edges_children_count_limit, 45,
static INT_VAR(edges_children_count_limit, 45,
"Max holes allowed in blob");
EXTERN BOOL_VAR(edges_children_fix, false,
static BOOL_VAR(edges_children_fix, false,
"Remove boxy parents of char-like children");
EXTERN INT_VAR(edges_min_nonhole, 12,
static INT_VAR(edges_min_nonhole, 12,
"Min pixels for potential char in box");
EXTERN INT_VAR(edges_patharea_ratio, 40,
static INT_VAR(edges_patharea_ratio, 40,
"Max lensq/area for acceptable child outline");
EXTERN double_VAR(edges_childarea, 0.5,
static double_VAR(edges_childarea, 0.5,
"Min area fraction of child outline");
EXTERN double_VAR(edges_boxarea, 0.875,
static double_VAR(edges_boxarea, 0.875,
"Min area fraction of grandchild for box");

/**
Expand Down
12 changes: 1 addition & 11 deletions src/textord/edgloop.h
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
/**********************************************************************
* File: edgloop.h (Formerly edgeloop.h)
* Description: Functions to clean up an outline before approximation.
* Author: Ray Smith
* Created: Tue Mar 26 16:56:25 GMT 1991
* Author: Ray Smith
*
* (C) Copyright 1991, Hewlett-Packard Ltd.
** Licensed under the Apache License, Version 2.0 (the "License");
Expand All @@ -28,15 +27,6 @@

#define BUCKETSIZE 16


extern INT_VAR_H (edges_children_per_grandchild, 10,
"Importance ratio for chucking outlines");
extern INT_VAR_H (edges_children_count_limit, 45,
"Max holes allowed in blob");
extern double_VAR_H (edges_childarea, 0.5,
"Max area fraction of child outline");
extern double_VAR_H (edges_boxarea, 0.8,
"Min area fraction of grandchild for box");
void complete_edge(CRACKEDGE *start, //start of loop
C_OUTLINE_IT* outline_it);
ScrollView::Color check_path_legal( //certify outline
Expand Down
3 changes: 1 addition & 2 deletions src/textord/imagefind.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
// Description: Function to find image and drawing regions in an image
// and create a corresponding list of empty blobs.
// Author: Ray Smith
// Created: Thu Mar 20 09:49:01 PDT 2008
//
// (C) Copyright 2008, Google Inc.
// Licensed under the Apache License, Version 2.0 (the "License");
Expand Down Expand Up @@ -32,7 +31,7 @@

#include <algorithm>

INT_VAR(textord_tabfind_show_images, false, "Show image blobs");
static INT_VAR(textord_tabfind_show_images, false, "Show image blobs");

namespace tesseract {

Expand Down
Loading

0 comments on commit 4bec4a6

Please sign in to comment.