Skip to content

Commit d2febaf

Browse files
committed
Fix compiler warnings [-Wmissing-prototypes]
Add missing include statements, add missing "static" qualifiers or remove functions which are not used at all. Signed-off-by: Stefan Weil <[email protected]>
1 parent 4ca452d commit d2febaf

29 files changed

+158
-253
lines changed

src/api/baseapi.cpp

+3-3
Original file line numberDiff line numberDiff line change
@@ -2622,9 +2622,9 @@ void TessBaseAPI::NormalizeTBLOB(TBLOB *tblob, ROW *row, bool numeric_mode) {
26222622
* Return a TBLOB * from the whole pix.
26232623
* To be freed later with delete.
26242624
*/
2625-
TBLOB *make_tesseract_blob(float baseline, float xheight,
2626-
float descender, float ascender,
2627-
bool numeric_mode, Pix* pix) {
2625+
static TBLOB *make_tesseract_blob(float baseline, float xheight,
2626+
float descender, float ascender,
2627+
bool numeric_mode, Pix* pix) {
26282628
TBLOB *tblob = TessBaseAPI::MakeTBLOB(pix);
26292629

26302630
// Normalize TBLOB

src/api/pdfrenderer.cpp

+9-9
Original file line numberDiff line numberDiff line change
@@ -202,15 +202,15 @@ void TessPDFRenderer::AppendPDFObject(const char *data) {
202202
// Helper function to prevent us from accidentally writing
203203
// scientific notation to an HOCR or PDF file. Besides, three
204204
// decimal points are all you really need.
205-
double prec(double x) {
205+
static double prec(double x) {
206206
double kPrecision = 1000.0;
207207
double a = round(x * kPrecision) / kPrecision;
208208
if (a == -0)
209209
return 0;
210210
return a;
211211
}
212212

213-
long dist2(int x1, int y1, int x2, int y2) {
213+
static long dist2(int x1, int y1, int x2, int y2) {
214214
return (x2 - x1) * (x2 - x1) + (y2 - y1) * (y2 - y1);
215215
}
216216

@@ -222,10 +222,10 @@ long dist2(int x1, int y1, int x2, int y2) {
222222
// left-to-right no matter what the reading order is. We need the
223223
// word baseline in reading order, so we do that conversion here. Returns
224224
// the word's baseline origin and length.
225-
void GetWordBaseline(int writing_direction, int ppi, int height,
226-
int word_x1, int word_y1, int word_x2, int word_y2,
227-
int line_x1, int line_y1, int line_x2, int line_y2,
228-
double *x0, double *y0, double *length) {
225+
static void GetWordBaseline(int writing_direction, int ppi, int height,
226+
int word_x1, int word_y1, int word_x2, int word_y2,
227+
int line_x1, int line_y1, int line_x2, int line_y2,
228+
double *x0, double *y0, double *length) {
229229
if (writing_direction == WRITING_DIRECTION_RIGHT_TO_LEFT) {
230230
Swap(&word_x1, &word_x2);
231231
Swap(&word_y1, &word_y2);
@@ -264,9 +264,9 @@ void GetWordBaseline(int writing_direction, int ppi, int height,
264264
// RTL
265265
// [ x' ] = [ a b ][ x ] = [-1 0 ] [ cos sin ][ x ]
266266
// [ y' ] [ c d ][ y ] [ 0 1 ] [-sin cos ][ y ]
267-
void AffineMatrix(int writing_direction,
268-
int line_x1, int line_y1, int line_x2, int line_y2,
269-
double *a, double *b, double *c, double *d) {
267+
static void AffineMatrix(int writing_direction,
268+
int line_x1, int line_y1, int line_x2, int line_y2,
269+
double *a, double *b, double *c, double *d) {
270270
double theta = atan2(static_cast<double>(line_y1 - line_y2),
271271
static_cast<double>(line_x2 - line_x1));
272272
*a = cos(theta);

src/ccmain/osdetect.cpp

+3-2
Original file line numberDiff line numberDiff line change
@@ -156,8 +156,9 @@ void OSResults::accumulate(const OSResults& osr) {
156156

157157
// Detect and erase horizontal/vertical lines and picture regions from the
158158
// image, so that non-text blobs are removed from consideration.
159-
void remove_nontext_regions(tesseract::Tesseract *tess, BLOCK_LIST *blocks,
160-
TO_BLOCK_LIST *to_blocks) {
159+
static void remove_nontext_regions(tesseract::Tesseract *tess,
160+
BLOCK_LIST *blocks,
161+
TO_BLOCK_LIST *to_blocks) {
161162
Pix *pix = tess->pix_binary();
162163
ASSERT_HOST(pix != nullptr);
163164
int vertical_x = 0;

src/ccmain/output.cpp

-17
Original file line numberDiff line numberDiff line change
@@ -42,23 +42,6 @@
4242
#define CTRL_NEWLINE '\012' //newline
4343
#define CTRL_HARDLINE '\015' //cr
4444

45-
/**********************************************************************
46-
* pixels_to_pts
47-
*
48-
* Convert an integer number of pixels to the nearest integer
49-
* number of points.
50-
**********************************************************************/
51-
52-
int32_t pixels_to_pts( //convert coords
53-
int32_t pixels,
54-
int32_t pix_res //resolution
55-
) {
56-
float pts; //converted value
57-
58-
pts = pixels * 72.0 / pix_res;
59-
return (int32_t) (pts + 0.5); //round it
60-
}
61-
6245
namespace tesseract {
6346
void Tesseract::output_pass( //Tess output pass //send to api
6447
PAGE_RES_IT &page_res_it,

0 commit comments

Comments
 (0)