mirror of
https://github.com/fmtlib/fmt.git
synced 2025-12-12 06:30:02 +08:00
Avoid repeated call to GetLastError in file::size (#4522)
This commit is contained in:
parent
f17b9aa44c
commit
80549a630e
@ -251,7 +251,7 @@ auto file::size() const -> long long {
|
||||
if (size_lower == INVALID_FILE_SIZE) {
|
||||
DWORD error = GetLastError();
|
||||
if (error != NO_ERROR)
|
||||
FMT_THROW(windows_error(GetLastError(), "cannot get file size"));
|
||||
FMT_THROW(windows_error(error, "cannot get file size"));
|
||||
}
|
||||
unsigned long long long_size = size_upper;
|
||||
return (long_size << sizeof(DWORD) * CHAR_BIT) | size_lower;
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user