summaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
authorRuediger Meier2016-02-09 18:08:56 +0100
committerRuediger Meier2016-02-11 13:39:56 +0100
commit7231fb2a5b0b0ebf2be047a23a11ca43e786861b (patch)
tree2467d1d110e0699a65a36636e173a132e1233751 /lib
parentinclude: add missing includes (diff)
downloadkernel-qcow2-util-linux-7231fb2a5b0b0ebf2be047a23a11ca43e786861b.tar.gz
kernel-qcow2-util-linux-7231fb2a5b0b0ebf2be047a23a11ca43e786861b.tar.xz
kernel-qcow2-util-linux-7231fb2a5b0b0ebf2be047a23a11ca43e786861b.zip
misc: fix some printf format strings
Fix the warnings below for OSX clang and add a few more casts for timeval: lib/at.c:131:27: warning: format specifies type 'intmax_t' (aka 'long') but the argument has type 'off_t' (aka 'long long') [-Wformat] printf("%16jd bytes ", st.st_size); ~~~~~ ^~~~~~~~~~ lib/strutils.c:522:52: warning: format specifies type 'intmax_t' (aka 'long') but the argument has type 'uint64_t' (aka 'unsigned long long') [-Wformat] snprintf(buf, sizeof(buf), "%d%s%jd%s", dec, dp, frac, suffix); ~~~ ^~~~ lib/sysfs.c:468:42: warning: format specifies type 'uintmax_t' (aka 'unsigned long') but the argument has type 'uint64_t' (aka 'unsigned long long') [-Wformat] len = snprintf(buf, sizeof(buf), "%ju", num); ~~~ ^~~ libuuid/src/gen_uuid.c:316:34: warning: format specifies type 'unsigned long' but the argument has type '__darwin_suseconds_t' (aka 'int') [-Wformat] clock_seq, last.tv_sec, last.tv_usec, adjustment); ^~~~~~~~~~~~ Signed-off-by: Ruediger Meier <ruediger.meier@ga-group.nl>
Diffstat (limited to 'lib')
-rw-r--r--lib/at.c2
-rw-r--r--lib/strutils.c2
-rw-r--r--lib/sysfs.c2
3 files changed, 3 insertions, 3 deletions
diff --git a/lib/at.c b/lib/at.c
index f8bfe1399..26f5ab95f 100644
--- a/lib/at.c
+++ b/lib/at.c
@@ -128,7 +128,7 @@ int main(int argc, char *argv[])
printf("%32s ", d->d_name);
if (fstat_at(dirfd(dir), dirname, d->d_name, &st, 0) == 0)
- printf("%16jd bytes ", st.st_size);
+ printf("%16zd bytes ", st.st_size);
else
printf("%16s bytes ", "???");
diff --git a/lib/strutils.c b/lib/strutils.c
index 30dc090b4..ac59de8ee 100644
--- a/lib/strutils.c
+++ b/lib/strutils.c
@@ -519,7 +519,7 @@ char *size_to_human_string(int options, uint64_t bytes)
if (!dp || !*dp)
dp = ".";
- snprintf(buf, sizeof(buf), "%d%s%jd%s", dec, dp, frac, suffix);
+ snprintf(buf, sizeof(buf), "%d%s%" PRIu64 "%s", dec, dp, frac, suffix);
} else
snprintf(buf, sizeof(buf), "%d%s", dec, suffix);
diff --git a/lib/sysfs.c b/lib/sysfs.c
index ade219eb9..53aba3af9 100644
--- a/lib/sysfs.c
+++ b/lib/sysfs.c
@@ -462,7 +462,7 @@ int sysfs_write_u64(struct sysfs_cxt *cxt, const char *attr, uint64_t num)
if (fd < 0)
return -errno;
- len = snprintf(buf, sizeof(buf), "%ju", num);
+ len = snprintf(buf, sizeof(buf), "%" PRIu64, num);
if (len < 0 || (size_t) len + 1 > sizeof(buf))
rc = -errno;
else