From 7cc893b2169555a8c4d8242f69e7ef12ebc36185 Mon Sep 17 00:00:00 2001 From: Alex Trotsenko Date: Tue, 24 Jun 2014 08:41:11 +0300 Subject: Fix QRingBuffer::readPointerAtPosition() Fix condition to allow return a valid pointer when head != 0. Change-Id: I5215f7dfc44924016c2d9b67ab2d9935b5164d7a Reviewed-by: Oswald Buddenhagen --- src/corelib/tools/qringbuffer_p.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'src/corelib/tools') diff --git a/src/corelib/tools/qringbuffer_p.h b/src/corelib/tools/qringbuffer_p.h index b17c6d2f40..5d25b0add1 100644 --- a/src/corelib/tools/qringbuffer_p.h +++ b/src/corelib/tools/qringbuffer_p.h @@ -90,7 +90,7 @@ public: // special case: it is in the first buffer int nextDataBlockSizeValue = nextDataBlockSize(); - if (pos - head < nextDataBlockSizeValue) { + if (pos < nextDataBlockSizeValue) { length = nextDataBlockSizeValue - pos; return buffers.at(0).constData() + head + pos; } -- cgit v1.2.3