From 8c6bc02bf7dae6c9e2ec1e774f0f4b2702b4fdc4 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Tue, 26 Jan 2021 22:27:18 +0100 Subject: [PATCH] io/BufferedOutputStream: use std::byte --- src/io/BufferedOutputStream.cxx | 9 +++++---- src/io/BufferedOutputStream.hxx | 2 +- 2 files changed, 6 insertions(+), 5 deletions(-) diff --git a/src/io/BufferedOutputStream.cxx b/src/io/BufferedOutputStream.cxx index c1bd44512..103eb357f 100644 --- a/src/io/BufferedOutputStream.cxx +++ b/src/io/BufferedOutputStream.cxx @@ -1,5 +1,5 @@ /* - * Copyright (C) 2014-2018 Max Kellermann + * Copyright 2014-2021 Max Kellermann * * Redistribution and use in source and binary forms, with or without * modification, are permitted provided that the following conditions @@ -88,7 +88,7 @@ BufferedOutputStream::Format(const char *fmt, ...) /* format into the buffer */ std::va_list ap; va_start(ap, fmt); - std::size_t size = vsnprintf(r.data, r.size, fmt, ap); + std::size_t size = vsnprintf((char *)r.data, r.size, fmt, ap); va_end(ap); if (gcc_unlikely(size >= r.size)) { @@ -108,7 +108,7 @@ BufferedOutputStream::Format(const char *fmt, ...) /* format into the new buffer */ va_start(ap, fmt); - size = vsnprintf(r.data, r.size, fmt, ap); + size = vsnprintf((char *)r.data, r.size, fmt, ap); va_end(ap); /* this time, it must fit */ @@ -140,7 +140,8 @@ BufferedOutputStream::WriteWideToUTF8(const wchar_t *src, } int length = WideCharToMultiByte(CP_UTF8, 0, src, src_length, - r.data, r.size, nullptr, nullptr); + (char *)r.data, r.size, + nullptr, nullptr); if (length <= 0) { const auto error = GetLastError(); if (error != ERROR_INSUFFICIENT_BUFFER) diff --git a/src/io/BufferedOutputStream.hxx b/src/io/BufferedOutputStream.hxx index b88be1bac..576aeedd7 100644 --- a/src/io/BufferedOutputStream.hxx +++ b/src/io/BufferedOutputStream.hxx @@ -53,7 +53,7 @@ class OutputStream; class BufferedOutputStream { OutputStream &os; - DynamicFifoBuffer buffer; + DynamicFifoBuffer buffer; public: explicit BufferedOutputStream(OutputStream &_os,