io/BufferedOutputStream: use std::size_t

This commit is contained in:
Max Kellermann 2021-07-29 17:14:03 +02:00 committed by Max Kellermann
parent 19d19cd737
commit f9f3306db9
2 changed files with 8 additions and 7 deletions

View File

@ -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;

View File

@ -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
};