mirror of
https://github.com/gabime/spdlog.git
synced 2024-12-25 18:11:33 +08:00
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
This commit is contained in:
parent
b492642282
commit
26d7c27bee
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user