[progressmeter.c] make compilers without long long happy.

This commit is contained in:
Tim Rice 2003-01-19 20:15:13 -08:00
parent 140344b809
commit 4ea542b41a
2 changed files with 19 additions and 1 deletions

View File

@ -1,5 +1,6 @@
20030120
- (djm) Fix compilation for NetBSD from dtucker@zip.com.au
- (tim) [progressmeter.c] make compilers without long long happy.
20030118
- (djm) Revert fix for Bug #442 for now.
@ -1037,4 +1038,4 @@
save auth method before monitor_reset_key_state(); bugzilla bug #284;
ok provos@
$Id: ChangeLog,v 1.2576 2003/01/20 02:15:10 djm Exp $
$Id: ChangeLog,v 1.2577 2003/01/20 04:15:13 tim Exp $

View File

@ -203,6 +203,7 @@ draw_progress_meter()
nspaces = MIN(get_tty_width() - 79, sizeof(spaces) - 1);
#ifdef HAVE_LONG_LONG_INT
snprintf(buf, sizeof(buf),
"\r%-45.45s%.*s%3d%% %4lld%c%c %3lld.%01d%cB/s",
curfile,
@ -216,6 +217,22 @@ draw_progress_meter()
(int)((bytespersec % 1024) * 10 / 1024),
prefixes[bi]
);
#else
/* XXX: Handle integer overflow? */
snprintf(buf, sizeof(buf),
"\r%-45.45s%.*s%3d%% %4lu%c%c %3lu.%01d%cB/s",
curfile,
nspaces,
spaces,
ratio,
(u_long)abbrevsize,
prefixes[ai],
ai == 0 ? ' ' : 'B',
(u_long)(bytespersec / 1024),
(int)((bytespersec % 1024) * 10 / 1024),
prefixes[bi]
);
#endif
if (cursize <= 0 || elapsed <= 0.0 || cursize > totalbytes) {
snprintf(buf + strlen(buf), sizeof(buf) - strlen(buf),