]> granicus.if.org Git - transmission/commitdiff
introduce TR_PRIuSIZE macro for portable printf()ing of size_t. mikedld
authorJordan Lee <jordan@transmissionbt.com>
Sun, 8 Sep 2013 17:32:09 +0000 (17:32 +0000)
committerJordan Lee <jordan@transmissionbt.com>
Sun, 8 Sep 2013 17:32:09 +0000 (17:32 +0000)
19 files changed:
libtransmission/announcer-http.c
libtransmission/announcer-udp.c
libtransmission/announcer.c
libtransmission/bandwidth.c
libtransmission/cache.c
libtransmission/handshake.c
libtransmission/peer-io.c
libtransmission/peer-msgs.c
libtransmission/resume.c
libtransmission/rpc-server.c
libtransmission/rpcimpl.c
libtransmission/session.c
libtransmission/torrent.c
libtransmission/tr-utp.c
libtransmission/transmission.h
libtransmission/variant-benc.c
libtransmission/variant-json.c
libtransmission/web.c
utils/edit.c

index 556f3b29aa4f0bc380fc15322b8632504c25ef16..dc3623fb90605298111923a4b08906c8fe09f2bd 100644 (file)
@@ -262,18 +262,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 %zu", len);
+                dbgmsg (data->log_name, "got a peers6 length of %"TR_PRIuSIZE, 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 %zu", len);
+                dbgmsg (data->log_name, "got a compact peers length of %"TR_PRIuSIZE, 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 %zu entries",
+                dbgmsg (data->log_name, "got a peers list with %"TR_PRIuSIZE" entries",
                         response->pex_count);
             }
         }
index b5bfea66a8f4d0b4dfa15ca74ebca62b5d79dda7..2b16b3bcbed037d20e1f28dcda68b79e552d57ef 100644 (file)
@@ -690,7 +690,7 @@ tau_tracker_upkeep (struct tau_tracker * tracker)
         return;
     }
 
