summaryrefslogtreecommitdiffhomepage
path: root/compat/format.hpp
diff options
context:
space:
mode:
authorStanislaw Halik <sthalik@misaki.pl>2023-11-27 05:57:05 +0100
committerStanislaw Halik <sthalik@misaki.pl>2023-11-27 05:57:05 +0100
commit5f3d184276f6b4e13642018681cf33d2bc5b7638 (patch)
treec6538eb7ef9c6ab0f361337698f7eee4a9ece819 /compat/format.hpp
parent143b205fae27ed433fd7cac0e0ab6f0fa4f8b03b (diff)
a
Diffstat (limited to 'compat/format.hpp')
-rw-r--r--compat/format.hpp9
1 files changed, 6 insertions, 3 deletions
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 <fmt/compile.h>
#include <Corrade/Containers/StringView.h>
#include <Corrade/Containers/String.h>
-#include <Corrade/Utility/Math.h>
#include <Corrade/Utility/Move.h>
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>(fmt), Corrade::Utility::forward<Xs>(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