Merge pull request #926 from lestera/patch-1

Fix exceptions on file size calculation on Windows XP x64 and Windows Server 2003 x64
This commit is contained in:
Gabi Melman 2018-11-27 16:08:30 +02:00 committed by GitHub
commit 3eba3224c8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -210,10 +210,10 @@ inline size_t filesize(FILE *f)
#if defined(_WIN32) && !defined(__CYGWIN__)
int fd = _fileno(f);
#if _WIN64 // 64 bits
struct _stat64 st;
if (_fstat64(fd, &st) == 0)
__int64 ret = _filelengthi64(fd);
if (ret >= 0)
{
return st.st_size;
return static_cast<size_t>(ret);
}
#else // windows 32 bits