Bridge C++ bytes with Rust &[u8]

This commit is contained in:
topjohnwu
2023-06-07 16:49:40 -07:00
parent 5e2ef1b7f4
commit ee4dad7a13
7 changed files with 145 additions and 132 deletions

View File

@@ -174,7 +174,7 @@ void byte_channel::resize(size_t new_sz, bool zero) {
resize = true;
}
if (resize) {
_data.realloc(_cap);
_data._buf = static_cast<uint8_t *>(::realloc(_data._buf, _cap));
if (zero)
memset(_data.buf() + old_cap, 0, _cap - old_cap);
}