Clarify printf argument flags

This commit is contained in:
ntfs.hard
2022-10-22 14:03:43 +03:00
committed by Arvid Norberg
parent b21cf127d8
commit a58400b3fb
8 changed files with 9 additions and 9 deletions

View File

@ -484,7 +484,7 @@ struct peer_conn
unsigned int length = read_uint32(ptr);
if (length > sizeof(buffer))
{
std::fprintf(stderr, "len: %d\n", length);
std::fprintf(stderr, "len: %u\n", length);
close("ERROR RECEIVE MESSAGE PREFIX: packet too big", error_code());
return;
}

View File

@ -347,7 +347,7 @@ void setup_swarm(int num_nodes
#if DEBUG_SWARM != 0
"[%d] "
#endif
"%4d.%03d: %-25s %s\n"
"%4u.%03u: %-25s %s\n"
#if DEBUG_SWARM != 0
, i
#endif

View File

@ -134,7 +134,7 @@ TORRENT_TEST(optimistic_unchoke)
lt::time_duration d = lt::clock_type::now() - start_time;
std::uint32_t const millis = std::uint32_t(
lt::duration_cast<lt::milliseconds>(d).count());
printf("\x1b[35m%4d.%03d: [%d] %s (%d ms)\x1b[0m\n"
printf("\x1b[35m%4u.%03u: [%d] %s (%d ms)\x1b[0m\n"
, millis / 1000, millis % 1000, i, msg_str[msg]
, int(lt::duration_cast<lt::milliseconds>(cs.unchoke_duration).count()));
}

View File

@ -255,7 +255,7 @@ void test_udp_tracker(std::uint32_t const flags, socks_flags_t const sflags)
}
else
{
std::printf("unsupported udp tracker action: %d\n", action);
std::printf("unsupported udp tracker action: %u\n", action);
}
return ret;
});

View File

@ -951,7 +951,7 @@ TORRENT_TEST(pex)
lt::duration_cast<lt::milliseconds>(d).count());
if (i == 0) {
std::printf("%4d.%03d: %-25s %s\n"
std::printf("%4u.%03u: %-25s %s\n"
, millis / 1000, millis % 1000
, a->what()
, a->message().c_str());

View File

@ -354,7 +354,7 @@ void on_alert_notify(lt::session* ses)
lt::time_duration d = a->timestamp().time_since_epoch();
std::uint32_t const millis = std::uint32_t(
lt::duration_cast<lt::milliseconds>(d).count());
std::printf("%4d.%03d: %s\n", millis / 1000, millis % 1000,
std::printf("%4u.%03u: %s\n", millis / 1000, millis % 1000,
a->message().c_str());
}
});
@ -514,7 +514,7 @@ void test_udpv6_support(char const* listen_interfaces
lt::time_duration d = a->timestamp().time_since_epoch();
std::uint32_t const millis = std::uint32_t(
lt::duration_cast<lt::milliseconds>(d).count());
std::printf("%4d.%03d: %s\n", millis / 1000, millis % 1000,
std::printf("%4u.%03u: %s\n", millis / 1000, millis % 1000,
a->message().c_str());
if (auto tr = alert_cast<tracker_announce_alert>(a))
{

View File

@ -63,7 +63,7 @@ void print_alerts(lt::session* ses, lt::time_point start_time)
#endif
lt::time_duration d = a->timestamp() - start_time;
std::uint32_t millis = std::uint32_t(lt::duration_cast<lt::milliseconds>(d).count());
std::printf("%4d.%03d: %-25s %s\n", millis / 1000, millis % 1000
std::printf("%4u.%03u: %-25s %s\n", millis / 1000, millis % 1000
, a->what()
, a->message().c_str());
}

View File

@ -160,7 +160,7 @@ struct udp_tracker
std::printf("%s: UDP scrape (ignored)\n", time_now_string().c_str());
break;
default:
std::printf("%s: UDP unknown message: %d\n", time_now_string().c_str()
std::printf("%s: UDP unknown message: %u\n", time_now_string().c_str()
, action);
break;
}