mirror of
https://github.com/fmtlib/fmt.git
synced 2024-12-24 03:17:53 +00:00
Handy fix for handling of handles.
This commit is contained in:
parent
cb7caa540f
commit
225b757b50
3
posix.cc
3
posix.cc
@ -132,7 +132,8 @@ void fmt::File::close() {
|
||||
fmt::LongLong fmt::File::size() const {
|
||||
#ifdef _WIN32
|
||||
LARGE_INTEGER size = {};
|
||||
if (!FMT_SYSTEM(GetFileSizeEx(_get_osfhandle(fd_), &size)))
|
||||
HANDLE handle = reinterpret_cast<HANDLE>(_get_osfhandle(fd_));
|
||||
if (!FMT_SYSTEM(GetFileSizeEx(handle, &size)))
|
||||
throw WindowsError(GetLastError(), "cannot get file size");
|
||||
FMT_STATIC_ASSERT(sizeof(fmt::LongLong) >= sizeof(size.QuadPart),
|
||||
"return type of File::size is not large enough");
|
||||
|
Loading…
Reference in New Issue
Block a user