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

open ifstream in zstr as binary always #793

Merged
merged 1 commit into from
Apr 7, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions extern/zstr/zstr.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -414,7 +414,11 @@ class ifstream
{
public:
explicit ifstream(const std::string filename, std::ios_base::openmode mode = std::ios_base::in, size_t buff_size = default_buff_size)
: detail::strict_fstream_holder< strict_fstream::ifstream >(filename, mode),
: detail::strict_fstream_holder< strict_fstream::ifstream >(filename, mode
#ifdef _WIN32 // to avoid problems with conversion of \r\n, only windows as otherwise there are problems on mac
| std::ios_base::binary
#endif
),
std::istream(new istreambuf(_fs.rdbuf(), buff_size))
{
exceptions(std::ios_base::badbit);
Expand All @@ -424,7 +428,11 @@ class ifstream
_fs.close();
}
void open(const std::string filename, std::ios_base::openmode mode = std::ios_base::in) {
_fs.open(filename, mode);
_fs.open(filename, mode
#ifdef _WIN32 // to avoid problems with conversion of \r\n, only windows as otherwise there are problems on mac
| std::ios_base::binary
#endif
);
std::istream::operator=(std::istream(new istreambuf(_fs.rdbuf())));
}
bool is_open() const {
Expand Down