@@ -440,33 +440,33 @@ int main(int argc, char** argv) {
440
440
argc - arg_i, &vars_vec, &vars_values, false );
441
441
if (init_failed) {
442
442
fprintf (stderr, " Could not initialize tesseract.\n " );
443
- exit ( 1 ) ;
443
+ return EXIT_FAILURE ;
444
444
}
445
445
446
446
SetVariablesFromCLArgs (&api, argc, argv);
447
447
448
448
if (list_langs) {
449
449
PrintLangsList (&api);
450
- exit ( 0 ) ;
450
+ return EXIT_SUCCESS ;
451
451
}
452
452
453
453
if (print_parameters) {
454
454
FILE* fout = stdout;
455
455
fprintf (stdout, " Tesseract parameters:\n " );
456
456
api.PrintVariables (fout);
457
457
api.End ();
458
- exit ( 0 ) ;
458
+ return EXIT_SUCCESS ;
459
459
}
460
460
461
461
FixPageSegMode (&api, pagesegmode);
462
462
463
463
if (pagesegmode == tesseract::PSM_AUTO_ONLY) {
464
- int ret_val = 0 ;
464
+ int ret_val = EXIT_SUCCESS ;
465
465
466
466
Pix* pixs = pixRead (image);
467
467
if (!pixs) {
468
468
fprintf (stderr, " Cannot open input file: %s\n " , image);
469
- exit ( 2 ) ;
469
+ return 2 ;
470
470
}
471
471
472
472
api.SetImage (pixs);
@@ -484,13 +484,13 @@ int main(int argc, char** argv) {
484
484
" Deskew angle: %.4f\n " ,
485
485
orientation, direction, order, deskew_angle);
486
486
} else {
487
- ret_val = 1 ;
487
+ ret_val = EXIT_FAILURE ;
488
488
}
489
489
490
490
delete it;
491
491
492
492
pixDestroy (&pixs);
493
- exit ( ret_val) ;
493
+ return ret_val;
494
494
}
495
495
496
496
// set in_training_mode to true when using one of these configs:
@@ -515,10 +515,11 @@ int main(int argc, char** argv) {
515
515
bool succeed = api.ProcessPages (image, NULL , 0 , renderers[0 ]);
516
516
if (!succeed) {
517
517
fprintf (stderr, " Error during processing.\n " );
518
- exit ( 1 ) ;
518
+ return EXIT_FAILURE ;
519
519
}
520
520
}
521
521
522
522
PERF_COUNT_END
523
- return 0 ; // Normal exit
523
+
524
+ return EXIT_SUCCESS;
524
525
}
0 commit comments