diff options
author | Alex Trotsenko <alex1973tr@gmail.com> | 2014-07-21 16:35:43 +0300 |
---|---|---|
committer | Alex Trotsenko <alex1973tr@gmail.com> | 2014-07-23 07:31:09 +0200 |
commit | edfac1a9edb9c9c76ca9a97a0f9d7a5bfd83143b (patch) | |
tree | 9f32564a4e0939104831e0cb860ddfcbd10da64e /src/corelib/tools/qringbuffer_p.h | |
parent | 3905c6f00d9d11e01d6e211565d5ed58a59fc2d8 (diff) |
Make QRingBuffer::append() not leave empty arrays in buffer list
Change-Id: I4c5af33488a70996299289ec2b953b7bf3b2c428
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@digia.com>
Diffstat (limited to 'src/corelib/tools/qringbuffer_p.h')
-rw-r--r-- | src/corelib/tools/qringbuffer_p.h | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/src/corelib/tools/qringbuffer_p.h b/src/corelib/tools/qringbuffer_p.h index 2f208d21e3..afd15c85ea 100644 --- a/src/corelib/tools/qringbuffer_p.h +++ b/src/corelib/tools/qringbuffer_p.h @@ -369,9 +369,13 @@ public: // append a new buffer to the end inline void append(const QByteArray &qba) { - buffers[tailBuffer].resize(tail); - buffers << qba; - ++tailBuffer; + if (tail == 0) { + buffers.last() = qba; + } else { + buffers.last().resize(tail); + buffers << qba; + ++tailBuffer; + } tail = qba.length(); bufferSize += qba.length(); } |