Fix format statements to make e2fsprogs programs 32-bit clean

Change the format string(%d, %ld) for a block number and inode number
to %u or %lu.

Signed-off-by: Takashi Sato <sho@tnes.nec.co.jp>
Signed-off-by: "Theodore Ts'o" <tytso@mit.edu>


diff --git a/debugfs/ChangeLog b/debugfs/ChangeLog
index 83844ed..d71f6d8 100644
--- a/debugfs/ChangeLog
+++ b/debugfs/ChangeLog
@@ -1,5 +1,8 @@
 2006-03-18  Theodore Ts'o  <tytso@mit.edu>
 
+	* debugfs.c, htree.c, unused.c: Change printf statements to use
+		%u instead of %d when printing block numbers.
+
 	* debugfs.c (do_open_filesys), debugfs.8.in: Add the -e option to
 		the open_filesystem command, which requests that the
 		filesystem be opened in exclusive mode.
diff --git a/debugfs/debugfs.c b/debugfs/debugfs.c
index 992a2b7..12ef00c 100644
--- a/debugfs/debugfs.c
+++ b/debugfs/debugfs.c
@@ -303,9 +303,9 @@
 	
 	gdp = &current_fs->group_desc[0];
 	for (i = 0; i < current_fs->group_desc_count; i++, gdp++)
