diff --git a/db/mork/src/morkConfig.h b/db/mork/src/morkConfig.h index d0e46fa8e5d..83aee914b1b 100644 --- a/db/mork/src/morkConfig.h +++ b/db/mork/src/morkConfig.h @@ -94,7 +94,13 @@ #define MORK_FILETELL(file) ftell(file) #define MORK_FILESEEK(file, where, how) fseek(file, where, how) #define MORK_FILEREAD(outbuf, insize, file) fread(outbuf, 1, insize, file) +#if defined(MORK_WIN) +void mork_fileflush(FILE * file); +#define MORK_FILEFLUSH(file) mork_fileflush(file) +#else #define MORK_FILEFLUSH(file) fflush(file) +#endif /*MORK_WIN*/ + #if defined(MORK_OS2) FILE* mork_fileopen(const char* name, const char* mode); #define MORK_FILEOPEN(file, how) mork_fileopen(file, how) diff --git a/db/mork/src/morkFile.cpp b/db/mork/src/morkFile.cpp index 79913cbd076..f8754f5ad95 100644 --- a/db/mork/src/morkFile.cpp +++ b/db/mork/src/morkFile.cpp @@ -56,6 +56,11 @@ #include "morkFile.h" #endif +#ifdef MORK_WIN +#include "io.h" +#include +#endif + // #define MORK_CONFIG_USE_ORKINFILE 1 #ifdef MORK_CONFIG_USE_ORKINFILE @@ -920,5 +925,22 @@ morkStdioFile::Steal(nsIMdbEnv* ev, nsIMdbFile* ioThief) } +#if defined(MORK_WIN) + +void mork_fileflush(FILE * file) +{ + fflush(file); + OSVERSIONINFOA vi = { sizeof(OSVERSIONINFOA) }; + if ((GetVersionExA(&vi) && vi.dwPlatformId == VER_PLATFORM_WIN32_WINDOWS)) + { + // Win9x/ME + int fd = fileno(file); + HANDLE fh = (HANDLE)_get_osfhandle(fd); + FlushFileBuffers(fh); + } +} + +#endif /*MORK_WIN*/ + //3456789_123456789_123456789_123456789_123456789_123456789_123456789_123456789