From f60a42e0b6326cd25f0c20eb21e03f4cc2d90bf0 Mon Sep 17 00:00:00 2001 From: Max Kellermann Date: Fri, 25 Jun 2021 17:32:11 +0200 Subject: [PATCH] Log, client/Response: adapt to libfmt 8.0.0 API changes --- src/Log.cxx | 4 ++++ src/Log.hxx | 2 +- src/client/Response.cxx | 4 ++++ src/client/Response.hxx | 2 +- 4 files changed, 10 insertions(+), 2 deletions(-) diff --git a/src/Log.cxx b/src/Log.cxx index 69fa138c3..e174355e8 100644 --- a/src/Log.cxx +++ b/src/Log.cxx @@ -35,7 +35,11 @@ LogVFmt(LogLevel level, const Domain &domain, fmt::string_view format_str, fmt::format_args args) noexcept { fmt::memory_buffer buffer; +#if FMT_VERSION >= 80000 + fmt::vformat_to(std::back_inserter(buffer), format_str, args); +#else fmt::vformat_to(buffer, format_str, args); +#endif Log(level, domain, {buffer.data(), buffer.size()}); } diff --git a/src/Log.hxx b/src/Log.hxx index dfc33a409..e04728570 100644 --- a/src/Log.hxx +++ b/src/Log.hxx @@ -24,7 +24,7 @@ #include "util/Compiler.h" #include -#if FMT_VERSION < 70000 +#if FMT_VERSION < 70000 || FMT_VERSION >= 80000 #include #endif diff --git a/src/client/Response.cxx b/src/client/Response.cxx index aeede609d..cda9e4969 100644 --- a/src/client/Response.cxx +++ b/src/client/Response.cxx @@ -44,7 +44,11 @@ bool Response::VFmt(fmt::string_view format_str, fmt::format_args args) noexcept { fmt::memory_buffer buffer; +#if FMT_VERSION >= 80000 + fmt::vformat_to(std::back_inserter(buffer), format_str, args); +#else fmt::vformat_to(buffer, format_str, args); +#endif return Write(buffer.data(), buffer.size()); } diff --git a/src/client/Response.hxx b/src/client/Response.hxx index a34b16851..7955d07c1 100644 --- a/src/client/Response.hxx +++ b/src/client/Response.hxx @@ -23,7 +23,7 @@ #include "protocol/Ack.hxx" #include -#if FMT_VERSION < 70000 +#if FMT_VERSION < 70000 || FMT_VERSION >= 80000 #include #endif