From 8bc8da2577c0f0c3b4f33b3190de57a2b4d13a24 Mon Sep 17 00:00:00 2001 From: Ron Yorston Date: Tue, 13 Feb 2018 13:03:51 +0000 Subject: du: use Windows-compatible print formats Commit 18afed0f9 replaced %ll* formats with Windows equivalents to silence compiler warnings. Some format strings in du were missed because they weren't compiled or weren't string literals. These fixes make 'du -h' work as expected on Windows XP. --- libbb/human_readable.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'libbb') diff --git a/libbb/human_readable.c b/libbb/human_readable.c index 09221a186..3199ede6e 100644 --- a/libbb/human_readable.c +++ b/libbb/human_readable.c @@ -38,7 +38,7 @@ const char* FAST_FUNC make_human_readable_str(unsigned long long val, if (val == 0) return "0"; - fmt = "%llu"; + fmt = "%"LL_FMT"u"; if (block_size > 1) val *= block_size; frac = 0; @@ -52,7 +52,7 @@ const char* FAST_FUNC make_human_readable_str(unsigned long long val, while ((val >= 1024) /* && (u < unit_chars + sizeof(unit_chars) - 1) - always true */ ) { - fmt = "%llu.%u%c"; + fmt = "%"LL_FMT"u.%u%c"; u++; frac = (((unsigned)val % 1024) * 10 + 1024/2) / 1024; val /= 1024; @@ -67,7 +67,7 @@ const char* FAST_FUNC make_human_readable_str(unsigned long long val, if (frac >= 5) { ++val; } - fmt = "%llu%*c"; + fmt = "%"LL_FMT"u%*c"; frac = 1; } #endif -- cgit v1.2.3-55-g6feb