Function cras::resizeBuffer

Function Documentation

void cras::resizeBuffer(::topic_tools::ShapeShifter &msg, size_t newLength)

Resize the internal buffer of the message.

Note

If the new size is the same as the old one, nothing happens. If the new one is longer, the buffer is reallocated and the contents of the old buffer are copied to it. If the new one is shorter, the contained data are cropped to the new length.

Note

Use this function with care. After calling it, the message object becomes invalid until you fix it.

Parameters:
  • msg[inout] The message to change.

  • newLength[in] New length of the internal buffer.