-		fprintf(out, " Group %2d: block bitmap at %d, "
-		        "inode bitmap at %d, "
-		        "inode table at %d\n"
+		fprintf(out, " Group %2d: block bitmap at %u, "
+		        "inode bitmap at %u, "
+		        "inode table at %u\n"
 		        "           %d free %s, "
 		        "%d free %s, "
 		        "%d used %s\n",
@@ -356,9 +356,9 @@
 	else
 		fprintf(lb->f, ", ");
 	if (lb->first_block == lb->last_block)
-		fprintf(lb->f, "(%lld):%d", lb->first_bcnt, lb->first_block);
+		fprintf(lb->f, "(%lld):%u", lb->first_bcnt, lb->first_block);
 	else
-		fprintf(lb->f, "(%lld-%lld):%d-%d", lb->first_bcnt,
+		fprintf(lb->f, "(%lld-%lld):%u-%u", lb->first_bcnt,
 			lb->last_bcnt, lb->first_block, lb->last_block);
 	lb->first_block = 0;
 }
@@ -400,11 +400,11 @@
 	else
 		fprintf(lb->f, ", ");
 	if (blockcnt == -1)
-		fprintf(lb->f, "(IND):%d", *blocknr);
+		fprintf(lb->f, "(IND):%u", *blocknr);
 	else if (blockcnt == -2)
-		fprintf(lb->f, "(DIND):%d", *blocknr);
+		fprintf(lb->f, "(DIND):%u", *blocknr);
 	else if (blockcnt == -3)
-		fprintf(lb->f, "(TIND):%d", *blocknr);
+		fprintf(lb->f, "(TIND):%u", *blocknr);
 	return 0;
 }
 
@@ -436,7 +436,7 @@
 	char *start, *end;
 	unsigned int storage_size;
 
-	fprintf(out, "Size of extra inode fields: %d\n", inode->i_extra_isize);
+	fprintf(out, "Size of extra inode fields: %u\n", inode->i_extra_isize);
 	if (inode->i_extra_isize > EXT2_INODE_SIZE(current_fs->super) -
 			EXT2_GOOD_OLD_INODE_SIZE) {
 		fprintf(stderr, "invalid inode->i_extra_isize (%u)\n",
@@ -467,7 +467,7 @@
 			fprintf(out, " = \"");
 			dump_xattr_string(out, start + entry->e_value_offs,
 						entry->e_value_size);
-			fprintf(out, "\" (%d)\n", entry->e_value_size);
+			fprintf(out, "\" (%u)\n", entry->e_value_size);
 			entry = next;
 		}
 	}
@@ -530,7 +530,7 @@
 		fprintf(out, "%sFile ACL: %d    Directory ACL: %d\n",
 			prefix,
 			inode->i_file_acl, LINUX_S_ISDIR(inode->i_mode) ? inode->i_dir_acl : 0);
-	fprintf(out, "%sLinks: %d   Blockcount: %d\n", 
+	fprintf(out, "%sLinks: %d   Blockcount: %u\n",
 		prefix, inode->i_links_count, inode->i_blocks);
 	switch (os) {
 	    case EXT2_OS_LINUX:
@@ -709,7 +709,7 @@
 		return;
 	while (count-- > 0) {
 		if (!ext2fs_test_block_bitmap(current_fs->block_map,block))
-			com_err(argv[0], 0, "Warning: block %d already clear",
+			com_err(argv[0], 0, "Warning: block %u already clear",
 				block);
 		ext2fs_unmark_block_bitmap(current_fs->block_map,block);
 		block++;
@@ -728,7 +728,7 @@
 		return;
 	while (count-- > 0) {
 		if (ext2fs_test_block_bitmap(current_fs->block_map,block))
-			com_err(argv[0], 0, "Warning: block %d already set",
+			com_err(argv[0], 0, "Warning: block %u already set",
 				block);
 		ext2fs_mark_block_bitmap(current_fs->block_map,block);
 		block++;
@@ -745,9 +745,9 @@
 		return;
 	while (count-- > 0) {
 		if (ext2fs_test_block_bitmap(current_fs->block_map,block))
-			printf("Block %d marked in use\n", block);
+			printf("Block %u marked in use\n", block);
 		else
-			printf("Block %d not in use\n", block);
+			printf("Block %u not in use\n", block);
 		block++;
 	}
 }
@@ -827,6 +827,7 @@
 	const char	*hex_format = "0x%x";
 	const char	*octal_format = "0%o";
 	const char	*decimal_format = "%d";
+	const char	*unsignedlong_format = "%lu";
 	
 	if (common_inode_args_process(argc, argv, &inode_num, CHECK_FS_RW))
 		return;
@@ -839,13 +840,13 @@
 	modify_u16(argv[0], "Mode", octal_format, &inode.i_mode);
 	modify_u16(argv[0], "User ID", decimal_format, &inode.i_uid);
 	modify_u16(argv[0], "Group ID", decimal_format, &inode.i_gid);
-	modify_u32(argv[0], "Size", decimal_format, &inode.i_size);
+	modify_u32(argv[0], "Size", unsignedlong_format, &inode.i_size);
 	modify_u32(argv[0], "Creation time", decimal_format, &inode.i_ctime);
 	modify_u32(argv[0], "Modification time", decimal_format, &inode.i_mtime);
 	modify_u32(argv[0], "Access time", decimal_format, &inode.i_atime);
 	modify_u32(argv[0], "Deletion time", decimal_format, &inode.i_dtime);
 	modify_u16(argv[0], "Link count", decimal_format, &inode.i_links_count);
-	modify_u32(argv[0], "Block count", decimal_format, &inode.i_blocks);
+	modify_u32(argv[0], "Block count", unsignedlong_format, &inode.i_blocks);
 	modify_u32(argv[0], "File flags", hex_format, &inode.i_flags);
 	modify_u32(argv[0], "Generation", hex_format, &inode.i_generation);
 #if 0
@@ -1156,7 +1157,7 @@
 			com_err("ext2fs_new_block", retval, 0);
 			return;
 		} else
-			printf("%d ", free_blk);
+			printf("%u ", free_blk);
 	}
  	printf("\n");
 }
@@ -1667,10 +1668,10 @@
 	errcode = ext2fs_bmap(current_fs, ino, 0, 0, 0, blk, &pblk);
 	if (errcode) {
 		com_err("argv[0]", errcode,
-			"while mapping logical block %d\n", blk);
+			"while mapping logical block %u\n", blk);
 		return;
 	}
-	printf("%d\n", pblk);
+	printf("%u\n", pblk);
 }
 
 void do_imap(int argc, char *argv[])
diff --git a/debugfs/htree.c b/debugfs/htree.c
index 7af3d1b..6dbe426 100644
--- a/debugfs/htree.c
+++ b/debugfs/htree.c
@@ -43,14 +43,14 @@
 	errcode = ext2fs_bmap(fs, ino, inode, buf, 0, blk, &pblk);
 	if (errcode) {
 		com_err("htree_dump_leaf_node", errcode,
-			"while mapping logical block %d\n", blk);
+			"while mapping logical block %u\n", blk);
 		return;
 	}
 
 	errcode = ext2fs_read_dir_block2(current_fs, pblk, buf, 0);
 	if (errcode) {
 		com_err("htree_dump_leaf_node", errcode,
-			"while 	reading block %d\n", blk);
+			"while 	reading block %u\n", blk);
 		return;
 	}
 
