Fix some of the comments on StreamBuffer

This commit is contained in:
2021-10-14 14:41:03 -04:00
parent 796a3c4139
commit 901517bc01
2 changed files with 43 additions and 29 deletions

View File

@@ -89,6 +89,13 @@ void StreamBuffer::make_space_slow(int64_t bytes) {
write_cursor_ = buf_lo_ + data_size;
}
void StreamBuffer::wrote_space(int64_t bytes) {
int64_t available = buf_hi_ - write_cursor_;
assert(bytes >= 0);
assert(available >= bytes);
write_cursor_ += bytes;
}
char *StreamBuffer::get_overwrite(int64_t size, int64_t write_count_after) {
int64_t write_count_before = write_count_after - size;
assert(write_count_before >= total_reads());
@@ -159,7 +166,6 @@ static inline bool safe_to_cast_to_uint64(uint64_t vv) {
return true;
}
void StreamBuffer::write_bytes(const char *s, int64_t len) {
make_space(len);
memcpy(write_cursor_, s, len);