diff --git a/src/api/baseapi.cpp b/src/api/baseapi.cpp index 42a1badb98..d90cde72cf 100644 --- a/src/api/baseapi.cpp +++ b/src/api/baseapi.cpp @@ -161,11 +161,25 @@ static void addAvailableLanguages(const std::string &datadir, const std::string const size_t extlen = sizeof(kTrainedDataSuffix); #ifdef _WIN32 WIN32_FIND_DATA data; +#if (defined WINAPI_FAMILY) && (WINAPI_FAMILY != WINAPI_FAMILY_DESKTOP_APP) /* windows but not desktop environment */ + const int strBufferSize = 4096; + wchar_t w_string[strBufferSize]; + MultiByteToWideChar(CP_ACP, 0, (datadir + base2 + "*").c_str(), -1, w_string, strBufferSize); + HANDLE handle = FindFirstFile(w_string, &data); +#else HANDLE handle = FindFirstFile((datadir + base2 + "*").c_str(), &data); +#endif if (handle != INVALID_HANDLE_VALUE) { BOOL result = TRUE; for (; result;) { +#if (defined WINAPI_FAMILY) && (WINAPI_FAMILY != WINAPI_FAMILY_DESKTOP_APP) /* windows but not desktop environment */ + char cstr[strBufferSize]; + size_t charsConverted; + wcstombs_s(&charsConverted, cstr, data.cFileName, wcslen(data.cFileName)); + char *name = cstr; +#else char *name = data.cFileName; +#endif // Skip '.', '..', and hidden files if (name[0] != '.') { if ((data.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) == FILE_ATTRIBUTE_DIRECTORY) { @@ -1032,6 +1046,8 @@ bool TessBaseAPI::ProcessPagesMultipageTiff(const l_uint8 *data, size_t size, co const char *retry_config, int timeout_millisec, TessResultRenderer *renderer, int tessedit_page_number) { + return false; +/* Pix *pix = nullptr; int page = (tessedit_page_number >= 0) ? tessedit_page_number : 0; size_t offset = 0; @@ -1065,6 +1081,7 @@ bool TessBaseAPI::ProcessPagesMultipageTiff(const l_uint8 *data, size_t size, co } } return true; +*/ } // Master ProcessPages calls ProcessPagesInternal and then does any post- diff --git a/src/arch/simddetect.cpp b/src/arch/simddetect.cpp index 1afe5a5d81..5d999df76b 100644 --- a/src/arch/simddetect.cpp +++ b/src/arch/simddetect.cpp @@ -62,6 +62,8 @@ # elif defined(HAVE_ELF_AUX_INFO) # include # include +# elif defined(__APPLE__) +# else # endif #endif @@ -228,6 +230,8 @@ SIMDDetect::SIMDDetect() { unsigned long hwcap = 0; elf_aux_info(AT_HWCAP, &hwcap, sizeof hwcap); neon_available_ = hwcap & HWCAP_NEON; +# elif defined(__APPLE__) + neon_available_ = false; # endif #endif diff --git a/src/ccutil/ccutil.cpp b/src/ccutil/ccutil.cpp index aad8ef655a..d38cce3dd2 100644 --- a/src/ccutil/ccutil.cpp +++ b/src/ccutil/ccutil.cpp @@ -58,7 +58,14 @@ void CCUtil::main_setup(const std::string &argv0, const std::string &basename) { } else if (datadir.empty() || _access(datadir.c_str(), 0) != 0) { /* Look for tessdata in directory of executable. */ char path[_MAX_PATH]; +#if (defined WINAPI_FAMILY) && (WINAPI_FAMILY != WINAPI_FAMILY_DESKTOP_APP) /* windows but not desktop environment */ + wchar_t w_string[_MAX_PATH]; + DWORD length = GetModuleFileName(nullptr, w_string, sizeof(path)); + size_t charsConverted; + wcstombs_s(&charsConverted, path, _MAX_PATH, w_string, _MAX_PATH); +#else DWORD length = GetModuleFileName(nullptr, path, sizeof(path)); +#endif if (length > 0 && length < sizeof(path)) { char *separator = std::strrchr(path, '\\'); if (separator != nullptr) { diff --git a/src/ccutil/scanutils.cpp b/src/ccutil/scanutils.cpp index c3acd13821..f7be9d3f76 100644 --- a/src/ccutil/scanutils.cpp +++ b/src/ccutil/scanutils.cpp @@ -28,6 +28,12 @@ #include "scanutils.h" +// workaround for "'off_t' was not declared in this scope" with -std=c++11 +// OSX has off_t defined, but HAVE_OFF_T is false... +#if !defined(HAVE_OFF_T) && !__APPLE__ && !defined(__EMSCRIPTEN_major__) +typedef long off_t; +#endif // off_t + enum Flags { FL_SPLAT = 0x01, // Drop the value, do not assign FL_INV = 0x02, // Character-set with inverse @@ -134,7 +140,7 @@ static uintmax_t streamtoumax(FILE *s, int base) { } ungetc(c, s); - return minus ? -v : v; + return minus ? 0 : v; } static double streamtofloat(FILE *s) { diff --git a/src/lstm/stridemap.h b/src/lstm/stridemap.h index 53f00fe47b..5c8a02c079 100644 --- a/src/lstm/stridemap.h +++ b/src/lstm/stridemap.h @@ -108,7 +108,7 @@ class StrideMap { // Default copy constructor and operator= are OK to use here! // Sets up the stride for the given array of height, width pairs. - void SetStride(const std::vector> &h_w_pairs); + void SetStride(const std::vector< std::pair >& h_w_pairs); // Scales width and height dimensions by the given factors. void ScaleXY(int x_factor, int y_factor); // Reduces width to 1, across the batch, whatever the input size.