From f9f3306db9425f61120dbe276f5013e9bdb0af93 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Thu, 29 Jul 2021 17:14:03 +0200 Subject: [PATCH] io/BufferedOutputStream: use std::size_t --- src/fs/io/BufferedOutputStream.cxx | 9 +++++---- src/fs/io/BufferedOutputStream.hxx | 6 +++--- 2 files changed, 8 insertions(+), 7 deletions(-) diff --git a/src/fs/io/BufferedOutputStream.cxx b/src/fs/io/BufferedOutputStream.cxx index 960466c9a..c1bd44512 100644 --- a/src/fs/io/BufferedOutputStream.cxx +++ b/src/fs/io/BufferedOutputStream.cxx @@ -41,7 +41,7 @@ #endif bool -BufferedOutputStream::AppendToBuffer(const void *data, size_t size) noexcept +BufferedOutputStream::AppendToBuffer(const void *data, std::size_t size) noexcept { auto r = buffer.Write(); if (r.size < size) @@ -53,7 +53,7 @@ BufferedOutputStream::AppendToBuffer(const void *data, size_t size) noexcept } void -BufferedOutputStream::Write(const void *data, size_t size) +BufferedOutputStream::Write(const void *data, std::size_t size) { /* try to append to the current buffer */ if (AppendToBuffer(data, size)) @@ -88,7 +88,7 @@ BufferedOutputStream::Format(const char *fmt, ...) /* format into the buffer */ std::va_list ap; va_start(ap, fmt); - size_t size = vsnprintf(r.data, r.size, fmt, ap); + std::size_t size = vsnprintf(r.data, r.size, fmt, ap); va_end(ap); if (gcc_unlikely(size >= r.size)) { @@ -127,7 +127,8 @@ BufferedOutputStream::Write(const wchar_t *p) } void -BufferedOutputStream::WriteWideToUTF8(const wchar_t *src, size_t src_length) +BufferedOutputStream::WriteWideToUTF8(const wchar_t *src, + std::size_t src_length) { if (src_length == 0) return; diff --git a/src/fs/io/BufferedOutputStream.hxx b/src/fs/io/BufferedOutputStream.hxx index 657846b53..3aa6df4d2 100644 --- a/src/fs/io/BufferedOutputStream.hxx +++ b/src/fs/io/BufferedOutputStream.hxx @@ -56,7 +56,7 @@ public: explicit BufferedOutputStream(OutputStream &_os) noexcept :os(_os), buffer(32768) {} - void Write(const void *data, size_t size); + void Write(const void *data, std::size_t size); void Write(const char &ch) { Write(&ch, sizeof(ch)); @@ -81,10 +81,10 @@ public: void Flush(); private: - bool AppendToBuffer(const void *data, size_t size) noexcept; + bool AppendToBuffer(const void *data, std::size_t size) noexcept; #ifdef _UNICODE - void WriteWideToUTF8(const wchar_t *p, size_t length); + void WriteWideToUTF8(const wchar_t *p, std::size_t length); #endif };