diff --git a/src/api/baseapi.cpp b/src/api/baseapi.cpp index 82e3e33e..b17fe2d2 100644 --- a/src/api/baseapi.cpp +++ b/src/api/baseapi.cpp @@ -43,6 +43,7 @@ #endif // _WIN32 #include +#include #include #include #include @@ -185,7 +186,15 @@ TessBaseAPI::TessBaseAPI() rect_width_(0), rect_height_(0), image_width_(0), - image_height_(0) {} + image_height_(0) { + const char *locale; + locale = std::setlocale(LC_ALL, nullptr); + ASSERT_HOST(!strcmp(locale, "C")); + locale = std::setlocale(LC_CTYPE, nullptr); + ASSERT_HOST(!strcmp(locale, "C")); + locale = std::setlocale(LC_NUMERIC, nullptr); + ASSERT_HOST(!strcmp(locale, "C")); +} TessBaseAPI::~TessBaseAPI() { End(); diff --git a/src/ccutil/scanutils.cpp b/src/ccutil/scanutils.cpp index f47546ae..aeb16707 100644 --- a/src/ccutil/scanutils.cpp +++ b/src/ccutil/scanutils.cpp @@ -472,8 +472,10 @@ static int tvfscanf(FILE* stream, const char *format, va_list ap) { case 's': // String { - char *sp; - sp = sarg = va_arg(ap, char *); + if (!(flags & FL_SPLAT)) { + sarg = va_arg(ap, char *); + } + char *sp = sarg; while (width--) { q = fgetc(stream); if (isspace(static_cast(q)) || q <= 0) { @@ -488,7 +490,6 @@ static int tvfscanf(FILE* stream, const char *format, va_list ap) { } else if (!(flags & FL_SPLAT)) { *sp = '\0'; // Terminate output converted++; - } else { } } break;