From 5f3d184276f6b4e13642018681cf33d2bc5b7638 Mon Sep 17 00:00:00 2001 From: Stanislaw Halik Date: Mon, 27 Nov 2023 05:57:05 +0100 Subject: a --- compat/format.hpp | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) (limited to 'compat') diff --git a/compat/format.hpp b/compat/format.hpp index 741b35bd..d0736c97 100644 --- a/compat/format.hpp +++ b/compat/format.hpp @@ -4,7 +4,6 @@ #include #include #include -#include #include namespace fmt { @@ -54,11 +53,15 @@ size_t snformat(char(&buf)[N], Fmt&& fmt, Xs&&... args) { constexpr size_t n = N > 0 ? N - 1 : 0; auto result = fmt::format_to_n(buf, n, Corrade::Utility::forward(fmt), Corrade::Utility::forward(args)...); - const auto len = Utility::min(n, result.size); + const auto len = n < result.size ? n : result.size; fm_assert(len > 0); +#if 0 if constexpr(N > 0) buf[len] = '\0'; - return len; +#else + buf[len] = '\0'; +#endif + return result.size; } } // namespace floormat -- cgit v1.2.3