Skip to content

Commit

Permalink
tesseractmain: Always use EXIT_SUCCESS and EXIT_FAILURE macros for ex…
Browse files Browse the repository at this point in the history
…it status

Signed-off-by: Stefan Weil <sw@weilnetz.de>
  • Loading branch information
stweil committed Jun 2, 2018
1 parent b5ac850 commit 724a72a
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions src/api/tesseractmain.cpp
Expand Up @@ -206,7 +206,7 @@ static void SetVariablesFromCLArgs(tesseract::TessBaseAPI* api, int argc,
char* p = strchr(opt1, '=');
if (!p) {
fprintf(stderr, "Missing = in configvar assignment\n");
exit(1);
exit(EXIT_FAILURE);
}
*p = 0;
strncpy(opt2, strchr(argv[i + 1], '=') + 1, 255);
Expand Down Expand Up @@ -259,7 +259,7 @@ static void FixPageSegMode(tesseract::TessBaseAPI* api,
static void checkArgValues(int arg, const char* mode, int count) {
if (arg >= count || arg < 0) {
printf("Invalid %s value, please enter a number between 0-%d\n", mode, count - 1);
exit(0);
exit(EXIT_SUCCESS);
}
}

Expand All @@ -275,23 +275,23 @@ static void ParseArgs(const int argc, char** argv, const char** lang,
if (argc == 2) {
if ((strcmp(argv[1], "-h") == 0) || (strcmp(argv[1], "--help") == 0)) {
PrintHelpMessage(argv[0]);
exit(0);
exit(EXIT_SUCCESS);
}
if (strcmp(argv[1], "--help-extra") == 0) {
PrintHelpExtra(argv[0]);
exit(0);
exit(EXIT_SUCCESS);
}
if ((strcmp(argv[1], "--help-psm") == 0)) {
PrintHelpForPSM();
exit(0);
exit(EXIT_SUCCESS);
}
if ((strcmp(argv[1], "--help-oem") == 0)) {
PrintHelpForOEM();
exit(0);
exit(EXIT_SUCCESS);
}
if ((strcmp(argv[1], "-v") == 0) || (strcmp(argv[1], "--version") == 0)) {
PrintVersionInfo();
exit(0);
exit(EXIT_SUCCESS);
}
}

Expand Down Expand Up @@ -338,15 +338,15 @@ static void ParseArgs(const int argc, char** argv, const char** lang,
} else {
// Unexpected argument.
fprintf(stderr, "Error, unknown command line argument '%s'\n", argv[i]);
exit(1);
exit(EXIT_FAILURE);
}
}

*arg_i = i;

if (*outputbase == nullptr && noocr == false) {
PrintHelpMessage(argv[0]);
exit(1);
exit(EXIT_FAILURE);
}
}

Expand Down

0 comments on commit 724a72a

Please sign in to comment.