Skip to content

Commit

Permalink
fix namespace qualification of snprintf
Browse files Browse the repository at this point in the history
  • Loading branch information
arvidn committed Jul 4, 2016
1 parent 1df1d60 commit c19b35e
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion src/http_proxy.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -193,7 +193,7 @@ namespace sim
if (err)
{
char port_str[10];
snprintf(port_str, sizeof(port_str), "%d", port);
std::snprintf(port_str, sizeof(port_str), "%d", port);
asio::ip::tcp::resolver::query q(host, port_str);
m_resolver.async_resolve(q
, std::bind(&http_proxy::on_domain_lookup, this, _1, _2));
Expand Down
2 changes: 1 addition & 1 deletion src/http_server.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ namespace sim
, int len, char const** extra_header)
{
char msg[600];
int pkt_len = snprintf(msg, sizeof(msg), "HTTP/1.1 %d %s\r\n"
int pkt_len = std::snprintf(msg, sizeof(msg), "HTTP/1.1 %d %s\r\n"
"content-length: %d\r\n"
"%s"
"%s"
Expand Down
8 changes: 4 additions & 4 deletions src/queue.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -44,23 +44,23 @@ namespace sim
std::string queue::label() const
{
char ret[400];
int p = snprintf(ret, sizeof(ret), "%s\n", m_node_name.c_str());
int p = std::snprintf(ret, sizeof(ret), "%s\n", m_node_name.c_str());

if (m_bandwidth != 0)
{
p += snprintf(ret + p, sizeof(ret) - p, "rate: %d kB/s\n"
p += std::snprintf(ret + p, sizeof(ret) - p, "rate: %d kB/s\n"
, m_bandwidth / 1000);
}

if (m_queue_size != 0)
{
p += snprintf(ret + p, sizeof(ret) - p, "queue: %d kB\n"
p += std::snprintf(ret + p, sizeof(ret) - p, "queue: %d kB\n"
, m_queue_size / 1000);
}

if (m_forwarding_latency.count() != 0)
{
p += snprintf(ret + p, sizeof(ret) - p, "latency: %d ms\n"
p += std::snprintf(ret + p, sizeof(ret) - p, "latency: %d ms\n"
, int(chrono::duration_cast<chrono::milliseconds>(m_forwarding_latency).count()));
}

Expand Down
2 changes: 1 addition & 1 deletion src/socks_server.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -376,7 +376,7 @@ namespace sim
, command(), hostname.c_str(), port);

char port_str[10];
snprintf(port_str, sizeof(port_str), "%d", port);
std::snprintf(port_str, sizeof(port_str), "%d", port);
asio::ip::tcp::resolver::query q(hostname, port_str);
m_resolver.async_resolve(q
, std::bind(&socks_connection::on_request_domain_lookup
Expand Down

0 comments on commit c19b35e

Please sign in to comment.