Fix WARNS=4 issues (-Wcast-qual -Wsign-compare)

This commit is contained in:
lukem 2009-04-13 11:07:59 +00:00
parent 183f6d8af1
commit 64d3192b1d
4 changed files with 13 additions and 12 deletions

View File

@ -1,4 +1,4 @@
/* $NetBSD: fields.c,v 1.19 2008/04/28 20:24:15 martin Exp $ */
/* $NetBSD: fields.c,v 1.20 2009/04/13 11:07:59 lukem Exp $ */
/*-
* Copyright (c) 2000-2003 The NetBSD Foundation, Inc.
@ -66,7 +66,7 @@
#include "sort.h"
#ifndef lint
__RCSID("$NetBSD: fields.c,v 1.19 2008/04/28 20:24:15 martin Exp $");
__RCSID("$NetBSD: fields.c,v 1.20 2009/04/13 11:07:59 lukem Exp $");
__SCCSID("@(#)fields.c 8.1 (Berkeley) 6/6/93");
#endif /* not lint */
@ -146,7 +146,7 @@ enterkey(keybuf, line, size, fieldtable)
keybuf->offset = keypos - keybuf->data;
keybuf->length = keybuf->offset + line->size;
if (keybuf->length + sizeof(TRECHEADER) > size) {
if (keybuf->length + sizeof(TRECHEADER) > (length_t)size) {
/* line too long for buffer */
return (1);
}

View File

@ -1,4 +1,4 @@
/* $NetBSD: files.c,v 1.26 2008/04/28 20:24:15 martin Exp $ */
/* $NetBSD: files.c,v 1.27 2009/04/13 11:07:59 lukem Exp $ */
/*-
* Copyright (c) 2000-2003 The NetBSD Foundation, Inc.
@ -65,7 +65,7 @@
#include "fsort.h"
#ifndef lint
__RCSID("$NetBSD: files.c,v 1.26 2008/04/28 20:24:15 martin Exp $");
__RCSID("$NetBSD: files.c,v 1.27 2009/04/13 11:07:59 lukem Exp $");
__SCCSID("@(#)files.c 8.1 (Berkeley) 6/6/93");
#endif /* not lint */
@ -132,7 +132,7 @@ getnext(binno, infl0, filelist, nfiles, pos, end, dummy)
if ((u_char *) pos > end - sizeof(TRECHEADER))
return (BUFFEND);
fread(pos, sizeof(TRECHEADER), 1, fp);
if (end - pos->data < pos->length) {
if (end - pos->data < (ptrdiff_t)pos->length) {
hp = ((u_char *)pos) + sizeof(TRECHEADER);
for (i = sizeof(TRECHEADER); i ; i--)
ungetc(*--hp, fp);
@ -392,7 +392,7 @@ geteasy(flno, top, filelist, nfiles, rec, end, dummy2)
fstack[flno].fp = 0;
return (EOF);
}
if (end - rec->data < rec->length) {
if (end - rec->data < (ptrdiff_t)rec->length) {
for (i = sizeof(TRECHEADER) - 1; i >= 0; i--)
ungetc(*((char *) rec + i), fp);
return (BUFFEND);

View File

@ -1,4 +1,4 @@
/* $NetBSD: sort.c,v 1.47 2008/11/08 17:11:56 christos Exp $ */
/* $NetBSD: sort.c,v 1.48 2009/04/13 11:07:59 lukem Exp $ */
/*-
* Copyright (c) 2000-2003 The NetBSD Foundation, Inc.
@ -76,7 +76,7 @@ __COPYRIGHT("@(#) Copyright (c) 1993\
#endif /* not lint */
#ifndef lint
__RCSID("$NetBSD: sort.c,v 1.47 2008/11/08 17:11:56 christos Exp $");
__RCSID("$NetBSD: sort.c,v 1.48 2009/04/13 11:07:59 lukem Exp $");
__SCCSID("@(#)sort.c 8.1 (Berkeley) 6/6/93");
#endif /* not lint */
@ -219,7 +219,7 @@ main(argc, argv)
optarg++, t = 8;
REC_D = (int)strtol(optarg, &ep, t);
if (*ep != '\0' || REC_D < 0 ||
REC_D >= __arraycount(d_mask))
REC_D >= (int)__arraycount(d_mask))
errx(2, "invalid record delimiter %s",
optarg);
}
@ -257,7 +257,7 @@ main(argc, argv)
/* change to /dev/stdin if '-' */
if (argv[i][0] == '-')
argv[i] = _PATH_STDIN;
argv[i] = __UNCONST(_PATH_STDIN);
} else if ((ch = access(argv[i], R_OK)))
err(2, "%s", argv[i]);

View File

@ -1,4 +1,4 @@
/* $NetBSD: sort.h,v 1.19 2008/04/28 20:24:15 martin Exp $ */
/* $NetBSD: sort.h,v 1.20 2009/04/13 11:07:59 lukem Exp $ */
/*-
* Copyright (c) 2000-2003 The NetBSD Foundation, Inc.
@ -70,6 +70,7 @@
#include <errno.h>
#include <fcntl.h>
#include <limits.h>
#include <stddef.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>