diff options
Diffstat (limited to 'src/corelib/tools')
-rw-r--r-- | src/corelib/tools/qringbuffer.cpp | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/src/corelib/tools/qringbuffer.cpp b/src/corelib/tools/qringbuffer.cpp index 658267a521..85cfdaf129 100644 --- a/src/corelib/tools/qringbuffer.cpp +++ b/src/corelib/tools/qringbuffer.cpp @@ -138,10 +138,14 @@ char *QRingBuffer::reserveFront(qint64 bytes) if (tailBuffer == 0) tail -= head; - buffers.prepend(QByteArray()); head = qMax(basicBlockSize, int(bytes)); + if (bufferSize == 0) { + tail = head; + } else { + buffers.prepend(QByteArray()); + ++tailBuffer; + } buffers.first().resize(head); - ++tailBuffer; } head -= int(bytes); |