Right now callers of ply_buffer_append_bytes have to be
very careful to make sure the data they're appending is
non-zero in length. This is kind of inconvenient, since
it's not unusual for data to come in that's zero bytes
long.
For simplicity, this commit just makes
ply_buffer_append_bytes support that use case.
{
assert (buffer != NULL);
assert (bytes_in != NULL);
- assert (length != 0);
const uint8_t *bytes = bytes_in;
+ if (length == 0)
+ return;
+
if (length > PLY_BUFFER_MAX_BUFFER_CAPACITY) {
bytes += length - (PLY_BUFFER_MAX_BUFFER_CAPACITY - 1);
length = (PLY_BUFFER_MAX_BUFFER_CAPACITY - 1);
memset (buffer->data, '\0', buffer->capacity);
buffer->size = 0;
}
-