Do not assume int64_t is printable with %qd - on 64 bit ports it isn't.
Use %lld instead and cast the args to (long long) explicitly. I'm not sure about our policy vs. the C99 format string macros in basesrc - should we use those here?
This commit is contained in:
parent
19ad2640ac
commit
ab77398ff9
@ -39,7 +39,7 @@
|
|||||||
#ifndef __lint
|
#ifndef __lint
|
||||||
__COPYRIGHT("@(#) Copyright (c) 2002\n\
|
__COPYRIGHT("@(#) Copyright (c) 2002\n\
|
||||||
The NetBSD Foundation, inc. All rights reserved.\n");
|
The NetBSD Foundation, inc. All rights reserved.\n");
|
||||||
__RCSID("$NetBSD: humanize_number.c,v 1.1 2002/08/08 16:50:39 abs Exp $");
|
__RCSID("$NetBSD: humanize_number.c,v 1.2 2002/08/12 09:06:59 martin Exp $");
|
||||||
#endif /* !__lint */
|
#endif /* !__lint */
|
||||||
|
|
||||||
#include <assert.h>
|
#include <assert.h>
|
||||||
@ -117,14 +117,14 @@ humanize_number(char *buf, size_t len, int64_t bytes,
|
|||||||
s1++;
|
s1++;
|
||||||
s2 = 0;
|
s2 = 0;
|
||||||
}
|
}
|
||||||
r = snprintf(buf, len, "%qd%s%qd%s%c%s", sign * s1,
|
r = snprintf(buf, len, "%lld%s%lld%s%c%s", (long long)(sign * s1),
|
||||||
localeconv()->decimal_point, s2,
|
localeconv()->decimal_point, (long long)s2,
|
||||||
(i == 0 && !(flags & HN_B) ) || flags & HN_NOSPACE ?
|
(i == 0 && !(flags & HN_B) ) || flags & HN_NOSPACE ?
|
||||||
"" : " ", (i == 0 && (flags & HN_B)) ? 'B' :
|
"" : " ", (i == 0 && (flags & HN_B)) ? 'B' :
|
||||||
prefixes[i], suffix);
|
prefixes[i], suffix);
|
||||||
|
|
||||||
} else
|
} else
|
||||||
r = snprintf(buf, len, "%qd%s%c%s", sign * ((bytes + 50) / 100),
|
r = snprintf(buf, len, "%lld%s%c%s", (long long)(sign * ((bytes + 50) / 100)),
|
||||||
i == 0 || flags & HN_NOSPACE ? "" : " ", (i == 0 &&
|
i == 0 || flags & HN_NOSPACE ? "" : " ", (i == 0 &&
|
||||||
(flags & HN_B)) ? 'B' : prefixes[i], suffix);
|
(flags & HN_B)) ? 'B' : prefixes[i], suffix);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user