From 225b757b50006a24bcc1c0216cf1a025afddd987 Mon Sep 17 00:00:00 2001 From: Victor Zverovich Date: Fri, 12 Sep 2014 12:37:32 -0700 Subject: [PATCH] Handy fix for handling of handles. --- posix.cc | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/posix.cc b/posix.cc index 302c78ad..9dc6b79b 100644 --- a/posix.cc +++ b/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(_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");