Skip to content

Commit

Permalink
Fix compiler warnings [-Wmissing-prototypes]
Browse files Browse the repository at this point in the history
Add missing include statements, add missing "static" qualifiers or
remove functions which are not used at all.

Signed-off-by: Stefan Weil <sw@weilnetz.de>
  • Loading branch information
stweil committed Jul 5, 2018
1 parent 4ca452d commit d2febaf
Show file tree
Hide file tree
Showing 29 changed files with 158 additions and 253 deletions.
6 changes: 3 additions & 3 deletions src/api/baseapi.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2622,9 +2622,9 @@ void TessBaseAPI::NormalizeTBLOB(TBLOB *tblob, ROW *row, bool numeric_mode) {
* Return a TBLOB * from the whole pix.
* To be freed later with delete.
*/
TBLOB *make_tesseract_blob(float baseline, float xheight,
float descender, float ascender,
bool numeric_mode, Pix* pix) {
static TBLOB *make_tesseract_blob(float baseline, float xheight,
float descender, float ascender,
bool numeric_mode, Pix* pix) {
TBLOB *tblob = TessBaseAPI::MakeTBLOB(pix);

// Normalize TBLOB
Expand Down
18 changes: 9 additions & 9 deletions src/api/pdfrenderer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -202,15 +202,15 @@ void TessPDFRenderer::AppendPDFObject(const char *data) {
// Helper function to prevent us from accidentally writing
// scientific notation to an HOCR or PDF file. Besides, three
// decimal points are all you really need.
double prec(double x) {
static double prec(double x) {
double kPrecision = 1000.0;
double a = round(x * kPrecision) / kPrecision;
if (a == -0)
return 0;
return a;
}

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

Expand All @@ -222,10 +222,10 @@ long dist2(int x1, int y1, int x2, int y2) {
// left-to-right no matter what the reading order is. We need the
// word baseline in reading order, so we do that conversion here. Returns
// the word's baseline origin and length.
void GetWordBaseline(int writing_direction, int ppi, int height,
int word_x1, int word_y1, int word_x2, int word_y2,
int line_x1, int line_y1, int line_x2, int line_y2,
double *x0, double *y0, double *length) {
static void GetWordBaseline(int writing_direction, int ppi, int height,
int word_x1, int word_y1, int word_x2, int word_y2,
int line_x1, int line_y1, int line_x2, int line_y2,
double *x0, double *y0, double *length) {
if (writing_direction == WRITING_DIRECTION_RIGHT_TO_LEFT) {
Swap(&word_x1, &word_x2);
Swap(&word_y1, &word_y2);
Expand Down Expand Up @@ -264,9 +264,9 @@ void GetWordBaseline(int writing_direction, int ppi, int height,
// RTL
// [ x' ] = [ a b ][ x ] = [-1 0 ] [ cos sin ][ x ]
// [ y' ] [ c d ][ y ] [ 0 1 ] [-sin cos ][ y ]
void AffineMatrix(int writing_direction,
int line_x1, int line_y1, int line_x2, int line_y2,
double *a, double *b, double *c, double *d) {
static void AffineMatrix(int writing_direction,
int line_x1, int line_y1, int line_x2, int line_y2,
double *a, double *b, double *c, double *d) {
double theta = atan2(static_cast<double>(line_y1 - line_y2),
static_cast<double>(line_x2 - line_x1));
*a = cos(theta);
Expand Down
5 changes: 3 additions & 2 deletions src/ccmain/osdetect.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -156,8 +156,9 @@ void OSResults::accumulate(const OSResults& osr) {

// Detect and erase horizontal/vertical lines and picture regions from the
// image, so that non-text blobs are removed from consideration.
void remove_nontext_regions(tesseract::Tesseract *tess, BLOCK_LIST *blocks,
TO_BLOCK_LIST *to_blocks) {
static void remove_nontext_regions(tesseract::Tesseract *tess,
BLOCK_LIST *blocks,
TO_BLOCK_LIST *to_blocks) {
Pix *pix = tess->pix_binary();
ASSERT_HOST(pix != nullptr);
int vertical_x = 0;
Expand Down
17 changes: 0 additions & 17 deletions src/ccmain/output.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,23 +42,6 @@
#define CTRL_NEWLINE '\012' //newline
#define CTRL_HARDLINE '\015' //cr

/**********************************************************************
* pixels_to_pts
*
* Convert an integer number of pixels to the nearest integer
* number of points.
**********************************************************************/

int32_t pixels_to_pts( //convert coords
int32_t pixels,
int32_t pix_res //resolution
) {
float pts; //converted value

pts = pixels * 72.0 / pix_res;
return (int32_t) (pts + 0.5); //round it
}

namespace tesseract {
void Tesseract::output_pass( //Tess output pass //send to api
PAGE_RES_IT &page_res_it,
Expand Down
Loading

0 comments on commit d2febaf

Please sign in to comment.