[experimental-ims] fb3cc4b Make fmt_bytes take an uintmax_t

Geoff Simmons geoff at varnish-cache.org
Tue Feb 14 17:49:29 CET 2012


commit fb3cc4b53a61b1ca404eb4885e09f497aee00998
Author: Poul-Henning Kamp <phk at FreeBSD.org>
Date:   Mon Feb 13 10:19:26 2012 +0000

    Make fmt_bytes take an uintmax_t

diff --git a/bin/varnishd/mgt/mgt_param.c b/bin/varnishd/mgt/mgt_param.c
index ff523b1..f32cc0e 100644
--- a/bin/varnishd/mgt/mgt_param.c
+++ b/bin/varnishd/mgt/mgt_param.c
@@ -283,7 +283,7 @@ tweak_uint(struct cli *cli, const struct parspec *par, const char *arg)
 /*--------------------------------------------------------------------*/
 
 static void
-fmt_bytes(struct cli *cli, ssize_t t)
+fmt_bytes(struct cli *cli, uintmax_t t)
 {
 	const char *p;
 
@@ -298,7 +298,7 @@ fmt_bytes(struct cli *cli, ssize_t t)
 		}
 		t /= 1024;
 		if (t & 0x0ff) {
-			VCLI_Out(cli, "%zu%c", t, *p);
+			VCLI_Out(cli, "%ju%c", t, *p);
 			return;
 		}
 	}
@@ -324,14 +324,14 @@ tweak_generic_bytes(struct cli *cli, volatile ssize_t *dest, const char *arg,
 		}
 		if ((uintmax_t)((ssize_t)r) != r || r > max) {
 			VCLI_Out(cli, "Must be no more than ");
-			fmt_bytes(cli, (ssize_t)max);
+			fmt_bytes(cli, (uintmax_t)max);
 			VCLI_Out(cli, "\n");
 			VCLI_SetResult(cli, CLIS_PARAM);
 			return;
 		}
 		if (r < min) {
 			VCLI_Out(cli, "Must be at least ");
-			fmt_bytes(cli, (ssize_t)min);
+			fmt_bytes(cli, (uintmax_t)min);
 			VCLI_Out(cli, "\n");
 			VCLI_SetResult(cli, CLIS_PARAM);
 			return;



More information about the varnish-commit mailing list