Fix formatting strings on C++20 compilers.

This commit is contained in:
Sadie Powell 2024-08-22 09:41:36 +01:00
parent 41bc99c614
commit 05cea6f835
5 changed files with 11 additions and 11 deletions

View File

@ -271,7 +271,7 @@ public:
template <typename... Args> template <typename... Args>
void Critical(const std::string& type, const char* format, Args&&... args) void Critical(const std::string& type, const char* format, Args&&... args)
{ {
Write(Level::CRITICAL, type, fmt::format(format, std::forward<Args>(args)...)); Write(Level::CRITICAL, type, fmt::vformat(format, fmt::make_format_args(args...)));
} }
/** Writes a warning message to the server log. /** Writes a warning message to the server log.
@ -291,7 +291,7 @@ public:
template <typename... Args> template <typename... Args>
void Warning(const std::string& type, const char* format, Args&&... args) void Warning(const std::string& type, const char* format, Args&&... args)
{ {
Write(Level::WARNING, type, fmt::format(format, std::forward<Args>(args)...)); Write(Level::WARNING, type, fmt::vformat(format, fmt::make_format_args(args...)));
} }
/** Writes a normal message to the server log. /** Writes a normal message to the server log.
@ -311,7 +311,7 @@ public:
template <typename... Args> template <typename... Args>
void Normal(const std::string& type, const char* format, Args&&... args) void Normal(const std::string& type, const char* format, Args&&... args)
{ {
Write(Level::NORMAL, type, fmt::format(format, std::forward<Args>(args)...)); Write(Level::NORMAL, type, fmt::vformat(format, fmt::make_format_args(args...)));
} }
/** Writes a debug message to the server log. /** Writes a debug message to the server log.
@ -330,7 +330,7 @@ public:
template <typename... Args> template <typename... Args>
void Debug(const std::string& type, const char* format, Args&&... args) void Debug(const std::string& type, const char* format, Args&&... args)
{ {
Write(Level::DEBUG, type, fmt::format(format, std::forward<Args>(args)...)); Write(Level::DEBUG, type, fmt::vformat(format, fmt::make_format_args(args...)));
} }
/** Writes a raw I/O message to the server log. /** Writes a raw I/O message to the server log.
@ -350,6 +350,6 @@ public:
template <typename... Args> template <typename... Args>
void RawIO(const std::string& type, const char* format, Args&&... args) void RawIO(const std::string& type, const char* format, Args&&... args)
{ {
Write(Level::RAWIO, type, fmt::format(format, std::forward<Args>(args)...)); Write(Level::RAWIO, type, fmt::vformat(format, fmt::make_format_args(args...)));
} }
}; };

View File

@ -142,6 +142,6 @@ public:
template <typename... Param> template <typename... Param>
void WriteNotice(const char* text, Param&&... p) void WriteNotice(const char* text, Param&&... p)
{ {
WriteNotice(fmt::format(text, std::forward<Param>(p)...)); WriteNotice(fmt::vformat(text, fmt::make_format_args(p...)));
} }
}; };

View File

@ -135,7 +135,7 @@ public:
template <typename... Args> template <typename... Args>
Numeric& push_fmt(const char* text, Args&&... args) Numeric& push_fmt(const char* text, Args&&... args)
{ {
push(fmt::format(text, std::forward<Args>(args)...)); push(fmt::vformat(text, fmt::make_format_args(args...)));
return *this; return *this;
} }

View File

@ -103,7 +103,7 @@ public:
template <typename... Args> template <typename... Args>
void WriteToSnoMask(char letter, const char* text, Args&&... args) void WriteToSnoMask(char letter, const char* text, Args&&... args)
{ {
WriteToSnoMask(letter, fmt::format(text, std::forward<Args>(args)...)); WriteToSnoMask(letter, fmt::vformat(text, fmt::make_format_args(args...)));
} }
/** Write to all users with a given snomask (sent globally) /** Write to all users with a given snomask (sent globally)
@ -120,7 +120,7 @@ public:
template <typename... Args> template <typename... Args>
void WriteGlobalSno(char letter, const char* text, Args&&... args) void WriteGlobalSno(char letter, const char* text, Args&&... args)
{ {
WriteGlobalSno(letter, fmt::format(text, std::forward<Args>(args)...)); WriteGlobalSno(letter, fmt::vformat(text, fmt::make_format_args(args...)));
} }
/** Called once per 5 seconds from the mainloop, this flushes any cached /** Called once per 5 seconds from the mainloop, this flushes any cached

View File

@ -672,7 +672,7 @@ public:
template <typename... Param> template <typename... Param>
void WriteNotice(const char* text, Param&&... p) void WriteNotice(const char* text, Param&&... p)
{ {
WriteNotice(fmt::format(text, std::forward<Param>(p)...)); WriteNotice(fmt::vformat(text, fmt::make_format_args(p...)));
} }
/** Sends a server notice from the local server to the user. /** Sends a server notice from the local server to the user.
@ -687,7 +687,7 @@ public:
template <typename... Param> template <typename... Param>
void WriteRemoteNotice(const char* text, Param&&... p) void WriteRemoteNotice(const char* text, Param&&... p)
{ {
WriteRemoteNotice(fmt::format(text, std::forward<Param>(p)...)); WriteRemoteNotice(fmt::vformat(text, fmt::make_format_args(p...)));
} }
/** Sends a notice to this user. /** Sends a notice to this user.