tesseractmain: Always use EXIT_SUCCESS and EXIT_FAILURE macros for exit status

Signed-off-by: Stefan Weil <sw@weilnetz.de>
This commit is contained in:
Stefan Weil 2018-06-01 21:27:46 +02:00
parent b5ac8502bc
commit 724a72a278

View File

@ -206,7 +206,7 @@ static void SetVariablesFromCLArgs(tesseract::TessBaseAPI* api, int argc,
char* p = strchr(opt1, '='); char* p = strchr(opt1, '=');
if (!p) { if (!p) {
fprintf(stderr, "Missing = in configvar assignment\n"); fprintf(stderr, "Missing = in configvar assignment\n");
exit(1); exit(EXIT_FAILURE);
} }
*p = 0; *p = 0;
strncpy(opt2, strchr(argv[i + 1], '=') + 1, 255); strncpy(opt2, strchr(argv[i + 1], '=') + 1, 255);
@ -259,7 +259,7 @@ static void FixPageSegMode(tesseract::TessBaseAPI* api,
static void checkArgValues(int arg, const char* mode, int count) { static void checkArgValues(int arg, const char* mode, int count) {
if (arg >= count || arg < 0) { if (arg >= count || arg < 0) {
printf("Invalid %s value, please enter a number between 0-%d\n", mode, count - 1); printf("Invalid %s value, please enter a number between 0-%d\n", mode, count - 1);
exit(0); exit(EXIT_SUCCESS);
} }
} }
@ -275,23 +275,23 @@ static void ParseArgs(const int argc, char** argv, const char** lang,
if (argc == 2) { if (argc == 2) {
if ((strcmp(argv[1], "-h") == 0) || (strcmp(argv[1], "--help") == 0)) { if ((strcmp(argv[1], "-h") == 0) || (strcmp(argv[1], "--help") == 0)) {
PrintHelpMessage(argv[0]); PrintHelpMessage(argv[0]);
exit(0); exit(EXIT_SUCCESS);
} }
if (strcmp(argv[1], "--help-extra") == 0) { if (strcmp(argv[1], "--help-extra") == 0) {
PrintHelpExtra(argv[0]); PrintHelpExtra(argv[0]);
exit(0); exit(EXIT_SUCCESS);
} }
if ((strcmp(argv[1], "--help-psm") == 0)) { if ((strcmp(argv[1], "--help-psm") == 0)) {
PrintHelpForPSM(); PrintHelpForPSM();
exit(0); exit(EXIT_SUCCESS);
} }
if ((strcmp(argv[1], "--help-oem") == 0)) { if ((strcmp(argv[1], "--help-oem") == 0)) {
PrintHelpForOEM(); PrintHelpForOEM();
exit(0); exit(EXIT_SUCCESS);
} }
if ((strcmp(argv[1], "-v") == 0) || (strcmp(argv[1], "--version") == 0)) { if ((strcmp(argv[1], "-v") == 0) || (strcmp(argv[1], "--version") == 0)) {
PrintVersionInfo(); PrintVersionInfo();
exit(0); exit(EXIT_SUCCESS);
} }
} }
@ -338,7 +338,7 @@ static void ParseArgs(const int argc, char** argv, const char** lang,
} else { } else {
// Unexpected argument. // Unexpected argument.
fprintf(stderr, "Error, unknown command line argument '%s'\n", argv[i]); fprintf(stderr, "Error, unknown command line argument '%s'\n", argv[i]);
exit(1); exit(EXIT_FAILURE);
} }
} }
@ -346,7 +346,7 @@ static void ParseArgs(const int argc, char** argv, const char** lang,
if (*outputbase == nullptr && noocr == false) { if (*outputbase == nullptr && noocr == false) {
PrintHelpMessage(argv[0]); PrintHelpMessage(argv[0]);
exit(1); exit(EXIT_FAILURE);
} }
} }