| 127 | } |
| 128 | |
| 129 | void Buffer::copy_from(uint32_t offset, const uint8_t *src, uint32_t src_offset, |
| 130 | uint32_t nbytes) { |
| 131 | auto new_size = offset + nbytes; |
| 132 | if (new_size > size_) { |
| 133 | reserve(new_size * 2); |
| 134 | } |
| 135 | std::memcpy(data_ + offset, src + src_offset, static_cast<size_t>(nbytes)); |
| 136 | } |
| 137 | |
| 138 | std::string Buffer::to_string() const { |
| 139 | return std::string(reinterpret_cast<const char *>(data_), |