fix -Wsign-compare issues
This commit is contained in:
parent
4459b5fdab
commit
cadac39416
17
dist/nvi/common/conv.c
vendored
17
dist/nvi/common/conv.c
vendored
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: conv.c,v 1.5 2008/12/06 18:39:20 christos Exp $ */
|
||||
/* $NetBSD: conv.c,v 1.6 2009/01/18 03:45:50 lukem Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1993, 1994
|
||||
@ -74,7 +74,7 @@ raw2int(SCR *sp, const char * str, ssize_t len, CONVWIN *cw, size_t *tolen,
|
||||
char *bp = buffer; \
|
||||
outleft = CONV_BUFFER_SIZE; \
|
||||
errno = 0; \
|
||||
if (iconv(id, (const char **)&str, &left, &bp, &outleft) == -1 \
|
||||
if (iconv(id, (const char **)&str, &left, &bp, &outleft) == (size_t)-1 \
|
||||
/* && errno != E2BIG */) \
|
||||
goto err; \
|
||||
if ((len = CONV_BUFFER_SIZE - outleft) == 0) { \
|
||||
@ -91,7 +91,8 @@ static int
|
||||
default_char2int(SCR *sp, const char * str, ssize_t len, CONVWIN *cw,
|
||||
size_t *tolen, const CHAR_T **dst, const char *enc)
|
||||
{
|
||||
int i = 0, j;
|
||||
int j;
|
||||
size_t i = 0;
|
||||
CHAR_T **tostr = (CHAR_T **)(void *)&cw->bp1;
|
||||
size_t *blen = &cw->blen1;
|
||||
mbstate_t mbs;
|
||||
@ -118,8 +119,8 @@ default_char2int(SCR *sp, const char * str, ssize_t len, CONVWIN *cw,
|
||||
for (i = 0, j = 0; j < len; ) {
|
||||
n = mbrtowc((*tostr)+i, src+j, len-j, &mbs);
|
||||
/* NULL character converted */
|
||||
if (n == -2) error = -(len-j);
|
||||
if (n == -1 || n == -2) goto err;
|
||||
if (n == (size_t)-2) error = -(len-j);
|
||||
if (n == (size_t)-1 || n == (size_t)-2) goto err;
|
||||
if (n == 0) n = 1;
|
||||
j += n;
|
||||
if (++i >= *blen) {
|
||||
@ -241,7 +242,7 @@ default_int2char(SCR *sp, const CHAR_T * str, ssize_t len, CONVWIN *cw,
|
||||
BINC_RETC(NULL, cw->bp1, cw->blen1, nlen); \
|
||||
} \
|
||||
errno = 0; \
|
||||
if (iconv(id, &bp, &len, &obp, &outleft) == -1 && \
|
||||
if (iconv(id, &bp, &len, &obp, &outleft) == (size_t)-1 && \
|
||||
errno != E2BIG) \
|
||||
goto err; \
|
||||
offset = cw->blen1 - outleft; \
|
||||
@ -265,9 +266,9 @@ default_int2char(SCR *sp, const CHAR_T * str, ssize_t len, CONVWIN *cw,
|
||||
}
|
||||
#endif
|
||||
|
||||
for (i = 0, j = 0; i < len; ++i) {
|
||||
for (i = 0, j = 0; i < (size_t)len; ++i) {
|
||||
n = wcrtomb(dst+j, str[i], &mbs);
|
||||
if (n == -1) goto err;
|
||||
if (n == (size_t)-1) goto err;
|
||||
j += n;
|
||||
if (buflen < j + MB_CUR_MAX) {
|
||||
if (id != (iconv_t)-1) {
|
||||
|
9
dist/nvi/common/conv.h
vendored
9
dist/nvi/common/conv.h
vendored
@ -1,9 +1,10 @@
|
||||
/* $NetBSD: conv.h,v 1.2 2008/12/05 22:51:42 christos Exp $ */
|
||||
/* $NetBSD: conv.h,v 1.3 2009/01/18 03:43:45 lukem Exp $ */
|
||||
|
||||
#define KEY_COL(sp, ch) \
|
||||
(INTISWIDE(ch) ? CHAR_WIDTH(sp, ch) ? CHAR_WIDTH(sp, ch) : \
|
||||
1 : /* extra space */ \
|
||||
KEY_LEN(sp,ch))
|
||||
(INTISWIDE(ch) ? \
|
||||
(size_t)CHAR_WIDTH(sp, ch) ? \
|
||||
(size_t)CHAR_WIDTH(sp, ch) : 1 /* extra space */ \
|
||||
: KEY_LEN(sp,ch))
|
||||
|
||||
struct _conv_win {
|
||||
void *bp1;
|
||||
|
5
dist/nvi/common/gs.h
vendored
5
dist/nvi/common/gs.h
vendored
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: gs.h,v 1.3 2008/12/05 22:51:42 christos Exp $ */
|
||||
/* $NetBSD: gs.h,v 1.4 2009/01/18 03:43:45 lukem Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1993, 1994
|
||||
@ -108,7 +108,8 @@ struct _gs {
|
||||
#define KEY_VAL(sp, ch) \
|
||||
((UCHAR_T)(ch) <= MAX_FAST_KEY ? \
|
||||
sp->gp->special_key[(UCHAR_T)ch] : \
|
||||
(UCHAR_T)(ch) > sp->gp->max_special ? K_NOTUSED : v_key_val(sp,ch))
|
||||
(UCHAR_T)(ch) > (UCHAR_T)sp->gp->max_special ? \
|
||||
K_NOTUSED : v_key_val(sp,ch))
|
||||
CHAR_T max_special; /* Max special character. */
|
||||
u_char /* Fast lookup table. */
|
||||
special_key[MAX_FAST_KEY + 1];
|
||||
|
4
dist/nvi/common/key.c
vendored
4
dist/nvi/common/key.c
vendored
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: key.c,v 1.4 2009/01/02 00:32:11 tnozaki Exp $ */
|
||||
/* $NetBSD: key.c,v 1.5 2009/01/18 03:45:50 lukem Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1991, 1993, 1994
|
||||
@ -146,7 +146,7 @@ v_key_init(SCR *sp)
|
||||
}
|
||||
|
||||
/* Find a non-printable character to use as a message separator. */
|
||||
for (ch = 1; ch <= MAX_CHAR_T; ++ch)
|
||||
for (ch = 1; (unsigned)ch <= MAX_CHAR_T; ++ch)
|
||||
if (!ISPRINT(ch)) {
|
||||
gp->noprint = ch;
|
||||
break;
|
||||
|
10
dist/nvi/common/mark.c
vendored
10
dist/nvi/common/mark.c
vendored
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: mark.c,v 1.2 2008/12/05 22:51:42 christos Exp $ */
|
||||
/* $NetBSD: mark.c,v 1.3 2009/01/18 03:45:50 lukem Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1992, 1993, 1994
|
||||
@ -116,7 +116,7 @@ mark_get(SCR *sp, ARG_CHAR_T key, MARK *mp, mtype_t mtype)
|
||||
key = ABSMARK1;
|
||||
|
||||
lmp = mark_find(sp, key);
|
||||
if (lmp == NULL || lmp->name != key) {
|
||||
if (lmp == NULL || (ARG_CHAR_T)lmp->name != key) {
|
||||
msgq(sp, mtype, "017|Mark %s: not set", KEY_NAME(sp, key));
|
||||
return (1);
|
||||
}
|
||||
@ -163,7 +163,7 @@ mark_set(SCR *sp, ARG_CHAR_T key, MARK *value, int userset)
|
||||
* by a previous undo.
|
||||
*/
|
||||
lmp = mark_find(sp, key);
|
||||
if (lmp == NULL || lmp->name != key) {
|
||||
if (lmp == NULL || (ARG_CHAR_T)lmp->name != key) {
|
||||
MALLOC_RET(sp, lmt, LMARK *, sizeof(LMARK));
|
||||
if (lmp == NULL) {
|
||||
LIST_INSERT_HEAD(&sp->ep->marks, lmt, q);
|
||||
@ -197,8 +197,8 @@ mark_find(SCR *sp, ARG_CHAR_T key)
|
||||
*/
|
||||
for (lastlmp = NULL, lmp = sp->ep->marks.lh_first;
|
||||
lmp != NULL; lastlmp = lmp, lmp = lmp->q.le_next)
|
||||
if (lmp->name >= key)
|
||||
return (lmp->name == key ? lmp : lastlmp);
|
||||
if ((ARG_CHAR_T)lmp->name >= key)
|
||||
return ((ARG_CHAR_T)lmp->name == key ? lmp : lastlmp);
|
||||
return (lastlmp);
|
||||
}
|
||||
|
||||
|
4
dist/nvi/common/mem.h
vendored
4
dist/nvi/common/mem.h
vendored
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: mem.h,v 1.2 2008/12/05 22:51:42 christos Exp $ */
|
||||
/* $NetBSD: mem.h,v 1.3 2009/01/18 03:43:45 lukem Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1993, 1994
|
||||
@ -41,7 +41,7 @@
|
||||
#define BINC_RET(sp, type, lp, llen, nlen) { \
|
||||
CHECK_TYPE(type *, lp) \
|
||||
void *L__bincp; \
|
||||
if ((nlen) > llen) { \
|
||||
if ((size_t)(nlen) > llen) { \
|
||||
if ((L__bincp = binc(sp, lp, &(llen), nlen)) == NULL) \
|
||||
return (1); \
|
||||
/* \
|
||||
|
8
dist/nvi/common/msg.c
vendored
8
dist/nvi/common/msg.c
vendored
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: msg.c,v 1.2 2008/12/05 22:51:42 christos Exp $ */
|
||||
/* $NetBSD: msg.c,v 1.3 2009/01/18 03:45:50 lukem Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1991, 1993, 1994
|
||||
@ -458,8 +458,8 @@ mod_rpt(SCR *sp)
|
||||
};
|
||||
db_recno_t total;
|
||||
u_long rptval;
|
||||
int first, cnt;
|
||||
size_t blen, len, tlen;
|
||||
int first;
|
||||
size_t cnt, blen, len, tlen;
|
||||
const char *t;
|
||||
const char * const *ap;
|
||||
char *bp, *p;
|
||||
@ -685,7 +685,7 @@ msgq_status(SCR *sp, db_recno_t lno, u_int flags)
|
||||
*/
|
||||
s = bp;
|
||||
if (LF_ISSET(MSTAT_TRUNCATE) && len > sp->cols) {
|
||||
for (; s < np && (*s != '/' || (p - s) > sp->cols - 3); ++s);
|
||||
for (; s < np && (*s != '/' || (size_t)(p - s) > sp->cols - 3); ++s);
|
||||
if (s == np) {
|
||||
s = p - (sp->cols - 5);
|
||||
*--s = ' ';
|
||||
|
4
dist/nvi/common/recover.c
vendored
4
dist/nvi/common/recover.c
vendored
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: recover.c,v 1.2 2008/12/05 22:51:42 christos Exp $ */
|
||||
/* $NetBSD: recover.c,v 1.3 2009/01/18 03:45:50 lukem Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1993, 1994
|
||||
@ -403,7 +403,7 @@ rcv_mailfile(SCR *sp, int issync, char *cp_path)
|
||||
"Precedence: bulk"); /* For vacation(1). */
|
||||
if (len > sizeof(buf) - 1)
|
||||
goto lerr;
|
||||
if (write(fd, buf, len) != len)
|
||||
if ((size_t)write(fd, buf, len) != len)
|
||||
goto werr;
|
||||
|
||||
len = snprintf(buf, sizeof(buf),
|
||||
|
5
dist/nvi/common/util.h
vendored
5
dist/nvi/common/util.h
vendored
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: util.h,v 1.1.1.2 2008/05/18 14:29:52 aymeric Exp $ */
|
||||
/* $NetBSD: util.h,v 1.2 2009/01/18 03:43:45 lukem Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1994
|
||||
@ -52,7 +52,8 @@ enum nresult { NUM_ERR, NUM_OK, NUM_OVER, NUM_UNDER };
|
||||
NNFITS(LONG_MIN, (v1), (v2))) ? NUM_UNDER : NUM_OK : \
|
||||
(v1) > 0 ? \
|
||||
(v2) > 0 && \
|
||||
NPFITS(LONG_MAX, (v1), (v2)) ? NUM_OK : NUM_OVER : \
|
||||
NPFITS(LONG_MAX, (unsigned long)(v1), (unsigned long)(v2)) ? \
|
||||
NUM_OK : NUM_OVER : \
|
||||
NUM_OK)
|
||||
#define NADD_USLONG(sp, v1, v2) \
|
||||
(NPFITS(ULONG_MAX, (v1), (v2)) ? NUM_OK : NUM_OVER)
|
||||
|
17
dist/nvi/ex/ex.c
vendored
17
dist/nvi/ex/ex.c
vendored
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: ex.c,v 1.3 2008/12/13 09:17:48 tsutsui Exp $ */
|
||||
/* $NetBSD: ex.c,v 1.4 2009/01/18 03:45:50 lukem Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1992, 1993, 1994
|
||||
@ -1421,13 +1421,13 @@ addr_verify:
|
||||
*/
|
||||
if (sp->ep != NULL && ecp->flagoff) {
|
||||
if (ecp->flagoff < 0) {
|
||||
if (sp->lno <= -ecp->flagoff) {
|
||||
if (sp->lno <= (db_recno_t)(-ecp->flagoff)) {
|
||||
msgq(sp, M_ERR,
|
||||
"088|Flag offset to before line 1");
|
||||
goto err;
|
||||
}
|
||||
} else {
|
||||
if (!NPFITS(DB_MAX_RECORDS, sp->lno, ecp->flagoff)) {
|
||||
if (!NPFITS(DB_MAX_RECORDS, sp->lno, (db_recno_t)ecp->flagoff)) {
|
||||
ex_badaddr(sp, NULL, A_NOTSET, NUM_OVER);
|
||||
goto err;
|
||||
}
|
||||
@ -1825,6 +1825,7 @@ ex_line(SCR *sp, EXCMD *ecp, MARK *mp, int *isaddrp, int *errp)
|
||||
EX_PRIVATE *exp;
|
||||
GS *gp;
|
||||
long total, val;
|
||||
unsigned long uval;
|
||||
int isneg;
|
||||
int (*sf) __P((SCR *, MARK *, MARK *, CHAR_T *, size_t, CHAR_T **, u_int));
|
||||
CHAR_T *endp;
|
||||
@ -1858,17 +1859,17 @@ ex_line(SCR *sp, EXCMD *ecp, MARK *mp, int *isaddrp, int *errp)
|
||||
*isaddrp = 1;
|
||||
F_SET(ecp, E_ABSMARK);
|
||||
|
||||
if ((nret = nget_slong(sp, &val, ecp->cp, &endp, 10)) != NUM_OK) {
|
||||
if ((nret = nget_uslong(sp, &uval, ecp->cp, &endp, 10)) != NUM_OK) {
|
||||
ex_badaddr(sp, NULL, A_NOTSET, nret);
|
||||
*errp = 1;
|
||||
return (0);
|
||||
}
|
||||
if (!NPFITS(DB_MAX_RECORDS, 0, val)) {
|
||||
if (!NPFITS(DB_MAX_RECORDS, 0, uval)) {
|
||||
ex_badaddr(sp, NULL, A_NOTSET, NUM_OVER);
|
||||
*errp = 1;
|
||||
return (0);
|
||||
}
|
||||
mp->lno = val;
|
||||
mp->lno = uval;
|
||||
mp->cno = 0;
|
||||
ecp->clen -= (endp - ecp->cp);
|
||||
ecp->cp = endp;
|
||||
@ -2043,14 +2044,14 @@ search: mp->lno = sp->lno;
|
||||
*/
|
||||
if (*isaddrp && total != 0) {
|
||||
if (total < 0) {
|
||||
if (-total > mp->lno) {
|
||||
if ((db_recno_t)-total > mp->lno) {
|
||||
msgq(sp, M_ERR,
|
||||
"097|Reference to a line number less than 0");
|
||||
*errp = 1;
|
||||
return (0);
|
||||
}
|
||||
} else
|
||||
if (!NPFITS(DB_MAX_RECORDS, mp->lno, total)) {
|
||||
if (!NPFITS(DB_MAX_RECORDS, mp->lno, (unsigned long)total)) {
|
||||
ex_badaddr(sp, NULL, A_NOTSET, NUM_OVER);
|
||||
*errp = 1;
|
||||
return (0);
|
||||
|
5
dist/nvi/ex/ex_args.c
vendored
5
dist/nvi/ex/ex_args.c
vendored
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: ex_args.c,v 1.2 2008/12/05 22:51:42 christos Exp $ */
|
||||
/* $NetBSD: ex_args.c,v 1.3 2009/01/18 03:45:50 lukem Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1991, 1993, 1994
|
||||
@ -266,7 +266,8 @@ int
|
||||
ex_args(SCR *sp, EXCMD *cmdp)
|
||||
{
|
||||
GS *gp;
|
||||
int cnt, col, len, sep;
|
||||
int cnt, sep;
|
||||
size_t col, len;
|
||||
char **ap;
|
||||
|
||||
if (sp->argv == NULL) {
|
||||
|
4
dist/nvi/ex/ex_cscope.c
vendored
4
dist/nvi/ex/ex_cscope.c
vendored
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: ex_cscope.c,v 1.3 2008/12/06 18:39:20 christos Exp $ */
|
||||
/* $NetBSD: ex_cscope.c,v 1.4 2009/01/18 03:45:50 lukem Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1994, 1996
|
||||
@ -322,7 +322,7 @@ get_paths(SCR *sp, CSC *csc)
|
||||
len = sb.st_size;
|
||||
MALLOC_RET(sp, csc->pbuf, char *, len + 1);
|
||||
if ((fd = open(buf, O_RDONLY, 0)) < 0 ||
|
||||
read(fd, csc->pbuf, len) != len) {
|
||||
(size_t)read(fd, csc->pbuf, len) != len) {
|
||||
msgq_str(sp, M_SYSERR, buf, "%s");
|
||||
if (fd >= 0)
|
||||
(void)close(fd);
|
||||
|
5
dist/nvi/ex/ex_screen.c
vendored
5
dist/nvi/ex/ex_screen.c
vendored
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: ex_screen.c,v 1.1.1.2 2008/05/18 14:31:17 aymeric Exp $ */
|
||||
/* $NetBSD: ex_screen.c,v 1.2 2009/01/18 03:45:50 lukem Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1993, 1994
|
||||
@ -104,7 +104,8 @@ ex_sdisplay(SCR *sp)
|
||||
{
|
||||
GS *gp;
|
||||
SCR *tsp;
|
||||
int cnt, col, len, sep;
|
||||
int cnt, sep;
|
||||
size_t col, len;
|
||||
|
||||
gp = sp->gp;
|
||||
if ((tsp = gp->hq.cqh_first) == (void *)&gp->hq) {
|
||||
|
7
dist/nvi/ex/ex_script.c
vendored
7
dist/nvi/ex/ex_script.c
vendored
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: ex_script.c,v 1.3 2008/12/05 22:51:42 christos Exp $ */
|
||||
/* $NetBSD: ex_script.c,v 1.4 2009/01/18 03:45:50 lukem Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1992, 1993, 1994
|
||||
@ -302,7 +302,8 @@ sscr_exec(SCR *sp, db_recno_t lno)
|
||||
SCRIPT *sc;
|
||||
db_recno_t last_lno;
|
||||
size_t blen, len, last_len, tlen;
|
||||
int isempty, matchprompt, nw, rval;
|
||||
int isempty, matchprompt, rval;
|
||||
ssize_t nw;
|
||||
CHAR_T *bp = NULL;
|
||||
CHAR_T *p;
|
||||
|
||||
@ -341,7 +342,7 @@ empty: msgq(sp, M_BERR, "151|No command to execute");
|
||||
|
||||
/* Push the line to the shell. */
|
||||
sc = sp->script;
|
||||
if ((nw = write(sc->sh_master, p, len)) != len)
|
||||
if ((size_t)(nw = write(sc->sh_master, p, len)) != len)
|
||||
goto err2;
|
||||
rval = 0;
|
||||
if (write(sc->sh_master, "\n", 1) != 1) {
|
||||
|
4
dist/nvi/ex/ex_shell.c
vendored
4
dist/nvi/ex/ex_shell.c
vendored
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: ex_shell.c,v 1.2 2008/12/05 22:51:42 christos Exp $ */
|
||||
/* $NetBSD: ex_shell.c,v 1.3 2009/01/18 03:45:50 lukem Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1992, 1993, 1994
|
||||
@ -359,7 +359,7 @@ sigmsg(int signo)
|
||||
{
|
||||
static char buf[40];
|
||||
const SIGS *sigp;
|
||||
int n;
|
||||
size_t n;
|
||||
|
||||
for (n = 0,
|
||||
sigp = &sigs[0]; n < sizeof(sigs) / sizeof(sigs[0]); ++n, ++sigp)
|
||||
|
12
dist/nvi/ex/ex_tag.c
vendored
12
dist/nvi/ex/ex_tag.c
vendored
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: ex_tag.c,v 1.5 2008/12/06 18:39:20 christos Exp $ */
|
||||
/* $NetBSD: ex_tag.c,v 1.6 2009/01/18 03:45:50 lukem Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1992, 1993, 1994
|
||||
@ -54,7 +54,7 @@ static TAGQ *gtag_slist __P((SCR *, CHAR_T *, int));
|
||||
#endif
|
||||
static int ctag_sfile __P((SCR *, TAGF *, TAGQ *, char *));
|
||||
static TAGQ *ctag_slist __P((SCR *, CHAR_T *));
|
||||
static char *linear_search __P((char *, char *, char *, long));
|
||||
static char *linear_search __P((char *, char *, char *, unsigned long));
|
||||
static int tag_copy __P((SCR *, TAG *, TAG **));
|
||||
static int tag_pop __P((SCR *, TAGQ *, int));
|
||||
static int tagf_copy __P((SCR *, TAGF *, TAGF **));
|
||||
@ -122,7 +122,7 @@ ex_tag_push(SCR *sp, EXCMD *cmdp)
|
||||
{
|
||||
EX_PRIVATE *exp;
|
||||
TAGQ *tqp;
|
||||
long tl;
|
||||
unsigned long tl;
|
||||
|
||||
exp = EXP(sp);
|
||||
switch (cmdp->argc) {
|
||||
@ -1208,7 +1208,7 @@ ctag_sfile(SCR *sp, TAGF *tfp, TAGQ *tqp, char *tname)
|
||||
char *cname = NULL, *dname = NULL, *name = NULL;
|
||||
const CHAR_T *wp;
|
||||
size_t wlen;
|
||||
long tl;
|
||||
unsigned long tl;
|
||||
|
||||
if ((fd = open(tfp->name, O_RDONLY, 0)) < 0) {
|
||||
tfp->errnum = errno;
|
||||
@ -1444,11 +1444,11 @@ binary_search(register char *string, register char *front, register char *back)
|
||||
* o front is before or at the first line to be printed.
|
||||
*/
|
||||
static char *
|
||||
linear_search(char *string, char *front, char *back, long tl)
|
||||
linear_search(char *string, char *front, char *back, unsigned long tl)
|
||||
{
|
||||
char *end;
|
||||
while (front < back) {
|
||||
end = tl && back-front > tl ? front+tl : back;
|
||||
end = tl && (unsigned long)(back-front) > tl ? front+tl : back;
|
||||
switch (compare(string, front, end)) {
|
||||
case EQUAL: /* Found it. */
|
||||
return (front);
|
||||
|
6
dist/nvi/regex/engine.c
vendored
6
dist/nvi/regex/engine.c
vendored
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: engine.c,v 1.3 2009/01/02 00:32:11 tnozaki Exp $ */
|
||||
/* $NetBSD: engine.c,v 1.4 2009/01/18 03:45:50 lukem Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1992, 1993, 1994 Henry Spencer.
|
||||
@ -105,7 +105,7 @@ static states step __P((struct re_guts *g, sopno start, sopno stop, states bef,
|
||||
#define BOW (BOL+4)
|
||||
#define EOW (BOL+5)
|
||||
#define CODEMAX (BOL+5) /* highest code used */
|
||||
#define NONCHAR(c) ((c) > RCHAR_T_MAX)
|
||||
#define NONCHAR(c) ((RCHAR_T)(c) > (RCHAR_T)RCHAR_T_MAX)
|
||||
#define NNONCHAR (CODEMAX-CHAR_MAX)
|
||||
#ifdef REDEBUG
|
||||
static void print __P((struct match *m, char *caption, states st, int ch, FILE *d));
|
||||
@ -146,7 +146,7 @@ regmatch_t pmatch[];
|
||||
int eflags;
|
||||
{
|
||||
register RCHAR_T *endp;
|
||||
register int i;
|
||||
register size_t i;
|
||||
struct match mv;
|
||||
register struct match *m = &mv;
|
||||
register RCHAR_T *dp;
|
||||
|
12
dist/nvi/regex/regcomp.c
vendored
12
dist/nvi/regex/regcomp.c
vendored
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: regcomp.c,v 1.3 2009/01/02 00:32:11 tnozaki Exp $ */
|
||||
/* $NetBSD: regcomp.c,v 1.4 2009/01/18 03:45:50 lukem Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1992, 1993, 1994 Henry Spencer.
|
||||
@ -895,7 +895,7 @@ p_b_coll_elem(register struct parse *p, int endc)
|
||||
{
|
||||
register RCHAR_T *sp = p->next;
|
||||
register struct cname *cp;
|
||||
register int len;
|
||||
register size_t len;
|
||||
|
||||
while (MORE() && !SEETWO(endc, ']'))
|
||||
NEXT();
|
||||
@ -1148,7 +1148,7 @@ allocset(register struct parse *p)
|
||||
static void
|
||||
freeset(register struct parse *p, register cset *cs)
|
||||
{
|
||||
register int i;
|
||||
register size_t i;
|
||||
register cset *top = &p->g->sets[p->g->ncsets];
|
||||
register size_t css = (size_t)p->g->csetsize;
|
||||
|
||||
@ -1172,7 +1172,7 @@ static int /* set number */
|
||||
freezeset(register struct parse *p, register cset *cs)
|
||||
{
|
||||
register uch h = cs->hash;
|
||||
register int i;
|
||||
register size_t i;
|
||||
register cset *top = &p->g->sets[p->g->ncsets];
|
||||
register cset *cs2;
|
||||
register size_t css = (size_t)p->g->csetsize;
|
||||
@ -1203,7 +1203,7 @@ freezeset(register struct parse *p, register cset *cs)
|
||||
static int /* character; there is no "none" value */
|
||||
firstch(register struct parse *p, register cset *cs)
|
||||
{
|
||||
register int i;
|
||||
register size_t i;
|
||||
register size_t css = (size_t)p->g->csetsize;
|
||||
|
||||
for (i = 0; i < css; i++)
|
||||
@ -1220,7 +1220,7 @@ firstch(register struct parse *p, register cset *cs)
|
||||
static int
|
||||
nch(register struct parse *p, register cset *cs)
|
||||
{
|
||||
register int i;
|
||||
register size_t i;
|
||||
register size_t css = (size_t)p->g->csetsize;
|
||||
register int n = 0;
|
||||
|
||||
|
4
dist/nvi/regex/regexec.c
vendored
4
dist/nvi/regex/regexec.c
vendored
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: regexec.c,v 1.2 2008/12/05 22:51:43 christos Exp $ */
|
||||
/* $NetBSD: regexec.c,v 1.3 2009/01/18 03:45:50 lukem Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1992, 1993, 1994 Henry Spencer.
|
||||
@ -173,7 +173,7 @@ regexec(const regex_t *preg, const RCHAR_T *string, size_t nmatch, regmatch_t *p
|
||||
return(REG_BADPAT);
|
||||
eflags = GOODFLAGS(eflags);
|
||||
|
||||
if (g->nstates <= CHAR_BIT*sizeof(states1) && !(eflags®_LARGE))
|
||||
if (g->nstates <= (int)(CHAR_BIT*sizeof(states1)) && !(eflags®_LARGE))
|
||||
return(smatcher(g, (RCHAR_T *)__UNCONST(string), nmatch, pmatch, eflags));
|
||||
else
|
||||
return(lmatcher(g, (RCHAR_T *)__UNCONST(string), nmatch, pmatch, eflags));
|
||||
|
4
dist/nvi/vi/v_event.c
vendored
4
dist/nvi/vi/v_event.c
vendored
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: v_event.c,v 1.2 2008/12/05 22:51:43 christos Exp $ */
|
||||
/* $NetBSD: v_event.c,v 1.3 2009/01/18 03:45:50 lukem Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1996
|
||||
@ -61,7 +61,7 @@ v_c_settop(SCR *sp, VICMD *vp)
|
||||
SMAP_FLUSH(smp);
|
||||
if (vs_line(sp, smp, &ty, &tx))
|
||||
return (1);
|
||||
if (ty != -1) {
|
||||
if (ty != (size_t)-1) {
|
||||
y = ty;
|
||||
x = tx;
|
||||
}
|
||||
|
9
dist/nvi/vi/v_increment.c
vendored
9
dist/nvi/vi/v_increment.c
vendored
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: v_increment.c,v 1.2 2008/12/05 22:51:43 christos Exp $ */
|
||||
/* $NetBSD: v_increment.c,v 1.3 2009/01/18 03:45:50 lukem Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1992, 1993, 1994
|
||||
@ -55,8 +55,8 @@ int
|
||||
v_increment(SCR *sp, VICMD *vp)
|
||||
{
|
||||
enum nresult nret;
|
||||
u_long ulval;
|
||||
long change, ltmp, lval;
|
||||
u_long ulval, change;
|
||||
long ltmp, lval;
|
||||
size_t beg, blen, end, len, nlen, wlen;
|
||||
int base, isempty, rval;
|
||||
const char *ntype;
|
||||
@ -193,7 +193,8 @@ nonum: msgq(sp, M_ERR, "181|Cursor not in a number");
|
||||
if ((nret = nget_slong(sp, &lval, t, NULL, 10)) != NUM_OK)
|
||||
goto err;
|
||||
ltmp = vp->character == '-' ? -change : change;
|
||||
if (lval > 0 && ltmp > 0 && !NPFITS(LONG_MAX, lval, ltmp)) {
|
||||
if (lval > 0 && ltmp > 0 &&
|
||||
!NPFITS(LONG_MAX, (unsigned long)lval, (unsigned long)ltmp)) {
|
||||
nret = NUM_OVER;
|
||||
goto err;
|
||||
}
|
||||
|
11
dist/nvi/vi/v_match.c
vendored
11
dist/nvi/vi/v_match.c
vendored
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: v_match.c,v 1.3 2008/12/05 22:51:43 christos Exp $ */
|
||||
/* $NetBSD: v_match.c,v 1.4 2009/01/18 03:45:50 lukem Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1992, 1993, 1994
|
||||
@ -44,7 +44,8 @@ v_match(SCR *sp, VICMD *vp)
|
||||
char *cp;
|
||||
const char *match_chars;
|
||||
|
||||
static int match_lno, match_col, match_dir;
|
||||
static MARK match = { 0, 0 };
|
||||
static int match_dir;
|
||||
|
||||
/*
|
||||
* Historically vi would match (), {} and [] however
|
||||
@ -84,7 +85,7 @@ nomatch: msgq(sp, M_BERR, "184|No match character on this line");
|
||||
/* Alternate back-forward search if startc and matchc the same */
|
||||
if (startc == matchc) {
|
||||
/* are we continuing from where last match finished? */
|
||||
if (match_lno == vp->m_start.lno && match_col ==vp->m_start.cno)
|
||||
if (match.lno == vp->m_start.lno && match.cno ==vp->m_start.cno)
|
||||
/* yes - continue in sequence */
|
||||
match_dir++;
|
||||
else
|
||||
@ -137,8 +138,8 @@ nomatch: msgq(sp, M_BERR, "184|No match character on this line");
|
||||
else
|
||||
vp->m_final = vp->m_stop;
|
||||
|
||||
match_lno = vp->m_final.lno;
|
||||
match_col = vp->m_final.cno;
|
||||
match.lno = vp->m_final.lno;
|
||||
match.cno = vp->m_final.cno;
|
||||
|
||||
/*
|
||||
* !!!
|
||||
|
9
dist/nvi/vi/v_txt.c
vendored
9
dist/nvi/vi/v_txt.c
vendored
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: v_txt.c,v 1.4 2009/01/16 15:05:55 christos Exp $ */
|
||||
/* $NetBSD: v_txt.c,v 1.5 2009/01/18 03:45:50 lukem Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1993, 1994
|
||||
@ -276,7 +276,8 @@ v_txt(SCR *sp, VICMD *vp, MARK *tm, const CHAR_T *lp, size_t len, ARG_CHAR_T pro
|
||||
int hexcnt; /* Hex character count. */
|
||||
int showmatch; /* Showmatch set on this character. */
|
||||
int wm_set, wm_skip; /* Wrapmargin happened, blank skip flags. */
|
||||
int max, tmp;
|
||||
size_t max;
|
||||
int tmp;
|
||||
CHAR_T *p;
|
||||
|
||||
gp = sp->gp;
|
||||
@ -2215,7 +2216,7 @@ txt_fc_col(SCR *sp, int argc, ARGS **argv)
|
||||
} else {
|
||||
/* Figure out the number of columns. */
|
||||
numcols = (sp->cols - 1) / colwidth;
|
||||
if (argc > numcols) {
|
||||
if ((size_t)argc > numcols) {
|
||||
numrows = argc / numcols;
|
||||
if (argc % numcols)
|
||||
++numrows;
|
||||
@ -2232,7 +2233,7 @@ txt_fc_col(SCR *sp, int argc, ARGS **argv)
|
||||
if (nf)
|
||||
FREE_SPACE(sp, pp, 0);
|
||||
CHK_INTR;
|
||||
if ((base += numrows) >= argc)
|
||||
if ((base += numrows) >= (size_t)argc)
|
||||
break;
|
||||
(void)ex_printf(sp,
|
||||
"%*s", (int)(colwidth - cnt), "");
|
||||
|
4
dist/nvi/vi/vs_line.c
vendored
4
dist/nvi/vi/vs_line.c
vendored
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: vs_line.c,v 1.3 2008/12/06 23:18:36 christos Exp $ */
|
||||
/* $NetBSD: vs_line.c,v 1.4 2009/01/18 03:45:50 lukem Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1993, 1994
|
||||
@ -65,7 +65,7 @@ vs_line(SCR *sp, SMAP *smp, size_t *yp, size_t *xp)
|
||||
no_draw = 0;
|
||||
if (!F_ISSET(sp, SC_TINPUT_INFO) && VIP(sp)->totalcount > 1)
|
||||
no_draw = 1;
|
||||
if (F_ISSET(sp, SC_SCR_EXWROTE) && smp - HMAP != LASTLINE(sp))
|
||||
if (F_ISSET(sp, SC_SCR_EXWROTE) && (size_t)(smp - HMAP) != LASTLINE(sp))
|
||||
no_draw = 1;
|
||||
|
||||
/*
|
||||
|
6
dist/nvi/vi/vs_refresh.c
vendored
6
dist/nvi/vi/vs_refresh.c
vendored
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: vs_refresh.c,v 1.2 2008/12/05 22:51:43 christos Exp $ */
|
||||
/* $NetBSD: vs_refresh.c,v 1.3 2009/01/18 03:45:50 lukem Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1992, 1993, 1994
|
||||
@ -625,7 +625,7 @@ shifted: /* Fill in screen map with the new offset. */
|
||||
vip->sc_smap = NULL; smp <= TMAP && smp->lno == LNO; ++smp) {
|
||||
if (vs_line(sp, smp, &y, &SCNO))
|
||||
return (1);
|
||||
if (y != -1) {
|
||||
if (y != (size_t)-1) {
|
||||
vip->sc_smap = smp;
|
||||
break;
|
||||
}
|
||||
@ -645,7 +645,7 @@ paint: for (smp = HMAP; smp <= TMAP; ++smp)
|
||||
for (y = -1, vip->sc_smap = NULL, smp = HMAP; smp <= TMAP; ++smp) {
|
||||
if (vs_line(sp, smp, &y, &SCNO))
|
||||
return (1);
|
||||
if (y != -1 && vip->sc_smap == NULL)
|
||||
if (y != (size_t)-1 && vip->sc_smap == NULL)
|
||||
vip->sc_smap = smp;
|
||||
}
|
||||
/*
|
||||
|
10
dist/nvi/vi/vs_smap.c
vendored
10
dist/nvi/vi/vs_smap.c
vendored
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: vs_smap.c,v 1.1.1.2 2008/05/18 14:31:52 aymeric Exp $ */
|
||||
/* $NetBSD: vs_smap.c,v 1.2 2009/01/18 03:45:50 lukem Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1993, 1994
|
||||
@ -913,7 +913,7 @@ vs_sm_down(SCR *sp, MARK *rp, db_recno_t count, scroll_t scmd, SMAP *smp)
|
||||
* The ^B and ^U commands move the cursor towards SOF
|
||||
* if there are more lines to move.
|
||||
*/
|
||||
if (count < smp - HMAP)
|
||||
if (count < (db_recno_t)(smp - HMAP))
|
||||
smp -= count;
|
||||
else
|
||||
smp = HMAP;
|
||||
@ -1142,7 +1142,7 @@ vs_sm_position(SCR *sp, MARK *rp, u_long cnt, pos_t pos)
|
||||
* We do nothing special here, just making sure that H in
|
||||
* an empty screen works.
|
||||
*/
|
||||
if (cnt > TMAP - HMAP)
|
||||
if (cnt > (u_long)(TMAP - HMAP))
|
||||
goto sof;
|
||||
smp = HMAP + cnt;
|
||||
if (cnt && !db_exist(sp, smp->lno)) {
|
||||
@ -1173,14 +1173,14 @@ sof: msgq(sp, M_BERR, "220|Movement past the end-of-screen");
|
||||
* If the screen isn't filled, find the bottom of what's
|
||||
* real and try to offset from there.
|
||||
*/
|
||||
if (cnt > TMAP - HMAP)
|
||||
if (cnt > (u_long)(TMAP - HMAP))
|
||||
goto eof;
|
||||
smp = TMAP - cnt;
|
||||
if (!db_exist(sp, smp->lno)) {
|
||||
if (db_last(sp, &last))
|
||||
return (1);
|
||||
for (; smp->lno > last && smp > HMAP; --smp);
|
||||
if (cnt > smp - HMAP) {
|
||||
if (cnt > (u_long)(smp - HMAP)) {
|
||||
eof: msgq(sp, M_BERR,
|
||||
"221|Movement past the beginning-of-screen");
|
||||
return (1);
|
||||
|
14
dist/nvi/vi/vs_split.c
vendored
14
dist/nvi/vi/vs_split.c
vendored
@ -1,4 +1,4 @@
|
||||
/* $NetBSD: vs_split.c,v 1.2 2008/12/05 22:51:43 christos Exp $ */
|
||||
/* $NetBSD: vs_split.c,v 1.3 2009/01/18 03:45:50 lukem Exp $ */
|
||||
|
||||
/*-
|
||||
* Copyright (c) 1993, 1994
|
||||
@ -98,7 +98,7 @@ vs_split(SCR *sp, SCR *new, int ccl)
|
||||
* in half and update the shared information.
|
||||
*/
|
||||
splitup =
|
||||
!ccl && (vs_sm_cursor(sp, &smp) ? 0 : (smp - HMAP) + 1) >= half;
|
||||
!ccl && (vs_sm_cursor(sp, &smp) ? 0 : (size_t)(smp - HMAP) + 1) >= half;
|
||||
if (splitup) { /* Old is bottom half. */
|
||||
new->rows = sp->rows - half; /* New. */
|
||||
new->roff = sp->roff;
|
||||
@ -827,9 +827,9 @@ vs_resize(SCR *sp, long int count, adj_t adj)
|
||||
if (count == 0)
|
||||
return (0);
|
||||
if (adj == A_SET) {
|
||||
if (sp->t_maxrows == count)
|
||||
if (sp->t_maxrows == (size_t)count)
|
||||
return (0);
|
||||
if (sp->t_maxrows > count) {
|
||||
if (sp->t_maxrows > (size_t)count) {
|
||||
adj = A_DECREASE;
|
||||
count = sp->t_maxrows - count;
|
||||
} else {
|
||||
@ -862,7 +862,7 @@ vs_resize(SCR *sp, long int count, adj_t adj)
|
||||
if (count < 0)
|
||||
count = -count;
|
||||
s = sp;
|
||||
if (s->t_maxrows < MINIMUM_SCREEN_ROWS + count)
|
||||
if (s->t_maxrows < MINIMUM_SCREEN_ROWS + (size_t)count)
|
||||
goto toosmall;
|
||||
if ((g = prev) == (void *)&wp->scrq) {
|
||||
if ((g = next) == (void *)&wp->scrq)
|
||||
@ -873,7 +873,7 @@ vs_resize(SCR *sp, long int count, adj_t adj)
|
||||
} else {
|
||||
g = sp;
|
||||
if ((s = next) != (void *)&wp->scrq &&
|
||||
s->t_maxrows >= MINIMUM_SCREEN_ROWS + count)
|
||||
s->t_maxrows >= MINIMUM_SCREEN_ROWS + (size_t)count)
|
||||
s_off = count;
|
||||
else
|
||||
s = NULL;
|
||||
@ -884,7 +884,7 @@ toobig: msgq(sp, M_BERR, adj == A_DECREASE ?
|
||||
"228|The screen cannot grow");
|
||||
return (1);
|
||||
}
|
||||
if (s->t_maxrows < MINIMUM_SCREEN_ROWS + count) {
|
||||
if (s->t_maxrows < MINIMUM_SCREEN_ROWS + (size_t)count) {
|
||||
toosmall: msgq(sp, M_BERR,
|
||||
"226|The screen can only shrink to %d rows",
|
||||
MINIMUM_SCREEN_ROWS);
|
||||
|
Loading…
Reference in New Issue
Block a user