aboutsummaryrefslogtreecommitdiff
path: root/lib/progress.c
diff options
context:
space:
mode:
authorDaniel Stenberg <daniel@haxx.se>2004-01-27 12:25:37 +0000
committerDaniel Stenberg <daniel@haxx.se>2004-01-27 12:25:37 +0000
commite0960727453034ac3e01e20007a9c1b261d1d135 (patch)
tree1b5f11f045698d6bcd6543bbad6b6398c7514ae6 /lib/progress.c
parent5d947e973e770241ca9a5f685d0ca42a2ae4668b (diff)
very big transfers now get nicer progress displayed after 9999 megabytes have
been transfered!
Diffstat (limited to 'lib/progress.c')
-rw-r--r--lib/progress.c11
1 files changed, 11 insertions, 0 deletions
diff --git a/lib/progress.c b/lib/progress.c
index 972629c64..b22f4a70b 100644
--- a/lib/progress.c
+++ b/lib/progress.c
@@ -57,6 +57,7 @@ static char *max5data(double bytes, char *max5)
{
#define ONE_KILOBYTE 1024
#define ONE_MEGABYTE (1024*1024)
+#define ONE_GIGABYTE (1024*1024*1024)
if(bytes < 100000) {
sprintf(max5, "%5Od", (curl_off_t)bytes);
@@ -71,7 +72,17 @@ static char *max5data(double bytes, char *max5)
sprintf(max5, "%4.1fM", bytes/ONE_MEGABYTE);
return max5;
}
+#if SIZEOF_CURL_OFF_T > 4
+ if((curl_off_t)bytes < ((curl_off_t)10000*ONE_MEGABYTE)) {
+ sprintf(max5, "%4OdM", (curl_off_t)bytes/ONE_MEGABYTE);
+ return max5;
+ }
+ /* 10000 MB - 8589934587 GB !! */
+ sprintf(max5, "%4.1fG", bytes/ONE_GIGABYTE);
+#else
sprintf(max5, "%4OdM", (curl_off_t)bytes/ONE_MEGABYTE);
+#endif
+
return max5;
}