Skip to content

Commit

Permalink
Add note on rcutils_uint8_array_resize usage
Browse files Browse the repository at this point in the history
Signed-off-by: P. J. Reed <preed@swri.org>
  • Loading branch information
pjreed committed Jun 2, 2020
1 parent a255b20 commit e91de52
Showing 1 changed file with 2 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -272,6 +272,8 @@ void ZstdCompressor::compress_serialized_bag_message(
rcutils_uint8_array_resize(message->serialized_data.get(), compression_result);
throw_on_rcutils_resize_error(resize_result);

// Note that rcutils_uint8_array_resize changes buffer_capacity but not buffer_length, we
// have to do that manually.
message->serialized_data->buffer_length = compression_result;
std::copy(compressed_buffer.begin(), compressed_buffer.end(), message->serialized_data->buffer);

Expand Down

0 comments on commit e91de52

Please sign in to comment.