[7488] Fixed map extractor on platforms with 2GB fopen() limit

This commit is contained in:
arrai 2009-03-18 16:43:48 +01:00
parent a7fd57cc74
commit 071a24562a
2 changed files with 20 additions and 3 deletions

View file

@ -16,7 +16,23 @@
#include "loadlib/adt.h" #include "loadlib/adt.h"
#include "loadlib/wdt.h" #include "loadlib/wdt.h"
#include <fcntl.h>
#if defined( __GNUC__ )
#define _open open
#define _close close
#ifndef O_BINARY
#define O_BINARY 0
#endif
#else
#include <io.h>
#endif
#ifdef O_LARGEFILE
#define OPEN_FLAGS (O_RDONLY | O_BINARY | O_LARGEFILE)
#else
#define OPEN_FLAGS (O_RDONLY | O_BINARY)
#endif
extern ArchiveSet gOpenArchives; extern ArchiveSet gOpenArchives;
typedef struct typedef struct
@ -81,9 +97,10 @@ void CreateDir( const std::string& Path )
bool FileExists( const char* FileName ) bool FileExists( const char* FileName )
{ {
if(FILE* fp = fopen( FileName, "rb" )) int fp = _open(FileName, OPEN_FLAGS);
if(fp != -1)
{ {
fclose(fp); _close(fp);
return true; return true;
} }

View file

@ -1,4 +1,4 @@
#ifndef __REVISION_NR_H__ #ifndef __REVISION_NR_H__
#define __REVISION_NR_H__ #define __REVISION_NR_H__
#define REVISION_NR "7487" #define REVISION_NR "7488"
#endif // __REVISION_NR_H__ #endif // __REVISION_NR_H__