Unverified Commit 26d7c27b authored by Adi Lester's avatar Adi Lester Committed by GitHub

Use _filelengthi64 instead of _fstat64 to calculate file size on x64 machines

For some reason, `_fstat64` fails with errno 22 on Windows Server 2003 x64 when compiled using the `v141_xp` toolset.
Using `_filelengthi64` instead solves this issue
parent b4926422
......@@ -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)
long long ret = _filelengthi64(fd);
if (ret >= 0)
{
return st.st_size;
return static_cast<size_t>(ret);
}
#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