0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2024-07-06 10:38:37 +02:00

ircd::net: No user input so use standard ::snprintf() here.

This commit is contained in:
Jason Volk 2017-10-17 00:48:10 -07:00
parent 3c0d5bd5d6
commit 8fc336a1e9

View file

@ -534,7 +534,9 @@ std::string
ircd::net::string(const ip::tcp::endpoint &ep) ircd::net::string(const ip::tcp::endpoint &ep)
{ {
std::string ret(256, char{}); std::string ret(256, char{});
ret.resize(fmt::sprintf(mutable_buffer{ret}, "%s:%u", string(address(ep)), port(ep))); const auto addr{string(address(ep))};
const auto data{const_cast<char *>(ret.data())};
ret.resize(snprintf(data, ret.size(), "%s:%u", addr.c_str(), port(ep)));
return ret; return ret;
} }
@ -712,7 +714,7 @@ ircd::net::socket::disconnect(const dc &type)
if(sd.is_open()) if(sd.is_open())
log::debug("socket(%p): disconnect: %s type: %d", log::debug("socket(%p): disconnect: %s type: %d",
this, (const void *)this,
string(remote()), string(remote()),
uint(type)); uint(type));