Module Name:    src
Committed By:   lukem
Date:           Mon Apr  6 12:50:37 UTC 2009

Modified Files:
        src/sbin/fsck_ext2fs: inode.c pass1.c pass1b.c pass5.c

Log Message:
fix sign-compare issues


To generate a diff of this commit:
cvs rdiff -u -r1.28 -r1.29 src/sbin/fsck_ext2fs/inode.c
cvs rdiff -u -r1.18 -r1.19 src/sbin/fsck_ext2fs/pass1.c
cvs rdiff -u -r1.6 -r1.7 src/sbin/fsck_ext2fs/pass1b.c
cvs rdiff -u -r1.15 -r1.16 src/sbin/fsck_ext2fs/pass5.c

Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.

Modified files:

Index: src/sbin/fsck_ext2fs/inode.c
diff -u src/sbin/fsck_ext2fs/inode.c:1.28 src/sbin/fsck_ext2fs/inode.c:1.29
--- src/sbin/fsck_ext2fs/inode.c:1.28	Mon Mar  2 11:31:59 2009
+++ src/sbin/fsck_ext2fs/inode.c	Mon Apr  6 12:50:36 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: inode.c,v 1.28 2009/03/02 11:31:59 tsutsui Exp $	*/
+/*	$NetBSD: inode.c,v 1.29 2009/04/06 12:50:36 lukem Exp $	*/
 
 /*
  * Copyright (c) 1980, 1986, 1993
@@ -63,7 +63,7 @@
 #if 0
 static char sccsid[] = "@(#)inode.c	8.5 (Berkeley) 2/8/95";
 #else
-__RCSID("$NetBSD: inode.c,v 1.28 2009/03/02 11:31:59 tsutsui Exp $");
+__RCSID("$NetBSD: inode.c,v 1.29 2009/04/06 12:50:36 lukem Exp $");
 #endif
 #endif /* not lint */
 
@@ -240,7 +240,8 @@
 	int32_t *ap;
 	int32_t *aplim;
 	struct bufarea *bp;
-	int i, n, (*func)(struct inodesc *), nif;
+	int i, n, (*func)(struct inodesc *);
+	size_t nif;
 	u_int64_t sizepb;
 	char buf[BUFSIZ];
 	char pathbuf[MAXPATHLEN + 1];

Index: src/sbin/fsck_ext2fs/pass1.c
diff -u src/sbin/fsck_ext2fs/pass1.c:1.18 src/sbin/fsck_ext2fs/pass1.c:1.19
--- src/sbin/fsck_ext2fs/pass1.c:1.18	Mon Nov 24 18:05:25 2008
+++ src/sbin/fsck_ext2fs/pass1.c	Mon Apr  6 12:50:37 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: pass1.c,v 1.18 2008/11/24 18:05:25 tsutsui Exp $	*/
+/*	$NetBSD: pass1.c,v 1.19 2009/04/06 12:50:37 lukem Exp $	*/
 
 /*
  * Copyright (c) 1980, 1986, 1993
@@ -63,7 +63,7 @@
 #if 0
 static char sccsid[] = "@(#)pass1.c	8.1 (Berkeley) 6/5/93";
 #else
-__RCSID("$NetBSD: pass1.c,v 1.18 2008/11/24 18:05:25 tsutsui Exp $");
+__RCSID("$NetBSD: pass1.c,v 1.19 2009/04/06 12:50:37 lukem Exp $");
 #endif
 #endif /* not lint */
 
