From 4ea542b41a5d677c3c91b883c935c1930a5bede4 Mon Sep 17 00:00:00 2001 From: Tim Rice Date: Sun, 19 Jan 2003 20:15:13 -0800 Subject: [PATCH] [progressmeter.c] make compilers without long long happy. --- ChangeLog | 3 ++- progressmeter.c | 17 +++++++++++++++++ 2 files changed, 19 insertions(+), 1 deletion(-) diff --git a/ChangeLog b/ChangeLog index 2f9adb864..23230b5d4 100644 --- a/ChangeLog +++ b/ChangeLog @@ -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 $ diff --git a/progressmeter.c b/progressmeter.c index e7380a8ff..948d361d2 100644 --- a/progressmeter.c +++ b/progressmeter.c @@ -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),