1
0
Fork 0
mirror of https://github.com/transmission/transmission synced 2024-12-24 08:43:27 +00:00

Unbreak BeOS build.

This commit is contained in:
Josh Elsasser 2006-08-18 08:46:19 +00:00
parent dc282004c8
commit d07b688c86
3 changed files with 17 additions and 4 deletions

View file

@ -403,3 +403,12 @@ void tr_netClose( int s )
close( s );
#endif
}
void tr_netNtop( const struct in_addr * addr, char * buf, int len )
{
const uint8_t * cast;
cast = (const uint8_t *)addr;
snprintf( buf, len, "%hhu.%hhu.%hhu.%hhu",
cast[0], cast[1], cast[2], cast[3] );
}

View file

@ -52,3 +52,4 @@ void tr_netClose ( int s );
int tr_netSend ( int s, uint8_t * buf, int size );
int tr_netRecv ( int s, uint8_t * buf, int size );
void tr_netNtop( const struct in_addr * addr, char * buf, int len );

View file

@ -410,6 +410,7 @@ int tr_getFinished( tr_torrent_t * tor )
tr_stat_t * tr_torrentStat( tr_torrent_t * tor )
{
tr_stat_t * s;
tr_peer_t * peer;
tr_info_t * inf = &tor->info;
int i;
@ -435,7 +436,6 @@ tr_stat_t * tr_torrentStat( tr_torrent_t * tor )
s->peersUploading = 0;
s->peersDownloading = 0;
tr_peer_t * peer;
for( i = 0; i < tor->peerCount; i++ )
{
peer = tor->peers[i];
@ -494,11 +494,13 @@ tr_stat_t * tr_torrentStat( tr_torrent_t * tor )
tr_peer_stat_t * tr_torrentPeers( tr_torrent_t * tor, int * peerCount )
{
tr_peer_stat_t * peers;
tr_lockLock( &tor->lock );
*peerCount = tor->peerCount;
tr_peer_stat_t * peers = (tr_peer_stat_t *) calloc( tor->peerCount, sizeof( tr_peer_stat_t ) );
peers = (tr_peer_stat_t *) calloc( tor->peerCount, sizeof( tr_peer_stat_t ) );
if (peers != NULL)
{
tr_peer_t * peer;
@ -511,7 +513,7 @@ tr_peer_stat_t * tr_torrentPeers( tr_torrent_t * tor, int * peerCount )
addr = tr_peerAddress( peer );
if( NULL != addr )
{
inet_ntop( AF_INET, addr, peers[i].addr,
tr_netNtop( addr, peers[i].addr,
sizeof( peers[i].addr ) );
}
@ -530,10 +532,11 @@ tr_peer_stat_t * tr_torrentPeers( tr_torrent_t * tor, int * peerCount )
void tr_torrentPeersFree( tr_peer_stat_t * peers, int peerCount )
{
int i;
if (peers == NULL)
return;
int i;
for (i = 0; i < peerCount; i++)
free( peers[i].client );