aboutsummaryrefslogtreecommitdiffstats
path: root/src/util/PeakBuffer.cxx
diff options
context:
space:
mode:
authorMax Kellermann <max@duempel.org>2013-12-19 10:30:26 +0100
committerMax Kellermann <max@duempel.org>2013-12-19 10:30:26 +0100
commit52dca859c7ad32ac0869f75326ea82731d7d2271 (patch)
treec970234fcfbbaac1d6640b31decb3fce8acb4dd4 /src/util/PeakBuffer.cxx
parentf5443163140ee4ffba66748d3e9ff30160563bb2 (diff)
downloadmpd-52dca859c7ad32ac0869f75326ea82731d7d2271.tar.gz
mpd-52dca859c7ad32ac0869f75326ea82731d7d2271.tar.xz
mpd-52dca859c7ad32ac0869f75326ea82731d7d2271.zip
util/PeakBuffer: use IsEmpty() instead of IsNull()
The DynamicFifoBuffer methods never return nullptr when the buffer is empty or full; instead, they return an empty buffer. This bug caused an endless loop.
Diffstat (limited to 'src/util/PeakBuffer.cxx')
-rw-r--r--src/util/PeakBuffer.cxx6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/util/PeakBuffer.cxx b/src/util/PeakBuffer.cxx
index c66218043..5e86503e8 100644
--- a/src/util/PeakBuffer.cxx
+++ b/src/util/PeakBuffer.cxx
@@ -43,13 +43,13 @@ PeakBuffer::Read() const
{
if (normal_buffer != nullptr) {
const auto p = normal_buffer->Read();
- if (!p.IsNull())
+ if (!p.IsEmpty())
return p.ToVoid();
}
if (peak_buffer != nullptr) {
const auto p = peak_buffer->Read();
- if (!p.IsNull())
+ if (!p.IsEmpty())
return p.ToVoid();
}
@@ -85,7 +85,7 @@ AppendTo(DynamicFifoBuffer<uint8_t> &buffer, const void *data, size_t length)
do {
const auto p = buffer.Write();
- if (p.IsNull())
+ if (p.IsEmpty())
break;
const size_t nbytes = std::min(length, p.size);