mirror of
https://github.com/transmission/transmission
synced 2025-03-03 18:25:35 +00:00
(trunk) #3618 "FreeBSD 8.1 & GCC 4.2.1 compiler warnings" -- fix some compiler warnings.
This commit is contained in:
parent
0cf643f8c3
commit
6c3d651ffe
5 changed files with 26 additions and 29 deletions
|
@ -231,7 +231,7 @@ tr_pwrite( int fd, const void *buf, size_t count, off_t offset )
|
|||
}
|
||||
|
||||
int
|
||||
tr_prefetch( int fd, off_t offset, size_t count )
|
||||
tr_prefetch( int fd UNUSED, off_t offset UNUSED, size_t count UNUSED )
|
||||
{
|
||||
#ifdef HAVE_POSIX_FADVISE
|
||||
return posix_fadvise( fd, offset, count, POSIX_FADV_WILLNEED );
|
||||
|
|
|
@ -836,20 +836,15 @@ comparePieceByIndex( const void * va, const void * vb )
|
|||
static void
|
||||
pieceListSort( Torrent * t, int mode )
|
||||
{
|
||||
int(*compar)(const void *, const void *);
|
||||
|
||||
assert( mode==PIECES_SORTED_BY_INDEX
|
||||
|| mode==PIECES_SORTED_BY_WEIGHT );
|
||||
|
||||
switch( mode ) {
|
||||
case PIECES_SORTED_BY_WEIGHT: compar = comparePieceByWeight; break;
|
||||
case PIECES_SORTED_BY_INDEX: compar = comparePieceByIndex; break;
|
||||
default: assert( 0 && "unhandled" ); break;
|
||||
}
|
||||
|
||||
weightTorrent = t->tor;
|
||||
qsort( t->pieces, t->pieceCount,
|
||||
sizeof( struct weighted_piece ), compar );
|
||||
|
||||
if( mode == PIECES_SORTED_BY_WEIGHT )
|
||||
qsort( t->pieces, t->pieceCount, sizeof( struct weighted_piece ), comparePieceByWeight );
|
||||
else
|
||||
qsort( t->pieces, t->pieceCount, sizeof( struct weighted_piece ), comparePieceByIndex );
|
||||
}
|
||||
|
||||
static tr_bool
|
||||
|
|
|
@ -268,7 +268,7 @@ tr_torrentSetMetadataPiece( tr_torrent * tor, int piece, const void * data, in
|
|||
|
||||
if( success && !tr_getBlockSize( info.pieceSize ) )
|
||||
{
|
||||
tr_torrentSetLocalError( tor, _( "Magnet torrent's metadata is not usable" ) );
|
||||
tr_torrentSetLocalError( tor, "%s", _( "Magnet torrent's metadata is not usable" ) );
|
||||
success = FALSE;
|
||||
}
|
||||
|
||||
|
|
|
@ -1484,7 +1484,7 @@ checkAndStartImpl( void * vtor )
|
|||
stop the torrent and log an error. */
|
||||
if( tor->preVerifyTotal && !tr_cpHaveTotal( &tor->completion ) )
|
||||
{
|
||||
tr_torrentSetLocalError( tor, _( "No data found! Reconnect any disconnected drives, use \"Set Location\", or restart the torrent to re-download." ) );
|
||||
tr_torrentSetLocalError( tor, "%s", _( "No data found! Reconnect any disconnected drives, use \"Set Location\", or restart the torrent to re-download." ) );
|
||||
}
|
||||
else
|
||||
{
|
||||
|
@ -1567,7 +1567,7 @@ torrentRecheckDoneImpl( void * vtor )
|
|||
|
||||
if( tor->preVerifyTotal && !tr_cpHaveTotal( &tor->completion ) )
|
||||
{
|
||||
tr_torrentSetLocalError( tor, _( "Can't find local data. Try \"Set Location\" to find it, or restart the torrent to re-download." ) );
|
||||
tr_torrentSetLocalError( tor, "%s", _( "Can't find local data. Try \"Set Location\" to find it, or restart the torrent to re-download." ) );
|
||||
}
|
||||
else if( tor->startAfterVerify )
|
||||
{
|
||||
|
@ -1680,7 +1680,7 @@ closeTorrent( void * vtor )
|
|||
tr_bencDictAddInt( d, "id", tor->uniqueId );
|
||||
tr_bencDictAddInt( d, "date", tr_time( ) );
|
||||
|
||||
tr_torinf( tor, _( "Removing torrent" ) );
|
||||
tr_torinf( tor, "%s", _( "Removing torrent" ) );
|
||||
|
||||
stopTorrent( tor );
|
||||
|
||||
|
|
30
third-party/dht/dht.c
vendored
30
third-party/dht/dht.c
vendored
|
@ -380,7 +380,7 @@ is_martian(struct sockaddr *sa)
|
|||
/* Forget about the ``XOR-metric''. An id is just a path from the
|
||||
root of the tree, so bits are numbered from the start. */
|
||||
|
||||
static inline int
|
||||
static int
|
||||
id_cmp(const unsigned char *restrict id1, const unsigned char *restrict id2)
|
||||
{
|
||||
/* Memcmp is guaranteed to perform an unsigned comparison. */
|
||||
|
@ -1224,10 +1224,24 @@ static int
|
|||
storage_store(const unsigned char *id, struct sockaddr *sa)
|
||||
{
|
||||
int i, len;
|
||||
struct storage *st = storage;
|
||||
struct storage *st;
|
||||
unsigned char *ip;
|
||||
unsigned short port;
|
||||
|
||||
if(sa->sa_family == AF_INET) {
|
||||
struct sockaddr_in *sin = (struct sockaddr_in*)sa;
|
||||
ip = (unsigned char*)&sin->sin_addr;
|
||||
len = 4;
|
||||
port = ntohs(sin->sin_port);
|
||||
} else if(sa->sa_family == AF_INET6) {
|
||||
struct sockaddr_in6 *sin6 = (struct sockaddr_in6*)sa;
|
||||
ip = (unsigned char*)&sin6->sin6_addr;
|
||||
len = 16;
|
||||
port = ntohs(sin6->sin6_port);
|
||||
} else {
|
||||
return -1;
|
||||
}
|
||||
|
||||
st = find_storage(id);
|
||||
|
||||
if(st == NULL) {
|
||||
|
@ -1241,18 +1255,6 @@ storage_store(const unsigned char *id, struct sockaddr *sa)
|
|||
numstorage++;
|
||||
}
|
||||
|
||||
if(sa->sa_family == AF_INET) {
|
||||
struct sockaddr_in *sin = (struct sockaddr_in*)sa;
|
||||
ip = (unsigned char*)&sin->sin_addr;
|
||||
len = 4;
|
||||
port = ntohs(sin->sin_port);
|
||||
} else if(sa->sa_family == AF_INET6) {
|
||||
struct sockaddr_in6 *sin6 = (struct sockaddr_in6*)sa;
|
||||
ip = (unsigned char*)&sin6->sin6_addr;
|
||||
len = 16;
|
||||
port = ntohs(sin6->sin6_port);
|
||||
}
|
||||
|
||||
for(i = 0; i < st->numpeers; i++) {
|
||||
if(st->peers[i].port == port && st->peers[i].len == len &&
|
||||
memcmp(st->peers[i].ip, ip, len) == 0)
|
||||
|
|
Loading…
Reference in a new issue