@@ -94,6 +94,7 @@
 {
 	ino_t inumber;
 	int c, i;
+	size_t j;
 	daddr_t dbase;
 	struct inodesc idesc;
 
@@ -144,9 +145,9 @@
 	n_files = n_blks = 0;
 	resetinodebuf();
 	for (c = 0; c < sblock.e2fs_ncg; c++) {
-		for (i = 0;
-			i < sblock.e2fs.e2fs_ipg && inumber <= sblock.e2fs.e2fs_icount;
-			i++, inumber++) {
+		for (j = 0;
+			j < sblock.e2fs.e2fs_ipg && inumber <= sblock.e2fs.e2fs_icount;
+			j++, inumber++) {
 			if (inumber < EXT2_ROOTINO) /* XXX */
 				continue;
 			checkinode(inumber, &idesc);
@@ -307,7 +308,7 @@
 	idesc->id_number = inumber;
 	(void)ckinode(dp, idesc);
 	idesc->id_entryno *= btodb(sblock.e2fs_bsize);
-	if (fs2h32(dp->e2di_nblock) != idesc->id_entryno) {
+	if (fs2h32(dp->e2di_nblock) != (uint32_t)idesc->id_entryno) {
 		pwarn("INCORRECT BLOCK COUNT I=%llu (%d should be %d)",
 		    (unsigned long long)inumber, fs2h32(dp->e2di_nblock),
 		    idesc->id_entryno);

Index: src/sbin/fsck_ext2fs/pass1b.c
diff -u src/sbin/fsck_ext2fs/pass1b.c:1.6 src/sbin/fsck_ext2fs/pass1b.c:1.7
--- src/sbin/fsck_ext2fs/pass1b.c:1.6	Wed Jan 19 19:31:28 2005
+++ src/sbin/fsck_ext2fs/pass1b.c	Mon Apr  6 12:50:37 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: pass1b.c,v 1.6 2005/01/19 19:31:28 xtraeme Exp $	*/
+/*	$NetBSD: pass1b.c,v 1.7 2009/04/06 12:50:37 lukem Exp $	*/
 
 /*
  * Copyright (c) 1980, 1986, 1993
@@ -63,7 +63,7 @@
 #if 0
 static char sccsid[] = "@(#)pass1b.c	8.1 (Berkeley) 6/5/93";
 #else
-__RCSID("$NetBSD: pass1b.c,v 1.6 2005/01/19 19:31:28 xtraeme Exp $");
+__RCSID("$NetBSD: pass1b.c,v 1.7 2009/04/06 12:50:37 lukem Exp $");
 #endif
 #endif /* not lint */
 
@@ -82,7 +82,8 @@
 void
 pass1b(void)
 {
-	int c, i;
+	int c;
+	uint32_t i;
 	struct ext2fs_dinode *dp;
 	struct inodesc idesc;
 	ino_t inumber;

Index: src/sbin/fsck_ext2fs/pass5.c
diff -u src/sbin/fsck_ext2fs/pass5.c:1.15 src/sbin/fsck_ext2fs/pass5.c:1.16
--- src/sbin/fsck_ext2fs/pass5.c:1.15	Sun Mar 16 23:17:55 2008
+++ src/sbin/fsck_ext2fs/pass5.c	Mon Apr  6 12:50:37 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: pass5.c,v 1.15 2008/03/16 23:17:55 lukem Exp $	*/
+/*	$NetBSD: pass5.c,v 1.16 2009/04/06 12:50:37 lukem Exp $	*/
 
 /*
  * Copyright (c) 1980, 1986, 1993
@@ -63,7 +63,7 @@
 #if 0
 static char sccsid[] = "@(#)pass5.c	8.6 (Berkeley) 11/30/94";
 #else
-__RCSID("$NetBSD: pass5.c,v 1.15 2008/03/16 23:17:55 lukem Exp $");
+__RCSID("$NetBSD: pass5.c,v 1.16 2009/04/06 12:50:37 lukem Exp $");
 #endif
 #endif /* not lint */
 
@@ -72,6 +72,7 @@
 #include <ufs/ufs/dinode.h>
 #include <ufs/ext2fs/ext2fs_dinode.h>
 #include <ufs/ext2fs/ext2fs.h>
+#include <inttypes.h>
 #include <string.h>
 #include <malloc.h>
 #include <stdio.h>
@@ -90,7 +91,7 @@
 	struct m_ext2fs *fs = &sblock;
 	daddr_t dbase, dmax;
 	daddr_t d;
-	long i, j;
+	uint32_t i, j;
 	struct inodesc idesc[3];
 	struct bufarea *ino_bitmap = NULL, *blk_bitmap = NULL;
 	char *ibmap, *bbmap;
@@ -167,13 +168,13 @@
 				break;
 
 			default:
-				errexit("BAD STATE %d FOR INODE I=%ld",
+				errexit("BAD STATE %d FOR INODE I=%"PRIu32,
 				    statemap[j], j);
 			}
 		}
 
 		/* fill in unused par of the inode map */
-		for (i = fs->e2fs.e2fs_ipg / NBBY; i < fs->e2fs_bsize; i++)
+		for (i = fs->e2fs.e2fs_ipg / NBBY; i < (uint32_t)fs->e2fs_bsize; i++)
 			ibmap[i] = 0xff; 
 
 		dbase = c * sblock.e2fs.e2fs_bpg +
@@ -269,7 +270,7 @@
 void 
 print_bmap(u_char *map, u_int32_t size)
 {
-	int i, j;
+	uint32_t i, j;
 
 	i = 0;
 	while (i < size) {

Reply via email to