Unverified Commit 3eba3224 authored by Gabi Melman's avatar Gabi Melman Committed by GitHub

Merge pull request #926 from lestera/patch-1

Fix exceptions on file size calculation on Windows XP x64 and Windows Server 2003 x64
parents b4926422 247c4e55
...@@ -210,10 +210,10 @@ inline size_t filesize(FILE *f) ...@@ -210,10 +210,10 @@ inline size_t filesize(FILE *f)
#if defined(_WIN32) && !defined(__CYGWIN__) #if defined(_WIN32) && !defined(__CYGWIN__)
int fd = _fileno(f); int fd = _fileno(f);
#if _WIN64 // 64 bits #if _WIN64 // 64 bits
struct _stat64 st; __int64 ret = _filelengthi64(fd);
if (_fstat64(fd, &st) == 0) if (ret >= 0)
{ {
return st.st_size; return static_cast<size_t>(ret);
} }
#else // windows 32 bits #else // windows 32 bits
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment