base: Reset CircleBuf size on flush()
authorAndreas Sandberg <andreas.sandberg@arm.com>
Tue, 9 Jun 2015 13:21:14 +0000 (09:21 -0400)
committerAndreas Sandberg <andreas.sandberg@arm.com>
Tue, 9 Jun 2015 13:21:14 +0000 (09:21 -0400)
The flush() method in CircleBuf resets the state of the circular
buffer, but fails to set size to zero. This obviously confuses code
that tries to determine the amount of data in the buffer. Set the size
to zero on flush.

src/base/circlebuf.cc

index 06d0075b2dea6e67ecc3477ac8d9285623696fa0..2f04bc16e049682ae5c5ccf2e0aba713d90e9ca9 100644 (file)
@@ -67,6 +67,7 @@ CircleBuf::flush()
 {
     _start = 0;
     _stop = 0;
+    _size = 0;
     _rollover = false;
 }