From a370c116d5edff516e29cce8fdc50da8f5b320bf Mon Sep 17 00:00:00 2001 From: Krystine Sherwin <93062060+KrystalDelusion@users.noreply.github.com> Date: Fri, 18 Oct 2024 07:25:29 +1300 Subject: [PATCH] libs/fst: Use unbuffered IO flag --- libs/fst/00_PATCH_win_io.patch | 18 ++++++++++++++++++ libs/fst/fstapi.cc | 4 ++-- 2 files changed, 20 insertions(+), 2 deletions(-) diff --git a/libs/fst/00_PATCH_win_io.patch b/libs/fst/00_PATCH_win_io.patch index 1105538e5..bf8679406 100644 --- a/libs/fst/00_PATCH_win_io.patch +++ b/libs/fst/00_PATCH_win_io.patch @@ -20,6 +20,15 @@ #define WIN32_LEAN_AND_MEAN #include #endif +@@ -137,7 +137,7 @@ void **JenkinsIns(void *base_i, const unsigned char *mem, uint32_t length, uint3 + #include + #endif + +-#if defined(FST_MACOSX) || defined(__MINGW32__) || defined(__OpenBSD__) || defined(__FreeBSD__) || defined(__NetBSD__) ++#if defined(FST_MACOSX) || defined(__MINGW32__) || defined(_MSC_VER) || defined(__OpenBSD__) || defined(__FreeBSD__) || defined(__NetBSD__) + #define FST_UNBUFFERED_IO + #endif + @@ -159,7 +159,7 @@ void **JenkinsIns(void *base_i, const unsigned char *mem, uint32_t length, uint3 /*** ***/ /***********************/ @@ -38,3 +47,12 @@ #include #define fstMmap(__addr,__len,__prot,__flags,__fd,__off) fstMmap2((__len), (__fd), (__off)) #define fstMunmap(__addr,__len) UnmapViewOfFile((LPCVOID)__addr) +@@ -4638,7 +4638,7 @@ if(sectype == FST_BL_ZWRAPPER) + #endif + + fstReaderFseeko(xc, xc->f, FST_ZWRAPPER_HDR_SIZE, SEEK_SET); +-#ifndef __MINGW32__ ++#if !defined(__MINGW32__) && !defined(_MSC_VER) + fflush(xc->f); + #else + /* Windows UCRT runtime library reads one byte ahead in the file diff --git a/libs/fst/fstapi.cc b/libs/fst/fstapi.cc index 00a304909..74e755d31 100644 --- a/libs/fst/fstapi.cc +++ b/libs/fst/fstapi.cc @@ -137,7 +137,7 @@ void **JenkinsIns(void *base_i, const unsigned char *mem, uint32_t length, uint3 #include #endif -#if defined(FST_MACOSX) || defined(__MINGW32__) || defined(__OpenBSD__) || defined(__FreeBSD__) || defined(__NetBSD__) +#if defined(FST_MACOSX) || defined(__MINGW32__) || defined(_MSC_VER) || defined(__OpenBSD__) || defined(__FreeBSD__) || defined(__NetBSD__) #define FST_UNBUFFERED_IO #endif @@ -4638,7 +4638,7 @@ if(sectype == FST_BL_ZWRAPPER) #endif fstReaderFseeko(xc, xc->f, FST_ZWRAPPER_HDR_SIZE, SEEK_SET); -#ifndef __MINGW32__ +#if !defined(__MINGW32__) && !defined(_MSC_VER) fflush(xc->f); #else /* Windows UCRT runtime library reads one byte ahead in the file