From 05cea6f8354f6fe0819590cedce23e6a2cc2dff4 Mon Sep 17 00:00:00 2001 From: Sadie Powell Date: Thu, 22 Aug 2024 09:41:36 +0100 Subject: [PATCH] Fix formatting strings on C++20 compilers. --- include/logging.h | 10 +++++----- include/membership.h | 2 +- include/numeric.h | 2 +- include/snomasks.h | 4 ++-- include/users.h | 4 ++-- 5 files changed, 11 insertions(+), 11 deletions(-) diff --git a/include/logging.h b/include/logging.h index fe1d505e7..85027696c 100644 --- a/include/logging.h +++ b/include/logging.h @@ -271,7 +271,7 @@ public: template void Critical(const std::string& type, const char* format, Args&&... args) { - Write(Level::CRITICAL, type, fmt::format(format, std::forward(args)...)); + Write(Level::CRITICAL, type, fmt::vformat(format, fmt::make_format_args(args...))); } /** Writes a warning message to the server log. @@ -291,7 +291,7 @@ public: template void Warning(const std::string& type, const char* format, Args&&... args) { - Write(Level::WARNING, type, fmt::format(format, std::forward(args)...)); + Write(Level::WARNING, type, fmt::vformat(format, fmt::make_format_args(args...))); } /** Writes a normal message to the server log. @@ -311,7 +311,7 @@ public: template void Normal(const std::string& type, const char* format, Args&&... args) { - Write(Level::NORMAL, type, fmt::format(format, std::forward(args)...)); + Write(Level::NORMAL, type, fmt::vformat(format, fmt::make_format_args(args...))); } /** Writes a debug message to the server log. @@ -330,7 +330,7 @@ public: template void Debug(const std::string& type, const char* format, Args&&... args) { - Write(Level::DEBUG, type, fmt::format(format, std::forward(args)...)); + Write(Level::DEBUG, type, fmt::vformat(format, fmt::make_format_args(args...))); } /** Writes a raw I/O message to the server log. @@ -350,6 +350,6 @@ public: template void RawIO(const std::string& type, const char* format, Args&&... args) { - Write(Level::RAWIO, type, fmt::format(format, std::forward(args)...)); + Write(Level::RAWIO, type, fmt::vformat(format, fmt::make_format_args(args...))); } }; diff --git a/include/membership.h b/include/membership.h index f54ef32e0..a7dfe5a21 100644 --- a/include/membership.h +++ b/include/membership.h @@ -142,6 +142,6 @@ public: template void WriteNotice(const char* text, Param&&... p) { - WriteNotice(fmt::format(text, std::forward(p)...)); + WriteNotice(fmt::vformat(text, fmt::make_format_args(p...))); } }; diff --git a/include/numeric.h b/include/numeric.h index b821424ca..c135552bd 100644 --- a/include/numeric.h +++ b/include/numeric.h @@ -135,7 +135,7 @@ public: template Numeric& push_fmt(const char* text, Args&&... args) { - push(fmt::format(text, std::forward(args)...)); + push(fmt::vformat(text, fmt::make_format_args(args...))); return *this; } diff --git a/include/snomasks.h b/include/snomasks.h index b42c40124..1a6242128 100644 --- a/include/snomasks.h +++ b/include/snomasks.h @@ -103,7 +103,7 @@ public: template void WriteToSnoMask(char letter, const char* text, Args&&... args) { - WriteToSnoMask(letter, fmt::format(text, std::forward(args)...)); + WriteToSnoMask(letter, fmt::vformat(text, fmt::make_format_args(args...))); } /** Write to all users with a given snomask (sent globally) @@ -120,7 +120,7 @@ public: template void WriteGlobalSno(char letter, const char* text, Args&&... args) { - WriteGlobalSno(letter, fmt::format(text, std::forward(args)...)); + WriteGlobalSno(letter, fmt::vformat(text, fmt::make_format_args(args...))); } /** Called once per 5 seconds from the mainloop, this flushes any cached diff --git a/include/users.h b/include/users.h index b7be744eb..8259b5116 100644 --- a/include/users.h +++ b/include/users.h @@ -672,7 +672,7 @@ public: template void WriteNotice(const char* text, Param&&... p) { - WriteNotice(fmt::format(text, std::forward(p)...)); + WriteNotice(fmt::vformat(text, fmt::make_format_args(p...))); } /** Sends a server notice from the local server to the user. @@ -687,7 +687,7 @@ public: template void WriteRemoteNotice(const char* text, Param&&... p) { - WriteRemoteNotice(fmt::format(text, std::forward(p)...)); + WriteRemoteNotice(fmt::vformat(text, fmt::make_format_args(p...))); } /** Sends a notice to this user.