From 4a3db316c634397ea04bd486af406864609c6d32 Mon Sep 17 00:00:00 2001 From: Robert Schumacher Date: Sat, 14 Aug 2021 00:59:40 +0000 Subject: [PATCH] Remove all uses of std::io_errc --- include/vcpkg/base/files.h | 2 +- src/vcpkg/base/files.cpp | 6 ++---- src/vcpkg/base/hash.cpp | 3 +-- 3 files changed, 4 insertions(+), 7 deletions(-) diff --git a/include/vcpkg/base/files.h b/include/vcpkg/base/files.h index 1a91a62172..7477910720 100644 --- a/include/vcpkg/base/files.h +++ b/include/vcpkg/base/files.h @@ -173,7 +173,7 @@ namespace vcpkg return this->seek(static_cast(offset), origin); } int eof() const noexcept { return ::feof(m_fs); } - int error() const noexcept { return ::ferror(m_fs); } + std::error_code error() const noexcept { return std::error_code(::ferror(m_fs), std::generic_category()); } ~FilePointer() { diff --git a/src/vcpkg/base/files.cpp b/src/vcpkg/base/files.cpp index d66066ba8b..a7aef10f4e 100644 --- a/src/vcpkg/base/files.cpp +++ b/src/vcpkg/base/files.cpp @@ -1467,9 +1467,8 @@ namespace vcpkg { output.append(buffer, this_read); } - else if (file.error()) + else if ((ec = file.error())) { - ec = std::io_errc::stream; return std::string(); } } while (!file.eof()); @@ -1495,9 +1494,8 @@ namespace vcpkg { output.on_data({buffer, this_read}); } - else if (file.error()) + else if ((ec = file.error())) { - ec = std::io_errc::stream; return std::vector(); } } while (!file.eof()); diff --git a/src/vcpkg/base/hash.cpp b/src/vcpkg/base/hash.cpp index f9730cba83..a9f640ba00 100644 --- a/src/vcpkg/base/hash.cpp +++ b/src/vcpkg/base/hash.cpp @@ -582,9 +582,8 @@ namespace vcpkg::Hash { hasher.add_bytes(buffer, buffer + this_read); } - else if (file.error()) + else if ((ec = file.error())) { - ec = std::io_errc::stream; return std::string(); } } while (!file.eof());