aboutsummaryrefslogtreecommitdiffstats
path: root/src/util
diff options
context:
space:
mode:
Diffstat (limited to 'src/util')
-rw-r--r--src/util/ForeignFifoBuffer.hxx6
-rw-r--r--src/util/StaticFifoBuffer.hxx6
2 files changed, 10 insertions, 2 deletions
diff --git a/src/util/ForeignFifoBuffer.hxx b/src/util/ForeignFifoBuffer.hxx
index 0ebcd6069..b829fb030 100644
--- a/src/util/ForeignFifoBuffer.hxx
+++ b/src/util/ForeignFifoBuffer.hxx
@@ -147,7 +147,11 @@ public:
* When you are finished, call append().
*/
Range Write() {
- Shift();
+ if (IsEmpty())
+ Clear();
+ else if (tail == capacity)
+ Shift();
+
return Range(data + tail, capacity - tail);
}
diff --git a/src/util/StaticFifoBuffer.hxx b/src/util/StaticFifoBuffer.hxx
index 67645638e..c1b64bb1e 100644
--- a/src/util/StaticFifoBuffer.hxx
+++ b/src/util/StaticFifoBuffer.hxx
@@ -92,7 +92,11 @@ public:
* When you are finished, call append().
*/
Range Write() {
- Shift();
+ if (IsEmpty())
+ Clear();
+ else if (tail == size)
+ Shift();
+
return Range(data + tail, size - tail);
}