mirror of
https://gitlab.torproject.org/tpo/core/tor.git
synced 2024-11-24 20:33:31 +01:00
Fix up some windows compilation issues.
These were mostly cases where our previous macros had been casting, and the values that we were trying to printf were not in fact uint64_t.
This commit is contained in:
parent
d5a3bb960d
commit
02a4442524
@ -35,8 +35,8 @@ typedef int pid_t;
|
|||||||
#define PID_T_FORMAT "%d"
|
#define PID_T_FORMAT "%d"
|
||||||
#elif (SIZEOF_PID_T == SIZEOF_LONG)
|
#elif (SIZEOF_PID_T == SIZEOF_LONG)
|
||||||
#define PID_T_FORMAT "%ld"
|
#define PID_T_FORMAT "%ld"
|
||||||
#elif (SIZEOF_PID_T == SIZEOF_INT64_T)
|
#elif (SIZEOF_PID_T == 8)
|
||||||
#define PID_T_FORMAT I64_FORMAT
|
#define PID_T_FORMAT "%"PRId64
|
||||||
#else
|
#else
|
||||||
#error Unknown: SIZEOF_PID_T
|
#error Unknown: SIZEOF_PID_T
|
||||||
#endif /* (0 == SIZEOF_PID_T) && defined(_WIN32) || ... */
|
#endif /* (0 == SIZEOF_PID_T) && defined(_WIN32) || ... */
|
||||||
|
@ -52,14 +52,14 @@ tv_udiff(const struct timeval *start, const struct timeval *end)
|
|||||||
if (start->tv_usec > TOR_USEC_PER_SEC || start->tv_usec < 0) {
|
if (start->tv_usec > TOR_USEC_PER_SEC || start->tv_usec < 0) {
|
||||||
log_warn(LD_GENERAL, "comparing times on microsecond detail with bad "
|
log_warn(LD_GENERAL, "comparing times on microsecond detail with bad "
|
||||||
"start tv_usec: %"PRId64 " microseconds",
|
"start tv_usec: %"PRId64 " microseconds",
|
||||||
(start->tv_usec));
|
(int64_t)start->tv_usec);
|
||||||
return LONG_MAX;
|
return LONG_MAX;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (end->tv_usec > TOR_USEC_PER_SEC || end->tv_usec < 0) {
|
if (end->tv_usec > TOR_USEC_PER_SEC || end->tv_usec < 0) {
|
||||||
log_warn(LD_GENERAL, "comparing times on microsecond detail with bad "
|
log_warn(LD_GENERAL, "comparing times on microsecond detail with bad "
|
||||||
"end tv_usec: %"PRId64 " microseconds",
|
"end tv_usec: %"PRId64 " microseconds",
|
||||||
(end->tv_usec));
|
(int64_t)end->tv_usec);
|
||||||
return LONG_MAX;
|
return LONG_MAX;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -101,14 +101,14 @@ tv_mdiff(const struct timeval *start, const struct timeval *end)
|
|||||||
if (start->tv_usec > TOR_USEC_PER_SEC || start->tv_usec < 0) {
|
if (start->tv_usec > TOR_USEC_PER_SEC || start->tv_usec < 0) {
|
||||||
log_warn(LD_GENERAL, "comparing times on millisecond detail with bad "
|
log_warn(LD_GENERAL, "comparing times on millisecond detail with bad "
|
||||||
"start tv_usec: %"PRId64 " microseconds",
|
"start tv_usec: %"PRId64 " microseconds",
|
||||||
(start->tv_usec));
|
(int64_t)start->tv_usec);
|
||||||
return LONG_MAX;
|
return LONG_MAX;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (end->tv_usec > TOR_USEC_PER_SEC || end->tv_usec < 0) {
|
if (end->tv_usec > TOR_USEC_PER_SEC || end->tv_usec < 0) {
|
||||||
log_warn(LD_GENERAL, "comparing times on millisecond detail with bad "
|
log_warn(LD_GENERAL, "comparing times on millisecond detail with bad "
|
||||||
"end tv_usec: %"PRId64 " microseconds",
|
"end tv_usec: %"PRId64 " microseconds",
|
||||||
(end->tv_usec));
|
(int64_t)end->tv_usec);
|
||||||
return LONG_MAX;
|
return LONG_MAX;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -124,7 +124,7 @@ tv_mdiff(const struct timeval *start, const struct timeval *end)
|
|||||||
if (secdiff > (int64_t)(LONG_MAX/1000 - 2) ||
|
if (secdiff > (int64_t)(LONG_MAX/1000 - 2) ||
|
||||||
secdiff < (int64_t)(LONG_MIN/1000 + 1)) {
|
secdiff < (int64_t)(LONG_MIN/1000 + 1)) {
|
||||||
log_warn(LD_GENERAL, "comparing times on millisecond detail too far "
|
log_warn(LD_GENERAL, "comparing times on millisecond detail too far "
|
||||||
"apart: %"PRId64 " seconds", (secdiff));
|
"apart: %"PRId64 " seconds", (int64_t)secdiff);
|
||||||
return LONG_MAX;
|
return LONG_MAX;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -102,7 +102,7 @@ correct_tm(int islocal, const time_t *timep, struct tm *resultbuf,
|
|||||||
if (err_out) {
|
if (err_out) {
|
||||||
tor_asprintf(err_out, "%s(%"PRId64") failed with error %s: %s",
|
tor_asprintf(err_out, "%s(%"PRId64") failed with error %s: %s",
|
||||||
islocal?"localtime":"gmtime",
|
islocal?"localtime":"gmtime",
|
||||||
timep?(*timep):0,
|
timep?((int64_t)*timep):0,
|
||||||
strerror(errno),
|
strerror(errno),
|
||||||
outcome);
|
outcome);
|
||||||
}
|
}
|
||||||
|
@ -2544,10 +2544,10 @@ channel_dump_statistics, (channel_t *chan, int severity))
|
|||||||
" (%"PRIu64 " seconds ago) "
|
" (%"PRIu64 " seconds ago) "
|
||||||
"and last active at %"PRIu64 " (%"PRIu64 " seconds ago)",
|
"and last active at %"PRIu64 " (%"PRIu64 " seconds ago)",
|
||||||
(chan->global_identifier),
|
(chan->global_identifier),
|
||||||
(chan->timestamp_created),
|
(uint64_t)(chan->timestamp_created),
|
||||||
(now - chan->timestamp_created),
|
(uint64_t)(now - chan->timestamp_created),
|
||||||
(chan->timestamp_active),
|
(uint64_t)(chan->timestamp_active),
|
||||||
(now - chan->timestamp_active));
|
(uint64_t)(now - chan->timestamp_active));
|
||||||
|
|
||||||
/* Handle digest. */
|
/* Handle digest. */
|
||||||
if (!tor_digest_is_zero(chan->identity_digest)) {
|
if (!tor_digest_is_zero(chan->identity_digest)) {
|
||||||
@ -2624,20 +2624,20 @@ channel_dump_statistics, (channel_t *chan, int severity))
|
|||||||
" * Channel %"PRIu64 " was last used by a "
|
" * Channel %"PRIu64 " was last used by a "
|
||||||
"client at %"PRIu64 " (%"PRIu64 " seconds ago)",
|
"client at %"PRIu64 " (%"PRIu64 " seconds ago)",
|
||||||
(chan->global_identifier),
|
(chan->global_identifier),
|
||||||
(chan->timestamp_client),
|
(uint64_t)(chan->timestamp_client),
|
||||||
(now - chan->timestamp_client));
|
(uint64_t)(now - chan->timestamp_client));
|
||||||
tor_log(severity, LD_GENERAL,
|
tor_log(severity, LD_GENERAL,
|
||||||
" * Channel %"PRIu64 " last received a cell "
|
" * Channel %"PRIu64 " last received a cell "
|
||||||
"at %"PRIu64 " (%"PRIu64 " seconds ago)",
|
"at %"PRIu64 " (%"PRIu64 " seconds ago)",
|
||||||
(chan->global_identifier),
|
(chan->global_identifier),
|
||||||
(chan->timestamp_recv),
|
(uint64_t)(chan->timestamp_recv),
|
||||||
(now - chan->timestamp_recv));
|
(uint64_t)(now - chan->timestamp_recv));
|
||||||
tor_log(severity, LD_GENERAL,
|
tor_log(severity, LD_GENERAL,
|
||||||
" * Channel %"PRIu64 " last transmitted a cell "
|
" * Channel %"PRIu64 " last transmitted a cell "
|
||||||
"at %"PRIu64 " (%"PRIu64 " seconds ago)",
|
"at %"PRIu64 " (%"PRIu64 " seconds ago)",
|
||||||
(chan->global_identifier),
|
(chan->global_identifier),
|
||||||
(chan->timestamp_xmit),
|
(uint64_t)(chan->timestamp_xmit),
|
||||||
(now - chan->timestamp_xmit));
|
(uint64_t)(now - chan->timestamp_xmit));
|
||||||
|
|
||||||
/* Describe counters and rates */
|
/* Describe counters and rates */
|
||||||
tor_log(severity, LD_GENERAL,
|
tor_log(severity, LD_GENERAL,
|
||||||
@ -2727,19 +2727,19 @@ channel_listener_dump_statistics(channel_listener_t *chan_l, int severity)
|
|||||||
" (%"PRIu64 " seconds ago) "
|
" (%"PRIu64 " seconds ago) "
|
||||||
"and last active at %"PRIu64 " (%"PRIu64 " seconds ago)",
|
"and last active at %"PRIu64 " (%"PRIu64 " seconds ago)",
|
||||||
(chan_l->global_identifier),
|
(chan_l->global_identifier),
|
||||||
(chan_l->timestamp_created),
|
(uint64_t)(chan_l->timestamp_created),
|
||||||
(now - chan_l->timestamp_created),
|
(uint64_t)(now - chan_l->timestamp_created),
|
||||||
(chan_l->timestamp_active),
|
(uint64_t)(chan_l->timestamp_active),
|
||||||
(now - chan_l->timestamp_active));
|
(uint64_t)(now - chan_l->timestamp_active));
|
||||||
|
|
||||||
tor_log(severity, LD_GENERAL,
|
tor_log(severity, LD_GENERAL,
|
||||||
" * Channel listener %"PRIu64 " last accepted an incoming "
|
" * Channel listener %"PRIu64 " last accepted an incoming "
|
||||||
"channel at %"PRIu64 " (%"PRIu64 " seconds ago) "
|
"channel at %"PRIu64 " (%"PRIu64 " seconds ago) "
|
||||||
"and has accepted %"PRIu64 " channels in total",
|
"and has accepted %"PRIu64 " channels in total",
|
||||||
(chan_l->global_identifier),
|
(chan_l->global_identifier),
|
||||||
(chan_l->timestamp_accepted),
|
(uint64_t)(chan_l->timestamp_accepted),
|
||||||
(now - chan_l->timestamp_accepted),
|
(uint64_t)(now - chan_l->timestamp_accepted),
|
||||||
(chan_l->n_accepted));
|
(uint64_t)(chan_l->n_accepted));
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* If it's sensible to do so, get the rate of incoming channels on this
|
* If it's sensible to do so, get the rate of incoming channels on this
|
||||||
@ -3477,4 +3477,3 @@ channel_update_bad_for_new_circs(const char *digest, int force)
|
|||||||
channel_rsa_id_group_set_badness(&(*iter)->channel_list, force);
|
channel_rsa_id_group_set_badness(&(*iter)->channel_list, force);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2601,10 +2601,10 @@ circuits_handle_oom(size_t current_allocation)
|
|||||||
|
|
||||||
done_recovering_mem:
|
done_recovering_mem:
|
||||||
|
|
||||||
log_notice(LD_GENERAL, "Removed %"PRIu64" bytes by killing %d circuits; "
|
log_notice(LD_GENERAL, "Removed %"TOR_PRIuSZ" bytes by killing %d circuits; "
|
||||||
"%d circuits remain alive. Also killed %d non-linked directory "
|
"%d circuits remain alive. Also killed %d non-linked directory "
|
||||||
"connections.",
|
"connections.",
|
||||||
(mem_recovered),
|
mem_recovered,
|
||||||
n_circuits_killed,
|
n_circuits_killed,
|
||||||
smartlist_len(circlist) - n_circuits_killed,
|
smartlist_len(circlist) - n_circuits_killed,
|
||||||
n_dirconns_killed);
|
n_dirconns_killed);
|
||||||
|
@ -1929,8 +1929,8 @@ directory_send_command(dir_connection_t *conn,
|
|||||||
|
|
||||||
log_debug(LD_DIR,
|
log_debug(LD_DIR,
|
||||||
"Sent request to directory server '%s:%d': "
|
"Sent request to directory server '%s:%d': "
|
||||||
"(purpose: %d, request size: %"PRIu64 ", "
|
"(purpose: %d, request size: %"TOR_PRIuSZ", "
|
||||||
"payload size: %"PRIu64 ")",
|
"payload size: %"TOR_PRIuSZ")",
|
||||||
conn->base_.address, conn->base_.port,
|
conn->base_.address, conn->base_.port,
|
||||||
conn->base_.purpose,
|
conn->base_.purpose,
|
||||||
(total_request_len),
|
(total_request_len),
|
||||||
@ -2420,7 +2420,7 @@ connection_dir_client_reached_eof(dir_connection_t *conn)
|
|||||||
|
|
||||||
tor_log(LOG_DEBUG, LD_DIR,
|
tor_log(LOG_DEBUG, LD_DIR,
|
||||||
"Received response from directory server '%s:%d': %d %s "
|
"Received response from directory server '%s:%d': %d %s "
|
||||||
"(purpose: %d, response size: %"PRIu64
|
"(purpose: %d, response size: %"TOR_PRIuSZ
|
||||||
#ifdef MEASUREMENTS_21206
|
#ifdef MEASUREMENTS_21206
|
||||||
", data cells received: %d, data cells sent: %d"
|
", data cells received: %d, data cells sent: %d"
|
||||||
#endif
|
#endif
|
||||||
@ -5952,4 +5952,3 @@ dir_split_resource_into_spoolable(const char *resource,
|
|||||||
smartlist_free(fingerprints);
|
smartlist_free(fingerprints);
|
||||||
return r;
|
return r;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -5557,7 +5557,7 @@ test_util_max_mem(void *arg)
|
|||||||
tt_int_op(r, OP_EQ, r2);
|
tt_int_op(r, OP_EQ, r2);
|
||||||
tt_uint_op(memory2, OP_EQ, memory1);
|
tt_uint_op(memory2, OP_EQ, memory1);
|
||||||
|
|
||||||
TT_BLATHER(("System memory: %"PRIu64, (memory1)));
|
TT_BLATHER(("System memory: %"TOR_PRIuSZ, (memory1)));
|
||||||
|
|
||||||
if (r==0) {
|
if (r==0) {
|
||||||
/* You have at least a megabyte. */
|
/* You have at least a megabyte. */
|
||||||
|
Loading…
Reference in New Issue
Block a user