(trunk libT) a couple more minor -Wconversion warnings

This commit is contained in:
Charles Kerr 2010-07-01 05:39:54 +00:00
parent a5a1f38393
commit 4ad26f7910
3 changed files with 10 additions and 9 deletions

View File

@ -69,14 +69,13 @@ tr_getCurrentThread( void )
#endif #endif
} }
static int static tr_bool
tr_areThreadsEqual( tr_thread_id a, tr_areThreadsEqual( tr_thread_id a, tr_thread_id b )
tr_thread_id b )
{ {
#ifdef WIN32 #ifdef WIN32
return a == b; return a == b;
#else #else
return pthread_equal( a, b ); return pthread_equal( a, b ) != 0;
#endif #endif
} }
@ -91,7 +90,7 @@ struct tr_thread
#endif #endif
}; };
int tr_bool
tr_amInThread( const tr_thread * t ) tr_amInThread( const tr_thread * t )
{ {
return tr_areThreadsEqual( tr_getCurrentThread( ), t->thread ); return tr_areThreadsEqual( tr_getCurrentThread( ), t->thread );

View File

@ -74,7 +74,7 @@ tr_thread* tr_threadNew( void ( *func )(void *), void * arg );
/** @brief Return nonzero if this function is being called from `thread' /** @brief Return nonzero if this function is being called from `thread'
@param thread the thread being tested */ @param thread the thread being tested */
int tr_amInThread( const tr_thread * ); tr_bool tr_amInThread( const tr_thread * );
/*** /***
**** ****

View File

@ -1172,7 +1172,7 @@ tr_torrentFiles( const tr_torrent * tor,
for( i=0; i<n; ++i, ++walk ) { for( i=0; i<n; ++i, ++walk ) {
const uint64_t b = isSeed ? tor->info.files[i].length : fileBytesCompleted( tor, i ); const uint64_t b = isSeed ? tor->info.files[i].length : fileBytesCompleted( tor, i );
walk->bytesCompleted = b; walk->bytesCompleted = b;
walk->progress = tor->info.files[i].length > 0 ? ( (float)b / tor->info.files[i].length ) : 1.0; walk->progress = tor->info.files[i].length > 0 ? ( b / tor->info.files[i].length ) : 1.0;
} }
if( fileCount ) if( fileCount )
@ -1842,8 +1842,10 @@ setFileDND( tr_torrent * tor, tr_file_index_t fileIndex, int doDownload )
{ {
tr_file * file; tr_file * file;
const int8_t dnd = !doDownload; const int8_t dnd = !doDownload;
tr_piece_index_t firstPiece, firstPieceDND; tr_piece_index_t firstPiece;
tr_piece_index_t lastPiece, lastPieceDND; int8_t firstPieceDND;
tr_piece_index_t lastPiece;
int8_t lastPieceDND;
tr_file_index_t i; tr_file_index_t i;
assert( tr_isTorrent( tor ) ); assert( tr_isTorrent( tor ) );