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>
This commit is contained in:
parent
948d1f3114
commit
7231fb2a5b
7 changed files with 20 additions and 19 deletions
|
@ -591,26 +591,26 @@ static void print_stats(struct fsck_instance *inst)
|
||||||
|
|
||||||
if (report_stats_file)
|
if (report_stats_file)
|
||||||
fprintf(report_stats_file, "%s %d %ld "
|
fprintf(report_stats_file, "%s %d %ld "
|
||||||
"%ld.%06ld %d.%06d %d.%06d\n",
|
"%ld.%06ld %ld.%06ld %ld.%06ld\n",
|
||||||
fs_get_device(inst->fs),
|
fs_get_device(inst->fs),
|
||||||
inst->exit_status,
|
inst->exit_status,
|
||||||
inst->rusage.ru_maxrss,
|
inst->rusage.ru_maxrss,
|
||||||
delta.tv_sec, delta.tv_usec,
|
(long)delta.tv_sec, (long)delta.tv_usec,
|
||||||
(int)inst->rusage.ru_utime.tv_sec,
|
(long)inst->rusage.ru_utime.tv_sec,
|
||||||
(int)inst->rusage.ru_utime.tv_usec,
|
(long)inst->rusage.ru_utime.tv_usec,
|
||||||
(int)inst->rusage.ru_stime.tv_sec,
|
(long)inst->rusage.ru_stime.tv_sec,
|
||||||
(int)inst->rusage.ru_stime.tv_usec);
|
(long)inst->rusage.ru_stime.tv_usec);
|
||||||
else
|
else
|
||||||
fprintf(stdout, "%s: status %d, rss %ld, "
|
fprintf(stdout, "%s: status %d, rss %ld, "
|
||||||
"real %ld.%06ld, user %d.%06d, sys %d.%06d\n",
|
"real %ld.%06ld, user %ld.%06ld, sys %ld.%06ld\n",
|
||||||
fs_get_device(inst->fs),
|
fs_get_device(inst->fs),
|
||||||
inst->exit_status,
|
inst->exit_status,
|
||||||
inst->rusage.ru_maxrss,
|
inst->rusage.ru_maxrss,
|
||||||
delta.tv_sec, delta.tv_usec,
|
(long)delta.tv_sec, (long)delta.tv_usec,
|
||||||
(int)inst->rusage.ru_utime.tv_sec,
|
(long)inst->rusage.ru_utime.tv_sec,
|
||||||
(int)inst->rusage.ru_utime.tv_usec,
|
(long)inst->rusage.ru_utime.tv_usec,
|
||||||
(int)inst->rusage.ru_stime.tv_sec,
|
(long)inst->rusage.ru_stime.tv_sec,
|
||||||
(int)inst->rusage.ru_stime.tv_usec);
|
(long)inst->rusage.ru_stime.tv_usec);
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
|
2
lib/at.c
2
lib/at.c
|
@ -128,7 +128,7 @@ int main(int argc, char *argv[])
|
||||||
printf("%32s ", d->d_name);
|
printf("%32s ", d->d_name);
|
||||||
|
|
||||||
if (fstat_at(dirfd(dir), dirname, d->d_name, &st, 0) == 0)
|
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
|
else
|
||||||
printf("%16s bytes ", "???");
|
printf("%16s bytes ", "???");
|
||||||
|
|
||||||
|
|
|
@ -519,7 +519,7 @@ char *size_to_human_string(int options, uint64_t bytes)
|
||||||
|
|
||||||
if (!dp || !*dp)
|
if (!dp || !*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
|
} else
|
||||||
snprintf(buf, sizeof(buf), "%d%s", dec, suffix);
|
snprintf(buf, sizeof(buf), "%d%s", dec, suffix);
|
||||||
|
|
||||||
|
|
|
@ -462,7 +462,7 @@ int sysfs_write_u64(struct sysfs_cxt *cxt, const char *attr, uint64_t num)
|
||||||
if (fd < 0)
|
if (fd < 0)
|
||||||
return -errno;
|
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))
|
if (len < 0 || (size_t) len + 1 > sizeof(buf))
|
||||||
rc = -errno;
|
rc = -errno;
|
||||||
else
|
else
|
||||||
|
|
|
@ -312,8 +312,8 @@ try_again:
|
||||||
if (state_fd >= 0) {
|
if (state_fd >= 0) {
|
||||||
rewind(state_f);
|
rewind(state_f);
|
||||||
len = fprintf(state_f,
|
len = fprintf(state_f,
|
||||||
"clock: %04x tv: %016lu %08lu adj: %08d\n",
|
"clock: %04x tv: %016ld %08ld adj: %08d\n",
|
||||||
clock_seq, last.tv_sec, last.tv_usec, adjustment);
|
clock_seq, (long)last.tv_sec, (long)last.tv_usec, adjustment);
|
||||||
fflush(state_f);
|
fflush(state_f);
|
||||||
if (ftruncate(state_fd, len) < 0) {
|
if (ftruncate(state_fd, len) < 0) {
|
||||||
fprintf(state_f, " \n");
|
fprintf(state_f, " \n");
|
||||||
|
|
|
@ -163,7 +163,7 @@ main(int argc, char **argv)
|
||||||
printf("Warning: not a time-based UUID, so UUID time "
|
printf("Warning: not a time-based UUID, so UUID time "
|
||||||
"decoding will likely not work!\n");
|
"decoding will likely not work!\n");
|
||||||
}
|
}
|
||||||
printf("UUID time is: (%ld, %ld): %s\n", tv.tv_sec, tv.tv_usec,
|
printf("UUID time is: (%ld, %ld): %s\n", (long)tv.tv_sec, (long)tv.tv_usec,
|
||||||
ctime(&time_reg));
|
ctime(&time_reg));
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
|
|
|
@ -249,7 +249,8 @@ static void write_output(struct script_control *ctl, char *obuf,
|
||||||
|
|
||||||
gettime_monotonic(&now);
|
gettime_monotonic(&now);
|
||||||
timersub(&now, &ctl->oldtime, &delta);
|
timersub(&now, &ctl->oldtime, &delta);
|
||||||
fprintf(ctl->timingfp, "%ld.%06ld %zd\n", delta.tv_sec, delta.tv_usec, bytes);
|
fprintf(ctl->timingfp, "%ld.%06ld %zd\n",
|
||||||
|
(long)delta.tv_sec, (long)delta.tv_usec, bytes);
|
||||||
if (ctl->flush)
|
if (ctl->flush)
|
||||||
fflush(ctl->timingfp);
|
fflush(ctl->timingfp);
|
||||||
ctl->oldtime = now;
|
ctl->oldtime = now;
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue