Remove all uses of std::io_errc
MODIFY
include/vcpkg/base/files.h
include/vcpkg/base/files.h
@@ -173,7 +173,7 @@ namespace vcpkg
return this->seek(static_cast<long long>(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()
{

MODIFY
src/vcpkg/base/files.cpp
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<std::string>();
}
} while (!file.eof());

MODIFY
src/vcpkg/base/hash.cpp
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());

Remove all uses of std::io_errc (#158)