(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:
Jordan Lee 2011-02-12 17:27:47 +00:00
parent f4b9423998
commit 2b8124d3ad
7 changed files with 12 additions and 12 deletions

View File

@ -2277,7 +2277,7 @@ processArgs( const char * rpcurl, int argc, const char ** argv )
}
default:
{
fprintf( stderr, "got opt [%d]\n", (int)c );
fprintf( stderr, "got opt [%d]\n", c );
showUsage( );
break;
}

View File

@ -793,7 +793,7 @@ tr_fdSetPeerLimit( tr_session * session, int socket_limit )
#endif
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

View File

@ -265,7 +265,7 @@ parseHandshake( tr_handshake * handshake,
uint8_t peer_id[PEER_ID_LEN];
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 )
return READ_LATER;
@ -608,7 +608,7 @@ readHandshake( tr_handshake * handshake,
uint8_t hash[SHA_DIGEST_LENGTH];
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 )
return READ_LATER;
@ -757,7 +757,7 @@ readYa( tr_handshake * handshake,
int len;
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 )
return READ_LATER;

View File

@ -91,7 +91,7 @@ callback( void * vdata,
case JSON_T_FLOAT:
data->hasContent = TRUE;
tr_bencInitReal( getNode( data ), (double)value->vu.float_value );
tr_bencInitReal( getNode( data ), value->vu.float_value );
break;
case JSON_T_NULL:

View File

@ -803,10 +803,10 @@ comparePieceByWeight( const void * va, const void * vb )
/* primary key: weight */
missing = tr_cpMissingBlocksInPiece( &tor->completion, a->index );
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 );
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;

View File

@ -201,7 +201,7 @@ tr_getLogTimeStr( char * buf, int buflen )
seconds = tv.tv_sec;
tr_localtime_r( &seconds, &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 );
return buf;

View File

@ -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 );
#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 ) \
( (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 ) \
( (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 );