diff --git a/libtransmission/platform.c b/libtransmission/platform.c index d24afe532..e90dacf3f 100644 --- a/libtransmission/platform.c +++ b/libtransmission/platform.c @@ -69,14 +69,13 @@ tr_getCurrentThread( void ) #endif } -static int -tr_areThreadsEqual( tr_thread_id a, - tr_thread_id b ) +static tr_bool +tr_areThreadsEqual( tr_thread_id a, tr_thread_id b ) { #ifdef WIN32 return a == b; #else - return pthread_equal( a, b ); + return pthread_equal( a, b ) != 0; #endif } @@ -91,7 +90,7 @@ struct tr_thread #endif }; -int +tr_bool tr_amInThread( const tr_thread * t ) { return tr_areThreadsEqual( tr_getCurrentThread( ), t->thread ); diff --git a/libtransmission/platform.h b/libtransmission/platform.h index 5990598e0..dae995e2e 100644 --- a/libtransmission/platform.h +++ b/libtransmission/platform.h @@ -74,7 +74,7 @@ tr_thread* tr_threadNew( void ( *func )(void *), void * arg ); /** @brief Return nonzero if this function is being called from `thread' @param thread the thread being tested */ -int tr_amInThread( const tr_thread * ); +tr_bool tr_amInThread( const tr_thread * ); /*** **** diff --git a/libtransmission/torrent.c b/libtransmission/torrent.c index ea9cb448b..870694ada 100644 --- a/libtransmission/torrent.c +++ b/libtransmission/torrent.c @@ -1172,7 +1172,7 @@ tr_torrentFiles( const tr_torrent * tor, for( i=0; iinfo.files[i].length : fileBytesCompleted( tor, i ); 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 ) @@ -1842,8 +1842,10 @@ setFileDND( tr_torrent * tor, tr_file_index_t fileIndex, int doDownload ) { tr_file * file; const int8_t dnd = !doDownload; - tr_piece_index_t firstPiece, firstPieceDND; - tr_piece_index_t lastPiece, lastPieceDND; + tr_piece_index_t firstPiece; + int8_t firstPieceDND; + tr_piece_index_t lastPiece; + int8_t lastPieceDND; tr_file_index_t i; assert( tr_isTorrent( tor ) );