MinGW __stat64 support depends on MSVCRT version

pull/1094/head
Mika Rautio 2016-12-05 12:33:48 +02:00
parent 17fc3eea8f
commit f9cce7f59c
1 changed files with 2 additions and 2 deletions

View File

@ -120,13 +120,13 @@ size_t DefaultIOStream::FileSize() const
// //
// See here for details: // See here for details:
// https://www.securecoding.cert.org/confluence/display/seccode/FIO19-C.+Do+not+use+fseek()+and+ftell()+to+compute+the+size+of+a+regular+file // https://www.securecoding.cert.org/confluence/display/seccode/FIO19-C.+Do+not+use+fseek()+and+ftell()+to+compute+the+size+of+a+regular+file
#if defined _WIN32 #if defined _WIN32 && (!defined __GNUC__ || __MSVCRT_VERSION__ >= 0x0601)
struct __stat64 fileStat; struct __stat64 fileStat;
int err = _stat64( mFilename.c_str(), &fileStat ); int err = _stat64( mFilename.c_str(), &fileStat );
if (0 != err) if (0 != err)
return 0; return 0;
mCachedSize = (size_t) (fileStat.st_size); mCachedSize = (size_t) (fileStat.st_size);
#elif defined __gnu_linux__ || defined __APPLE__ || defined __MACH__ #elif defined __GNUC__ || defined __APPLE__ || defined __MACH__
struct stat fileStat; struct stat fileStat;
int err = stat(mFilename.c_str(), &fileStat ); int err = stat(mFilename.c_str(), &fileStat );
if (0 != err) if (0 != err)