| 26 | } |
| 27 | |
| 28 | bool InputCallback::decode(pb_istream_t* stream, const pb_field_t*) |
| 29 | { |
| 30 | size_t available = stream->bytes_left; |
| 31 | auto new_buf = realloc(data, length + available); |
| 32 | if(new_buf == nullptr) { |
| 33 | return false; |
| 34 | } |
| 35 | data = static_cast<uint8_t*>(new_buf); |
| 36 | auto old_length = length; |
| 37 | length += available; |
| 38 | |
| 39 | return pb_read(stream, &data[old_length], available); |
| 40 | } |
| 41 | |
| 42 | } // namespace Protobuf |
no test coverage detected