Skip to content

Commit

Permalink
print error/warning messages to stderr/debug file instead of stdout (…
Browse files Browse the repository at this point in the history
…fix issue 911)

git-svn-id: https://tesseract-ocr.googlecode.com/svn/trunk@843 d0cd1f9f-072b-0410-8dd7-cf729c803f20
  • Loading branch information
zdenop@gmail.com committed May 16, 2013
1 parent 642e9e7 commit 7e14ade
Show file tree
Hide file tree
Showing 6 changed files with 14 additions and 14 deletions.
12 changes: 6 additions & 6 deletions ccmain/osdetect.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@ int OSResults::get_best_script(int orientation_id) const {
// Print the script scores for all possible orientations.
void OSResults::print_scores(void) const {
for (int i = 0; i < 4; ++i) {
printf("Orientation id #%d", i);
tprintf("Orientation id #%d", i);
print_scores(i);
}
}
Expand All @@ -139,7 +139,7 @@ void OSResults::print_scores(void) const {
void OSResults::print_scores(int orientation_id) const {
for (int j = 0; j < kMaxNumberOfScripts; ++j) {
if (scripts_na[orientation_id][j]) {
printf("%12s\t: %f\n", unicharset->get_script_from_script_id(j),
tprintf("%12s\t: %f\n", unicharset->get_script_from_script_id(j),
scripts_na[orientation_id][j]);
}
}
Expand Down Expand Up @@ -284,13 +284,13 @@ int os_detect_blobs(BLOBNBOX_CLIST* blob_list, OSResults* osr,

BLOBNBOX_C_IT filtered_it(blob_list);
int real_max = MIN(filtered_it.length(), kMaxCharactersToTry);
// printf("Total blobs found = %d\n", blobs_total);
// printf("Number of blobs post-filtering = %d\n", filtered_it.length());
// printf("Number of blobs to try = %d\n", real_max);
// tprintf("Total blobs found = %d\n", blobs_total);
// tprintf("Number of blobs post-filtering = %d\n", filtered_it.length());
// tprintf("Number of blobs to try = %d\n", real_max);

// If there are too few characters, skip this page entirely.
if (real_max < kMinCharactersToTry / 2) {
printf("Too few characters. Skipping this page\n");
tprintf("Too few characters. Skipping this page\n");
return 0;
}

Expand Down
2 changes: 1 addition & 1 deletion ccstruct/blobbox.h
Original file line number Diff line number Diff line change
Expand Up @@ -710,7 +710,7 @@ class TO_BLOCK:public ELIST_LINK
for (row_it.mark_cycle_pt (); !row_it.cycled_list ();
row_it.forward ()) {
row = row_it.data ();
printf ("Row range (%g,%g), para_c=%g, blobcount=" INT32FORMAT
tprintf ("Row range (%g,%g), para_c=%g, blobcount=" INT32FORMAT
"\n", row->min_y (), row->max_y (), row->parallel_c (),
row->blob_list ()->length ());
}
Expand Down
4 changes: 2 additions & 2 deletions ccstruct/coutln.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -172,12 +172,12 @@ C_OUTLINE::C_OUTLINE( //constructor
pos += srcline->step (stepindex);
destpos = pos;
destpos.rotate (rotation);
// printf("%i %i %i %i ", destpos.x(), destpos.y(), pos.x(), pos.y());
// tprintf("%i %i %i %i ", destpos.x(), destpos.y(), pos.x(), pos.y());
while (destpos.x () != prevpos.x () || destpos.y () != prevpos.y ()) {
dir = DIR128 (FCOORD (destpos - prevpos));
dir += 64; //turn to step style
new_step = dir.get_dir ();
// printf(" %i\n", new_step);
// tprintf(" %i\n", new_step);
if (new_step & 31) {
set_step(destindex++, dir + round1);
prevpos += step(destindex - 1);
Expand Down
4 changes: 2 additions & 2 deletions ccutil/tessdatamanager.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ bool TessdataManager::TessdataTypeFromFileSuffix(
return true;
}
}
printf("TessdataManager can't determine which tessdata"
tprintf("TessdataManager can't determine which tessdata"
" component is represented by %s\n", suffix);
return false;
}
Expand All @@ -239,7 +239,7 @@ bool TessdataManager::ExtractToFile(const char *filename) {

FILE *output_file = fopen(filename, "wb");
if (output_file == NULL) {
printf("Error openning %s\n", filename);
tprintf("Error openning %s\n", filename);
exit(1);
}
inT64 begin_offset = ftell(GetDataFilePtr());
Expand Down
2 changes: 1 addition & 1 deletion cube/search_column.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ SearchNode *SearchColumn::AddNode(LangModEdge *edge, int reco_cost,
// because the langmod state is not unique
if (edge->IsOOD() == false) {
if (!node_hash_table_->Insert(edge, new_node)) {
printf("Hash table full!!!");
tprintf("Hash table full!!!");
delete new_node;
return NULL;
}
Expand Down
4 changes: 2 additions & 2 deletions textord/tordmain.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -346,12 +346,12 @@ float Textord::filter_noise_blobs(
size_stats.add (height, 1);
}
max_height = size_stats.ile (textord_initialasc_ile);
// printf("max_y=%g, min_y=%g, initial_x=%g, max_height=%g,",
// tprintf("max_y=%g, min_y=%g, initial_x=%g, max_height=%g,",
// max_y,min_y,initial_x,max_height);
max_height *= tesseract::CCStruct::kXHeightCapRatio;
if (max_height > initial_x)
initial_x = max_height;
// printf(" ret=%g\n",initial_x);
// tprintf(" ret=%g\n",initial_x);
return initial_x;
}

Expand Down

0 comments on commit 7e14ade

Please sign in to comment.