@@ -60,7 +60,7 @@
 		    (dirent->rec_len < 8) ||
 		    ((dirent->rec_len % 4) != 0) ||
 		    (((dirent->name_len & 0xFF)+8) > dirent->rec_len)) {
-			fprintf(pager, "Corrupted directory block (%d)!\n", blk);
+			fprintf(pager, "Corrupted directory block (%u)!\n", blk);
 			break;
 		}
 		thislen = ((dirent->name_len & 0xFF) < EXT2_NAME_LEN) ?
@@ -124,7 +124,7 @@
 	for (i=0; i < limit.count; i++) {
 		e.hash = ext2fs_le32_to_cpu(ent[i].hash);
 		e.block = ext2fs_le32_to_cpu(ent[i].block);
-		fprintf(pager, "Entry #%d: Hash 0x%08x, block %d\n", i,
+		fprintf(pager, "Entry #%d: Hash 0x%08x, block %u\n", i,
 		       i ? e.hash : 0, e.block);
 		if (level)
 			htree_dump_int_block(fs, ino, inode, rootnode,
@@ -155,14 +155,14 @@
 	errcode = ext2fs_bmap(fs, ino, inode, buf, 0, blk, &pblk);
 	if (errcode) {
 		com_err("htree_dump_int_block", errcode,
-			"while mapping logical block %d\n", blk);
+			"while mapping logical block %u\n", blk);
 		return;
 	}
 
 	errcode = io_channel_read_blk(current_fs->io, pblk, 1, buf);
 	if (errcode) {
 		com_err("htree_dump_int_block", errcode,
-			"while 	reading block %d\n", blk);
+			"while 	reading block %u\n", blk);
 		return;
 	}
 
@@ -241,7 +241,7 @@
 	rootnode = (struct ext2_dx_root_info *) (buf + 24);
 
 	fprintf(pager, "Root node dump:\n");
-	fprintf(pager, "\t Reserved zero: %d\n", rootnode->reserved_zero);
+	fprintf(pager, "\t Reserved zero: %u\n", rootnode->reserved_zero);
 	fprintf(pager, "\t Hash Version: %d\n", rootnode->hash_version);
 	fprintf(pager, "\t Info length: %d\n", rootnode->info_length);
 	fprintf(pager, "\t Indirect levels: %d\n", rootnode->indirect_levels);
@@ -372,9 +372,9 @@
 		    strncmp(p->search_name, dirent->name,
 			    p->len) == 0) {
 			printf("Entry found at logical block %lld, "
-			       "phys %d, offset %d\n", blockcnt,
+			       "phys %u, offset %u\n", blockcnt,
 			       *blocknr, offset);
-			printf("offset %d\n", offset);
+			printf("offset %u\n", offset);
 			return BLOCK_ABORT;
 		}
 		offset += dirent->rec_len;
