mirror of
https://github.com/transmission/transmission
synced 2024-12-23 00:04:06 +00:00
(trunk daemon) fix rounding error in transmission-remote display. Patch by wereHamster
This commit is contained in:
parent
08fe5351eb
commit
cae89d9b2a
1 changed files with 3 additions and 2 deletions
|
@ -11,6 +11,7 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
|
#include <math.h>
|
||||||
#include <stdio.h>
|
#include <stdio.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <string.h> /* strcmp */
|
#include <string.h> /* strcmp */
|
||||||
|
@ -736,7 +737,7 @@ getStatusString( tr_benc * t, char * buf, size_t buflen )
|
||||||
: "Verifying";
|
: "Verifying";
|
||||||
double percent;
|
double percent;
|
||||||
if( tr_bencDictFindReal( t, "recheckProgress", &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
|
else
|
||||||
tr_strlcpy( buf, str, buflen );
|
tr_strlcpy( buf, str, buflen );
|
||||||
|
|
||||||
|
@ -1082,7 +1083,7 @@ printFileList( tr_benc * top )
|
||||||
}
|
}
|
||||||
printf( "%3d: %3.0f%% %-8s %-3s %9s %s\n",
|
printf( "%3d: %3.0f%% %-8s %-3s %9s %s\n",
|
||||||
j,
|
j,
|
||||||
( 100.0 * percent ),
|
floor( 100.0 * percent ),
|
||||||
pristr,
|
pristr,
|
||||||
( wanted ? "Yes" : "No" ),
|
( wanted ? "Yes" : "No" ),
|
||||||
sizestr,
|
sizestr,
|
||||||
|
|
Loading…
Reference in a new issue