Showing the changes to src/include/buffered_reader.h (1 of 14 files). Show all
Unified · Split
| @@ -20,12 +20,9 @@ namespace disvm · 19 unmodified lines | ||
| 20 | 20 | { |
| 21 | 21 | class buffered_reader_t |
| 22 | 22 | { |
| 23 | − private: // static | |
| 24 | − static const std::size_t buffer_size = 64 * 1024; // 64k is an optimization for the Windows filesystem manager | |
| 25 | − | |
| 26 | 23 | public: |
| 27 | 24 | buffered_reader_t(std::istream &stream) |
| 28 | − : _buffer(buffered_reader_t::buffer_size) | |
| 25 | + : _buffer(64 * 1024) // 64k is an optimization for the Windows filesystem manager | |
| 29 | 26 | , _current_index{ 0 } |
| 30 | 27 | , _current_size{ 0 } |
| 31 | 28 | , _stream{ stream } |
| @@ -141,10 +138,10 @@ namespace disvm · 109 unmodified lines | ||
| 141 | 138 | if (_stream.fail()) |
| 142 | 139 | return 0; |
| 143 | 140 | |
| 144 | − _stream.read(_buffer.data(), buffered_reader_t::buffer_size); | |
| 141 | + _stream.read(_buffer.data(), _buffer.size()); | |
| 145 | 142 | |
| 146 | 143 | // If the stream has failed, set the current size, otherwise the buffer size |
| 147 | − _current_size = _stream.fail() ? static_cast<std::size_t>(_stream.gcount()) : buffered_reader_t::buffer_size; | |
| 144 | + _current_size = _stream.fail() ? static_cast<std::size_t>(_stream.gcount()) : _buffer.size(); | |
| 148 | 145 | } |
| 149 | 146 | |
| 150 | 147 | return _current_size - _current_index; |