mirror of
https://github.com/transmission/transmission
synced 2025-03-13 15:39:01 +00:00
(trunk) #4019 "Minor patch, kill useless casts in transmission source." -- fixed. patch by jlouis
jlouis used Coccinelle to scan transmission's source for redundant code that casts a type to its own type.
This commit is contained in:
parent
f4b9423998
commit
2b8124d3ad
7 changed files with 12 additions and 12 deletions
|
@ -2277,7 +2277,7 @@ processArgs( const char * rpcurl, int argc, const char ** argv )
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
{
|
{
|
||||||
fprintf( stderr, "got opt [%d]\n", (int)c );
|
fprintf( stderr, "got opt [%d]\n", c );
|
||||||
showUsage( );
|
showUsage( );
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
|
@ -793,7 +793,7 @@ tr_fdSetPeerLimit( tr_session * session, int socket_limit )
|
||||||
#endif
|
#endif
|
||||||
gFd->public_socket_limit = socket_limit;
|
gFd->public_socket_limit = socket_limit;
|
||||||
|
|
||||||
tr_dbg( "socket limit is %d", (int)gFd->socket_limit );
|
tr_dbg( "socket limit is %d", gFd->socket_limit );
|
||||||
}
|
}
|
||||||
|
|
||||||
int
|
int
|
||||||
|
|
|
@ -265,7 +265,7 @@ parseHandshake( tr_handshake * handshake,
|
||||||
uint8_t peer_id[PEER_ID_LEN];
|
uint8_t peer_id[PEER_ID_LEN];
|
||||||
|
|
||||||
dbgmsg( handshake, "payload: need %d, got %zu",
|
dbgmsg( handshake, "payload: need %d, got %zu",
|
||||||
(int)HANDSHAKE_SIZE, evbuffer_get_length( inbuf ) );
|
HANDSHAKE_SIZE, evbuffer_get_length( inbuf ) );
|
||||||
|
|
||||||
if( evbuffer_get_length( inbuf ) < HANDSHAKE_SIZE )
|
if( evbuffer_get_length( inbuf ) < HANDSHAKE_SIZE )
|
||||||
return READ_LATER;
|
return READ_LATER;
|
||||||
|
@ -608,7 +608,7 @@ readHandshake( tr_handshake * handshake,
|
||||||
uint8_t hash[SHA_DIGEST_LENGTH];
|
uint8_t hash[SHA_DIGEST_LENGTH];
|
||||||
|
|
||||||
dbgmsg( handshake, "payload: need %d, got %zu",
|
dbgmsg( handshake, "payload: need %d, got %zu",
|
||||||
(int)INCOMING_HANDSHAKE_LEN, evbuffer_get_length( inbuf ) );
|
INCOMING_HANDSHAKE_LEN, evbuffer_get_length( inbuf ) );
|
||||||
|
|
||||||
if( evbuffer_get_length( inbuf ) < INCOMING_HANDSHAKE_LEN )
|
if( evbuffer_get_length( inbuf ) < INCOMING_HANDSHAKE_LEN )
|
||||||
return READ_LATER;
|
return READ_LATER;
|
||||||
|
@ -757,7 +757,7 @@ readYa( tr_handshake * handshake,
|
||||||
int len;
|
int len;
|
||||||
|
|
||||||
dbgmsg( handshake, "in readYa... need %d, have %zu",
|
dbgmsg( handshake, "in readYa... need %d, have %zu",
|
||||||
(int)KEY_LEN, evbuffer_get_length( inbuf ) );
|
KEY_LEN, evbuffer_get_length( inbuf ) );
|
||||||
if( evbuffer_get_length( inbuf ) < KEY_LEN )
|
if( evbuffer_get_length( inbuf ) < KEY_LEN )
|
||||||
return READ_LATER;
|
return READ_LATER;
|
||||||
|
|
||||||
|
|
|
@ -91,7 +91,7 @@ callback( void * vdata,
|
||||||
|
|
||||||
case JSON_T_FLOAT:
|
case JSON_T_FLOAT:
|
||||||
data->hasContent = TRUE;
|
data->hasContent = TRUE;
|
||||||
tr_bencInitReal( getNode( data ), (double)value->vu.float_value );
|
tr_bencInitReal( getNode( data ), value->vu.float_value );
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case JSON_T_NULL:
|
case JSON_T_NULL:
|
||||||
|
|
|
@ -803,10 +803,10 @@ comparePieceByWeight( const void * va, const void * vb )
|
||||||
/* primary key: weight */
|
/* primary key: weight */
|
||||||
missing = tr_cpMissingBlocksInPiece( &tor->completion, a->index );
|
missing = tr_cpMissingBlocksInPiece( &tor->completion, a->index );
|
||||||
pending = a->requestCount;
|
pending = a->requestCount;
|
||||||
ia = missing > pending ? missing - pending : (int)(tor->blockCountInPiece + pending);
|
ia = missing > pending ? missing - pending : (tor->blockCountInPiece + pending);
|
||||||
missing = tr_cpMissingBlocksInPiece( &tor->completion, b->index );
|
missing = tr_cpMissingBlocksInPiece( &tor->completion, b->index );
|
||||||
pending = b->requestCount;
|
pending = b->requestCount;
|
||||||
ib = missing > pending ? missing - pending : (int)(tor->blockCountInPiece + pending);
|
ib = missing > pending ? missing - pending : (tor->blockCountInPiece + pending);
|
||||||
if( ia < ib ) return -1;
|
if( ia < ib ) return -1;
|
||||||
if( ia > ib ) return 1;
|
if( ia > ib ) return 1;
|
||||||
|
|
||||||
|
|
|
@ -201,7 +201,7 @@ tr_getLogTimeStr( char * buf, int buflen )
|
||||||
seconds = tv.tv_sec;
|
seconds = tv.tv_sec;
|
||||||
tr_localtime_r( &seconds, &now_tm );
|
tr_localtime_r( &seconds, &now_tm );
|
||||||
strftime( tmp, sizeof( tmp ), "%H:%M:%S", &now_tm );
|
strftime( tmp, sizeof( tmp ), "%H:%M:%S", &now_tm );
|
||||||
milliseconds = (int)( tv.tv_usec / 1000 );
|
milliseconds = tv.tv_usec / 1000;
|
||||||
tr_snprintf( buf, buflen, "%s.%03d", tmp, milliseconds );
|
tr_snprintf( buf, buflen, "%s.%03d", tmp, milliseconds );
|
||||||
|
|
||||||
return buf;
|
return buf;
|
||||||
|
|
|
@ -323,13 +323,13 @@ void evbuffer_ref_cleanup_tr_free( const void * data UNUSED, size_t datalen UNUS
|
||||||
void* tr_memdup( const void * src, size_t byteCount );
|
void* tr_memdup( const void * src, size_t byteCount );
|
||||||
|
|
||||||
#define tr_new( struct_type, n_structs ) \
|
#define tr_new( struct_type, n_structs ) \
|
||||||
( (struct_type *) tr_malloc ( ( (size_t) sizeof ( struct_type ) ) * ( ( size_t) ( n_structs ) ) ) )
|
( (struct_type *) tr_malloc ( sizeof ( struct_type ) * ( ( size_t) ( n_structs ) ) ) )
|
||||||
|
|
||||||
#define tr_new0( struct_type, n_structs ) \
|
#define tr_new0( struct_type, n_structs ) \
|
||||||
( (struct_type *) tr_malloc0 ( ( (size_t) sizeof ( struct_type ) ) * ( ( size_t) ( n_structs ) ) ) )
|
( (struct_type *) tr_malloc0 ( sizeof ( struct_type ) * ( ( size_t) ( n_structs ) ) ) )
|
||||||
|
|
||||||
#define tr_renew( struct_type, mem, n_structs ) \
|
#define tr_renew( struct_type, mem, n_structs ) \
|
||||||
( (struct_type *) realloc ( ( mem ), ( (size_t) sizeof ( struct_type ) ) * ( ( size_t) ( n_structs ) ) ) )
|
( (struct_type *) realloc ( ( mem ), sizeof ( struct_type ) * ( ( size_t) ( n_structs ) ) ) )
|
||||||
|
|
||||||
void* tr_valloc( size_t bufLen );
|
void* tr_valloc( size_t bufLen );
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue