mirror of
https://github.com/tesseract-ocr/tesseract.git
synced 2025-06-08 02:12:40 +08:00
Fixed some formatting issues
git-svn-id: https://tesseract-ocr.googlecode.com/svn/trunk@1083 d0cd1f9f-072b-0410-8dd7-cf729c803f20
This commit is contained in:
parent
42bfdc21d8
commit
cda8e748b1
@ -431,7 +431,6 @@ bool Tesseract::recog_all_words(PAGE_RES* page_res,
|
|||||||
if (word->best_choice == NULL || word->best_choice->length() == 0)
|
if (word->best_choice == NULL || word->best_choice->length() == 0)
|
||||||
page_res_it.DeleteCurrentWord();
|
page_res_it.DeleteCurrentWord();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (monitor != NULL) {
|
if (monitor != NULL) {
|
||||||
monitor->progress = 100;
|
monitor->progress = 100;
|
||||||
|
@ -72,8 +72,7 @@ inline size_t LongBit() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
static inline int
|
static inline int
|
||||||
SkipSpace(FILE *s)
|
SkipSpace(FILE *s) {
|
||||||
{
|
|
||||||
int p;
|
int p;
|
||||||
while (isspace(p = fgetc(s)));
|
while (isspace(p = fgetc(s)));
|
||||||
ungetc(p, s); // Make sure next char is available for reading
|
ungetc(p, s); // Make sure next char is available for reading
|
||||||
@ -81,19 +80,16 @@ SkipSpace(FILE *s)
|
|||||||
}
|
}
|
||||||
|
|
||||||
static inline void
|
static inline void
|
||||||
SetBit(unsigned long *bitmap, unsigned int bit)
|
SetBit(unsigned long *bitmap, unsigned int bit) {
|
||||||
{
|
|
||||||
bitmap[bit/LongBit()] |= 1UL << (bit%LongBit());
|
bitmap[bit/LongBit()] |= 1UL << (bit%LongBit());
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline int
|
static inline int
|
||||||
TestBit(unsigned long *bitmap, unsigned int bit)
|
TestBit(unsigned long *bitmap, unsigned int bit) {
|
||||||
{
|
|
||||||
return static_cast<int>(bitmap[bit/LongBit()] >> (bit%LongBit())) & 1;
|
return static_cast<int>(bitmap[bit/LongBit()] >> (bit%LongBit())) & 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
static inline int DigitValue(int ch)
|
static inline int DigitValue(int ch) {
|
||||||
{
|
|
||||||
if (ch >= '0' && ch <= '9') {
|
if (ch >= '0' && ch <= '9') {
|
||||||
return ch-'0';
|
return ch-'0';
|
||||||
} else if (ch >= 'A' && ch <= 'Z') {
|
} else if (ch >= 'A' && ch <= 'Z') {
|
||||||
@ -106,8 +102,7 @@ static inline int DigitValue(int ch)
|
|||||||
}
|
}
|
||||||
|
|
||||||
// IO (re-)implementations -----------------------------------------------------
|
// IO (re-)implementations -----------------------------------------------------
|
||||||
uintmax_t streamtoumax(FILE* s, int base)
|
uintmax_t streamtoumax(FILE* s, int base) {
|
||||||
{
|
|
||||||
int minus = 0;
|
int minus = 0;
|
||||||
uintmax_t v = 0;
|
uintmax_t v = 0;
|
||||||
int d, c = 0;
|
int d, c = 0;
|
||||||
@ -148,8 +143,7 @@ uintmax_t streamtoumax(FILE* s, int base)
|
|||||||
return minus ? -v : v;
|
return minus ? -v : v;
|
||||||
}
|
}
|
||||||
|
|
||||||
double streamtofloat(FILE* s)
|
double streamtofloat(FILE* s) {
|
||||||
{
|
|
||||||
int minus = 0;
|
int minus = 0;
|
||||||
int v = 0;
|
int v = 0;
|
||||||
int d, c = 0;
|
int d, c = 0;
|
||||||
@ -184,8 +178,7 @@ double streamtofloat(FILE* s)
|
|||||||
return minus ? -f : f;
|
return minus ? -f : f;
|
||||||
}
|
}
|
||||||
|
|
||||||
double strtofloat(const char* s)
|
double strtofloat(const char* s) {
|
||||||
{
|
|
||||||
int minus = 0;
|
int minus = 0;
|
||||||
int v = 0;
|
int v = 0;
|
||||||
int d;
|
int d;
|
||||||
@ -219,8 +212,7 @@ double strtofloat(const char* s)
|
|||||||
|
|
||||||
static int tvfscanf(FILE* stream, const char *format, va_list ap);
|
static int tvfscanf(FILE* stream, const char *format, va_list ap);
|
||||||
|
|
||||||
int tfscanf(FILE* stream, const char *format, ...)
|
int tfscanf(FILE* stream, const char *format, ...) {
|
||||||
{
|
|
||||||
va_list ap;
|
va_list ap;
|
||||||
int rv;
|
int rv;
|
||||||
|
|
||||||
@ -233,8 +225,7 @@ int tfscanf(FILE* stream, const char *format, ...)
|
|||||||
|
|
||||||
#ifdef EMBEDDED
|
#ifdef EMBEDDED
|
||||||
|
|
||||||
int fscanf(FILE* stream, const char *format, ...)
|
int fscanf(FILE* stream, const char *format, ...) {
|
||||||
{
|
|
||||||
va_list ap;
|
va_list ap;
|
||||||
int rv;
|
int rv;
|
||||||
|
|
||||||
@ -245,8 +236,7 @@ int fscanf(FILE* stream, const char *format, ...)
|
|||||||
return rv;
|
return rv;
|
||||||
}
|
}
|
||||||
|
|
||||||
int vfscanf(FILE* stream, const char *format, ...)
|
int vfscanf(FILE* stream, const char *format, ...) {
|
||||||
{
|
|
||||||
va_list ap;
|
va_list ap;
|
||||||
int rv;
|
int rv;
|
||||||
|
|
||||||
@ -258,8 +248,7 @@ int vfscanf(FILE* stream, const char *format, ...)
|
|||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static int tvfscanf(FILE* stream, const char *format, va_list ap)
|
static int tvfscanf(FILE* stream, const char *format, va_list ap) {
|
||||||
{
|
|
||||||
const char *p = format;
|
const char *p = format;
|
||||||
char ch;
|
char ch;
|
||||||
int q = 0;
|
int q = 0;
|
||||||
@ -281,7 +270,8 @@ static int tvfscanf(FILE* stream, const char *format, va_list ap)
|
|||||||
enum Bail bail = BAIL_NONE;
|
enum Bail bail = BAIL_NONE;
|
||||||
int sign;
|
int sign;
|
||||||
int converted = 0; // Successful conversions
|
int converted = 0; // Successful conversions
|
||||||
unsigned long matchmap[((1 << CHAR_BIT)+(CHAR_BIT * sizeof(long) - 1))/ (CHAR_BIT * sizeof(long))];
|
unsigned long matchmap[((1 << CHAR_BIT)+(CHAR_BIT * sizeof(long) - 1)) /
|
||||||
|
(CHAR_BIT * sizeof(long))];
|
||||||
int matchinv = 0; // Is match map inverted?
|
int matchinv = 0; // Is match map inverted?
|
||||||
unsigned char range_start = 0;
|
unsigned char range_start = 0;
|
||||||
off_t start_off = ftell(stream);
|
off_t start_off = ftell(stream);
|
||||||
@ -575,8 +565,7 @@ static int tvfscanf(FILE* stream, const char *format, va_list ap)
|
|||||||
}
|
}
|
||||||
|
|
||||||
#ifdef EMBEDDED
|
#ifdef EMBEDDED
|
||||||
int creat(const char *pathname, mode_t mode)
|
int creat(const char *pathname, mode_t mode) {
|
||||||
{
|
|
||||||
return open(pathname, O_CREAT | O_TRUNC | O_WRONLY, mode);
|
return open(pathname, O_CREAT | O_TRUNC | O_WRONLY, mode);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -41,7 +41,7 @@ const int kMinRampSize = 1000;
|
|||||||
// If rotation is NULL, rotation is skipped. If *rotation is non-zero, the pix
|
// If rotation is NULL, rotation is skipped. If *rotation is non-zero, the pix
|
||||||
// is rotated by *rotation else it is randomly rotated and *rotation is
|
// is rotated by *rotation else it is randomly rotated and *rotation is
|
||||||
// modified.
|
// modified.
|
||||||
//
|
//
|
||||||
// HOW IT WORKS:
|
// HOW IT WORKS:
|
||||||
// Most of the process is really dictated by the fact that the minimum
|
// Most of the process is really dictated by the fact that the minimum
|
||||||
// available convolution is 3X3, which is too big really to simulate a
|
// available convolution is 3X3, which is too big really to simulate a
|
||||||
|
@ -349,7 +349,8 @@ bool PangoFontInfo::CanRenderString(const char* utf8_word, int len,
|
|||||||
PangoContext* context = pango_context_new();
|
PangoContext* context = pango_context_new();
|
||||||
pango_context_set_font_map(context, font_map);
|
pango_context_set_font_map(context, font_map);
|
||||||
PangoLayout* layout;
|
PangoLayout* layout;
|
||||||
{ // Pango is not relasing the cached layout.
|
{
|
||||||
|
// Pango is not relasing the cached layout.
|
||||||
#ifndef USE_STD_NAMESPACE
|
#ifndef USE_STD_NAMESPACE
|
||||||
DISABLE_HEAP_LEAK_CHECK;
|
DISABLE_HEAP_LEAK_CHECK;
|
||||||
#endif
|
#endif
|
||||||
|
@ -363,7 +363,8 @@ bool MakeIndividualGlyphs(Pix* pix,
|
|||||||
FLAGS_glyph_num_border_pixels_to_pad,
|
FLAGS_glyph_num_border_pixels_to_pad,
|
||||||
0);
|
0);
|
||||||
if (!pix_glyph_sq_pad) {
|
if (!pix_glyph_sq_pad) {
|
||||||
tprintf("ERROR: MakeIndividualGlyphs(): Failed to zero-pad, at i=%d\n", i);
|
tprintf("ERROR: MakeIndividualGlyphs(): Failed to zero-pad, at i=%d\n",
|
||||||
|
i);
|
||||||
continue;
|
continue;
|
||||||
}
|
}
|
||||||
// Write out
|
// Write out
|
||||||
|
Loading…
Reference in New Issue
Block a user