Resizing small doesn't reallocate the buffer.

This commit is contained in:
David Given
2019-03-05 20:36:13 +01:00
parent 8212adf84f
commit cca901825e

View File

@@ -96,9 +96,13 @@ void Bytes::adjustBounds(unsigned pos)
Bytes& Bytes::resize(unsigned size)
{
checkWritable();
unsigned oldsize = _high - _low;
if (size > oldsize)
{
checkWritable();
_data->resize(_low + size);
}
_high = _low + size;
_data->resize(_high);
return *this;
}