libs/fst: Use unbuffered IO flag

This commit is contained in:
Krystine Sherwin 2024-10-18 07:25:29 +13:00
parent 2157f67184
commit a370c116d5
No known key found for this signature in database
2 changed files with 20 additions and 2 deletions

View File

@ -20,6 +20,15 @@
#define WIN32_LEAN_AND_MEAN #define WIN32_LEAN_AND_MEAN
#include <windows.h> #include <windows.h>
#endif #endif
@@ -137,7 +137,7 @@ void **JenkinsIns(void *base_i, const unsigned char *mem, uint32_t length, uint3
#include <sys/sysctl.h>
#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 @@ -159,7 +159,7 @@ void **JenkinsIns(void *base_i, const unsigned char *mem, uint32_t length, uint3
/*** ***/ /*** ***/
/***********************/ /***********************/
@ -38,3 +47,12 @@
#include <limits.h> #include <limits.h>
#define fstMmap(__addr,__len,__prot,__flags,__fd,__off) fstMmap2((__len), (__fd), (__off)) #define fstMmap(__addr,__len,__prot,__flags,__fd,__off) fstMmap2((__len), (__fd), (__off))
#define fstMunmap(__addr,__len) UnmapViewOfFile((LPCVOID)__addr) #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

View File

@ -137,7 +137,7 @@ void **JenkinsIns(void *base_i, const unsigned char *mem, uint32_t length, uint3
#include <sys/sysctl.h> #include <sys/sysctl.h>
#endif #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 #define FST_UNBUFFERED_IO
#endif #endif
@ -4638,7 +4638,7 @@ if(sectype == FST_BL_ZWRAPPER)
#endif #endif
fstReaderFseeko(xc, xc->f, FST_ZWRAPPER_HDR_SIZE, SEEK_SET); fstReaderFseeko(xc, xc->f, FST_ZWRAPPER_HDR_SIZE, SEEK_SET);
#ifndef __MINGW32__ #if !defined(__MINGW32__) && !defined(_MSC_VER)
fflush(xc->f); fflush(xc->f);
#else #else
/* Windows UCRT runtime library reads one byte ahead in the file /* Windows UCRT runtime library reads one byte ahead in the file