Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Format code and fix some style issues #1935

Merged
merged 4 commits into from
Sep 29, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 11 additions & 11 deletions src/api/capi.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -413,9 +413,9 @@ TESS_API struct Boxa* TESS_CALL TessBaseAPIGetComponentImages(TessBaseAPI* handl
}

TESS_API struct Boxa*
TESS_CALL TessBaseAPIGetComponentImages1( TessBaseAPI* handle, const TessPageIteratorLevel level, const BOOL text_only,
const BOOL raw_image, const int raw_padding,
struct Pixa** pixa, int** blockids, int** paraids)
TESS_CALL TessBaseAPIGetComponentImages1(TessBaseAPI* handle, const TessPageIteratorLevel level, const BOOL text_only,
const BOOL raw_image, const int raw_padding,
struct Pixa** pixa, int** blockids, int** paraids)
{
return handle->GetComponentImages(level, text_only != FALSE, raw_image, raw_padding, pixa, blockids, paraids);
}
Expand Down Expand Up @@ -825,37 +825,37 @@ TESS_API ETEXT_DESC* TESS_CALL TessMonitorCreate()
return new ETEXT_DESC();
}

TESS_API void TESS_CALL TessMonitorDelete( ETEXT_DESC* monitor )
TESS_API void TESS_CALL TessMonitorDelete(ETEXT_DESC* monitor)
{
delete monitor;
}

TESS_API void TESS_CALL TessMonitorSetCancelFunc( ETEXT_DESC* monitor, TessCancelFunc cancelFunc )
TESS_API void TESS_CALL TessMonitorSetCancelFunc(ETEXT_DESC* monitor, TessCancelFunc cancelFunc)
{
monitor->cancel = cancelFunc;
}

TESS_API void TESS_CALL TessMonitorSetCancelThis( ETEXT_DESC* monitor, void* cancelThis )
TESS_API void TESS_CALL TessMonitorSetCancelThis(ETEXT_DESC* monitor, void* cancelThis)
{
monitor->cancel_this = cancelThis;
}

TESS_API void* TESS_CALL TessMonitorGetCancelThis( ETEXT_DESC* monitor )
TESS_API void* TESS_CALL TessMonitorGetCancelThis(ETEXT_DESC* monitor)
{
return monitor->cancel_this;
}

TESS_API void TESS_CALL TessMonitorSetProgressFunc( ETEXT_DESC* monitor, TessProgressFunc progressFunc )
TESS_API void TESS_CALL TessMonitorSetProgressFunc(ETEXT_DESC* monitor, TessProgressFunc progressFunc)
{
monitor->progress_callback2 = progressFunc;
}

TESS_API int TESS_CALL TessMonitorGetProgress( ETEXT_DESC* monitor )
TESS_API int TESS_CALL TessMonitorGetProgress(ETEXT_DESC* monitor)
{
return monitor->progress;
}

TESS_API void TESS_CALL TessMonitorSetDeadlineMSecs( ETEXT_DESC* monitor, int deadline )
TESS_API void TESS_CALL TessMonitorSetDeadlineMSecs(ETEXT_DESC* monitor, int deadline)
{
monitor->set_deadline_msecs( deadline );
monitor->set_deadline_msecs(deadline);
}
46 changes: 23 additions & 23 deletions src/api/capi.h
Original file line number Diff line number Diff line change
Expand Up @@ -151,7 +151,7 @@ TESS_API void TESS_CALL TessBaseAPIDelete(TessBaseAPI* handle);

TESS_API size_t TESS_CALL TessBaseAPIGetOpenCLDevice(TessBaseAPI* handle, void **device);

TESS_API void TESS_CALL TessBaseAPISetInputName( TessBaseAPI* handle, const char* name);
TESS_API void TESS_CALL TessBaseAPISetInputName(TessBaseAPI* handle, const char* name);
TESS_API const char* TESS_CALL TessBaseAPIGetInputName(TessBaseAPI* handle);

