Module Name:    src
Committed By:   lukem
Date:           Mon Apr 13 00:41:28 UTC 2009

Modified Files:
        src/usr.bin/mkstr: mkstr.c

Log Message:
fix sign-compare issues


To generate a diff of this commit:
cvs rdiff -u -r1.13 -r1.14 src/usr.bin/mkstr/mkstr.c

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

Modified files:

Index: src/usr.bin/mkstr/mkstr.c
diff -u src/usr.bin/mkstr/mkstr.c:1.13 src/usr.bin/mkstr/mkstr.c:1.14
--- src/usr.bin/mkstr/mkstr.c:1.13	Sun Apr 12 14:28:30 2009
+++ src/usr.bin/mkstr/mkstr.c	Mon Apr 13 00:41:28 2009
@@ -1,4 +1,4 @@
-/*	$NetBSD: mkstr.c,v 1.13 2009/04/12 14:28:30 lukem Exp $	*/
+/*	$NetBSD: mkstr.c,v 1.14 2009/04/13 00:41:28 lukem Exp $	*/
 
 /*
  * Copyright (c) 1980, 1993
@@ -39,7 +39,7 @@
 #if 0
 static char sccsid[] = "@(#)mkstr.c	8.1 (Berkeley) 6/6/93";
 #else
-__RCSID("$NetBSD: mkstr.c,v 1.13 2009/04/12 14:28:30 lukem Exp $");
+__RCSID("$NetBSD: mkstr.c,v 1.14 2009/04/13 00:41:28 lukem Exp $");
 #endif
 #endif /* not lint */
 
@@ -86,7 +86,7 @@
 int match __P((const char *));
 int octdigit __P((char));
 void inithash __P((void));
-int hashit __P((char *, char, unsigned));
+long hashit __P((char *, char, long));
 void copystr __P((void));
 int fgetNUL __P((char *, int, FILE *));
 
@@ -229,7 +229,7 @@
 	}
 out:
 	*cp = 0;
-	printf("%d", hashit(buf, 1, 0));
+	printf("%ld", hashit(buf, 1, 0));
 }
 
 int
@@ -244,7 +244,7 @@
 inithash()
 {
 	char buf[512];
-	int mesgpt = 0;
+	long mesgpt = 0;
 
 	rewind(mesgread);
 	while (fgetNUL(buf, sizeof buf, mesgread) != 0) {
@@ -257,15 +257,15 @@
 
 struct	hash {
 	long	hval;
-	unsigned hpt;
+	long	hpt;
 	struct	hash *hnext;
 } *bucket[NBUCKETS];
 
-int
+long
 hashit(str, really, fakept)
 	char *str;
 	char really;
-	unsigned fakept;
+	long fakept;
 {
 	int i;
 	struct hash *hp;
@@ -286,10 +286,10 @@
 	if (really != 0)
 		for (hp = bucket[i]; hp != 0; hp = hp->hnext)
 		if (hp->hval == hashval) {
-			fseek(mesgread, (long) hp->hpt, 0);
+			fseek(mesgread, hp->hpt, 0);
 			fgetNUL(buf, sizeof buf, mesgread);
 /*
-			fprintf(stderr, "Got (from %d) %s\n", hp->hpt, buf);
+			fprintf(stderr, "Got (from %ld) %s\n", hp->hpt, buf);
 */
 			if (strcmp(buf, str) == 0)
 				break;
@@ -306,7 +306,7 @@
 		bucket[i] = hp;
 	}
 /*
-	fprintf(stderr, "%s hashed to %ld at %d\n", str, hp->hval, hp->hpt);
+	fprintf(stderr, "%s hashed to %ld at %ld\n", str, hp->hval, hp->hpt);
 */
 	return (hp->hpt);
 }

Reply via email to