| 14 | } |
| 15 | |
| 16 | void MemoryStream::reserve(size_t len) |
| 17 | { |
| 18 | if (len == 0 || len < _capacity) |
| 19 | { |
| 20 | return; |
| 21 | } |
| 22 | |
| 23 | auto* newData = static_cast<std::byte*>(std::realloc(_data, len)); |
| 24 | if (newData == nullptr) |
| 25 | { |
| 26 | throw Exception::BadAllocation(); |
| 27 | } |
| 28 | |
| 29 | _data = newData; |
| 30 | _capacity = len; |
| 31 | } |
| 32 | |
| 33 | void MemoryStream::resize(size_t len) |
| 34 | { |
no outgoing calls
no test coverage detected