From 327f550669a80d72f36bc9e4de619c163aa46eff Mon Sep 17 00:00:00 2001 From: Denys Vlasenko Date: Fri, 29 Nov 2013 16:45:45 +0100 Subject: Use unsigned printf/scanf conversion where more appropriate Signed-off-by: Denys Vlasenko --- util-linux/fdformat.c | 2 +- util-linux/fsck_minix.c | 2 +- util-linux/ipcs.c | 10 +++++----- util-linux/mkfs_minix.c | 2 +- util-linux/readprofile.c | 12 ++++++------ 5 files changed, 14 insertions(+), 14 deletions(-) (limited to 'util-linux') diff --git a/util-linux/fdformat.c b/util-linux/fdformat.c index b3e918fb0..6f49cec8f 100644 --- a/util-linux/fdformat.c +++ b/util-linux/fdformat.c @@ -72,7 +72,7 @@ int fdformat_main(int argc UNUSED_PARAM, char **argv) /* original message was: "Could not determine current format type" */ xioctl(fd, FDGETPRM, ¶m); - printf("%s-sided, %d tracks, %d sec/track. Total capacity %d kB\n", + printf("%s-sided, %u tracks, %u sec/track. Total capacity %d kB\n", (param.head == 2) ? "Double" : "Single", param.track, param.sect, param.size >> 1); diff --git a/util-linux/fsck_minix.c b/util-linux/fsck_minix.c index c1d1b2cc3..33767a1af 100644 --- a/util-linux/fsck_minix.c +++ b/util-linux/fsck_minix.c @@ -686,7 +686,7 @@ static void get_inode_common(unsigned nr, uint16_t i_mode) total++; if (!inode_count[nr]) { if (!inode_in_use(nr)) { - printf("Inode %d is marked as 'unused', but it is used " + printf("Inode %u is marked as 'unused', but it is used " "for file '%s'\n", nr, current_name); if (OPT_repair) { if (ask("Mark as 'in use'", 1)) diff --git a/util-linux/ipcs.c b/util-linux/ipcs.c index 2668cafd4..67a25a8ef 100644 --- a/util-linux/ipcs.c +++ b/util-linux/ipcs.c @@ -166,10 +166,10 @@ static NOINLINE void do_shm(void) case STATUS: printf("------ Shared Memory %s --------\n", "Status"); printf("segments allocated %d\n" - "pages allocated %ld\n" - "pages resident %ld\n" - "pages swapped %ld\n" - "Swap performance: %ld attempts\t%ld successes\n", + "pages allocated %lu\n" + "pages resident %lu\n" + "pages swapped %lu\n" + "Swap performance: %lu attempts\t%lu successes\n", shm_info.used_ids, shm_info.shm_tot, shm_info.shm_rss, @@ -569,7 +569,7 @@ static void print_sem(int semid) if (val < 0 || ncnt < 0 || zcnt < 0 || pid < 0) { bb_perror_msg_and_die("semctl"); } - printf("%-10d %-10d %-10d %-10d %-10d\n", i, val, ncnt, zcnt, pid); + printf("%-10u %-10d %-10d %-10d %-10d\n", i, val, ncnt, zcnt, pid); } bb_putchar('\n'); } diff --git a/util-linux/mkfs_minix.c b/util-linux/mkfs_minix.c index 49afd1176..d65a5161c 100644 --- a/util-linux/mkfs_minix.c +++ b/util-linux/mkfs_minix.c @@ -505,7 +505,7 @@ static void get_list_blocks(char *filename) listfile = xfopen_for_read(filename); while (!feof(listfile)) { - fscanf(listfile, "%ld\n", &blockno); + fscanf(listfile, "%lu\n", &blockno); mark_zone(blockno); G.badblocks++; } diff --git a/util-linux/readprofile.c b/util-linux/readprofile.c index 974fe89c4..a64540464 100644 --- a/util-linux/readprofile.c +++ b/util-linux/readprofile.c @@ -152,7 +152,7 @@ int readprofile_main(int argc UNUSED_PARAM, char **argv) step = buf[0]; if (optInfo) { - printf("Sampling_step: %i\n", step); + printf("Sampling_step: %u\n", step); return EXIT_SUCCESS; } @@ -219,10 +219,10 @@ int readprofile_main(int argc UNUSED_PARAM, char **argv) && (fn_len = next_add-fn_add) != 0 ) { if (optVerbose) - printf("%016llx %-40s %6i %8.4f\n", fn_add, + printf("%016llx %-40s %6u %8.4f\n", fn_add, fn_name, this, this/(double)fn_len); else - printf("%6i %-40s %8.4f\n", + printf("%6u %-40s %8.4f\n", this, fn_name, this/(double)fn_len); if (optSub) { unsigned long long scan; @@ -246,14 +246,14 @@ int readprofile_main(int argc UNUSED_PARAM, char **argv) } /* clock ticks, out of kernel text - probably modules */ - printf("%6i %s\n", buf[len/sizeof(*buf)-1], "*unknown*"); + printf("%6u %s\n", buf[len/sizeof(*buf)-1], "*unknown*"); /* trailer */ if (optVerbose) - printf("%016x %-40s %6i %8.4f\n", + printf("%016x %-40s %6u %8.4f\n", 0, "total", total, total/(double)(fn_add-add0)); else - printf("%6i %-40s %8.4f\n", + printf("%6u %-40s %8.4f\n", total, "total", total/(double)(fn_add-add0)); fclose(map); -- cgit v1.2.3