Changeset 10920


Ignore:
Timestamp:
Jul 1, 2010, 3:14:35 PM (13 years ago)
Author:
charles
Message:

(trunk libT) fix a few -Wconversion warnings

Location:
trunk/libtransmission
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • trunk/libtransmission/blocklist.c

    r10858 r10920  
    8080blocklistLoad( tr_blocklist * b )
    8181{
    82     int          fd;
    83     struct stat  st;
     82    int fd;
     83    size_t byteCount;
     84    struct stat st;
    8485    const char * err_fmt = _( "Couldn't read \"%1$s\": %2$s" );
    8586
     
    9697    }
    9798
    98     b->rules = mmap( NULL, st.st_size, PROT_READ, MAP_PRIVATE, fd, 0 );
     99    byteCount = (size_t) st.st_size;
     100    b->rules = mmap( NULL, byteCount, PROT_READ, MAP_PRIVATE, fd, 0 );
    99101    if( !b->rules )
    100102    {
     
    104106    }
    105107
    106     b->byteCount = st.st_size;
    107     b->ruleCount = st.st_size / sizeof( struct tr_ip_range );
    108108    b->fd = fd;
     109    b->byteCount = byteCount;
     110    b->ruleCount = byteCount / sizeof( struct tr_ip_range );
    109111
    110112    {
     
    146148
    147149tr_blocklist *
    148 _tr_blocklistNew( const char * filename,
    149                   int          isEnabled )
     150_tr_blocklistNew( const char * filename, tr_bool isEnabled )
    150151{
    151152    tr_blocklist * b;
  • trunk/libtransmission/blocklist.h

    r9868 r10920  
    2222
    2323tr_blocklist* _tr_blocklistNew         ( const char              * filename,
    24                                          int                       isEnabled );
     24                                         tr_bool                   isEnabled );
    2525
    2626int           _tr_blocklistExists      ( const tr_blocklist      * b );
  • trunk/libtransmission/makemeta.c

    r10781 r10920  
    8989}
    9090
    91 static int
     91static uint32_t
    9292bestPieceSize( uint64_t totalSize )
    9393{
    94     const uint64_t GiB = 1073741824;
    95     const uint64_t MiB = 1048576;
    96     const uint64_t KiB = 1024;
     94    const uint32_t GiB = 1073741824;
     95    const uint32_t MiB = 1048576;
     96    const uint32_t KiB = 1024;
    9797
    9898    if( totalSize >=   ( 2 * GiB ) ) return 2 * MiB;
     
    227227    while( totalRemain )
    228228    {
    229         uint8_t *      bufptr = buf;
    230         const uint64_t thisPieceSize =
    231             MIN( (uint32_t)b->pieceSize, totalRemain );
    232         uint64_t       pieceRemain = thisPieceSize;
     229        uint8_t * bufptr = buf;
     230        const uint32_t thisPieceSize = (uint32_t) MIN( b->pieceSize, totalRemain );
     231        uint32_t leftInPiece = thisPieceSize;
    233232
    234233        assert( b->pieceIndex < b->pieceCount );
    235234
    236         while( pieceRemain )
     235        while( leftInPiece )
    237236        {
    238             const uint64_t n_this_pass =
    239                 MIN( ( b->files[fileIndex].size - off ), pieceRemain );
     237            const size_t n_this_pass = (size_t) MIN( ( b->files[fileIndex].size - off ), leftInPiece );
    240238            read( fd, bufptr, n_this_pass );
    241239            bufptr += n_this_pass;
    242240            off += n_this_pass;
    243             pieceRemain -= n_this_pass;
     241            leftInPiece -= n_this_pass;
    244242            if( off == b->files[fileIndex].size )
    245243            {
     
    266264
    267265        assert( bufptr - buf == (int)thisPieceSize );
    268         assert( pieceRemain == 0 );
     266        assert( leftInPiece == 0 );
    269267        tr_sha1( walk, buf, thisPieceSize, NULL );
    270268        walk += SHA_DIGEST_LENGTH;
Note: See TracChangeset for help on using the changeset viewer.