diff --git a/debugfs/unused.c b/debugfs/unused.c
index d0a5162..a3de6c8 100644
--- a/debugfs/unused.c
+++ b/debugfs/unused.c
@@ -45,7 +45,7 @@
 				break;
 		if (i >= current_fs->blocksize)
 			continue;
-		printf("\nUnused block %ld contains non-zero data:\n\n",
+		printf("\nUnused block %lu contains non-zero data:\n\n",
 		       blk);
 		for (i=0; i < current_fs->blocksize; i++)
 			fputc(buf[i], stdout);
diff --git a/e2fsck/ChangeLog b/e2fsck/ChangeLog
index dee2992..bd53c2e 100644
--- a/e2fsck/ChangeLog
+++ b/e2fsck/ChangeLog
@@ -1,5 +1,12 @@
 2006-03-18  Theodore Ts'o  <tytso@mit.edu>
 
+	* unix.c (show_stats): Use blk_t instead of int when referring to
+		block numbers.
+
+	* emptydir.c, message.c, pass1b.c, pass2.c, recovery.c, unix.c:
+		Change printf statements to use %u instead of %d when
+		printing block numbers.
+
 	* unix.c (main): If the filesystem is not mounted, open the
 		filesystem in exclusive mode (to prevent 2.6 kernels from
 		mounting the filesystem while it is being checked).
diff --git a/e2fsck/emptydir.c b/e2fsck/emptydir.c
index 3ee3413..ea39a09 100644
--- a/e2fsck/emptydir.c
+++ b/e2fsck/emptydir.c
@@ -94,7 +94,7 @@
 	if (db->ino == 11)
 		return;		/* Inode number 11 is usually lost+found */
 
-	printf(_("Empty directory block %d (#%d) in inode %d\n"),
+	printf(_("Empty directory block %u (#%d) in inode %d\n"),
 	       db->blk, db->blockcnt, db->ino);
 
 	ext2fs_mark_block_bitmap(edi->empty_dir_blocks, db->blk);
diff --git a/e2fsck/message.c b/e2fsck/message.c
index d11056a..f031b7e 100644
--- a/e2fsck/message.c
+++ b/e2fsck/message.c
@@ -418,7 +418,7 @@
 		print_pathname(fs, ctx->dir, ctx->ino);
 		break;
 	case 'S':
-		printf("%d", get_backup_sb(NULL, fs, NULL, NULL));
+		printf("%u", get_backup_sb(NULL, fs, NULL, NULL));
 		break;
 	case 's':
 		printf("%s", ctx->str ? ctx->str : "NULL");
diff --git a/e2fsck/pass1b.c b/e2fsck/pass1b.c
index 23a54d8..2b02b47 100644
--- a/e2fsck/pass1b.c
+++ b/e2fsck/pass1b.c
@@ -555,7 +555,7 @@
 			decrement_badcount(ctx, *block_nr, p);
 		} else
 			com_err("delete_file_block", 0,
-			    _("internal error; can't find dup_blk for %d\n"),
+			    _("internal error; can't find dup_blk for %u\n"),
 				*block_nr);
 	} else {
 		ext2fs_unmark_block_bitmap(ctx->block_found_map, *block_nr);
@@ -692,7 +692,7 @@
 			return BLOCK_CHANGED;
 		} else
 			com_err("clone_file_block", 0,
-			    _("internal error; can't find dup_blk for %d\n"),
+			    _("internal error; can't find dup_blk for %u\n"),
 				*block_nr);
 	}
 	return 0;
diff --git a/e2fsck/pass2.c b/e2fsck/pass2.c
index 18ea42c..a4db03f 100644
--- a/e2fsck/pass2.c
+++ b/e2fsck/pass2.c
@@ -543,7 +543,7 @@
 		
 #ifdef DX_DEBUG
 		printf("Root node dump:\n");
-		printf("\t Reserved zero: %d\n", root->reserved_zero);
+		printf("\t Reserved zero: %u\n", root->reserved_zero);
 		printf("\t Hash Version: %d\n", root->hash_version);
 		printf("\t Info length: %d\n", root->info_length);
 		printf("\t Indirect levels: %d\n", root->indirect_levels);
