History

Ensure a C++ object exists for all static const members of structs or create constexpr functions. - This is an attempt to adhere to the letter of the C++ specification.

arr committed 9 years ago

Commit af5c7a91 parent 4d839d714 files · +86 −64Browse files

Showing the changes to src/include/buffered_reader.h (1 of 14 files). Show all

Unified · Split

src/include/buffered_reader.h+3−6
@@ -20,12 +20,9 @@ namespace disvm · 19 unmodified lines
2020 {
2121 class buffered_reader_t
2222 {
23− private: // static
24− static const std::size_t buffer_size = 64 * 1024; // 64k is an optimization for the Windows filesystem manager
25−
2623 public:
2724 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
2926 , _current_index{ 0 }
3027 , _current_size{ 0 }
3128 , _stream{ stream }
@@ -141,10 +138,10 @@ namespace disvm · 109 unmodified lines
141138 if (_stream.fail())
142139 return 0;
143140
144− _stream.read(_buffer.data(), buffered_reader_t::buffer_size);
141+ _stream.read(_buffer.data(), _buffer.size());
145142
146143 // 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();
148145 }
149146
150147 return _current_size - _current_index;