aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorRon Yorston <rmy@pobox.com>2018-02-13 13:03:51 +0000
committerRon Yorston <rmy@pobox.com>2018-02-13 13:03:51 +0000
commit8bc8da2577c0f0c3b4f33b3190de57a2b4d13a24 (patch)
tree634adeb1170b0a498affb74f164c0fb138edc1f6
parent834805db9fe525dff26267fb7ba2794cee3ed51a (diff)
downloadbusybox-w32-8bc8da2577c0f0c3b4f33b3190de57a2b4d13a24.tar.gz
busybox-w32-8bc8da2577c0f0c3b4f33b3190de57a2b4d13a24.tar.bz2
busybox-w32-8bc8da2577c0f0c3b4f33b3190de57a2b4d13a24.zip
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.
-rw-r--r--coreutils/du.c2
-rw-r--r--libbb/human_readable.c6
2 files changed, 4 insertions, 4 deletions
diff --git a/coreutils/du.c b/coreutils/du.c
index d5ce46cf2..a0c99040e 100644
--- a/coreutils/du.c
+++ b/coreutils/du.c
@@ -133,7 +133,7 @@ static void print(unsigned long long size, const char *filename)
133 size++; 133 size++;
134 size >>= 1; 134 size >>= 1;
135 } 135 }
136 printf("%llu\t%s\n", size, filename); 136 printf("%"LL_FMT"u\t%s\n", size, filename);
137#endif 137#endif
138} 138}
139 139
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,
38 if (val == 0) 38 if (val == 0)
39 return "0"; 39 return "0";
40 40
41 fmt = "%llu"; 41 fmt = "%"LL_FMT"u";
42 if (block_size > 1) 42 if (block_size > 1)
43 val *= block_size; 43 val *= block_size;
44 frac = 0; 44 frac = 0;
@@ -52,7 +52,7 @@ const char* FAST_FUNC make_human_readable_str(unsigned long long val,
52 while ((val >= 1024) 52 while ((val >= 1024)
53 /* && (u < unit_chars + sizeof(unit_chars) - 1) - always true */ 53 /* && (u < unit_chars + sizeof(unit_chars) - 1) - always true */
54 ) { 54 ) {
55 fmt = "%llu.%u%c"; 55 fmt = "%"LL_FMT"u.%u%c";
56 u++; 56 u++;
57 frac = (((unsigned)val % 1024) * 10 + 1024/2) / 1024; 57 frac = (((unsigned)val % 1024) * 10 + 1024/2) / 1024;
58 val /= 1024; 58 val /= 1024;
@@ -67,7 +67,7 @@ const char* FAST_FUNC make_human_readable_str(unsigned long long val,
67 if (frac >= 5) { 67 if (frac >= 5) {
68 ++val; 68 ++val;
69 } 69 }
70 fmt = "%llu%*c"; 70 fmt = "%"LL_FMT"u%*c";
71 frac = 1; 71 frac = 1;
72 } 72 }
73#endif 73#endif