-    dbgmsg (tracker->key, "addr %p -- connected %d (%zu %zu) -- connecting_at %zu",
+    dbgmsg (tracker->key, "addr %p -- connected %d (%"TR_PRIuSIZE" %"TR_PRIuSIZE") -- connecting_at %"TR_PRIuSIZE,
             tracker->addr,
           (int)(tracker->connection_expiration_time > now), (size_t)tracker->connection_expiration_time, (size_t)now,
           (size_t)tracker->connecting_at);
@@ -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 %zu\n", msglen);*/
+    /*fprintf (stderr, "got an incoming udp message w/len %"TR_PRIuSIZE"\n", msglen);*/
 
     if (!session || !session->announcer_udp)
         return false;
index af04d356524c8542f107e3589087d59255c1e17e..4d4bbb3aba8910f12c6fd154148bd83b228ca9ff 100644 (file)
@@ -1035,8 +1035,8 @@ on_announce_done (const tr_announce_response  * response,
                       "interval:%d "
                       "min_interval:%d "
                       "tracker_id_str:%s "
-                      "pex:%zu "
-                      "pex6:%zu "
+                      "pex:%"TR_PRIuSIZE" "
+                      "pex6:%"TR_PRIuSIZE" "
                       "err:%s "
                       "warn:%s",
                     (int)response->did_connect,
@@ -1287,8 +1287,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 %zu seconds.", (size_t)interval);
-    tr_logAddTorInfo (tier->tor, "Retrying scrape in %zu seconds.", (size_t)interval);
+    dbgmsg (tier, "Retrying scrape in %"TR_PRIuSIZE" seconds.", (size_t)interval);
+    tr_logAddTorInfo (tier->tor, "Retrying scrape in %"TR_PRIuSIZE" seconds.", (size_t)interval);
     tier->lastScrapeSucceeded = false;
     tier->scrapeAt = get_next_scrape_time (session, tier, interval);
 }
index 42a238273c5e2c7d949a2e958e589832a8051300..8939916b0a0edde01ba71ef7d2c1e0c9a4651c84 100644 (file)
@@ -395,7 +395,7 @@ tr_bandwidthUsed (tr_bandwidth  * b,
 
 #ifdef DEBUG_DIRECTION
 if ((dir == DEBUG_DIRECTION) && (band->isLimited))
-fprintf (stderr, "%p consumed %5zu bytes of %5s data... was %6zu, now %6zu left\n",
+fprintf (stderr, "%p consumed %5"TR_PRIuSIZE" bytes of %5s data... was %6"TR_PRIuSIZE", now %6"TR_PRIuSIZE" left\n",
          b, byteCount, (isPieceData?"piece":"raw"), oldBytesLeft, band->bytesLeft);
 #endif
 
index e80ca5daba3b82b34b30e15377d6645ef08efd94..ceaee7c2dc6087efb4aa3faeeae314aacedbd94f 100644 (file)
@@ -96,7 +96,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 %zu time %zu\n", i, b->tor->uniqueId, (size_t)b->block, (size_t)b->time);
+      //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, "run is %d long from [%d to %d)\n", (int)(i-pos), i, (int)pos);
@@ -441,7 +441,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 [%zu...%zu]", (int)i, (size_t)first, (size_t)last);
+  dbgmsg ("flushing file %d from cache to disk: blocks [%"TR_PRIuSIZE"...%"TR_PRIuSIZE"]", (int)i, (size_t)first, (size_t)last);
 
   /* flush out all the blocks in that file */
   while (!err && (pos < tr_ptrArraySize (&cache->blocks)))
index 24f7f02fd5bf5222ed38c3485f6236c8948cfc3b..e919c0e33c3d28ad59d359ba2b333dd5a8b052e9 100644 (file)
@@ -254,7 +254,7 @@ parseHandshake (tr_handshake *    handshake,
   tr_torrent * tor;
   uint8_t peer_id[PEER_ID_LEN];
 
-  dbgmsg (handshake, "payload: need %d, got %zu",
+  dbgmsg (handshake, "payload: need %d, got %"TR_PRIuSIZE,
           HANDSHAKE_SIZE, evbuffer_get_length (inbuf));
 
   if (evbuffer_get_length (inbuf) < HANDSHAKE_SIZE)
@@ -565,7 +565,7 @@ readPadD (tr_handshake    * handshake,
 {
   const size_t needlen = handshake->pad_d_len;
 
-  dbgmsg (handshake, "pad d: need %zu, got %zu",
+  dbgmsg (handshake, "pad d: need %"TR_PRIuSIZE", got %"TR_PRIuSIZE,
           needlen, evbuffer_get_length (inbuf));
   if (evbuffer_get_length (inbuf) < needlen)
     return READ_LATER;
@@ -593,7 +593,7 @@ readHandshake (tr_handshake    * handshake,
   uint8_t reserved[HANDSHAKE_FLAGS_LEN];
   uint8_t hash[SHA_DIGEST_LENGTH];
 
-  dbgmsg (handshake, "payload: need %d, got %zu",
+  dbgmsg (handshake, "payload: need %d, got %"TR_PRIuSIZE,
           INCOMING_HANDSHAKE_LEN, evbuffer_get_length (inbuf));
 
   if (evbuffer_get_length (inbuf) < INCOMING_HANDSHAKE_LEN)
@@ -734,7 +734,7 @@ readYa (tr_handshake    * handshake,
   const uint8_t * secret;
   int len;
 
-  dbgmsg (handshake, "in readYa... need %d, have %zu",
+  dbgmsg (handshake, "in readYa... need %d, have %"TR_PRIuSIZE,
           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 %zu, need %zu",
+  dbgmsg (handshake, "reading IA... have %"TR_PRIuSIZE", need %"TR_PRIuSIZE,
           evbuffer_get_length (inbuf), needlen);
   if (evbuffer_get_length (inbuf) < needlen)
     return READ_LATER;
@@ -961,7 +961,7 @@ readPayloadStream (tr_handshake    * handshake,
   int i;
   const size_t needlen = HANDSHAKE_SIZE;
 
-  dbgmsg (handshake, "reading payload stream... have %zu, need %zu",
+  dbgmsg (handshake, "reading payload stream... have %"TR_PRIuSIZE", need %"TR_PRIuSIZE,
           evbuffer_get_length (inbuf), needlen);
   if (evbuffer_get_length (inbuf) < needlen)
     return READ_LATER;
index 06d9bad052892f9b96587002848fa39d89053aad..2cb7ca8031b1628d0e82c0fd231582dcc21845b3 100644 (file)
@@ -416,7 +416,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 %zu bytes", buflen);
+    dbgmsg (io, "utp_on_read got %"TR_PRIuSIZE" bytes", buflen);
 
     if (rc < 0) {
         tr_logAddNamedError ("UTP", "On read evbuffer_add");
@@ -435,7 +435,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 %zu bytes... evbuffer_remove returned %d", buflen, rc);
+    dbgmsg (io, "utp_on_write sending %"TR_PRIuSIZE" 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);
@@ -453,7 +453,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 %zu bytes", bytes);
+    dbgmsg (io, "utp_get_rb_size is saying it's ready to read %"TR_PRIuSIZE" bytes", bytes);
     return UTP_READ_BUFFER_SIZE - bytes;
 }
 
@@ -514,7 +514,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 %zu", count);
+    dbgmsg (io, "utp_on_overhead -- count is %"TR_PRIuSIZE, count);
 
     tr_bandwidthUsed (&io->bandwidth, send ? TR_UP : TR_DOWN,
                       count, false, tr_time_msec ());
@@ -1269,7 +1269,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 %zu", howmuch);
+    dbgmsg (io, "in tr_peerIoTryWrite %"TR_PRIuSIZE, howmuch);
 
     if (howmuch > old_len)
         howmuch = old_len;
@@ -1322,7 +1322,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 %zu, bytesUsed %d", (int)dir, limit, bytesUsed);
+    dbgmsg (io, "flushing peer-io, direction %d, limit %"TR_PRIuSIZE", bytesUsed %d", (int)dir, limit, bytesUsed);
     return bytesUsed;
 }
 
index a774d01b20a4b519db83f4cae9af633e74e03aea..998965d46337ce018aacb5d3eab8a10734fd9e1d 100644 (file)
@@ -333,7 +333,7 @@ pokeBatchPeriod (tr_peerMsgs * msgs, int interval)
 static void
 dbgOutMessageLen (tr_peerMsgs * msgs)
 {
-  dbgmsg (msgs, "outMessage size is now %zu", evbuffer_get_length (msgs->outMessages));
+  dbgmsg (msgs, "outMessage size is now %"TR_PRIuSIZE, evbuffer_get_length (msgs->outMessages));
 }
 
 static void
@@ -903,7 +903,7 @@ void
 tr_peerMsgsCancel (tr_peerMsgs * msgs, tr_block_index_t block)
 {
     struct peer_request req;
-/*fprintf (stderr, "SENDING CANCEL MESSAGE FOR BLOCK %zu\n\t\tFROM PEER %p ------------------------------------\n", (size_t)block, msgs->peer);*/
+/*fprintf (stderr, "SENDING CANCEL MESSAGE FOR BLOCK %"TR_PRIuSIZE"\n\t\tFROM PEER %p ------------------------------------\n", (size_t)block, msgs->peer);*/
     blockToReq (msgs->torrent, block, &req);
     protocolSendCancel (msgs, &req);
 }
@@ -1291,7 +1291,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 %zu", id, (size_t)msgs->incoming.length);
+    dbgmsg (msgs, "msgs->incoming.id is now %d; msgs->incoming.length is %"TR_PRIuSIZE, id, (size_t)msgs->incoming.length);
 
     if (id == BT_PIECE)
     {
@@ -1454,7 +1454,7 @@ readBtPiece (tr_peerMsgs      * msgs,
 
         fireClientGotPieceData (msgs, n);
         *setme_piece_bytes_read += n;
-        dbgmsg (msgs, "got %zu bytes for block %u:%u->%u ... %d remain",
+        dbgmsg (msgs, "got %"TR_PRIuSIZE" 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)
@@ -1486,7 +1486,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 %zu", (int)id, (int)msglen, inlen);
+    dbgmsg (msgs, "got BT id %d, len %d, buffer size is %"TR_PRIuSIZE, (int)id, (int)msglen, inlen);
 
     if (inlen < msglen)
         return READ_LATER;
@@ -1747,7 +1747,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 %zu, msgs->state is %d", inlen, msgs->state);
+    dbgmsg (msgs, "canRead: inlen is %"TR_PRIuSIZE", msgs->state is %d", inlen, msgs->state);
 
     if (!inlen)
     {
@@ -1915,14 +1915,14 @@ fillOutputBuffer (tr_peerMsgs * msgs, time_t now)
 
     if (haveMessages && !msgs->outMessagesBatchedAt) /* fresh batch */
     {
-        dbgmsg (msgs, "started an outMessages batch (length is %zu)", evbuffer_get_length (msgs->outMessages));
+        dbgmsg (msgs, "started an outMessages batch (length is %"TR_PRIuSIZE")", 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 %zu)", msgs->io, len);
+        dbgmsg (msgs, "flushing outMessages... to %p (length is %"TR_PRIuSIZE")", msgs->io, len);
         tr_peerIoWriteBuf (msgs->io, msgs->outMessages, false);
         msgs->clientSentAnythingAt = now;
         msgs->outMessagesBatchedAt = 0;
@@ -2029,7 +2029,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 #%zu is corrupt."), (size_t)req.index);
+                    tr_torrentSetLocalError (msgs->torrent, _("Please Verify Local Data! Piece #%"TR_PRIuSIZE" is corrupt."), (size_t)req.index);
 
             if (err)
             {
@@ -2130,7 +2130,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 %zu", evbuffer_get_length (out));
+    dbgmsg (msgs, "sending bitfield... outMessage size is now %"TR_PRIuSIZE, evbuffer_get_length (out));
     pokeBatchPeriod (msgs, IMMEDIATE_PRIORITY_INTERVAL_SECS);
 
     tr_free (bytes);
@@ -2425,7 +2425,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 %zu", evbuffer_get_length (out));
+            dbgmsg (msgs, "sending a pex message; outMessage size is now %"TR_PRIuSIZE, evbuffer_get_length (out));
             dbgOutMessageLen (msgs);
 
             evbuffer_free (payload);
index de3aef22d60e77ce5c2cecd0aeeabae68081541f..473a9ee936ee69bc05e49788bd6d41eca2696901 100644 (file)
@@ -164,7 +164,7 @@ loadDND (tr_variant * dict, tr_torrent * tor)
     }
   else
     {
-      tr_logAddTorDbg (tor, "Couldn't load DND flags. DND list (%p) has %zu children; torrent has %d files",
+      tr_logAddTorDbg (tor, "Couldn't load DND flags. DND list (%p) has %"TR_PRIuSIZE" children; torrent has %d files",
                        list, tr_variantListSize (list), (int)n);
     }
 
index 9df5ddd1edb6f21ac78ed4dd6920e1f68b0fff5c..57c6ed976d03c18c6548a123d0095d2331fed789 100644 (file)
@@ -387,7 +387,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==%zu bytes; compressed==%zu)\n",
+          fprintf (stderr, "compressed response is %.2f of original (raw==%"TR_PRIuSIZE" bytes; compressed==%"TR_PRIuSIZE")\n",
                    (double)evbuffer_get_length (out)/content_len,
                    content_len, evbuffer_get_length (out));
 #endif
index 61824089e0b390ed92092c2d33cc18eaa5e0f76f..10d3c78fe6222d57e7c9012d0a8f8bc93c8959ac 100644 (file)
@@ -1633,7 +1633,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 %zu bytes",
+  dbgmsg ("torrentAdd: HTTP response code was %ld (%s); response length was %"TR_PRIuSIZE" bytes",
           response_code, tr_webGetResponseStr (response_code), response_byte_count);
 
   if (response_code==200 || response_code==221) /* http or ftp success.. */
index 0e47097bacee0534a60212d687349bd4b77beb39..d079d12cdeb96ce237dfe9f904130670e547b37a 100644 (file)
@@ -676,7 +676,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 %zu sec, %zu microsec\n", (size_t)tr_time (), (size_t)tv.tv_usec); */
+  /* fprintf (stderr, "time %"TR_PRIuSIZE" sec, %"TR_PRIuSIZE" microsec\n", (size_t)tr_time (), (size_t)tv.tv_usec); */
 }
 
 static void loadBlocklists (tr_session * session);
@@ -1868,7 +1868,7 @@ tr_sessionClose (tr_session * session)
 
   assert (tr_isSession (session));
 
-  dbgmsg ("shutting down transmission session %p... now is %zu, deadline is %zu", session, (size_t)time (NULL), (size_t)deadline);
+  dbgmsg ("shutting down transmission session %p... now is %"TR_PRIuSIZE", deadline is %"TR_PRIuSIZE, session, (size_t)time (NULL), (size_t)deadline);
 
   /* close the session */
   tr_runInEventThread (session, sessionCloseImpl, session);
@@ -1885,7 +1885,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 %zu deadline %zu",
+      dbgmsg ("waiting on port unmap (%p) or announcer (%p)... now %"TR_PRIuSIZE" deadline %"TR_PRIuSIZE,
               session->shared, session->announcer, (size_t)time (NULL), (size_t)deadline);
       tr_wait_msec (50);
     }
@@ -1897,7 +1897,7 @@ tr_sessionClose (tr_session * session)
   while (session->events != NULL)
     {
       static bool forced = false;
-      dbgmsg ("waiting for libtransmission thread to finish... now %zu deadline %zu", (size_t)time (NULL), (size_t)deadline);
+      dbgmsg ("waiting for libtransmission thread to finish... now %"TR_PRIuSIZE" deadline %"TR_PRIuSIZE, (size_t)time (NULL), (size_t)deadline);
       tr_wait_msec (100);
 
       if (deadlineReached (deadline) && !forced)
index ab92da161938675375489e84591e70cf577c42a6..3abf6a926b8a155ec050fef50c78dbd7d7eb45d7 100644 (file)
@@ -562,9 +562,9 @@ onTrackerResponse (tr_torrent * tor, const tr_tracker_event * event, void * unus
           const bool allAreSeeds = seedProbability == 100;
 
           if (allAreSeeds)
-            tr_logAddTorDbg (tor, "Got %zu seeds from tracker", event->pexCount);
+            tr_logAddTorDbg (tor, "Got %"TR_PRIuSIZE" seeds from tracker", event->pexCount);
           else
-            tr_logAddTorDbg (tor, "Got %zu peers from tracker", event->pexCount);
+            tr_logAddTorDbg (tor, "Got %"TR_PRIuSIZE" peers from tracker", event->pexCount);
 
           for (i = 0; i < event->pexCount; ++i)
             tr_peerMgrAddPex (tor, TR_PEER_FROM_TRACKER, &event->pex[i], seedProbability);
@@ -2572,7 +2572,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 %zu, pass==%d", (size_t)pieceIndex, (int)pass);
+  tr_deeplog_tor (tor, "[LAZY] tr_torrentCheckPiece tested piece %"TR_PRIuSIZE", pass==%d", (size_t)pieceIndex, (int)pass);
   tr_torrentSetHasPiece (tor, pieceIndex, pass);
   tr_torrentSetPieceChecked (tor, pieceIndex);
   tor->anyDate = tr_time ();
@@ -3240,7 +3240,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 %zu", (size_t)p);
+          tr_logAddTorDbg (tor, "[LAZY] checking just-completed piece %"TR_PRIuSIZE, (size_t)p);
 
           if (tr_torrentCheckPiece (tor, p))
             {
index c03ce74bf2666b74d2c39e6b198c4cd2c86e50c7..1c072735066947f0bc7311157f5822a0a8ccaa99 100644 (file)
@@ -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, %zu) was called.", socket, count);
-    dbgmsg ("UTP_RBDrained (%p, %zu) was called.", socket, count);
+    tr_logAddNamedError (MY_NAME, "UTP_RBDrained (%p, %"TR_PRIuSIZE") was called.", socket, count);
+    dbgmsg ("UTP_RBDrained (%p, %"TR_PRIuSIZE") was called.", socket, count);
     assert (0); /* FIXME: this is too much for the long term, but probably needed in the short term */
     return false;
 }
index 1e805d1729c6f874ec18780afe087fdabe83ff69..76dabdd2b5869fd0d9a86c9f2ee7a8cc6474011f 100644 (file)
@@ -83,6 +83,14 @@ extern "C" {
  #endif
 #endif
 
+#ifndef TR_PRIuSIZE
+ #ifdef _MSC_VER
+  #define TR_PRIuSIZE "Iu"
+ #else
+  #define TR_PRIuSIZE "zu"
+ #endif
+#endif
+
 #if defined (WIN32) && defined (_MSC_VER)
  #define inline __inline
 #endif
index 45d039e170505791aa6958e89d7a1a935cc10aad..5048c5af0a8a529c7da17861fd447604ec7729b6 100644 (file)
@@ -297,7 +297,7 @@ saveStringFunc (const tr_variant * v, void * evbuf)
   size_t len;
   const char * str;
   tr_variantGetStr (v, &str, &len);
-  evbuffer_add_printf (evbuf, "%zu:", len);
+  evbuffer_add_printf (evbuf, "%"TR_PRIuSIZE":", len);
   evbuffer_add (evbuf, str, len);
 }
 
index 66a5d36294fdf216da31075fbf1150af17bcab28..a4810ed44848deb6da096254f1b10e402a9bc293 100644 (file)
@@ -91,7 +91,7 @@ error_handler (jsonsl_t                  jsn,
 
   if (data->source)
     {
-      tr_logAddError ("JSON parse failed in %s at pos %zu: %s -- remaining text \"%.16s\"",
+      tr_logAddError ("JSON parse failed in %s at pos %"TR_PRIuSIZE": %s -- remaining text \"%.16s\"",
               data->source,
               jsn->pos,
               jsonsl_strerror (error),
@@ -99,7 +99,7 @@ error_handler (jsonsl_t                  jsn,
     }
   else
     {
-      tr_logAddError ("JSON parse failed at pos %zu: %s -- remaining text \"%.16s\"",
+      tr_logAddError ("JSON parse failed at pos %"TR_PRIuSIZE": %s -- remaining text \"%.16s\"",
               jsn->pos,
               jsonsl_strerror (error),
               buf);
index 5d8ecab8ae48c89835d9c8c0e9ad50839517281e..a51bbd899bd6961984bd0d4c30a259bde7109832 100644 (file)
@@ -133,7 +133,7 @@ writeFunc (void * ptr, size_t size, size_t nmemb, void * vtask)
     }
 
   evbuffer_add (task->response, ptr, byteCount);
-  dbgmsg ("wrote %zu bytes to task %p's buffer", byteCount, task);
+  dbgmsg ("wrote %"TR_PRIuSIZE" bytes to task %p's buffer", byteCount, task);
   return byteCount;
 }
 
index ce29ae58413a32e9e57f4c9be2b44535bb7babc9..5bbda072352e3d4cf056e1007bb2a29ecedb1be0 100644 (file)
@@ -279,7 +279,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 %zu\n", url, tr_variantListSize (announce_list));
+          printf ("\tAdded \"%s\" to \"announce-list\" tier %"TR_PRIuSIZE"\n", url, tr_variantListSize (announce_list));
           changed = true;
         }
     }