1
0
mirror of https://git.tartarus.org/simon/putty.git synced 2025-04-09 23:28:06 -05:00

Fix potential float screwup in scp percentage indicator. (Don't

compute (100*a)/b. Instead compute 100*(a/b), because that way
there's no chance that 100*a will become inexact enough to fail to
yield 100 when a==b.)

[originally from svn r1254]
This commit is contained in:
Simon Tatham 2001-09-08 15:16:30 +00:00
parent b12f450964
commit b5dcdf7fc8

2
scp.c
View File

@ -649,7 +649,7 @@ static void print_stats(char *name, unsigned long size, unsigned long done,
sprintf(etastr, "%02ld:%02ld:%02ld",
eta / 3600, (eta % 3600) / 60, eta % 60);
pct = (int) (100.0 * (float) done / size);
pct = (int) (100 * (done * 1.0 / size));
len = printf("\r%-25.25s | %10ld kB | %5.1f kB/s | ETA: %8s | %3d%%",
name, done / 1024, ratebs / 1024.0, etastr, pct);