summaryrefslogtreecommitdiffstats
path: root/src/corelib/tools/qringbuffer.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/corelib/tools/qringbuffer.cpp')
-rw-r--r--src/corelib/tools/qringbuffer.cpp12
1 files changed, 6 insertions, 6 deletions
diff --git a/src/corelib/tools/qringbuffer.cpp b/src/corelib/tools/qringbuffer.cpp
index db2004dfd9..4a2dfdec2b 100644
--- a/src/corelib/tools/qringbuffer.cpp
+++ b/src/corelib/tools/qringbuffer.cpp
@@ -74,14 +74,14 @@ void QRingBuffer::free(qint64 bytes)
Q_ASSERT(bytes <= bufferSize);
while (bytes > 0) {
- const qint64 blockSize = buffers.first().size() - head;
+ const qint64 blockSize = buffers.constFirst().size() - head;
if (tailBuffer == 0 || blockSize > bytes) {
// keep a single block around if it does not exceed
// the basic block size, to avoid repeated allocations
// between uses of the buffer
if (bufferSize <= bytes) {
- if (buffers.first().size() <= basicBlockSize) {
+ if (buffers.constFirst().size() <= basicBlockSize) {
bufferSize = 0;
head = tail = 0;
} else {
@@ -114,8 +114,8 @@ char *QRingBuffer::reserve(qint64 bytes)
} else {
const qint64 newSize = bytes + tail;
// if need buffer reallocation
- if (newSize > buffers.last().size()) {
- if (newSize > buffers.last().capacity() && (tail >= basicBlockSize
+ if (newSize > buffers.constLast().size()) {
+ if (newSize > buffers.constLast().capacity() && (tail >= basicBlockSize
|| newSize >= MaxByteArraySize)) {
// shrink this buffer to its current size
buffers.last().resize(tail);
@@ -180,7 +180,7 @@ void QRingBuffer::chop(qint64 bytes)
// the basic block size, to avoid repeated allocations
// between uses of the buffer
if (bufferSize <= bytes) {
- if (buffers.first().size() <= basicBlockSize) {
+ if (buffers.constFirst().size() <= basicBlockSize) {
bufferSize = 0;
head = tail = 0;
} else {
@@ -198,7 +198,7 @@ void QRingBuffer::chop(qint64 bytes)
bytes -= tail;
buffers.removeLast();
--tailBuffer;
- tail = buffers.last().size();
+ tail = buffers.constLast().size();
}
}