Fix WARNS=4 issues

This commit is contained in:
lukem 2009-04-12 13:53:02 +00:00
parent 0feb17a4b1
commit 6533b9aa4b

View File

@ -1,4 +1,4 @@
/* $NetBSD: locate.c,v 1.16 2008/07/21 14:19:23 lukem Exp $ */ /* $NetBSD: locate.c,v 1.17 2009/04/12 13:53:02 lukem Exp $ */
/* /*
* Copyright (c) 1989, 1993 * Copyright (c) 1989, 1993
@ -42,7 +42,7 @@ __COPYRIGHT("@(#) Copyright (c) 1989, 1993\
#if 0 #if 0
static char sccsid[] = "@(#)locate.c 8.1 (Berkeley) 6/6/93"; static char sccsid[] = "@(#)locate.c 8.1 (Berkeley) 6/6/93";
#endif #endif
__RCSID("$NetBSD: locate.c,v 1.16 2008/07/21 14:19:23 lukem Exp $"); __RCSID("$NetBSD: locate.c,v 1.17 2009/04/12 13:53:02 lukem Exp $");
#endif /* not lint */ #endif /* not lint */
/* /*
@ -134,7 +134,7 @@ int
main(int argc, char *argv[]) main(int argc, char *argv[])
{ {
struct locate_db *dbp; struct locate_db *dbp;
char *locate_path = getenv("LOCATE_PATH"); const char *locate_path = getenv("LOCATE_PATH");
char *cp; char *cp;
int c; int c;
int rc; int rc;
@ -157,11 +157,12 @@ main(int argc, char *argv[])
if (!locate_path) if (!locate_path)
locate_path = _PATH_FCODES; locate_path = _PATH_FCODES;
if ((cp = strrchr(locate_path, ':'))) { if ((cp = strrchr(locate_path, ':'))) {
locate_path = strdup(locate_path); char *lp = strdup(locate_path);
while ((cp = strrchr(locate_path, ':'))) { while ((cp = strrchr(lp, ':'))) {
*cp++ = '\0'; *cp++ = '\0';
add_db(cp); add_db(cp);
} }
free(lp);
} }
add_db(locate_path); add_db(locate_path);
if (LIST_EMPTY(&db_list)) if (LIST_EMPTY(&db_list))
@ -213,7 +214,7 @@ fastfind(FILE *fp, char *pathpart)
else { /* bigrams are parity-marked */ else { /* bigrams are parity-marked */
c &= PARITY - 1; c &= PARITY - 1;
/* sanity check */ /* sanity check */
if (c < 0 || c >= sizeof(bigram1)) if (c < 0 || c >= (int)sizeof(bigram1))
return -1; /* invalid database file */ return -1; /* invalid database file */
*p++ = bigram1[c], *p++ = bigram2[c]; *p++ = bigram1[c], *p++ = bigram2[c];
} }