use C99 string formatting macros for platform independence
This commit is contained in:
parent
6e39f24dcf
commit
53f890608d
|
@ -1262,7 +1262,7 @@ int main(int argc, char* argv[])
|
|||
if (s.num_incomplete >= 0) downloaders = s.num_incomplete;
|
||||
else downloaders = s.list_peers - s.list_seeds;
|
||||
|
||||
snprintf(str, sizeof(str), "%-13s download: (%s%s%s) upload: %s%s%s (%s%s%s) swarm: %4d:%4d"
|
||||
snprintf(str, sizeof(str), "%-13s down: (%s%s%s) up: %s%s%s (%s%s%s) swarm: %4d:%4d"
|
||||
" bw queue: (%d|%d) all-time (Rx: %s%s%s Tx: %s%s%s) seed rank: %x%s\n"
|
||||
, (paused && !auto_managed)?"paused":(paused && auto_managed)?"queued":state_str[s.state]
|
||||
, esc("32"), add_suffix(s.total_download).c_str(), term
|
||||
|
@ -1291,7 +1291,7 @@ int main(int argc, char* argv[])
|
|||
progress_bar_color = "32"; // green
|
||||
}
|
||||
|
||||
snprintf(str, sizeof(str), " %-10s: %s%-10lld%s Bytes %6.2f%% %s\n"
|
||||
snprintf(str, sizeof(str), " %-10s: %s%-10"PRId64"%s Bytes %6.2f%% %s\n"
|
||||
, sequential_download?"sequential":"progress"
|
||||
, esc("32"), s.total_done, esc("0")
|
||||
, s.progress*100.f
|
||||
|
@ -1344,7 +1344,7 @@ int main(int argc, char* argv[])
|
|||
out += str;
|
||||
|
||||
snprintf(str, sizeof(str), "==== waste: %s fail: %s unchoked: %d / %d "
|
||||
"bw queues: %8d (%d) | %8d (%d) cache: w: %lld%% r: %lld%% size: %s (%s) / %s ===\n"
|
||||
"bw queues: %8d (%d) | %8d (%d) cache: w: %"PRId64"%% r: %lld%% size: %s (%s) / %s ===\n"
|
||||
, add_suffix(sess_stat.total_redundant_bytes).c_str()
|
||||
, add_suffix(sess_stat.total_failed_bytes).c_str()
|
||||
, sess_stat.num_unchoked, sess_stat.allowed_upload_slots
|
||||
|
@ -1365,7 +1365,7 @@ int main(int argc, char* argv[])
|
|||
|
||||
if (show_dht_status)
|
||||
{
|
||||
snprintf(str, sizeof(str), "DHT nodes: %d DHT cached nodes: %d total DHT size: %lld\n"
|
||||
snprintf(str, sizeof(str), "DHT nodes: %d DHT cached nodes: %d total DHT size: %"PRId64"\n"
|
||||
, sess_stat.dht_nodes, sess_stat.dht_node_cache, sess_stat.dht_global_nodes);
|
||||
out += str;
|
||||
|
||||
|
|
|
@ -36,6 +36,19 @@ POSSIBILITY OF SUCH DAMAGE.
|
|||
#include <boost/config.hpp>
|
||||
#include <boost/version.hpp>
|
||||
|
||||
#ifndef WIN32
|
||||
#define __STDC_FORMAT_MACROS
|
||||
#include <inttypes.h>
|
||||
#endif
|
||||
|
||||
#ifndef PRId64
|
||||
#ifdef _WIN32
|
||||
#define PRId64 "I64d"
|
||||
#else
|
||||
#define PRId64 "lld"
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined(__GNUC__) && __GNUC__ >= 4
|
||||
|
||||
#define TORRENT_DEPRECATED __attribute__ ((deprecated))
|
||||
|
|
|
@ -381,7 +381,7 @@ namespace libtorrent
|
|||
case lazy_entry::int_t:
|
||||
{
|
||||
char str[100];
|
||||
snprintf(str, sizeof(str), "%lld", e.int_value());
|
||||
snprintf(str, sizeof(str), "%"PRId64, e.int_value());
|
||||
return str;
|
||||
}
|
||||
case lazy_entry::string_t:
|
||||
|
|
Loading…
Reference in New Issue