Commit 225b757b authored by Victor Zverovich's avatar Victor Zverovich

Handy fix for handling of handles.

parent cb7caa54
......@@ -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");
......
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