Remove useless checks and definitions (C99)
Now that MSVC support for C99 is quite good, remove previously needed but now unused checks and definitions, like PRI* format macros (including PRIdMAX and TR_PRIuSIZE, replaced with %jd and %zu) and inline macro. Also, remove ssize_t typedef and replace few occurences with ev_ssize_t. Also, remove check for stdbool.h availability (guaranteed by C99) and include it unconditionally (except when in C++ mode).
This commit is contained in:
parent
eee92c82ac
commit
eb8fc35ac6
|
@ -453,7 +453,6 @@ endif()
|
|||
include(LargeFileSupport)
|
||||
|
||||
set(NEEDED_HEADERS
|
||||
stdbool.h
|
||||
sys/statvfs.h
|
||||
xfs/xfs.h
|
||||
xlocale.h)
|
||||
|
|
|
@ -106,7 +106,7 @@ fi
|
|||
AC_HEADER_STDC
|
||||
AC_HEADER_TIME
|
||||
|
||||
AC_CHECK_HEADERS([stdbool.h xlocale.h])
|
||||
AC_CHECK_HEADERS([xlocale.h])
|
||||
AC_CHECK_FUNCS([iconv_open pread pwrite lrintf strlcpy daemon dirname basename canonicalize_file_name strcasecmp localtime_r fallocate64 posix_fallocate memmem strsep strtold syslog valloc getpagesize posix_memalign statvfs htonll ntohll mkdtemp uselocale _configthreadlocale])
|
||||
AC_PROG_INSTALL
|
||||
AC_PROG_MAKE_SET
|
||||
|
|
|
@ -258,18 +258,18 @@ on_announce_done (tr_session * session,
|
|||
response->downloads = i;
|
||||
|
||||
if (tr_variantDictFindRaw (&benc, TR_KEY_peers6, &raw, &len)) {
|
||||
dbgmsg (data->log_name, "got a peers6 length of %"TR_PRIuSIZE, len);
|
||||
dbgmsg (data->log_name, "got a peers6 length of %zu", len);
|
||||
response->pex6 = tr_peerMgrCompact6ToPex (raw, len,
|
||||
NULL, 0, &response->pex6_count);
|
||||
}
|
||||
|
||||
if (tr_variantDictFindRaw (&benc, TR_KEY_peers, &raw, &len)) {
|
||||
dbgmsg (data->log_name, "got a compact peers length of %"TR_PRIuSIZE, len);
|
||||
dbgmsg (data->log_name, "got a compact peers length of %zu", len);
|
||||
response->pex = tr_peerMgrCompactToPex (raw, len,
|
||||
NULL, 0, &response->pex_count);
|
||||
} else if (tr_variantDictFindList (&benc, TR_KEY_peers, &tmp)) {
|
||||
response->pex = listToPex (tmp, &response->pex_count);
|
||||
dbgmsg (data->log_name, "got a peers list with %"TR_PRIuSIZE" entries",
|
||||
dbgmsg (data->log_name, "got a peers list with %zu entries",
|
||||
response->pex_count);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -688,7 +688,7 @@ tau_tracker_upkeep (struct tau_tracker * tracker)
|
|||
return;
|
||||
}
|
||||
|
||||
dbgmsg (tracker->key, "addr %p -- connected %d (%"TR_PRIuSIZE" %"TR_PRIuSIZE") -- connecting_at %"TR_PRIuSIZE,
|
||||
dbgmsg (tracker->key, "addr %p -- connected %d (%zu %zu) -- connecting_at %zu",
|
||||
(void*)tracker->addr,
|
||||
(int)(tracker->connection_expiration_time > now),
|
||||
(size_t)tracker->connection_expiration_time,
|
||||
|
@ -871,7 +871,7 @@ tau_handle_message (tr_session * session, const uint8_t * msg, size_t msglen)
|
|||
tau_transaction_t transaction_id;
|
||||
struct evbuffer * buf;
|
||||
|
||||
/*fprintf (stderr, "got an incoming udp message w/len %"TR_PRIuSIZE"\n", msglen);*/
|
||||
/*fprintf (stderr, "got an incoming udp message w/len %zu\n", msglen);*/
|
||||
|
||||
if (!session || !session->announcer_udp)
|
||||
return false;
|
||||
|
|
|
@ -1032,8 +1032,8 @@ on_announce_done (const tr_announce_response * response,
|
|||
"interval:%d "
|
||||
"min_interval:%d "
|
||||
"tracker_id_str:%s "
|
||||
"pex:%"TR_PRIuSIZE" "
|
||||
"pex6:%"TR_PRIuSIZE" "
|
||||
"pex:%zu "
|
||||
"pex6:%zu "
|
||||
"err:%s "
|
||||
"warn:%s",
|
||||
(int)response->did_connect,
|
||||
|
@ -1284,8 +1284,8 @@ on_scrape_error (tr_session * session, tr_tier * tier, const char * errmsg)
|
|||
|
||||
/* schedule a rescrape */
|
||||
interval = getRetryInterval (tier->currentTracker);
|
||||
dbgmsg (tier, "Retrying scrape in %"TR_PRIuSIZE" seconds.", (size_t)interval);
|
||||
tr_logAddTorInfo (tier->tor, "Retrying scrape in %"TR_PRIuSIZE" seconds.", (size_t)interval);
|
||||
dbgmsg (tier, "Retrying scrape in %zu seconds.", (size_t)interval);
|
||||
tr_logAddTorInfo (tier->tor, "Retrying scrape in %zu seconds.", (size_t)interval);
|
||||
tier->lastScrapeSucceeded = false;
|
||||
tier->scrapeAt = get_next_scrape_time (session, tier, interval);
|
||||
}
|
||||
|
|
|
@ -393,7 +393,7 @@ tr_bandwidthUsed (tr_bandwidth * b,
|
|||
|
||||
#ifdef DEBUG_DIRECTION
|
||||
if ((dir == DEBUG_DIRECTION) && (band->isLimited))
|
||||
fprintf (stderr, "%p consumed %5"TR_PRIuSIZE" bytes of %5s data... was %6"TR_PRIuSIZE", now %6"TR_PRIuSIZE" left\n",
|
||||
fprintf (stderr, "%p consumed %5zu bytes of %5s data... was %6zu, now %6zu left\n",
|
||||
b, byteCount, (isPieceData?"piece":"raw"), oldBytesLeft, band->bytesLeft);
|
||||
#endif
|
||||
|
||||
|
|
|
@ -97,7 +97,7 @@ blocklistLoad (tr_blocklistFile * b)
|
|||
b->ruleCount = byteCount / sizeof (struct tr_ipv4_range);
|
||||
|
||||
base = tr_sys_path_basename (b->filename, NULL);
|
||||
tr_logAddInfo (_("Blocklist \"%s\" contains %"TR_PRIuSIZE" entries"), base, b->ruleCount);
|
||||
tr_logAddInfo (_("Blocklist \"%s\" contains %zu entries"), base, b->ruleCount);
|
||||
tr_free (base);
|
||||
}
|
||||
|
||||
|
@ -405,7 +405,7 @@ tr_blocklistFileSetContent (tr_blocklistFile * b, const char * filename)
|
|||
else
|
||||
{
|
||||
char * base = tr_sys_path_basename (b->filename, NULL);
|
||||
tr_logAddInfo (_("Blocklist \"%s\" updated with %"TR_PRIuSIZE" entries"), base, ranges_count);
|
||||
tr_logAddInfo (_("Blocklist \"%s\" updated with %zu entries"), base, ranges_count);
|
||||
tr_free (base);
|
||||
}
|
||||
|
||||
|
|
|
@ -93,7 +93,7 @@ getBlockRun (const tr_cache * cache, int pos, struct run_info * info)
|
|||
break;
|
||||
if (b->tor != ref->tor)
|
||||
break;
|
||||
//fprintf (stderr, "pos %d tor %d block %"TR_PRIuSIZE" time %"TR_PRIuSIZE"\n", i, b->tor->uniqueId, (size_t)b->block, (size_t)b->time);
|
||||
//fprintf (stderr, "pos %d tor %d block %zu time %zu\n", i, b->tor->uniqueId, (size_t)b->block, (size_t)b->time);
|
||||
}
|
||||
|
||||
//fprintf (stderr, "run is %d long from [%d to %d)\n", (int)(i-pos), i, (int)pos);
|
||||
|
@ -438,7 +438,7 @@ tr_cacheFlushFile (tr_cache * cache, tr_torrent * torrent, tr_file_index_t i)
|
|||
|
||||
tr_torGetFileBlockRange (torrent, i, &first, &last);
|
||||
pos = findBlockPos (cache, torrent, first);
|
||||
dbgmsg ("flushing file %d from cache to disk: blocks [%"TR_PRIuSIZE"...%"TR_PRIuSIZE"]", (int)i, (size_t)first, (size_t)last);
|
||||
dbgmsg ("flushing file %d from cache to disk: blocks [%zu...%zu]", (int)i, (size_t)first, (size_t)last);
|
||||
|
||||
/* flush out all the blocks in that file */
|
||||
while (!err && (pos < tr_ptrArraySize (&cache->blocks)))
|
||||
|
|
|
@ -250,7 +250,7 @@ parseHandshake (tr_handshake * handshake,
|
|||
tr_torrent * tor;
|
||||
uint8_t peer_id[PEER_ID_LEN];
|
||||
|
||||
dbgmsg (handshake, "payload: need %d, got %"TR_PRIuSIZE,
|
||||
dbgmsg (handshake, "payload: need %d, got %zu",
|
||||
HANDSHAKE_SIZE, evbuffer_get_length (inbuf));
|
||||
|
||||
if (evbuffer_get_length (inbuf) < HANDSHAKE_SIZE)
|
||||
|
@ -567,7 +567,7 @@ readPadD (tr_handshake * handshake,
|
|||
{
|
||||
const size_t needlen = handshake->pad_d_len;
|
||||
|
||||
dbgmsg (handshake, "pad d: need %"TR_PRIuSIZE", got %"TR_PRIuSIZE,
|
||||
dbgmsg (handshake, "pad d: need %zu, got %zu",
|
||||
needlen, evbuffer_get_length (inbuf));
|
||||
if (evbuffer_get_length (inbuf) < needlen)
|
||||
return READ_LATER;
|
||||
|
@ -595,7 +595,7 @@ readHandshake (tr_handshake * handshake,
|
|||
uint8_t reserved[HANDSHAKE_FLAGS_LEN];
|
||||
uint8_t hash[SHA_DIGEST_LENGTH];
|
||||
|
||||
dbgmsg (handshake, "payload: need %d, got %"TR_PRIuSIZE,
|
||||
dbgmsg (handshake, "payload: need %d, got %zu",
|
||||
INCOMING_HANDSHAKE_LEN, evbuffer_get_length (inbuf));
|
||||
|
||||
if (evbuffer_get_length (inbuf) < INCOMING_HANDSHAKE_LEN)
|
||||
|
@ -735,7 +735,7 @@ readYa (tr_handshake * handshake,
|
|||
const uint8_t * myKey;
|
||||
int len;
|
||||
|
||||
dbgmsg (handshake, "in readYa... need %d, have %"TR_PRIuSIZE,
|
||||
dbgmsg (handshake, "in readYa... need %d, have %zu",
|
||||
KEY_LEN, evbuffer_get_length (inbuf));
|
||||
if (evbuffer_get_length (inbuf) < KEY_LEN)
|
||||
return READ_LATER;
|
||||
|
@ -884,7 +884,7 @@ readIA (tr_handshake * handshake,
|
|||
struct evbuffer * outbuf;
|
||||
uint32_t crypto_select;
|
||||
|
||||
dbgmsg (handshake, "reading IA... have %"TR_PRIuSIZE", need %"TR_PRIuSIZE,
|
||||
dbgmsg (handshake, "reading IA... have %zu, need %zu",
|
||||
evbuffer_get_length (inbuf), needlen);
|
||||
if (evbuffer_get_length (inbuf) < needlen)
|
||||
return READ_LATER;
|
||||
|
@ -961,7 +961,7 @@ readPayloadStream (tr_handshake * handshake,
|
|||
handshake_parse_err_t i;
|
||||
const size_t needlen = HANDSHAKE_SIZE;
|
||||
|
||||
dbgmsg (handshake, "reading payload stream... have %"TR_PRIuSIZE", need %"TR_PRIuSIZE,
|
||||
dbgmsg (handshake, "reading payload stream... have %zu, need %zu",
|
||||
evbuffer_get_length (inbuf), needlen);
|
||||
if (evbuffer_get_length (inbuf) < needlen)
|
||||
return READ_LATER;
|
||||
|
|
|
@ -411,7 +411,7 @@ utp_on_read (void *closure, const unsigned char *buf, size_t buflen)
|
|||
assert (tr_isPeerIo (io));
|
||||
|
||||
rc = evbuffer_add (io->inbuf, buf, buflen);
|
||||
dbgmsg (io, "utp_on_read got %"TR_PRIuSIZE" bytes", buflen);
|
||||
dbgmsg (io, "utp_on_read got %zu bytes", buflen);
|
||||
|
||||
if (rc < 0) {
|
||||
tr_logAddNamedError ("UTP", "On read evbuffer_add");
|
||||
|
@ -430,7 +430,7 @@ utp_on_write (void *closure, unsigned char *buf, size_t buflen)
|
|||
assert (tr_isPeerIo (io));
|
||||
|
||||
rc = evbuffer_remove (io->outbuf, buf, buflen);
|
||||
dbgmsg (io, "utp_on_write sending %"TR_PRIuSIZE" bytes... evbuffer_remove returned %d", buflen, rc);
|
||||
dbgmsg (io, "utp_on_write sending %zu bytes... evbuffer_remove returned %d", buflen, rc);
|
||||
assert (rc == (int)buflen); /* if this fails, we've corrupted our bookkeeping somewhere */
|
||||
if (rc < (long)buflen) {
|
||||
tr_logAddNamedError ("UTP", "Short write: %d < %ld", rc, (long)buflen);
|
||||
|
@ -448,7 +448,7 @@ utp_get_rb_size (void *closure)
|
|||
|
||||
bytes = tr_bandwidthClamp (&io->bandwidth, TR_DOWN, UTP_READ_BUFFER_SIZE);
|
||||
|
||||
dbgmsg (io, "utp_get_rb_size is saying it's ready to read %"TR_PRIuSIZE" bytes", bytes);
|
||||
dbgmsg (io, "utp_get_rb_size is saying it's ready to read %zu bytes", bytes);
|
||||
return UTP_READ_BUFFER_SIZE - bytes;
|
||||
}
|
||||
|
||||
|
@ -509,7 +509,7 @@ utp_on_overhead (void *closure, uint8_t send, size_t count, int type UNUSED)
|
|||
tr_peerIo *io = closure;
|
||||
assert (tr_isPeerIo (io));
|
||||
|
||||
dbgmsg (io, "utp_on_overhead -- count is %"TR_PRIuSIZE, count);
|
||||
dbgmsg (io, "utp_on_overhead -- count is %zu", count);
|
||||
|
||||
tr_bandwidthUsed (&io->bandwidth, send ? TR_UP : TR_DOWN,
|
||||
count, false, tr_time_msec ());
|
||||
|
@ -1287,7 +1287,7 @@ tr_peerIoTryWrite (tr_peerIo * io, size_t howmuch)
|
|||
{
|
||||
int n = 0;
|
||||
const size_t old_len = evbuffer_get_length (io->outbuf);
|
||||
dbgmsg (io, "in tr_peerIoTryWrite %"TR_PRIuSIZE, howmuch);
|
||||
dbgmsg (io, "in tr_peerIoTryWrite %zu", howmuch);
|
||||
|
||||
if (howmuch > old_len)
|
||||
howmuch = old_len;
|
||||
|
@ -1340,7 +1340,7 @@ tr_peerIoFlush (tr_peerIo * io, tr_direction dir, size_t limit)
|
|||
else
|
||||
bytesUsed = tr_peerIoTryWrite (io, limit);
|
||||
|
||||
dbgmsg (io, "flushing peer-io, direction %d, limit %"TR_PRIuSIZE", bytesUsed %d", (int)dir, limit, bytesUsed);
|
||||
dbgmsg (io, "flushing peer-io, direction %d, limit %zu, bytesUsed %d", (int)dir, limit, bytesUsed);
|
||||
return bytesUsed;
|
||||
}
|
||||
|
||||
|
|
|
@ -2902,7 +2902,7 @@ rechokeDownloads (tr_swarm * s)
|
|||
const double mult = MIN (timeSinceCancel, maxHistory) / (double) maxHistory;
|
||||
const int inc = maxIncrease * mult;
|
||||
maxPeers = s->maxPeers + inc;
|
||||
tordbg (s, "time since last cancel is %"PRIdMAX" -- increasing the "
|
||||
tordbg (s, "time since last cancel is %jd -- increasing the "
|
||||
"number of peers we're interested in by %d",
|
||||
(intmax_t)timeSinceCancel, inc);
|
||||
}
|
||||
|
|
|
@ -334,7 +334,7 @@ pokeBatchPeriod (tr_peerMsgs * msgs, int interval)
|
|||
static void
|
||||
dbgOutMessageLen (tr_peerMsgs * msgs)
|
||||
{
|
||||
dbgmsg (msgs, "outMessage size is now %"TR_PRIuSIZE, evbuffer_get_length (msgs->outMessages));
|
||||
dbgmsg (msgs, "outMessage size is now %zu", evbuffer_get_length (msgs->outMessages));
|
||||
}
|
||||
|
||||
static void
|
||||
|
@ -906,7 +906,7 @@ void
|
|||
tr_peerMsgsCancel (tr_peerMsgs * msgs, tr_block_index_t block)
|
||||
{
|
||||
struct peer_request req;
|
||||
/*fprintf (stderr, "SENDING CANCEL MESSAGE FOR BLOCK %"TR_PRIuSIZE"\n\t\tFROM PEER %p ------------------------------------\n", (size_t)block, msgs->peer);*/
|
||||
/*fprintf (stderr, "SENDING CANCEL MESSAGE FOR BLOCK %zu\n\t\tFROM PEER %p ------------------------------------\n", (size_t)block, msgs->peer);*/
|
||||
blockToReq (msgs->torrent, block, &req);
|
||||
protocolSendCancel (msgs, &req);
|
||||
}
|
||||
|
@ -1300,7 +1300,7 @@ readBtId (tr_peerMsgs * msgs, struct evbuffer * inbuf, size_t inlen)
|
|||
|
||||
tr_peerIoReadUint8 (msgs->io, inbuf, &id);
|
||||
msgs->incoming.id = id;
|
||||
dbgmsg (msgs, "msgs->incoming.id is now %d; msgs->incoming.length is %"TR_PRIuSIZE, id, (size_t)msgs->incoming.length);
|
||||
dbgmsg (msgs, "msgs->incoming.id is now %d; msgs->incoming.length is %zu", id, (size_t)msgs->incoming.length);
|
||||
|
||||
if (id == BT_PIECE)
|
||||
{
|
||||
|
@ -1463,7 +1463,7 @@ readBtPiece (tr_peerMsgs * msgs,
|
|||
|
||||
fireClientGotPieceData (msgs, n);
|
||||
*setme_piece_bytes_read += n;
|
||||
dbgmsg (msgs, "got %"TR_PRIuSIZE" bytes for block %u:%u->%u ... %d remain",
|
||||
dbgmsg (msgs, "got %zu bytes for block %u:%u->%u ... %d remain",
|
||||
n, req->index, req->offset, req->length,
|
||||
(int)(req->length - evbuffer_get_length (block_buffer)));
|
||||
if (evbuffer_get_length (block_buffer) < req->length)
|
||||
|
@ -1497,7 +1497,7 @@ readBtMessage (tr_peerMsgs * msgs, struct evbuffer * inbuf, size_t inlen)
|
|||
|
||||
--msglen; /* id length */
|
||||
|
||||
dbgmsg (msgs, "got BT id %d, len %d, buffer size is %"TR_PRIuSIZE, (int)id, (int)msglen, inlen);
|
||||
dbgmsg (msgs, "got BT id %d, len %d, buffer size is %zu", (int)id, (int)msglen, inlen);
|
||||
|
||||
if (inlen < msglen)
|
||||
return READ_LATER;
|
||||
|
@ -1764,7 +1764,7 @@ canRead (tr_peerIo * io, void * vmsgs, size_t * piece)
|
|||
struct evbuffer * in = tr_peerIoGetReadBuffer (io);
|
||||
const size_t inlen = evbuffer_get_length (in);
|
||||
|
||||
dbgmsg (msgs, "canRead: inlen is %"TR_PRIuSIZE", msgs->state is %d", inlen, msgs->state);
|
||||
dbgmsg (msgs, "canRead: inlen is %zu, msgs->state is %d", inlen, msgs->state);
|
||||
|
||||
if (!inlen)
|
||||
{
|
||||
|
@ -1932,14 +1932,14 @@ fillOutputBuffer (tr_peerMsgs * msgs, time_t now)
|
|||
|
||||
if (haveMessages && !msgs->outMessagesBatchedAt) /* fresh batch */
|
||||
{
|
||||
dbgmsg (msgs, "started an outMessages batch (length is %"TR_PRIuSIZE")", evbuffer_get_length (msgs->outMessages));
|
||||
dbgmsg (msgs, "started an outMessages batch (length is %zu)", evbuffer_get_length (msgs->outMessages));
|
||||
msgs->outMessagesBatchedAt = now;
|
||||
}
|
||||
else if (haveMessages && ((now - msgs->outMessagesBatchedAt) >= msgs->outMessagesBatchPeriod))
|
||||
{
|
||||
const size_t len = evbuffer_get_length (msgs->outMessages);
|
||||
/* flush the protocol messages */
|
||||
dbgmsg (msgs, "flushing outMessages... to %p (length is %"TR_PRIuSIZE")", (void*)msgs->io, len);
|
||||
dbgmsg (msgs, "flushing outMessages... to %p (length is %zu)", (void*)msgs->io, len);
|
||||
tr_peerIoWriteBuf (msgs->io, msgs->outMessages, false);
|
||||
msgs->clientSentAnythingAt = now;
|
||||
msgs->outMessagesBatchedAt = 0;
|
||||
|
@ -2046,7 +2046,7 @@ fillOutputBuffer (tr_peerMsgs * msgs, time_t now)
|
|||
/* check the piece if it needs checking... */
|
||||
if (!err && tr_torrentPieceNeedsCheck (msgs->torrent, req.index))
|
||||
if ((err = !tr_torrentCheckPiece (msgs->torrent, req.index)))
|
||||
tr_torrentSetLocalError (msgs->torrent, _("Please Verify Local Data! Piece #%"TR_PRIuSIZE" is corrupt."), (size_t)req.index);
|
||||
tr_torrentSetLocalError (msgs->torrent, _("Please Verify Local Data! Piece #%zu is corrupt."), (size_t)req.index);
|
||||
|
||||
if (err)
|
||||
{
|
||||
|
@ -2147,7 +2147,7 @@ sendBitfield (tr_peerMsgs * msgs)
|
|||
evbuffer_add_uint32 (out, sizeof (uint8_t) + byte_count);
|
||||
evbuffer_add_uint8 (out, BT_BITFIELD);
|
||||
evbuffer_add (out, bytes, byte_count);
|
||||
dbgmsg (msgs, "sending bitfield... outMessage size is now %"TR_PRIuSIZE, evbuffer_get_length (out));
|
||||
dbgmsg (msgs, "sending bitfield... outMessage size is now %zu", evbuffer_get_length (out));
|
||||
pokeBatchPeriod (msgs, IMMEDIATE_PRIORITY_INTERVAL_SECS);
|
||||
|
||||
tr_free (bytes);
|
||||
|
@ -2442,7 +2442,7 @@ sendPex (tr_peerMsgs * msgs)
|
|||
evbuffer_add_uint8 (out, msgs->ut_pex_id);
|
||||
evbuffer_add_buffer (out, payload);
|
||||
pokeBatchPeriod (msgs, HIGH_PRIORITY_INTERVAL_SECS);
|
||||
dbgmsg (msgs, "sending a pex message; outMessage size is now %"TR_PRIuSIZE, evbuffer_get_length (out));
|
||||
dbgmsg (msgs, "sending a pex message; outMessage size is now %zu", evbuffer_get_length (out));
|
||||
dbgOutMessageLen (msgs);
|
||||
|
||||
evbuffer_free (payload);
|
||||
|
|
|
@ -163,7 +163,7 @@ loadDND (tr_variant * dict, tr_torrent * tor)
|
|||
}
|
||||
else
|
||||
{
|
||||
tr_logAddTorDbg (tor, "Couldn't load DND flags. DND list (%p) has %"TR_PRIuSIZE" children; torrent has %d files",
|
||||
tr_logAddTorDbg (tor, "Couldn't load DND flags. DND list (%p) has %zu"" children; torrent has %d files",
|
||||
(void*)list, tr_variantListSize (list), (int)n);
|
||||
}
|
||||
|
||||
|
|
|
@ -370,7 +370,7 @@ add_response (struct evhttp_request * req,
|
|||
iovec[0].iov_len -= server->stream.avail_out;
|
||||
|
||||
#if 0
|
||||
fprintf (stderr, "compressed response is %.2f of original (raw==%"TR_PRIuSIZE" bytes; compressed==%"TR_PRIuSIZE")\n",
|
||||
fprintf (stderr, "compressed response is %.2f of original (raw==%zu bytes; compressed==%zu)\n",
|
||||
(double)evbuffer_get_length (out)/content_len,
|
||||
content_len, evbuffer_get_length (out));
|
||||
#endif
|
||||
|
|
|
@ -1649,7 +1649,7 @@ gotMetadataFromURL (tr_session * session UNUSED,
|
|||
{
|
||||
struct add_torrent_idle_data * data = user_data;
|
||||
|
||||
dbgmsg ("torrentAdd: HTTP response code was %ld (%s); response length was %"TR_PRIuSIZE" bytes",
|
||||
dbgmsg ("torrentAdd: HTTP response code was %ld (%s); response length was %zu bytes",
|
||||
response_code, tr_webGetResponseStr (response_code), response_byte_count);
|
||||
|
||||
if (response_code==200 || response_code==221) /* http or ftp success.. */
|
||||
|
|
|
@ -675,7 +675,7 @@ onNowTimer (evutil_socket_t foo UNUSED, short bar UNUSED, void * vsession)
|
|||
if (usec < min)
|
||||
usec = min;
|
||||
tr_timerAdd (session->nowTimer, 0, usec);
|
||||
/* fprintf (stderr, "time %"TR_PRIuSIZE" sec, %"TR_PRIuSIZE" microsec\n", (size_t)tr_time (), (size_t)tv.tv_usec); */
|
||||
/* fprintf (stderr, "time %zu sec, %zu microsec\n", (size_t)tr_time (), (size_t)tv.tv_usec); */
|
||||
}
|
||||
|
||||
static void loadBlocklists (tr_session * session);
|
||||
|
@ -1869,7 +1869,7 @@ tr_sessionClose (tr_session * session)
|
|||
|
||||
assert (tr_isSession (session));
|
||||
|
||||
dbgmsg ("shutting down transmission session %p... now is %"TR_PRIuSIZE", deadline is %"TR_PRIuSIZE, (void*)session, (size_t)time (NULL), (size_t)deadline);
|
||||
dbgmsg ("shutting down transmission session %p... now is %zu, deadline is %zu", (void*)session, (size_t)time (NULL), (size_t)deadline);
|
||||
|
||||
/* close the session */
|
||||
tr_runInEventThread (session, sessionCloseImpl, session);
|
||||
|
@ -1886,7 +1886,7 @@ tr_sessionClose (tr_session * session)
|
|||
while ((session->shared || session->web || session->announcer || session->announcer_udp)
|
||||
&& !deadlineReached (deadline))
|
||||
{
|
||||
dbgmsg ("waiting on port unmap (%p) or announcer (%p)... now %"TR_PRIuSIZE" deadline %"TR_PRIuSIZE,
|
||||
dbgmsg ("waiting on port unmap (%p) or announcer (%p)... now %zu deadline %zu",
|
||||
(void*)session->shared, (void*)session->announcer, (size_t)time (NULL), (size_t)deadline);
|
||||
tr_wait_msec (50);
|
||||
}
|
||||
|
@ -1898,7 +1898,7 @@ tr_sessionClose (tr_session * session)
|
|||
while (session->events != NULL)
|
||||
{
|
||||
static bool forced = false;
|
||||
dbgmsg ("waiting for libtransmission thread to finish... now %"TR_PRIuSIZE" deadline %"TR_PRIuSIZE, (size_t)time (NULL), (size_t)deadline);
|
||||
dbgmsg ("waiting for libtransmission thread to finish... now %zu deadline %zu", (size_t)time (NULL), (size_t)deadline);
|
||||
tr_wait_msec (100);
|
||||
|
||||
if (deadlineReached (deadline) && !forced)
|
||||
|
|
|
@ -560,9 +560,9 @@ onTrackerResponse (tr_torrent * tor, const tr_tracker_event * event, void * unus
|
|||
const bool allAreSeeds = seedProbability == 100;
|
||||
|
||||
if (allAreSeeds)
|
||||
tr_logAddTorDbg (tor, "Got %"TR_PRIuSIZE" seeds from tracker", event->pexCount);
|
||||
tr_logAddTorDbg (tor, "Got %zu seeds from tracker", event->pexCount);
|
||||
else
|
||||
tr_logAddTorDbg (tor, "Got %"TR_PRIuSIZE" peers from tracker", event->pexCount);
|
||||
tr_logAddTorDbg (tor, "Got %zu peers from tracker", event->pexCount);
|
||||
|
||||
for (i = 0; i < event->pexCount; ++i)
|
||||
tr_peerMgrAddPex (tor, TR_PEER_FROM_TRACKER, &event->pex[i], seedProbability);
|
||||
|
@ -2636,7 +2636,7 @@ tr_torrentCheckPiece (tr_torrent * tor, tr_piece_index_t pieceIndex)
|
|||
{
|
||||
const bool pass = tr_ioTestPiece (tor, pieceIndex);
|
||||
|
||||
tr_deeplog_tor (tor, "[LAZY] tr_torrentCheckPiece tested piece %"TR_PRIuSIZE", pass==%d", (size_t)pieceIndex, (int)pass);
|
||||
tr_deeplog_tor (tor, "[LAZY] tr_torrentCheckPiece tested piece %zu, pass==%d", (size_t)pieceIndex, (int)pass);
|
||||
tr_torrentSetHasPiece (tor, pieceIndex, pass);
|
||||
tr_torrentSetPieceChecked (tor, pieceIndex);
|
||||
tor->anyDate = tr_time ();
|
||||
|
@ -3315,7 +3315,7 @@ tr_torrentGotBlock (tr_torrent * tor, tr_block_index_t block)
|
|||
p = tr_torBlockPiece (tor, block);
|
||||
if (tr_torrentPieceIsComplete (tor, p))
|
||||
{
|
||||
tr_logAddTorDbg (tor, "[LAZY] checking just-completed piece %"TR_PRIuSIZE, (size_t)p);
|
||||
tr_logAddTorDbg (tor, "[LAZY] checking just-completed piece %zu", (size_t)p);
|
||||
|
||||
if (tr_torrentCheckPiece (tor, p))
|
||||
{
|
||||
|
|
|
@ -65,8 +65,8 @@ UTP_RBDrained (struct UTPSocket *socket)
|
|||
bool
|
||||
UTP_Write (struct UTPSocket *socket, size_t count)
|
||||
{
|
||||
tr_logAddNamedError (MY_NAME, "UTP_RBDrained (%p, %"TR_PRIuSIZE") was called.", socket, count);
|
||||
dbgmsg ("UTP_RBDrained (%p, %"TR_PRIuSIZE") was called.", socket, count);
|
||||
tr_logAddNamedError (MY_NAME, "UTP_RBDrained (%p, %zu) was called.", socket, count);
|
||||
dbgmsg ("UTP_RBDrained (%p, %zu) was called.", socket, count);
|
||||
assert (0); /* FIXME: this is too much for the long term, but probably needed in the short term */
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -29,62 +29,8 @@ extern "C" {
|
|||
#include <inttypes.h> /* uintN_t */
|
||||
#include <time.h> /* time_t */
|
||||
|
||||
#ifdef _MSC_VER
|
||||
typedef intptr_t ssize_t;
|
||||
#endif
|
||||
|
||||
#if !defined (__cplusplus)
|
||||
#ifdef HAVE_STDBOOL_H
|
||||
#include <stdbool.h>
|
||||
#elif !defined (__bool_true_false_are_defined)
|
||||
#define bool uint8_t
|
||||
#define true 1
|
||||
#define false 0
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef PRId64
|
||||
#ifdef _WIN32
|
||||
#define PRId64 "I64"
|
||||
#else
|
||||
#define PRId64 "lld"
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef PRIu64
|
||||
#ifdef _WIN32
|
||||
#define PRIu64 "I64u"
|
||||
#else
|
||||
#define PRIu64 "llu"
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef PRIu32
|
||||
#ifdef _WIN32
|
||||
#define PRIu32 "u"
|
||||
#else
|
||||
#define PRIu32 "lu"
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef PRIdMAX
|
||||
#ifdef _WIN32
|
||||
#define PRIdMAX "I64"
|
||||
#else
|
||||
#define PRIdMAX "jd"
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#ifndef TR_PRIuSIZE
|
||||
#ifdef _WIN32
|
||||
#define TR_PRIuSIZE "Iu"
|
||||
#else
|
||||
#define TR_PRIuSIZE "zu"
|
||||
#endif
|
||||
#endif
|
||||
|
||||
#if defined (_MSC_VER) && !defined (__cplusplus)
|
||||
#define inline __inline
|
||||
#ifndef __cplusplus
|
||||
#include <stdbool.h>
|
||||
#endif
|
||||
|
||||
#define SHA_DIGEST_LENGTH 20
|
||||
|
|
|
@ -190,8 +190,8 @@ readFromPipe (evutil_socket_t fd,
|
|||
{
|
||||
struct tr_run_data data;
|
||||
const size_t nwant = sizeof (data);
|
||||
const ssize_t ngot = piperead (fd, &data, nwant);
|
||||
if (!eh->die && (ngot == (ssize_t)nwant))
|
||||
const ev_ssize_t ngot = piperead (fd, &data, nwant);
|
||||
if (!eh->die && (ngot == (ev_ssize_t) nwant))
|
||||
{
|
||||
dbgmsg ("invoking function in libevent thread");
|
||||
(data.func)(data.user_data);
|
||||
|
@ -324,8 +324,8 @@ tr_runInEventThread (tr_session * session,
|
|||
{
|
||||
tr_pipe_end_t fd;
|
||||
char ch;
|
||||
ssize_t res_1;
|
||||
ssize_t res_2;
|
||||
ev_ssize_t res_1;
|
||||
ev_ssize_t res_2;
|
||||
tr_event_handle * e = session->events;
|
||||
struct tr_run_data data;
|
||||
|
||||
|
|
|
@ -304,7 +304,7 @@ saveStringFunc (const tr_variant * v, void * evbuf)
|
|||
size_t len;
|
||||
const char * str;
|
||||
tr_variantGetStr (v, &str, &len);
|
||||
evbuffer_add_printf (evbuf, "%"TR_PRIuSIZE":", len);
|
||||
evbuffer_add_printf (evbuf, "%zu:", len);
|
||||
evbuffer_add (evbuf, str, len);
|
||||
}
|
||||
|
||||
|
|
|
@ -88,7 +88,7 @@ error_handler (jsonsl_t jsn,
|
|||
|
||||
if (data->source)
|
||||
{
|
||||
tr_logAddError ("JSON parse failed in %s at pos %"TR_PRIuSIZE": %s -- remaining text \"%.16s\"",
|
||||
tr_logAddError ("JSON parse failed in %s at pos %zu: %s -- remaining text \"%.16s\"",
|
||||
data->source,
|
||||
jsn->pos,
|
||||
jsonsl_strerror (error),
|
||||
|
@ -96,7 +96,7 @@ error_handler (jsonsl_t jsn,
|
|||
}
|
||||
else
|
||||
{
|
||||
tr_logAddError ("JSON parse failed at pos %"TR_PRIuSIZE": %s -- remaining text \"%.16s\"",
|
||||
tr_logAddError ("JSON parse failed at pos %zu: %s -- remaining text \"%.16s\"",
|
||||
jsn->pos,
|
||||
jsonsl_strerror (error),
|
||||
buf);
|
||||
|
|
|
@ -100,7 +100,7 @@ testStr (void)
|
|||
size_t len;
|
||||
|
||||
/* string len is designed to overflow */
|
||||
n = tr_snprintf ((char*)buf, sizeof (buf), "%"TR_PRIuSIZE":boat", (size_t)(SIZE_MAX-2));
|
||||
n = tr_snprintf ((char*)buf, sizeof (buf), "%zu:boat", (size_t)(SIZE_MAX-2));
|
||||
err = tr_bencParseStr (buf, buf+n, &end, &str, &len);
|
||||
check_int_eq (EILSEQ, err);
|
||||
check_int_eq (0, len);
|
||||
|
|
|
@ -130,7 +130,7 @@ writeFunc (void * ptr, size_t size, size_t nmemb, void * vtask)
|
|||
}
|
||||
|
||||
evbuffer_add (task->response, ptr, byteCount);
|
||||
dbgmsg ("wrote %"TR_PRIuSIZE" bytes to task %p's buffer", byteCount, (void*)task);
|
||||
dbgmsg ("wrote %zu bytes to task %p's buffer", byteCount, (void*)task);
|
||||
return byteCount;
|
||||
}
|
||||
|
||||
|
|
|
@ -277,7 +277,7 @@ addURL (tr_variant * metainfo, const char * url)
|
|||
{
|
||||
tr_variant * tier = tr_variantListAddList (announce_list, 1);
|
||||
tr_variantListAddStr (tier, url);
|
||||
printf ("\tAdded \"%s\" to \"announce-list\" tier %"TR_PRIuSIZE"\n", url, tr_variantListSize (announce_list));
|
||||
printf ("\tAdded \"%s\" to \"announce-list\" tier %zu\n", url, tr_variantListSize (announce_list));
|
||||
changed = true;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue