зеркало из https://github.com/mozilla/pjs.git
fix 221797 flush mork db file buffers on win98, r=me, sr=mscott, a=asa, initial patch by Christian Franke
This commit is contained in:
Родитель
48d3faa53e
Коммит
008b5c9ecc
|
@ -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)
|
||||
|
|
|
@ -56,6 +56,11 @@
|
|||
#include "morkFile.h"
|
||||
#endif
|
||||
|
||||
#ifdef MORK_WIN
|
||||
#include "io.h"
|
||||
#include <windows.h>
|
||||
#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
|
||||
|
|
Загрузка…
Ссылка в новой задаче