@@ -582,7 +582,7 @@
 		prev_hash = hash;
 		hash = i ? (ext2fs_le32_to_cpu(ent[i].hash) & ~1) : 0;
 #ifdef DX_DEBUG
-		printf("Entry #%d: Hash 0x%08x, block %d\n", i,
+		printf("Entry #%d: Hash 0x%08x, block %u\n", i,
 		       hash, ext2fs_le32_to_cpu(ent[i].block));
 #endif
 		blk = ext2fs_le32_to_cpu(ent[i].block) & 0x0ffffff;
diff --git a/e2fsck/recovery.c b/e2fsck/recovery.c
index b37badf..d25dd98 100644
--- a/e2fsck/recovery.c
+++ b/e2fsck/recovery.c
@@ -435,7 +435,7 @@
 					success = err;
 					printk (KERN_ERR 
 						"JBD: IO error %d recovering "
-						"block %ld in log\n",
+						"block %lu in log\n",
 						err, io_block);
 				} else {
 					unsigned long blocknr;
diff --git a/e2fsck/unix.c b/e2fsck/unix.c
index d2bc594..9e722f4 100644
--- a/e2fsck/unix.c
+++ b/e2fsck/unix.c
@@ -98,7 +98,8 @@
 static void show_stats(e2fsck_t	ctx)
 {
 	ext2_filsys fs = ctx->fs;
-	int inodes, inodes_used, blocks, blocks_used;
+	int inodes, inodes_used;
+	blk_t blocks, blocks_used;
 	int dir_links;
 	int num_files, num_links;
 	int frag_percent;
@@ -117,7 +118,7 @@
 	frag_percent = (frag_percent + 5) / 10;
 	
 	if (!verbose) {
-		printf(_("%s: %d/%d files (%0d.%d%% non-contiguous), %d/%d blocks\n"),
+		printf(_("%s: %d/%d files (%0d.%d%% non-contiguous), %u/%u blocks\n"),
 		       ctx->device_name, inodes_used, inodes,
 		       frag_percent / 10, frag_percent % 10,
 		       blocks_used, blocks);
@@ -131,7 +132,7 @@
 		ctx->fs_fragmented, frag_percent / 10, frag_percent % 10);
 	printf (_("         # of inodes with ind/dind/tind blocks: %d/%d/%d\n"),
 		ctx->fs_ind_count, ctx->fs_dind_count, ctx->fs_tind_count);
-	printf (P_("%8d block used (%d%%)\n", "%8d blocks used (%d%%)\n",
+	printf (P_("%8u block used (%d%%)\n", "%8u blocks used (%d%%)\n",
 		   blocks_used),
 		blocks_used, (int) ((long long) 100 * blocks_used / blocks));
 	printf (P_("%8d bad block\n", "%8d bad blocks\n",
@@ -299,7 +300,7 @@
 		fputs(_(", check forced.\n"), stdout);
 		return;
 	}
-	printf(_("%s: clean, %d/%d files, %d/%d blocks"), ctx->device_name,
+	printf(_("%s: clean, %d/%d files, %u/%u blocks"), ctx->device_name,
 	       fs->super->s_inodes_count - fs->super->s_free_inodes_count,
 	       fs->super->s_inodes_count,
 	       fs->super->s_blocks_count - fs->super->s_free_blocks_count,
diff --git a/misc/ChangeLog b/misc/ChangeLog
index 511d29b..66a61f8 100644
--- a/misc/ChangeLog
+++ b/misc/ChangeLog
@@ -1,5 +1,9 @@
 2006-03-18  Theodore Ts'o  <tytso@mit.edu>
 
+	* dumpe2fs.c, e2image.c, findsuper.c, mke2fs.c: Change printf
+		statements to use %u instead of %d when printing block
+		numbers.
+
 	* mke2fs.c (main): Open the filesystem in exclusive mode while we
 		are initializing it.
 
diff --git a/misc/dumpe2fs.c b/misc/dumpe2fs.c
index c24dccf..0af1bad 100644
--- a/misc/dumpe2fs.c
+++ b/misc/dumpe2fs.c
@@ -253,12 +253,12 @@
 		exit(1);
 	}
 
-	printf(_("\nJournal block size:       %d\n"
-		 "Journal length:           %d\n"
-		 "Journal first block:      %d\n"
+	printf(_("\nJournal block size:       %u\n"
+		 "Journal length:           %u\n"
+		 "Journal first block:      %u\n"
 		 "Journal sequence:         0x%08x\n"
-		 "Journal start:            %d\n"
-		 "Journal number of users:  %d\n"),
+		 "Journal start:            %u\n"
+		 "Journal number of users:  %lu\n"),
 	       ntohl(jsb->s_blocksize),  ntohl(jsb->s_maxlen),
 	       ntohl(jsb->s_first), ntohl(jsb->s_sequence),
 	       ntohl(jsb->s_start), ntohl(jsb->s_nr_users));
diff --git a/misc/e2image.c b/misc/e2image.c
index 19f2c51..4f1cfde 100644
--- a/misc/e2image.c
+++ b/misc/e2image.c
@@ -329,7 +329,7 @@
 				err = errno;
 			else
 				err = 0;
-			com_err(program_name, err, "error writing block %d", 
+			com_err(program_name, err, "error writing block %u",
 				block);
 		}
 	}
diff --git a/misc/findsuper.c b/misc/findsuper.c
index 5720f4f..d82805b 100644
--- a/misc/findsuper.c
+++ b/misc/findsuper.c
@@ -182,15 +182,15 @@
 		if (ext2.s_magic != EXT2_SUPER_MAGIC)
 			continue;
 		if (ext2.s_log_block_size > 4)
-			WHY("log block size > 4 (%d)\n", ext2.s_log_block_size);
+			WHY("log block size > 4 (%u)\n", ext2.s_log_block_size);
 		if (ext2.s_r_blocks_count > ext2.s_blocks_count)
-			WHY("r_blocks_count > blocks_count (%d > %d)\n",
+			WHY("r_blocks_count > blocks_count (%u > %u)\n",
 			    ext2.s_r_blocks_count, ext2.s_blocks_count);
 		if (ext2.s_free_blocks_count > ext2.s_blocks_count)
-			WHY("free_blocks_count > blocks_count\n (%d > %d)\n",
+			WHY("free_blocks_count > blocks_count\n (%u > %u)\n",
 			    ext2.s_free_blocks_count, ext2.s_blocks_count);
 		if (ext2.s_free_inodes_count > ext2.s_inodes_count)
-			WHY("free_inodes_count > inodes_count (%d > %d)\n",
+			WHY("free_inodes_count > inodes_count (%u > %u)\n",
 			    ext2.s_free_inodes_count, ext2.s_inodes_count);
 
 		tm = ext2.s_mtime;
diff --git a/misc/mke2fs.c b/misc/mke2fs.c
index 7d9b898..d60d832 100644
--- a/misc/mke2fs.c
+++ b/misc/mke2fs.c
@@ -302,7 +302,7 @@
 		if (ext2fs_badblocks_list_test(bb_list, i)) {
 			fprintf(stderr, _("Block %d in primary "
 				"superblock/group descriptor area bad.\n"), i);
-			fprintf(stderr, _("Blocks %d through %d must be good "
+			fprintf(stderr, _("Blocks %u through %d must be good "
 				"in order to build a filesystem.\n"),
 				fs->super->s_first_data_block, must_be_good);
 			fputs(_("Aborting....\n"), stderr);
@@ -325,7 +325,7 @@
 						       group_block + j)) {
 				if (!group_bad) 
 					fprintf(stderr,
-_("Warning: the backup superblock/group descriptors at block %d contain\n"
+_("Warning: the backup superblock/group descriptors at block %u contain\n"
 "	bad blocks.\n\n"),
 						group_block);
 				group_bad++;
@@ -489,7 +489,7 @@
 		retval = zero_blocks(fs, blk, num, 0, &blk, &num);
 		if (retval) {
 			fprintf(stderr, _("\nCould not write %d blocks "
-				"in inode table starting at %d: %s\n"),
+				"in inode table starting at %u: %s\n"),
 				num, blk, error_message(retval));
 			exit(1);
 		}
@@ -692,7 +692,7 @@
 	int			need, col_left;
 	
 	if (fs_param.s_blocks_count != s->s_blocks_count)
-		fprintf(stderr, _("warning: %d blocks unused.\n\n"),
+		fprintf(stderr, _("warning: %u blocks unused.\n\n"),
 		       fs_param.s_blocks_count - s->s_blocks_count);
 
 	memset(buf, 0, sizeof(buf));
diff --git a/resize/ChangeLog b/resize/ChangeLog
index 6b727e9..3a972d5 100644
--- a/resize/ChangeLog
+++ b/resize/ChangeLog
@@ -1,5 +1,8 @@
 2006-03-18  Theodore Ts'o  <tytso@mit.edu>
 
+	* main.c, resize2fs.c: Change printf statements to use %u instead
+		of %d when printing block numbers.
+
 	* main.c (main): If the filesystem is mounted, open it in
 		read-only mode since the userspace program should not try
 		to modify it directly.  If the filesystem is not mounted,
diff --git a/resize/main.c b/resize/main.c
index e202c5f..0632c07 100644
--- a/resize/main.c
+++ b/resize/main.c
@@ -311,13 +311,13 @@
 	}
 	if (!force && (new_size > max_size)) {
 		fprintf(stderr, _("The containing partition (or device)"
-			" is only %d (%dk) blocks.\nYou requested a new size"
-			" of %d blocks.\n\n"), max_size,
+			" is only %u (%dk) blocks.\nYou requested a new size"
+			" of %u blocks.\n\n"), max_size,
 			fs->blocksize / 1024, new_size);
 		exit(1);
 	}
 	if (new_size == fs->super->s_blocks_count) {
-		fprintf(stderr, _("The filesystem is already %d blocks "
+		fprintf(stderr, _("The filesystem is already %u blocks "
 			"long.  Nothing to do!\n\n"), new_size);
 		exit(0);
 	}
@@ -332,7 +332,7 @@
 				device_name);
 			exit(1);
 		}
-		printf("Resizing the filesystem on %s to %d (%dk) blocks.\n",
+	printf("Resizing the filesystem on %s to %u (%dk) blocks.\n",
 		       device_name, new_size, fs->blocksize / 1024);
 		retval = resize_fs(fs, &new_size, flags,
 				   ((flags & RESIZE_PERCENT_COMPLETE) ?
@@ -344,7 +344,7 @@
 		ext2fs_close (fs);
 		exit(1);
 	}
-	printf(_("The filesystem on %s is now %d blocks long.\n\n"),
+	printf(_("The filesystem on %s is now %u blocks long.\n\n"),
 	       device_name, new_size);
 
 	if ((st_buf.st_size > new_file_size) &&
diff --git a/resize/resize2fs.c b/resize/resize2fs.c
index d920bef..de8f00d 100644
--- a/resize/resize2fs.c
+++ b/resize/resize2fs.c
@@ -108,7 +108,7 @@
 
 #ifdef RESIZE2FS_DEBUG
 	if (rfs->flags & RESIZE_DEBUG_BMOVE)
-		printf("Number of free blocks: %d/%d, Needed: %d\n",
+		printf("Number of free blocks: %u/%u, Needed: %d\n",
 		       rfs->old_fs->super->s_free_blocks_count,
 		       rfs->new_fs->super->s_free_blocks_count,
 		       rfs->needed_blocks);