TESS_API void TESS_CALL TessBaseAPISetInputImage(TessBaseAPI* handle, struct Pix* pix);
Expand All @@ -165,13 +165,13 @@ TESS_API void TESS_CALL TessBaseAPISetOutputName(TessBaseAPI* handle, const cha
TESS_API BOOL TESS_CALL TessBaseAPISetVariable(TessBaseAPI* handle, const char* name, const char* value);
TESS_API BOOL TESS_CALL TessBaseAPISetDebugVariable(TessBaseAPI* handle, const char* name, const char* value);

TESS_API BOOL TESS_CALL TessBaseAPIGetIntVariable( const TessBaseAPI* handle, const char* name, int* value);
TESS_API BOOL TESS_CALL TessBaseAPIGetBoolVariable( const TessBaseAPI* handle, const char* name, BOOL* value);
TESS_API BOOL TESS_CALL TessBaseAPIGetIntVariable(const TessBaseAPI* handle, const char* name, int* value);
TESS_API BOOL TESS_CALL TessBaseAPIGetBoolVariable(const TessBaseAPI* handle, const char* name, BOOL* value);
TESS_API BOOL TESS_CALL TessBaseAPIGetDoubleVariable(const TessBaseAPI* handle, const char* name, double* value);
TESS_API const char*
TESS_CALL TessBaseAPIGetStringVariable(const TessBaseAPI* handle, const char* name);

TESS_API void TESS_CALL TessBaseAPIPrintVariables( const TessBaseAPI* handle, FILE* fp);
TESS_API void TESS_CALL TessBaseAPIPrintVariables(const TessBaseAPI* handle, FILE* fp);
TESS_API BOOL TESS_CALL TessBaseAPIPrintVariablesToFile(const TessBaseAPI* handle, const char* filename);

#ifdef TESS_CAPI_INCLUDE_BASEAPI
Expand Down Expand Up @@ -231,27 +231,27 @@ TESS_API void TESS_CALL TessBaseAPISetThresholder(TessBaseAPI* handle, TessImag
#endif

TESS_API struct Pix*
TESS_CALL TessBaseAPIGetThresholdedImage( TessBaseAPI* handle);
TESS_CALL TessBaseAPIGetThresholdedImage(TessBaseAPI* handle);
TESS_API struct Boxa*
TESS_CALL TessBaseAPIGetRegions( TessBaseAPI* handle, struct Pixa** pixa);
TESS_CALL TessBaseAPIGetRegions(TessBaseAPI* handle, struct Pixa** pixa);
TESS_API struct Boxa*
TESS_CALL TessBaseAPIGetTextlines( TessBaseAPI* handle, struct Pixa** pixa, int** blockids);
TESS_CALL TessBaseAPIGetTextlines(TessBaseAPI* handle, struct Pixa** pixa, int** blockids);
TESS_API struct Boxa*
TESS_CALL TessBaseAPIGetTextlines1( TessBaseAPI* handle, const BOOL raw_image, const int raw_padding,
struct Pixa** pixa, int** blockids, int** paraids);
TESS_CALL TessBaseAPIGetTextlines1(TessBaseAPI* handle, const BOOL raw_image, const int raw_padding,
struct Pixa** pixa, int** blockids, int** paraids);
TESS_API struct Boxa*
TESS_CALL TessBaseAPIGetStrips( TessBaseAPI* handle, struct Pixa** pixa, int** blockids);
TESS_CALL TessBaseAPIGetStrips(TessBaseAPI* handle, struct Pixa** pixa, int** blockids);
TESS_API struct Boxa*
TESS_CALL TessBaseAPIGetWords( TessBaseAPI* handle, struct Pixa** pixa);
TESS_CALL TessBaseAPIGetWords(TessBaseAPI* handle, struct Pixa** pixa);
TESS_API struct Boxa*
TESS_CALL TessBaseAPIGetConnectedComponents(TessBaseAPI* handle, struct Pixa** cc);
TESS_API struct Boxa*
TESS_CALL TessBaseAPIGetComponentImages( TessBaseAPI* handle, const TessPageIteratorLevel level, const BOOL text_only,
struct Pixa** pixa, int** blockids);
TESS_CALL TessBaseAPIGetComponentImages(TessBaseAPI* handle, const TessPageIteratorLevel level, const BOOL text_only,
struct Pixa** pixa, int** blockids);
TESS_API struct Boxa*
TESS_CALL TessBaseAPIGetComponentImages1( TessBaseAPI* handle, const TessPageIteratorLevel level, const BOOL text_only,
const BOOL raw_image, const int raw_padding,
struct Pixa** pixa, int** blockids, int** paraids);
TESS_CALL TessBaseAPIGetComponentImages1(TessBaseAPI* handle, const TessPageIteratorLevel level, const BOOL text_only,
const BOOL raw_image, const int raw_padding,
struct Pixa** pixa, int** blockids, int** paraids);

TESS_API int TESS_CALL TessBaseAPIGetThresholdedImageScaleFactor(const TessBaseAPI* handle);

Expand Down Expand Up @@ -405,13 +405,13 @@ TESS_API float TESS_CALL TessChoiceIteratorConfidence(const TessChoiceIterator*
/* Progress monitor */

TESS_API ETEXT_DESC* TESS_CALL TessMonitorCreate();
TESS_API void TESS_CALL TessMonitorDelete( ETEXT_DESC* monitor );
TESS_API void TESS_CALL TessMonitorSetCancelFunc( ETEXT_DESC* monitor, TessCancelFunc cancelFunc );
TESS_API void TESS_CALL TessMonitorSetCancelThis( ETEXT_DESC* monitor, void* cancelThis );
TESS_API void* TESS_CALL TessMonitorGetCancelThis( ETEXT_DESC* monitor );
TESS_API void TESS_CALL TessMonitorSetProgressFunc( ETEXT_DESC* monitor, TessProgressFunc progressFunc );
TESS_API int TESS_CALL TessMonitorGetProgress( ETEXT_DESC* monitor );
TESS_API void TESS_CALL TessMonitorSetDeadlineMSecs( ETEXT_DESC* monitor, int deadline );
TESS_API void TESS_CALL TessMonitorDelete(ETEXT_DESC* monitor);
TESS_API void TESS_CALL TessMonitorSetCancelFunc(ETEXT_DESC* monitor, TessCancelFunc cancelFunc);
TESS_API void TESS_CALL TessMonitorSetCancelThis(ETEXT_DESC* monitor, void* cancelThis);
TESS_API void* TESS_CALL TessMonitorGetCancelThis(ETEXT_DESC* monitor);
TESS_API void TESS_CALL TessMonitorSetProgressFunc(ETEXT_DESC* monitor, TessProgressFunc progressFunc);
TESS_API int TESS_CALL TessMonitorGetProgress(ETEXT_DESC* monitor);
TESS_API void TESS_CALL TessMonitorSetDeadlineMSecs(ETEXT_DESC* monitor, int deadline);


#ifndef DISABLED_LEGACY_ENGINE
Expand Down
2 changes: 1 addition & 1 deletion src/ccstruct/statistc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -593,7 +593,7 @@ void STATS::plot(ScrollView* window, // to draw in
window->Pen(colour);

for (int index = 0; index < rangemax_ - rangemin_; index++) {
window->Rectangle( xorigin + xscale * index, yorigin,
window->Rectangle(xorigin + xscale * index, yorigin,
xorigin + xscale * (index + 1),
yorigin + yscale * buckets_[index]);
}
Expand Down
2 changes: 1 addition & 1 deletion src/ccstruct/statistc.h
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ class STATS {
// between 6 and 13 = 9.5
double median() const; // get median of samples
// Returns the count of the given value.
int32_t pile_count(int32_t value ) const {
int32_t pile_count(int32_t value) const {
if (value <= rangemin_)
return buckets_[0];
if (value >= rangemax_ - 1)
Expand Down
8 changes: 4 additions & 4 deletions src/ccutil/clst.h
Original file line number Diff line number Diff line change
Expand Up @@ -782,10 +782,10 @@ inline void CLIST_ITERATOR::add_to_end( // element to add
Replace <parm> with "<parm>". <parm> may be an arbitrary number of tokens
***********************************************************************/

#define QUOTE_IT( parm ) #parm
#define QUOTE_IT(parm) #parm

/***********************************************************************
CLISTIZE( CLASSNAME ) MACRO DEFINITION
CLISTIZE(CLASSNAME) MACRO DEFINITION
======================================

CLASSNAME is assumed to be the name of a class to be used in a CONS list
Expand All @@ -810,7 +810,7 @@ The ...IZE macros define the code use in .c files
***********************************************************************/

/***********************************************************************
CLISTIZEH( CLASSNAME ) MACRO
CLISTIZEH(CLASSNAME) MACRO

CLISTIZEH is a concatenation of 3 fragments CLISTIZEH_A, CLISTIZEH_B and
CLISTIZEH_C.
Expand Down Expand Up @@ -907,7 +907,7 @@ CLISTIZEH_C.
CLISTIZEH_C(CLASSNAME)

/***********************************************************************
CLISTIZE( CLASSNAME ) MACRO
CLISTIZE(CLASSNAME) MACRO
***********************************************************************/

#define CLISTIZE(CLASSNAME) \
Expand Down
20 changes: 10 additions & 10 deletions src/ccutil/elst.h
Original file line number Diff line number Diff line change
Expand Up @@ -826,10 +826,10 @@ inline void ELIST_ITERATOR::add_to_end( // element to add
Replace <parm> with "<parm>". <parm> may be an arbitrary number of tokens
***********************************************************************/

#define QUOTE_IT( parm ) #parm
#define QUOTE_IT(parm) #parm

/***********************************************************************
ELISTIZE( CLASSNAME ) MACRO
ELISTIZE(CLASSNAME) MACRO
============================

CLASSNAME is assumed to be the name of a class which has a baseclass of
Expand All @@ -852,7 +852,7 @@ The ...IZE macros define the code use in .c files
***********************************************************************/

/***********************************************************************
ELISTIZEH( CLASSNAME ) MACRO
ELISTIZEH(CLASSNAME) MACRO

ELISTIZEH is a concatenation of 3 fragments ELISTIZEH_A, ELISTIZEH_B and
ELISTIZEH_C.
Expand Down Expand Up @@ -893,10 +893,10 @@ private: \
DONT_CONSTRUCT_LIST_BY_COPY.error(QUOTE_IT(CLASSNAME##_LIST), ABORT, nullptr);\
} \
void operator=(const CLASSNAME##_LIST&) { \
DONT_ASSIGN_LISTS.error(QUOTE_IT(CLASSNAME##_LIST), ABORT, nullptr ); \
DONT_ASSIGN_LISTS.error(QUOTE_IT(CLASSNAME##_LIST), ABORT, nullptr); \
} \

#define ELISTIZEH_C( CLASSNAME ) \
#define ELISTIZEH_C(CLASSNAME) \
}; \
\
\
Expand Down Expand Up @@ -945,17 +945,17 @@ class DLLSYM CLASSNAME##_IT : public ELIST_ITERATOR { \
} \
};

#define ELISTIZEH( CLASSNAME ) \
#define ELISTIZEH(CLASSNAME) \
\
ELISTIZEH_A( CLASSNAME ) \
ELISTIZEH_A(CLASSNAME) \
\
ELISTIZEH_B( CLASSNAME ) \
ELISTIZEH_B(CLASSNAME) \
\
ELISTIZEH_C( CLASSNAME )
ELISTIZEH_C(CLASSNAME)


/***********************************************************************
ELISTIZE( CLASSNAME ) MACRO
ELISTIZE(CLASSNAME) MACRO
***********************************************************************/

#define ELISTIZE(CLASSNAME) \
Expand Down
2 changes: 1 addition & 1 deletion src/ccutil/elst2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ int32_t ELIST2::length() const { // count elements
*
* Sort elements on list
* NB If you don't like the const declarations in the comparator, coerce yours:
* ( int (*)(const void *, const void *)
* (int (*)(const void *, const void *)
**********************************************************************/

void
Expand Down
10 changes: 5 additions & 5 deletions src/ccutil/elst2.h
Original file line number Diff line number Diff line change
Expand Up @@ -616,7 +616,7 @@ inline ELIST2_LINK *ELIST2_ITERATOR::extract() {
}
}
// Always set ex_current_was_cycle_pt so an add/forward will work in a loop.
ex_current_was_cycle_pt = (current == cycle_pt) ? true : false;
ex_current_was_cycle_pt = (current == cycle_pt);
extracted_link = current;
extracted_link->next = nullptr; //for safety
extracted_link->prev = nullptr; //for safety
Expand Down Expand Up @@ -824,10 +824,10 @@ inline void ELIST2_ITERATOR::add_to_end( // element to add
Replace <parm> with "<parm>". <parm> may be an arbitrary number of tokens
***********************************************************************/

#define QUOTE_IT( parm ) #parm
#define QUOTE_IT(parm) #parm

/***********************************************************************
ELIST2IZE( CLASSNAME ) MACRO DEFINITION
ELIST2IZE(CLASSNAME) MACRO DEFINITION
======================================

CLASSNAME is assumed to be the name of a class which has a baseclass of
Expand All @@ -851,7 +851,7 @@ The ...IZE macros define the code use in .c files
***********************************************************************/

/***********************************************************************
ELIST2IZEH( CLASSNAME ) MACRO
ELIST2IZEH(CLASSNAME) MACRO

ELIST2IZEH is a concatenation of 3 fragments ELIST2IZEH_A, ELIST2IZEH_B and
ELIST2IZEH_C.
Expand Down Expand Up @@ -955,7 +955,7 @@ ELIST2IZEH_C.
ELIST2IZEH_C(CLASSNAME)

/***********************************************************************
ELIST2IZE( CLASSNAME ) MACRO
ELIST2IZE(CLASSNAME) MACRO
***********************************************************************/

#define ELIST2IZE(CLASSNAME) \
Expand Down
4 changes: 2 additions & 2 deletions src/ccutil/ocrclass.h
Original file line number Diff line number Diff line change
Expand Up @@ -142,7 +142,7 @@ class ETEXT_DESC { // output header
err_code(0),
cancel(nullptr),
progress_callback(nullptr),
progress_callback2( &default_progress_func ),
progress_callback2(&default_progress_func),
cancel_this(nullptr) {
end_time.tv_sec = 0;
end_time.tv_usec = 0;
Expand Down Expand Up @@ -173,7 +173,7 @@ class ETEXT_DESC { // output header
static bool default_progress_func(ETEXT_DESC* ths, int left, int right, int top,
int bottom)
{
if ( ths->progress_callback ) {
if (ths->progress_callback) {
return (*(ths->progress_callback))(ths->progress, left, right, top, bottom);
}
return true;
Expand Down
4 changes: 2 additions & 2 deletions src/ccutil/scanutils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -360,7 +360,7 @@ static int tvfscanf(FILE* stream, const char *format, va_list ap) {

scan_int:
q = SkipSpace(stream);
if ( q <= 0 ) {
if (q <= 0) {
bail = BAIL_EOF;
break;
}
Expand Down Expand Up @@ -471,7 +471,7 @@ static int tvfscanf(FILE* stream, const char *format, va_list ap) {
break;

case '%': // %% sequence
if (fgetc(stream) != '%' )
if (fgetc(stream) != '%')
bail = BAIL_ERR;
break;

Expand Down
2 changes: 1 addition & 1 deletion src/ccutil/serialis.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ class STRING;
Replace <parm> with "<parm>". <parm> may be an arbitrary number of tokens
***********************************************************************/

#define QUOTE_IT( parm ) #parm
#define QUOTE_IT(parm) #parm

namespace tesseract {

Expand Down
Loading