Make it so that drivenengine never changes (only appends) output bytes.

This commit is contained in:
2022-01-06 17:24:32 -05:00
parent 3306281dcc
commit dc2237e5c1
4 changed files with 59 additions and 42 deletions

View File

@@ -352,7 +352,7 @@ std::string StreamBuffer::read_string_limit(int64_t max_allowed) {
std::string StreamBuffer::read_entire_contents() {
std::string result(read_cursor_, fill());
clear();
read_cursor_ = write_cursor_;
return result;
}
@@ -438,6 +438,11 @@ void StreamBuffer::copy_into(StreamBuffer *sb) {
sb->write_bytes(read_cursor_, write_cursor_ - read_cursor_);
}
void StreamBuffer::transfer_into(StreamBuffer *sb) {
sb->write_bytes(read_cursor_, write_cursor_ - read_cursor_);
read_cursor_ = write_cursor_;
}
bool StreamBuffer::contents_equal(const StreamBuffer *other) const {
int64_t len = fill();
if (len != other->fill()) {