summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMax Kellermann <max@musicpd.org>2021-01-21 16:37:14 +0100
committerMax Kellermann <max@musicpd.org>2021-01-21 16:45:14 +0100
commit6b555b70178ce3048875a52f8fb3ac02858e8c90 (patch)
treeb0c31ff5c4e1ba08d82a3fb41d0476aa0309ae10 /src
parentdafba203e7c3ac7e13f82648869b78566d8151ab (diff)
util/PeakBuffer: use std::size_t
Diffstat (limited to 'src')
-rw-r--r--src/util/PeakBuffer.cxx14
-rw-r--r--src/util/PeakBuffer.hxx8
2 files changed, 11 insertions, 11 deletions
diff --git a/src/util/PeakBuffer.cxx b/src/util/PeakBuffer.cxx
index dcc6f92aa..1b93d1459 100644
--- a/src/util/PeakBuffer.cxx
+++ b/src/util/PeakBuffer.cxx
@@ -57,7 +57,7 @@ PeakBuffer::Read() const noexcept
}
void
-PeakBuffer::Consume(size_t length) noexcept
+PeakBuffer::Consume(std::size_t length) noexcept
{
if (normal_buffer != nullptr && !normal_buffer->empty()) {
normal_buffer->Consume(length);
@@ -75,21 +75,21 @@ PeakBuffer::Consume(size_t length) noexcept
}
}
-static size_t
+static std::size_t
AppendTo(DynamicFifoBuffer<uint8_t> &buffer,
const void *data, size_t length) noexcept
{
assert(data != nullptr);
assert(length > 0);
- size_t total = 0;
+ std::size_t total = 0;
do {
const auto p = buffer.Write();
if (p.empty())
break;
- const size_t nbytes = std::min(length, p.size);
+ const std::size_t nbytes = std::min(length, p.size);
memcpy(p.data, data, nbytes);
buffer.Append(nbytes);
@@ -102,20 +102,20 @@ AppendTo(DynamicFifoBuffer<uint8_t> &buffer,
}
bool
-PeakBuffer::Append(const void *data, size_t length)
+PeakBuffer::Append(const void *data, std::size_t length)
{
if (length == 0)
return true;
if (peak_buffer != nullptr && !peak_buffer->empty()) {
- size_t nbytes = AppendTo(*peak_buffer, data, length);
+ std::size_t nbytes = AppendTo(*peak_buffer, data, length);
return nbytes == length;
}
if (normal_buffer == nullptr)
normal_buffer = new DynamicFifoBuffer<uint8_t>(normal_size);
- size_t nbytes = AppendTo(*normal_buffer, data, length);
+ std::size_t nbytes = AppendTo(*normal_buffer, data, length);
if (nbytes > 0) {
data = (const uint8_t *)data + nbytes;
length -= nbytes;
diff --git a/src/util/PeakBuffer.hxx b/src/util/PeakBuffer.hxx
index 0684937b4..d40b31f4e 100644
--- a/src/util/PeakBuffer.hxx
+++ b/src/util/PeakBuffer.hxx
@@ -34,12 +34,12 @@ template<typename T> class DynamicFifoBuffer;
* kernel when it has been consumed.
*/
class PeakBuffer {
- size_t normal_size, peak_size;
+ std::size_t normal_size, peak_size;
DynamicFifoBuffer<uint8_t> *normal_buffer, *peak_buffer;
public:
- PeakBuffer(size_t _normal_size, size_t _peak_size)
+ PeakBuffer(std::size_t _normal_size, std::size_t _peak_size)
:normal_size(_normal_size), peak_size(_peak_size),
normal_buffer(nullptr), peak_buffer(nullptr) {}
@@ -62,9 +62,9 @@ public:
gcc_pure
WritableBuffer<void> Read() const noexcept;
- void Consume(size_t length) noexcept;
+ void Consume(std::size_t length) noexcept;
- bool Append(const void *data, size_t length);
+ bool Append(const void *data, std::size_t length);
};
#endif