summaryrefslogtreecommitdiffstats
path: root/src/corelib/tools
diff options
context:
space:
mode:
authorAlex Trotsenko <alex1973tr@gmail.com>2014-07-21 16:35:43 +0300
committerAlex Trotsenko <alex1973tr@gmail.com>2014-07-23 07:31:09 +0200
commitedfac1a9edb9c9c76ca9a97a0f9d7a5bfd83143b (patch)
tree9f32564a4e0939104831e0cb860ddfcbd10da64e /src/corelib/tools
parent3905c6f00d9d11e01d6e211565d5ed58a59fc2d8 (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')
-rw-r--r--src/corelib/tools/qringbuffer_p.h10
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();
}