Changeset 14190


Ignore:
Timestamp:
Sep 8, 2013, 5:32:09 PM (8 years ago)
Author:
jordan
Message:

introduce TR_PRIuSIZE macro for portable printf()ing of size_t. mikedld

Location:
trunk
Files:
19 edited

Legend:

Unmodified
Added
Removed
  • trunk/libtransmission/announcer-http.c

    r14188 r14190  
    263263
    264264            if (tr_variantDictFindRaw (&benc, TR_KEY_peers6, &raw, &len)) {
    265                 dbgmsg (data->log_name, "got a peers6 length of %zu", len);
     265                dbgmsg (data->log_name, "got a peers6 length of %"TR_PRIuSIZE, len);
    266266                response->pex6 = tr_peerMgrCompact6ToPex (raw, len,
    267267                                              NULL, 0, &response->pex6_count);
     
    269269
    270270            if (tr_variantDictFindRaw (&benc, TR_KEY_peers, &raw, &len)) {
    271                 dbgmsg (data->log_name, "got a compact peers length of %zu", len);
     271                dbgmsg (data->log_name, "got a compact peers length of %"TR_PRIuSIZE, len);
    272272                response->pex = tr_peerMgrCompactToPex (raw, len,
    273273                                               NULL, 0, &response->pex_count);
    274274            } else if (tr_variantDictFindList (&benc, TR_KEY_peers, &tmp)) {
    275275                response->pex = listToPex (tmp, &response->pex_count);
    276                 dbgmsg (data->log_name, "got a peers list with %zu entries",
     276                dbgmsg (data->log_name, "got a peers list with %"TR_PRIuSIZE" entries",
    277277                        response->pex_count);
    278278            }
  • trunk/libtransmission/announcer-udp.c

    r14188 r14190  
    691691    }
    692692
    693     dbgmsg (tracker->key, "addr %p -- connected %d (%zu %zu) -- connecting_at %zu",
     693    dbgmsg (tracker->key, "addr %p -- connected %d (%"TR_PRIuSIZE" %"TR_PRIuSIZE") -- connecting_at %"TR_PRIuSIZE,
    694694            tracker->addr,
    695695          (int)(tracker->connection_expiration_time > now), (size_t)tracker->connection_expiration_time, (size_t)now,
     
    872872    struct evbuffer * buf;
    873873
    874     /*fprintf (stderr, "got an incoming udp message w/len %zu\n", msglen);*/
     874    /*fprintf (stderr, "got an incoming udp message w/len %"TR_PRIuSIZE"\n", msglen);*/
    875875
    876876    if (!session || !session->announcer_udp)
  • trunk/libtransmission/announcer.c

    r14189 r14190  
    10361036                      "min_interval:%d "
    10371037                      "tracker_id_str:%s "
    1038                       "pex:%zu "
    1039                       "pex6:%zu "
     1038                      "pex:%"TR_PRIuSIZE" "
     1039                      "pex6:%"TR_PRIuSIZE" "
    10401040                      "err:%s "
    10411041                      "warn:%s",
     
    12881288    /* schedule a rescrape */
    12891289    interval = getRetryInterval (tier->currentTracker);
    1290     dbgmsg (tier, "Retrying scrape in %zu seconds.", (size_t)interval);
    1291     tr_logAddTorInfo (tier->tor, "Retrying scrape in %zu seconds.", (size_t)interval);
     1290    dbgmsg (tier, "Retrying scrape in %"TR_PRIuSIZE" seconds.", (size_t)interval);
     1291    tr_logAddTorInfo (tier->tor, "Retrying scrape in %"TR_PRIuSIZE" seconds.", (size_t)interval);
    12921292    tier->lastScrapeSucceeded = false;
    12931293    tier->scrapeAt = get_next_scrape_time (session, tier, interval);
  • trunk/libtransmission/bandwidth.c

    r14171 r14190  
    396396#ifdef DEBUG_DIRECTION
    397397if ((dir == DEBUG_DIRECTION) && (band->isLimited))
    398 fprintf (stderr, "%p consumed %5zu bytes of %5s data... was %6zu, now %6zu left\n",
     398fprintf (stderr, "%p consumed %5"TR_PRIuSIZE" bytes of %5s data... was %6"TR_PRIuSIZE", now %6"TR_PRIuSIZE" left\n",
    399399         b, byteCount, (isPieceData?"piece":"raw"), oldBytesLeft, band->bytesLeft);
    400400#endif
  • trunk/libtransmission/cache.c

    r14173 r14190  
    9797      if (b->tor != ref->tor)
    9898        break;
    99       //fprintf (stderr, "pos %d tor %d block %zu time %zu\n", i, b->tor->uniqueId, (size_t)b->block, (size_t)b->time);
     99      //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);
    100100    }
    101101
     
    442442  tr_torGetFileBlockRange (torrent, i, &first, &last);
    443443  pos = findBlockPos (cache, torrent, first);
    444   dbgmsg ("flushing file %d from cache to disk: blocks [%zu...%zu]", (int)i, (size_t)first, (size_t)last);
     444  dbgmsg ("flushing file %d from cache to disk: blocks [%"TR_PRIuSIZE"...%"TR_PRIuSIZE"]", (int)i, (size_t)first, (size_t)last);
    445445
    446446  /* flush out all the blocks in that file */
  • trunk/libtransmission/handshake.c

    r14187 r14190  
    255255  uint8_t peer_id[PEER_ID_LEN];
    256256
    257   dbgmsg (handshake, "payload: need %d, got %zu",
     257  dbgmsg (handshake, "payload: need %d, got %"TR_PRIuSIZE,
    258258          HANDSHAKE_SIZE, evbuffer_get_length (inbuf));
    259259
     
    566566  const size_t needlen = handshake->pad_d_len;
    567567
    568   dbgmsg (handshake, "pad d: need %zu, got %zu",
     568  dbgmsg (handshake, "pad d: need %"TR_PRIuSIZE", got %"TR_PRIuSIZE,
    569569          needlen, evbuffer_get_length (inbuf));
    570570  if (evbuffer_get_length (inbuf) < needlen)
     
    594594  uint8_t hash[SHA_DIGEST_LENGTH];
    595595
    596   dbgmsg (handshake, "payload: need %d, got %zu",
     596  dbgmsg (handshake, "payload: need %d, got %"TR_PRIuSIZE,
    597597          INCOMING_HANDSHAKE_LEN, evbuffer_get_length (inbuf));
    598598
     
    735735  int len;
    736736
    737   dbgmsg (handshake, "in readYa... need %d, have %zu",
     737  dbgmsg (handshake, "in readYa... need %d, have %"TR_PRIuSIZE,
    738738          KEY_LEN, evbuffer_get_length (inbuf));
    739739  if (evbuffer_get_length (inbuf) < KEY_LEN)
     
    885885  uint32_t crypto_select;
    886886
    887   dbgmsg (handshake, "reading IA... have %zu, need %zu",
     887  dbgmsg (handshake, "reading IA... have %"TR_PRIuSIZE", need %"TR_PRIuSIZE,
    888888          evbuffer_get_length (inbuf), needlen);
    889889  if (evbuffer_get_length (inbuf) < needlen)
     
    962962  const size_t needlen = HANDSHAKE_SIZE;
    963963
    964   dbgmsg (handshake, "reading payload stream... have %zu, need %zu",
     964  dbgmsg (handshake, "reading payload stream... have %"TR_PRIuSIZE", need %"TR_PRIuSIZE,
    965965          evbuffer_get_length (inbuf), needlen);
    966966  if (evbuffer_get_length (inbuf) < needlen)
  • trunk/libtransmission/peer-io.c

    r14187 r14190  
    417417
    418418    rc = evbuffer_add (io->inbuf, buf, buflen);
    419     dbgmsg (io, "utp_on_read got %zu bytes", buflen);
     419    dbgmsg (io, "utp_on_read got %"TR_PRIuSIZE" bytes", buflen);
    420420
    421421    if (rc < 0) {
     
    436436
    437437    rc = evbuffer_remove (io->outbuf, buf, buflen);
    438     dbgmsg (io, "utp_on_write sending %zu bytes... evbuffer_remove returned %d", buflen, rc);
     438    dbgmsg (io, "utp_on_write sending %"TR_PRIuSIZE" bytes... evbuffer_remove returned %d", buflen, rc);
    439439    assert (rc == (int)buflen); /* if this fails, we've corrupted our bookkeeping somewhere */
    440440    if (rc < (long)buflen) {
     
    454454    bytes = tr_bandwidthClamp (&io->bandwidth, TR_DOWN, UTP_READ_BUFFER_SIZE);
    455455
    456     dbgmsg (io, "utp_get_rb_size is saying it's ready to read %zu bytes", bytes);
     456    dbgmsg (io, "utp_get_rb_size is saying it's ready to read %"TR_PRIuSIZE" bytes", bytes);
    457457    return UTP_READ_BUFFER_SIZE - bytes;
    458458}
     
    515515    assert (tr_isPeerIo (io));
    516516
    517     dbgmsg (io, "utp_on_overhead -- count is %zu", count);
     517    dbgmsg (io, "utp_on_overhead -- count is %"TR_PRIuSIZE, count);
    518518
    519519    tr_bandwidthUsed (&io->bandwidth, send ? TR_UP : TR_DOWN,
     
    12701270    int n = 0;
    12711271    const size_t old_len = evbuffer_get_length (io->outbuf);
    1272     dbgmsg (io, "in tr_peerIoTryWrite %zu", howmuch);
     1272    dbgmsg (io, "in tr_peerIoTryWrite %"TR_PRIuSIZE, howmuch);
    12731273
    12741274    if (howmuch > old_len)
     
    13231323        bytesUsed = tr_peerIoTryWrite (io, limit);
    13241324
    1325     dbgmsg (io, "flushing peer-io, direction %d, limit %zu, bytesUsed %d", (int)dir, limit, bytesUsed);
     1325    dbgmsg (io, "flushing peer-io, direction %d, limit %"TR_PRIuSIZE", bytesUsed %d", (int)dir, limit, bytesUsed);
    13261326    return bytesUsed;
    13271327}
  • trunk/libtransmission/peer-msgs.c

    r14189 r14190  
    334334dbgOutMessageLen (tr_peerMsgs * msgs)
    335335{
    336   dbgmsg (msgs, "outMessage size is now %zu", evbuffer_get_length (msgs->outMessages));
     336  dbgmsg (msgs, "outMessage size is now %"TR_PRIuSIZE, evbuffer_get_length (msgs->outMessages));
    337337}
    338338
     
    904904{
    905905    struct peer_request req;
    906 /*fprintf (stderr, "SENDING CANCEL MESSAGE FOR BLOCK %zu\n\t\tFROM PEER %p ------------------------------------\n", (size_t)block, msgs->peer);*/
     906/*fprintf (stderr, "SENDING CANCEL MESSAGE FOR BLOCK %"TR_PRIuSIZE"\n\t\tFROM PEER %p ------------------------------------\n", (size_t)block, msgs->peer);*/
    907907    blockToReq (msgs->torrent, block, &req);
    908908    protocolSendCancel (msgs, &req);
     
    12921292    tr_peerIoReadUint8 (msgs->io, inbuf, &id);
    12931293    msgs->incoming.id = id;
    1294     dbgmsg (msgs, "msgs->incoming.id is now %d; msgs->incoming.length is %zu", id, (size_t)msgs->incoming.length);
     1294    dbgmsg (msgs, "msgs->incoming.id is now %d; msgs->incoming.length is %"TR_PRIuSIZE, id, (size_t)msgs->incoming.length);
    12951295
    12961296    if (id == BT_PIECE)
     
    14551455        fireClientGotPieceData (msgs, n);
    14561456        *setme_piece_bytes_read += n;
    1457         dbgmsg (msgs, "got %zu bytes for block %u:%u->%u ... %d remain",
     1457        dbgmsg (msgs, "got %"TR_PRIuSIZE" bytes for block %u:%u->%u ... %d remain",
    14581458               n, req->index, req->offset, req->length,
    14591459             (int)(req->length - evbuffer_get_length (block_buffer)));
     
    14871487    --msglen; /* id length */
    14881488
    1489     dbgmsg (msgs, "got BT id %d, len %d, buffer size is %zu", (int)id, (int)msglen, inlen);
     1489    dbgmsg (msgs, "got BT id %d, len %d, buffer size is %"TR_PRIuSIZE, (int)id, (int)msglen, inlen);
    14901490
    14911491    if (inlen < msglen)
     
    17481748    const size_t      inlen = evbuffer_get_length (in);
    17491749
    1750     dbgmsg (msgs, "canRead: inlen is %zu, msgs->state is %d", inlen, msgs->state);
     1750    dbgmsg (msgs, "canRead: inlen is %"TR_PRIuSIZE", msgs->state is %d", inlen, msgs->state);
    17511751
    17521752    if (!inlen)
     
    19161916    if (haveMessages && !msgs->outMessagesBatchedAt) /* fresh batch */
    19171917    {
    1918         dbgmsg (msgs, "started an outMessages batch (length is %zu)", evbuffer_get_length (msgs->outMessages));
     1918        dbgmsg (msgs, "started an outMessages batch (length is %"TR_PRIuSIZE")", evbuffer_get_length (msgs->outMessages));
    19191919        msgs->outMessagesBatchedAt = now;
    19201920    }
     
    19231923        const size_t len = evbuffer_get_length (msgs->outMessages);
    19241924        /* flush the protocol messages */
    1925         dbgmsg (msgs, "flushing outMessages... to %p (length is %zu)", msgs->io, len);
     1925        dbgmsg (msgs, "flushing outMessages... to %p (length is %"TR_PRIuSIZE")", msgs->io, len);
    19261926        tr_peerIoWriteBuf (msgs->io, msgs->outMessages, false);
    19271927        msgs->clientSentAnythingAt = now;
     
    20302030            if (!err && tr_torrentPieceNeedsCheck (msgs->torrent, req.index))
    20312031                if ((err = !tr_torrentCheckPiece (msgs->torrent, req.index)))
    2032                     tr_torrentSetLocalError (msgs->torrent, _("Please Verify Local Data! Piece #%zu is corrupt."), (size_t)req.index);
     2032                    tr_torrentSetLocalError (msgs->torrent, _("Please Verify Local Data! Piece #%"TR_PRIuSIZE" is corrupt."), (size_t)req.index);
    20332033
    20342034            if (err)
     
    21312131    evbuffer_add_uint8 (out, BT_BITFIELD);
    21322132    evbuffer_add     (out, bytes, byte_count);
    2133     dbgmsg (msgs, "sending bitfield... outMessage size is now %zu", evbuffer_get_length (out));
     2133    dbgmsg (msgs, "sending bitfield... outMessage size is now %"TR_PRIuSIZE, evbuffer_get_length (out));
    21342134    pokeBatchPeriod (msgs, IMMEDIATE_PRIORITY_INTERVAL_SECS);
    21352135
     
    24262426            evbuffer_add_buffer (out, payload);
    24272427            pokeBatchPeriod (msgs, HIGH_PRIORITY_INTERVAL_SECS);
    2428             dbgmsg (msgs, "sending a pex message; outMessage size is now %zu", evbuffer_get_length (out));
     2428            dbgmsg (msgs, "sending a pex message; outMessage size is now %"TR_PRIuSIZE, evbuffer_get_length (out));
    24292429            dbgOutMessageLen (msgs);
    24302430
  • trunk/libtransmission/resume.c

    r14136 r14190  
    165165  else
    166166    {
    167       tr_logAddTorDbg (tor, "Couldn't load DND flags. DND list (%p) has %zu children; torrent has %d files",
     167      tr_logAddTorDbg (tor, "Couldn't load DND flags. DND list (%p) has %"TR_PRIuSIZE" children; torrent has %d files",
    168168                       list, tr_variantListSize (list), (int)n);
    169169    }
  • trunk/libtransmission/rpc-server.c

    r14172 r14190  
    388388
    389389#if 0
    390           fprintf (stderr, "compressed response is %.2f of original (raw==%zu bytes; compressed==%zu)\n",
     390          fprintf (stderr, "compressed response is %.2f of original (raw==%"TR_PRIuSIZE" bytes; compressed==%"TR_PRIuSIZE")\n",
    391391                   (double)evbuffer_get_length (out)/content_len,
    392392                   content_len, evbuffer_get_length (out));
  • trunk/libtransmission/rpcimpl.c

    r14169 r14190  
    16341634  struct add_torrent_idle_data * data = user_data;
    16351635
    1636   dbgmsg ("torrentAdd: HTTP response code was %ld (%s); response length was %zu bytes",
     1636  dbgmsg ("torrentAdd: HTTP response code was %ld (%s); response length was %"TR_PRIuSIZE" bytes",
    16371637          response_code, tr_webGetResponseStr (response_code), response_byte_count);
    16381638
  • trunk/libtransmission/session.c

    r14187 r14190  
    677677    usec = min;
    678678  tr_timerAdd (session->nowTimer, 0, usec);
    679   /* fprintf (stderr, "time %zu sec, %zu microsec\n", (size_t)tr_time (), (size_t)tv.tv_usec); */
     679  /* fprintf (stderr, "time %"TR_PRIuSIZE" sec, %"TR_PRIuSIZE" microsec\n", (size_t)tr_time (), (size_t)tv.tv_usec); */
    680680}
    681681
     
    18691869  assert (tr_isSession (session));
    18701870
    1871   dbgmsg ("shutting down transmission session %p... now is %zu, deadline is %zu", session, (size_t)time (NULL), (size_t)deadline);
     1871  dbgmsg ("shutting down transmission session %p... now is %"TR_PRIuSIZE", deadline is %"TR_PRIuSIZE, session, (size_t)time (NULL), (size_t)deadline);
    18721872
    18731873  /* close the session */
     
    18861886           && !deadlineReached (deadline))
    18871887    {
    1888       dbgmsg ("waiting on port unmap (%p) or announcer (%p)... now %zu deadline %zu",
     1888      dbgmsg ("waiting on port unmap (%p) or announcer (%p)... now %"TR_PRIuSIZE" deadline %"TR_PRIuSIZE,
    18891889              session->shared, session->announcer, (size_t)time (NULL), (size_t)deadline);
    18901890      tr_wait_msec (50);
     
    18981898    {
    18991899      static bool forced = false;
    1900       dbgmsg ("waiting for libtransmission thread to finish... now %zu deadline %zu", (size_t)time (NULL), (size_t)deadline);
     1900      dbgmsg ("waiting for libtransmission thread to finish... now %"TR_PRIuSIZE" deadline %"TR_PRIuSIZE, (size_t)time (NULL), (size_t)deadline);
    19011901      tr_wait_msec (100);
    19021902
  • trunk/libtransmission/torrent.c

    r14188 r14190  
    563563
    564564          if (allAreSeeds)
    565             tr_logAddTorDbg (tor, "Got %zu seeds from tracker", event->pexCount);
     565            tr_logAddTorDbg (tor, "Got %"TR_PRIuSIZE" seeds from tracker", event->pexCount);
    566566          else
    567             tr_logAddTorDbg (tor, "Got %zu peers from tracker", event->pexCount);
     567            tr_logAddTorDbg (tor, "Got %"TR_PRIuSIZE" peers from tracker", event->pexCount);
    568568
    569569          for (i = 0; i < event->pexCount; ++i)
     
    25732573  const bool pass = tr_ioTestPiece (tor, pieceIndex);
    25742574
    2575   tr_deeplog_tor (tor, "[LAZY] tr_torrentCheckPiece tested piece %zu, pass==%d", (size_t)pieceIndex, (int)pass);
     2575  tr_deeplog_tor (tor, "[LAZY] tr_torrentCheckPiece tested piece %"TR_PRIuSIZE", pass==%d", (size_t)pieceIndex, (int)pass);
    25762576  tr_torrentSetHasPiece (tor, pieceIndex, pass);
    25772577  tr_torrentSetPieceChecked (tor, pieceIndex);
     
    32413241      if (tr_torrentPieceIsComplete (tor, p))
    32423242        {
    3243           tr_logAddTorDbg (tor, "[LAZY] checking just-completed piece %zu", (size_t)p);
     3243          tr_logAddTorDbg (tor, "[LAZY] checking just-completed piece %"TR_PRIuSIZE, (size_t)p);
    32443244
    32453245          if (tr_torrentCheckPiece (tor, p))
  • trunk/libtransmission/tr-utp.c

    r13868 r14190  
    6666UTP_Write (struct UTPSocket *socket, size_t count)
    6767{
    68     tr_logAddNamedError (MY_NAME, "UTP_RBDrained (%p, %zu) was called.", socket, count);
    69     dbgmsg ("UTP_RBDrained (%p, %zu) was called.", socket, count);
     68    tr_logAddNamedError (MY_NAME, "UTP_RBDrained (%p, %"TR_PRIuSIZE") was called.", socket, count);
     69    dbgmsg ("UTP_RBDrained (%p, %"TR_PRIuSIZE") was called.", socket, count);
    7070    assert (0); /* FIXME: this is too much for the long term, but probably needed in the short term */
    7171    return false;
  • trunk/libtransmission/transmission.h

    r14188 r14190  
    8181 #else
    8282  #define PRIu32 "lu"
     83 #endif
     84#endif
     85
     86#ifndef TR_PRIuSIZE
     87 #ifdef _MSC_VER
     88  #define TR_PRIuSIZE "Iu"
     89 #else
     90  #define TR_PRIuSIZE "zu"
    8391 #endif
    8492#endif
  • trunk/libtransmission/variant-benc.c

    r13968 r14190  
    298298  const char * str;
    299299  tr_variantGetStr (v, &str, &len);
    300   evbuffer_add_printf (evbuf, "%zu:", len);
     300  evbuffer_add_printf (evbuf, "%"TR_PRIuSIZE":", len);
    301301  evbuffer_add (evbuf, str, len);
    302302}
  • trunk/libtransmission/variant-json.c

    r13868 r14190  
    9292  if (data->source)
    9393    {
    94       tr_logAddError ("JSON parse failed in %s at pos %zu: %s -- remaining text \"%.16s\"",
     94      tr_logAddError ("JSON parse failed in %s at pos %"TR_PRIuSIZE": %s -- remaining text \"%.16s\"",
    9595              data->source,
    9696              jsn->pos,
     
    100100  else
    101101    {
    102       tr_logAddError ("JSON parse failed at pos %zu: %s -- remaining text \"%.16s\"",
     102      tr_logAddError ("JSON parse failed at pos %"TR_PRIuSIZE": %s -- remaining text \"%.16s\"",
    103103              jsn->pos,
    104104              jsonsl_strerror (error),
  • trunk/libtransmission/web.c

    r14188 r14190  
    134134
    135135  evbuffer_add (task->response, ptr, byteCount);
    136   dbgmsg ("wrote %zu bytes to task %p's buffer", byteCount, task);
     136  dbgmsg ("wrote %"TR_PRIuSIZE" bytes to task %p's buffer", byteCount, task);
    137137  return byteCount;
    138138}
  • trunk/utils/edit.c

    r13868 r14190  
    280280          tr_variant * tier = tr_variantListAddList (announce_list, 1);
    281281          tr_variantListAddStr (tier, url);
    282           printf ("\tAdded \"%s\" to \"announce-list\" tier %zu\n", url, tr_variantListSize (announce_list));
     282          printf ("\tAdded \"%s\" to \"announce-list\" tier %"TR_PRIuSIZE"\n", url, tr_variantListSize (announce_list));
    283283          changed = true;
    284284        }
Note: See TracChangeset for help on using the changeset viewer.