(trunk daemon) fix rounding error in transmission-remote display. Patch by wereHamster

This commit is contained in:
Charles Kerr 2009-04-22 21:00:52 +00:00
parent 08fe5351eb
commit cae89d9b2a
1 changed files with 3 additions and 2 deletions

View File

@ -11,6 +11,7 @@
*/
#include <errno.h>
#include <math.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h> /* strcmp */
@ -736,7 +737,7 @@ getStatusString( tr_benc * t, char * buf, size_t buflen )
: "Verifying";
double percent;
if( tr_bencDictFindReal( t, "recheckProgress", &percent ) )
tr_snprintf( buf, buflen, "%s (%.0f%%)", str, percent*100.0 );
tr_snprintf( buf, buflen, "%s (%.0f%%)", str, floor(percent*100.0) );
else
tr_strlcpy( buf, str, buflen );
@ -1082,7 +1083,7 @@ printFileList( tr_benc * top )
}
printf( "%3d: %3.0f%% %-8s %-3s %9s %s\n",
j,
( 100.0 * percent ),
floor( 100.0 * percent ),
pristr,
( wanted ? "Yes" : "No" ),
sizestr,