Skip to content

Commit 4bec4a6

Browse files
committed
Add missing static attributes
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>
1 parent 7e7811f commit 4bec4a6

27 files changed

+109
-150
lines changed

src/api/baseapi.cpp

+3-3
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@
9494
#include "tprintf.h" // for tprintf
9595
#include "werd.h" // for WERD, WERD_IT, W_FUZZY_NON, W_FUZZY_SP
9696

97-
BOOL_VAR(stream_filelist, false, "Stream a filelist from stdin");
97+
static BOOL_VAR(stream_filelist, false, "Stream a filelist from stdin");
9898

9999
namespace tesseract {
100100

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

src/ccmain/equationdetect.cpp

+4-5
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
// File: equationdetect.cpp
33
// Description: Helper classes to detect equations.
44
// Author: Zongyi (Joe) Liu (joeliu@google.com)
5-
// Created: Fri Aug 31 11:13:01 PST 2011
65
//
76
// (C) Copyright 2011, Google Inc.
87
// Licensed under the Apache License, Version 2.0 (the "License");
@@ -43,10 +42,10 @@
4342
#include "tesseractclass.h"
4443

4544
// Config variables.
46-
BOOL_VAR(equationdetect_save_bi_image, false, "Save input bi image");
47-
BOOL_VAR(equationdetect_save_spt_image, false, "Save special character image");
48-
BOOL_VAR(equationdetect_save_seed_image, false, "Save the seed image");
49-
BOOL_VAR(equationdetect_save_merged_image, false, "Save the merged image");
45+
static BOOL_VAR(equationdetect_save_bi_image, false, "Save input bi image");
46+
static BOOL_VAR(equationdetect_save_spt_image, false, "Save special character image");
47+
static BOOL_VAR(equationdetect_save_seed_image, false, "Save the seed image");
48+
static BOOL_VAR(equationdetect_save_merged_image, false, "Save the merged image");
5049

5150
namespace tesseract {
5251

src/ccmain/pgedit.cpp

+3-3
Original file line numberDiff line numberDiff line change
@@ -117,13 +117,13 @@ static bool display_image = false;
117117
static bool display_blocks = false;
118118
static bool display_baselines = false;
119119

120-
PAGE_RES *current_page_res = nullptr;
120+
static PAGE_RES *current_page_res = nullptr;
121121

122122
STRING_VAR(editor_image_win_name, "EditorImage",
123123
"Editor image window name");
124124
INT_VAR(editor_image_xpos, 590, "Editor image X Pos");
125125
INT_VAR(editor_image_ypos, 10, "Editor image Y Pos");
126-
INT_VAR(editor_image_menuheight, 50, "Add to image height for menu bar");
126+
static INT_VAR(editor_image_menuheight, 50, "Add to image height for menu bar");
127127
INT_VAR(editor_image_word_bb_color, ScrollView::BLUE,
128128
"Word bounding box colour");
129129
INT_VAR(editor_image_blob_bb_color, ScrollView::YELLOW,
@@ -144,7 +144,7 @@ INT_VAR(editor_word_ypos, 510, "Word window Y Pos");
144144
INT_VAR(editor_word_height, 240, "Word window height");
145145
INT_VAR(editor_word_width, 655, "Word window width");
146146

147-
STRING_VAR(editor_debug_config_file, "", "Config file to apply to single words");
147+
static STRING_VAR(editor_debug_config_file, "", "Config file to apply to single words");
148148

149149
/**
150150
* show_point()

src/ccstruct/mod128.cpp

+1-2
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
* File: mod128.cpp (Formerly dir128.c)
33
* Description: Code to convert a DIR128 to an ICOORD.
44
* Author: Ray Smith
5-
* Created: Tue Oct 22 11:56:09 BST 1991
65
*
76
* (C) Copyright 1991, Hewlett-Packard Ltd.
87
** Licensed under the Apache License, Version 2.0 (the "License");
@@ -54,7 +53,7 @@ static const int16_t idirtab[] = {
5453
980, -195, 989, -146, 995, -98, 998, -49
5554
};
5655

57-
const ICOORD* dirtab = reinterpret_cast<const ICOORD*>(idirtab);
56+
static const ICOORD* dirtab = reinterpret_cast<const ICOORD*>(idirtab);
5857

5958
/**********************************************************************
6059
* DIR128::DIR128

src/ccstruct/polyaprx.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -31,8 +31,8 @@
3131
#define EXTERN
3232
#define FASTEDGELENGTH 256
3333

34-
EXTERN BOOL_VAR(poly_debug, false, "Debug old poly");
35-
EXTERN BOOL_VAR(poly_wide_objects_better, true,
34+
static BOOL_VAR(poly_debug, false, "Debug old poly");
35+
static BOOL_VAR(poly_wide_objects_better, true,
3636
"More accurate approx on wide things");
3737

3838
#define FIXED 4 /*OUTLINE point is fixed */

src/ccutil/unicharcompress.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
namespace tesseract {
2727

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

src/classify/blobclass.cpp

+2-3
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
** Filename: blobclass.c
33
** Purpose: High level blob classification and training routines.
44
** Author: Dan Johnson
5-
** History: 7/21/89, DSJ, Created.
65
**
76
** (c) Copyright Hewlett-Packard Company, 1988.
87
** Licensed under the Apache License, Version 2.0 (the "License");
@@ -32,8 +31,8 @@
3231

3332
static const char kUnknownFontName[] = "UnknownFont";
3433

35-
STRING_VAR(classify_font_name, kUnknownFontName,
36-
"Default font name to be used in training");
34+
static STRING_VAR(classify_font_name, kUnknownFontName,
35+
"Default font name to be used in training");
3736

3837
namespace tesseract {
3938
/**----------------------------------------------------------------------------

src/classify/intfx.cpp

+2-3
Original file line numberDiff line numberDiff line change
@@ -41,15 +41,14 @@ using tesseract::TrainingSample;
4141
// The entries are in binary degrees where a full circle is 256 binary degrees.
4242
static float cos_table[INT_CHAR_NORM_RANGE];
4343
static float sin_table[INT_CHAR_NORM_RANGE];
44-
// Guards write access to AtanTable so we don't create it more than once.
45-
tesseract::CCUtilMutex atan_table_mutex;
46-
4744

4845
/**----------------------------------------------------------------------------
4946
Public Code
5047
----------------------------------------------------------------------------**/
5148

5249
void InitIntegerFX() {
50+
// Guards write access to AtanTable so we don't create it more than once.
51+
static tesseract::CCUtilMutex atan_table_mutex;
5352
static bool atan_table_init = false;
5453
atan_table_mutex.Lock();
5554
if (!atan_table_init) {

src/classify/intproto.cpp

+19-19
Original file line numberDiff line numberDiff line change
@@ -172,31 +172,31 @@ int TruncateParam(float Param, int Min, int Max, char *Id);
172172
-----------------------------------------------------------------------------*/
173173

174174
/* global display lists used to display proto and feature match information*/
175-
ScrollView *IntMatchWindow = nullptr;
176-
ScrollView *FeatureDisplayWindow = nullptr;
177-
ScrollView *ProtoDisplayWindow = nullptr;
175+
static ScrollView* IntMatchWindow = nullptr;
176+
static ScrollView* FeatureDisplayWindow = nullptr;
177+
static ScrollView* ProtoDisplayWindow = nullptr;
178178

179179
/*-----------------------------------------------------------------------------
180180
Variables
181181
-----------------------------------------------------------------------------*/
182182

183183
/* control knobs */
184-
INT_VAR(classify_num_cp_levels, 3, "Number of Class Pruner Levels");
185-
double_VAR(classify_cp_angle_pad_loose, 45.0,
186-
"Class Pruner Angle Pad Loose");
187-
double_VAR(classify_cp_angle_pad_medium, 20.0,
188-
"Class Pruner Angle Pad Medium");
189-
double_VAR(classify_cp_angle_pad_tight, 10.0,
190-
"CLass Pruner Angle Pad Tight");
191-
double_VAR(classify_cp_end_pad_loose, 0.5, "Class Pruner End Pad Loose");
192-
double_VAR(classify_cp_end_pad_medium, 0.5, "Class Pruner End Pad Medium");
193-
double_VAR(classify_cp_end_pad_tight, 0.5, "Class Pruner End Pad Tight");
194-
double_VAR(classify_cp_side_pad_loose, 2.5, "Class Pruner Side Pad Loose");
195-
double_VAR(classify_cp_side_pad_medium, 1.2, "Class Pruner Side Pad Medium");
196-
double_VAR(classify_cp_side_pad_tight, 0.6, "Class Pruner Side Pad Tight");
197-
double_VAR(classify_pp_angle_pad, 45.0, "Proto Pruner Angle Pad");
198-
double_VAR(classify_pp_end_pad, 0.5, "Proto Prune End Pad");
199-
double_VAR(classify_pp_side_pad, 2.5, "Proto Pruner Side Pad");
184+
static INT_VAR(classify_num_cp_levels, 3, "Number of Class Pruner Levels");
185+
static double_VAR(classify_cp_angle_pad_loose, 45.0,
186+
"Class Pruner Angle Pad Loose");
187+
static double_VAR(classify_cp_angle_pad_medium, 20.0,
188+
"Class Pruner Angle Pad Medium");
189+
static double_VAR(classify_cp_angle_pad_tight, 10.0,
190+
"CLass Pruner Angle Pad Tight");
191+
static double_VAR(classify_cp_end_pad_loose, 0.5, "Class Pruner End Pad Loose");
192+
static double_VAR(classify_cp_end_pad_medium, 0.5, "Class Pruner End Pad Medium");
193+
static double_VAR(classify_cp_end_pad_tight, 0.5, "Class Pruner End Pad Tight");
194+
static double_VAR(classify_cp_side_pad_loose, 2.5, "Class Pruner Side Pad Loose");
195+
static double_VAR(classify_cp_side_pad_medium, 1.2, "Class Pruner Side Pad Medium");
196+
static double_VAR(classify_cp_side_pad_tight, 0.6, "Class Pruner Side Pad Tight");
197+
static double_VAR(classify_pp_angle_pad, 45.0, "Proto Pruner Angle Pad");
198+
static double_VAR(classify_pp_end_pad, 0.5, "Proto Prune End Pad");
199+
static double_VAR(classify_pp_side_pad, 2.5, "Proto Pruner Side Pad");
200200

201201
/*-----------------------------------------------------------------------------
202202
Public Code

src/lstm/recodebeam.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ const int RecodeBeamSearch::kBeamWidths[RecodedCharID::kMaxCodeLen + 1] = {
4242
5, 10, 16, 16, 16, 16, 16, 16, 16, 16,
4343
};
4444

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

4747
// Prints debug details of the node.
4848
void RecodeNode::Print(int null_char, const UNICHARSET& unicharset,

src/textord/alignedblob.cpp

+4-5
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
// File: alignedblob.cpp
33
// Description: Subclass of BBGrid to find vertically aligned blobs.
44
// Author: Ray Smith
5-
// Created: Fri Mar 21 15:03:01 PST 2008
65
//
76
// (C) Copyright 2008, Google Inc.
87
// Licensed under the Apache License, Version 2.0 (the "License");
@@ -27,10 +26,10 @@
2726

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

3635
namespace tesseract {

src/textord/cjkpitch.cpp

+3-3
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,9 @@
2525
#include <algorithm>
2626
#include <vector> // for std::vector
2727

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

3232
namespace {
3333

src/textord/colfind.cpp

+9-9
Original file line numberDiff line numberDiff line change
@@ -53,15 +53,15 @@ const double kMinGutterWidthGrid = 0.5;
5353
// adding noise blobs.
5454
const double kMaxDistToPartSizeRatio = 1.5;
5555

56-
BOOL_VAR(textord_tabfind_show_initial_partitions,
57-
false, "Show partition bounds");
58-
BOOL_VAR(textord_tabfind_show_reject_blobs,
59-
false, "Show blobs rejected as noise");
60-
INT_VAR(textord_tabfind_show_partitions, 0,
61-
"Show partition bounds, waiting if >1");
62-
BOOL_VAR(textord_tabfind_show_columns, false, "Show column bounds");
63-
BOOL_VAR(textord_tabfind_show_blocks, false, "Show final block bounds");
64-
BOOL_VAR(textord_tabfind_find_tables, true, "run table detection");
56+
static BOOL_VAR(textord_tabfind_show_initial_partitions,
57+
false, "Show partition bounds");
58+
static BOOL_VAR(textord_tabfind_show_reject_blobs,
59+
false, "Show blobs rejected as noise");
60+
static INT_VAR(textord_tabfind_show_partitions, 0,
61+
"Show partition bounds, waiting if >1");
62+
static BOOL_VAR(textord_tabfind_show_columns, false, "Show column bounds");
63+
static BOOL_VAR(textord_tabfind_show_blocks, false, "Show final block bounds");
64+
static BOOL_VAR(textord_tabfind_find_tables, true, "run table detection");
6565

6666
ScrollView* ColumnFinder::blocks_win_ = nullptr;
6767

src/textord/colfind.h

-3
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
// File: colfind.h
33
// Description: Class to find columns in the grid of BLOBNBOXes.
44
// Author: Ray Smith
5-
// Created: Thu Feb 21 14:04:01 PST 2008
65
//
76
// (C) Copyright 2008, Google Inc.
87
// Licensed under the Apache License, Version 2.0 (the "License");
@@ -38,8 +37,6 @@ class TO_BLOCK;
3837

3938
namespace tesseract {
4039

41-
extern BOOL_VAR_H(textord_tabfind_find_tables, false, "run table detection");
42-
4340
class ColPartitionSet;
4441
class ColPartitionSet_LIST;
4542
class ColSegment_LIST;

src/textord/colpartitiongrid.cpp

+1-2
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
// File: colpartitiongrid.cpp
33
// Description: Class collecting code that acts on a BBGrid of ColPartitions.
44
// Author: Ray Smith
5-
// Created: Mon Oct 05 08:42:01 PDT 2009
65
//
76
// (C) Copyright 2009, Google Inc.
87
// Licensed under the Apache License, Version 2.0 (the "License");
@@ -29,7 +28,7 @@
2928

3029
namespace tesseract {
3130

32-
BOOL_VAR(textord_tabfind_show_color_fit, false, "Show stroke widths");
31+
static BOOL_VAR(textord_tabfind_show_color_fit, false, "Show stroke widths");
3332

3433
// Max pad factor used to search the neighbourhood of a partition to smooth
3534
// partition types.

src/textord/edgblob.cpp

+11-13
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22
* File: edgblob.cpp (Formerly edgeloop.c)
33
* Description: Functions to clean up an outline before approximation.
44
* Author: Ray Smith
5-
* Created: Tue Mar 26 16:56:25 GMT 1991
65
*
76
*(C) Copyright 1991, Hewlett-Packard Ltd.
87
** Licensed under the Apache License, Version 2.0(the "License");
@@ -34,29 +33,28 @@
3433
// - number of children exceeds edges_max_children_per_outline
3534
// - number of nested layers exceeds edges_max_children_layers
3635
// - joint complexity exceeds edges_children_count_limit(as in child_count())
37-
EXTERN BOOL_VAR(edges_use_new_outline_complexity, false,
36+
static BOOL_VAR(edges_use_new_outline_complexity, false,
3837
"Use the new outline complexity module");
39-
EXTERN INT_VAR(edges_max_children_per_outline, 10,
38+
static INT_VAR(edges_max_children_per_outline, 10,
4039
"Max number of children inside a character outline");
41-
EXTERN INT_VAR(edges_max_children_layers, 5,
40+
static INT_VAR(edges_max_children_layers, 5,
4241
"Max layers of nested children inside a character outline");
43-
EXTERN BOOL_VAR(edges_debug, false,
42+
static BOOL_VAR(edges_debug, false,
4443
"turn on debugging for this module");
4544

46-
47-
EXTERN INT_VAR(edges_children_per_grandchild, 10,
45+
static INT_VAR(edges_children_per_grandchild, 10,
4846
"Importance ratio for chucking outlines");
49-
EXTERN INT_VAR(edges_children_count_limit, 45,
47+
static INT_VAR(edges_children_count_limit, 45,
5048
"Max holes allowed in blob");
51-
EXTERN BOOL_VAR(edges_children_fix, false,
49+
static BOOL_VAR(edges_children_fix, false,
5250
"Remove boxy parents of char-like children");
53-
EXTERN INT_VAR(edges_min_nonhole, 12,
51+
static INT_VAR(edges_min_nonhole, 12,
5452
"Min pixels for potential char in box");
55-
EXTERN INT_VAR(edges_patharea_ratio, 40,
53+
static INT_VAR(edges_patharea_ratio, 40,
5654
"Max lensq/area for acceptable child outline");
57-
EXTERN double_VAR(edges_childarea, 0.5,
55+
static double_VAR(edges_childarea, 0.5,
5856
"Min area fraction of child outline");
59-
EXTERN double_VAR(edges_boxarea, 0.875,
57+
static double_VAR(edges_boxarea, 0.875,
6058
"Min area fraction of grandchild for box");
6159

6260
/**

src/textord/edgloop.h

+1-11
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,7 @@
11
/**********************************************************************
22
* File: edgloop.h (Formerly edgeloop.h)
33
* Description: Functions to clean up an outline before approximation.
4-
* Author: Ray Smith
5-
* Created: Tue Mar 26 16:56:25 GMT 1991
4+
* Author: Ray Smith
65
*
76
* (C) Copyright 1991, Hewlett-Packard Ltd.
87
** Licensed under the Apache License, Version 2.0 (the "License");
@@ -28,15 +27,6 @@
2827

2928
#define BUCKETSIZE 16
3029

31-
32-
extern INT_VAR_H (edges_children_per_grandchild, 10,
33-
"Importance ratio for chucking outlines");
34-
extern INT_VAR_H (edges_children_count_limit, 45,
35-
"Max holes allowed in blob");
36-
extern double_VAR_H (edges_childarea, 0.5,
37-
"Max area fraction of child outline");
38-
extern double_VAR_H (edges_boxarea, 0.8,
39-
"Min area fraction of grandchild for box");
4030
void complete_edge(CRACKEDGE *start, //start of loop
4131
C_OUTLINE_IT* outline_it);
4232
ScrollView::Color check_path_legal( //certify outline

src/textord/imagefind.cpp

+1-2
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,6 @@
33
// Description: Function to find image and drawing regions in an image
44
// and create a corresponding list of empty blobs.
55
// Author: Ray Smith
6-
// Created: Thu Mar 20 09:49:01 PDT 2008
76
//
87
// (C) Copyright 2008, Google Inc.
98
// Licensed under the Apache License, Version 2.0 (the "License");
@@ -32,7 +31,7 @@
3231

3332
#include <algorithm>
3433

35-
INT_VAR(textord_tabfind_show_images, false, "Show image blobs");
34+
static INT_VAR(textord_tabfind_show_images, false, "Show image blobs");
3635

3736
namespace tesseract {
3837

0 commit comments

Comments
 (0)