Fix small bug in StreamBuffer

This commit is contained in:
2021-03-05 14:33:01 -05:00
parent c742bc5645
commit d29e471f1d
3 changed files with 7 additions and 6 deletions

View File

@@ -54,6 +54,11 @@ void StreamBuffer::make_space_slow(int64_t bytes) {
int64_t existing_size = (buf_hi_ - buf_lo_);
int64_t desired_size = 8192 + ((data_size + bytes) * 2);
// Update some simple things.
pre_read_count_ += (read_cursor_ - buf_lo_);
lua_reader_data_ = 0;
lua_reader_size_ = 0;
// Move the data to the beginning of the buffer, or to
// the beginning of a new buffer.
if (fixed_size_) {
@@ -70,13 +75,8 @@ void StreamBuffer::make_space_slow(int64_t bytes) {
}
// Update the pointers to the data region.
pre_read_count_ += (read_cursor_ - buf_lo_);
read_cursor_ = buf_lo_;
write_cursor_ = buf_lo_ + data_size;
// Flush the lua reader data, if any.
lua_reader_data_ = 0;
lua_reader_size_ = 0;
}
char *StreamBuffer::get_overwrite(int64_t size, int64_t write_count_after) {