Core/NetPlayServer: Use fmt::format_to_n in GetInterfaceHost()

Lets us avoid some noisy deprecation warnings on macOS (and also lets us use
a more generic formatting specifier).
This commit is contained in:
Lioncache 2023-12-18 10:16:10 -05:00
parent 2b877fc92b
commit 9abcc1c08b
1 changed files with 3 additions and 2 deletions

View File

@ -2294,8 +2294,9 @@ std::unordered_set<std::string> NetPlayServer::GetInterfaceSet() const
// called from ---GUI--- thread // called from ---GUI--- thread
std::string NetPlayServer::GetInterfaceHost(const std::string& inter) const std::string NetPlayServer::GetInterfaceHost(const std::string& inter) const
{ {
char buf[16]; char buf[16]{};
sprintf(buf, ":%d", GetPort()); fmt::format_to_n(buf, sizeof(buf) - 1, ":{}", GetPort());
auto lst = GetInterfaceListInternal(); auto lst = GetInterfaceListInternal();
for (const auto& list_entry : lst) for (const auto& list_entry : lst)
{ {