diff --git a/src/common/file_stream.h b/src/common/file_stream.h index 9abe7e23..7f5236f7 100755 --- a/src/common/file_stream.h +++ b/src/common/file_stream.h @@ -178,11 +178,9 @@ public: bool empty() { return istream_->peek() == std::ifstream::traits_type::eof(); } void setbufsize(size_t size) const { -#ifdef 0 // this is buggy, do nothing istream_->rdbuf()->pubsetbuf(0, 0); - readBuf_.reset(new char[size]); - istream_->rdbuf()->pubsetbuf(readBuf_.get(), 0); -#endif + readBuf_.resize(size); + istream_->rdbuf()->pubsetbuf(readBuf_.data(), readBuf_.size()); } template @@ -206,9 +204,10 @@ private: std::unique_ptr istream_; boost::iostreams::file_descriptor_source fds_; + mutable std::vector readBuf_; // for setbuf() std::unique_ptr> fdsBuffer_; - mutable UPtr readBuf_; // for setbuf() + }; // wrapper around std::getline() that handles Windows input files with extra CR @@ -301,6 +300,7 @@ private: marian::filesystem::Path file_; std::unique_ptr ostream_; + boost::iostreams::file_descriptor_sink fds_; std::unique_ptr> fdsBuffer_; };