From 30c92232951e58903e5ba0bd3e84d7d776d38b05 Mon Sep 17 00:00:00 2001 From: Charles Kerr Date: Wed, 9 Jul 2008 15:16:43 +0000 Subject: [PATCH] (daemon) fix bug in the --list command's ratio display --- daemon/remote.c | 21 ++++++++++++--------- 1 file changed, 12 insertions(+), 9 deletions(-) diff --git a/daemon/remote.c b/daemon/remote.c index 6a5a3a72b..3f0b42473 100644 --- a/daemon/remote.c +++ b/daemon/remote.c @@ -31,7 +31,7 @@ #define DEFAULT_HOST "localhost" #define DEFAULT_PORT TR_DEFAULT_RPC_PORT -enum { TAG_LIST, TAG_DETAILS, TAG_FILES, TAG_PEERS }; +enum { TAG_LIST, TAG_DETAILS, TAG_FILES }; static const char* getUsage( void ) @@ -153,9 +153,9 @@ readargs( int argc, const char ** argv ) { case TR_OPT_UNK: if( addingTorrents ) { - char * tmp; + char * tmp = getEncodedMetainfo( optarg ); tr_bencDictAddStr( &top, "method", "torrent-add" ); - tr_bencDictAddStr( args, "metainfo", ((tmp=getEncodedMetainfo(optarg))) ); + tr_bencDictAddStr( args, "metainfo", tmp ); tr_free( tmp ); } else { fprintf( stderr, "Unknown option: %s\n", optarg ); @@ -204,6 +204,7 @@ readargs( int argc, const char ** argv ) tr_bencDictAddInt( &top, "tag", TAG_LIST ); fields = TR_RPC_TORRENT_FIELD_ID | TR_RPC_TORRENT_FIELD_ACTIVITY + | TR_RPC_TORRENT_FIELD_HISTORY | TR_RPC_TORRENT_FIELD_SIZE; tr_bencDictAddInt( args, "fields", fields ); break; @@ -412,9 +413,7 @@ printDetails( tr_benc * top ) if( tr_bencDictFindInt( t, "rateDownload", &i ) ) printf( " Download Speed: %.1f KB/s\n", i/1024.0 ); if( tr_bencDictFindInt( t, "rateUpload", &i ) ) - { printf( " Upload Speed: %.1f KB/s\n", i/1024.0 ); - } if( tr_bencDictFindInt( t, "haveUnchecked", &i ) && tr_bencDictFindInt( t, "haveValid", &j ) ) { @@ -583,17 +582,21 @@ printTorrentList( tr_benc * top ) "ID", "Done", "ETA", "Up", "Down", "Ratio", "Status", "Name" ); for( i=0, n=tr_bencListSize( list ); i