mirror of
https://github.com/tesseract-ocr/tesseract.git
synced 2025-01-18 22:43:45 +08:00
win32: Show TIFF warnings on console
Showing them in a window (default) is not acceptable for a console application like Tesseract which must be able to work in batch mode. Signed-off-by: Stefan Weil <sw@weilnetz.de>
This commit is contained in:
parent
669c7397aa
commit
896e80d9a7
@ -33,6 +33,23 @@
|
||||
#include "openclwrapper.h"
|
||||
#include "osdetect.h"
|
||||
|
||||
#if defined(_WIN32)
|
||||
|
||||
#include <tiffio.h>
|
||||
#include <windows.h>
|
||||
|
||||
static void Win32WarningHandler(const char* module, const char* fmt,
|
||||
va_list ap) {
|
||||
if (module != NULL) {
|
||||
fprintf(stderr, "%s: ", module);
|
||||
}
|
||||
fprintf(stderr, "Warning, ");
|
||||
vfprintf(stderr, fmt, ap);
|
||||
fprintf(stderr, ".\n");
|
||||
}
|
||||
|
||||
#endif /* _WIN32 */
|
||||
|
||||
void PrintVersionInfo() {
|
||||
char *versionStrP;
|
||||
|
||||
@ -352,6 +369,11 @@ int main(int argc, char **argv) {
|
||||
int arg_i = 1;
|
||||
tesseract::PageSegMode pagesegmode = tesseract::PSM_AUTO;
|
||||
|
||||
#if defined(_WIN32)
|
||||
/* Show libtiff warnings on console (not in GUI). */
|
||||
TIFFSetWarningHandler(Win32WarningHandler);
|
||||
#endif /* _WIN32 */
|
||||
|
||||
ParseArgs(argc, argv,
|
||||
&lang, &image, &outputbase, &datapath,
|
||||
&list_langs, &print_parameters,
|
||||
|
Loading…
Reference in New Issue
Block a user