Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove all uses of std::io_errc #158

Merged
merged 1 commit into from
Aug 14, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion include/vcpkg/base/files.h
Original file line number Diff line number Diff line change
Expand Up @@ -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()
{
Expand Down
6 changes: 2 additions & 4 deletions src/vcpkg/base/files.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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());
Expand All @@ -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());
Expand Down
3 changes: 1 addition & 2 deletions src/vcpkg/base/hash.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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());
Expand Down