diff options
author | Otto Moerbeek <otto@cvs.openbsd.org> | 2007-02-19 11:40:01 +0000 |
---|---|---|
committer | Otto Moerbeek <otto@cvs.openbsd.org> | 2007-02-19 11:40:01 +0000 |
commit | 798300be85f1053c70f183a2ac9e71458c7c1dae (patch) | |
tree | 69b9a3f7595052973872142f83c8c30289381dd6 /usr.bin | |
parent | 27d58412abaa0705237ccfac83add9738c79b6ec (diff) |
Fix const inconsistencies, void pointer artithmetic and a few other
things. now gcc -Wall and lint are more happy. ok joris@ xsa@
Diffstat (limited to 'usr.bin')
-rw-r--r-- | usr.bin/cvs/buf.c | 6 | ||||
-rw-r--r-- | usr.bin/cvs/buf.h | 6 | ||||
-rw-r--r-- | usr.bin/cvs/cmd.c | 4 | ||||
-rw-r--r-- | usr.bin/cvs/cvs.h | 6 | ||||
-rw-r--r-- | usr.bin/cvs/entries.c | 4 | ||||
-rw-r--r-- | usr.bin/cvs/file.c | 6 | ||||
-rw-r--r-- | usr.bin/cvs/rcs.c | 27 | ||||
-rw-r--r-- | usr.bin/cvs/rcs.h | 6 | ||||
-rw-r--r-- | usr.bin/cvs/util.c | 6 | ||||
-rw-r--r-- | usr.bin/cvs/util.h | 8 |
10 files changed, 39 insertions, 40 deletions
diff --git a/usr.bin/cvs/buf.c b/usr.bin/cvs/buf.c index 06989dc1fcd..f4fbb61c555 100644 --- a/usr.bin/cvs/buf.c +++ b/usr.bin/cvs/buf.c @@ -1,4 +1,4 @@ -/* $OpenBSD: buf.c,v 1.57 2007/02/02 04:34:49 ray Exp $ */ +/* $OpenBSD: buf.c,v 1.58 2007/02/19 11:40:00 otto Exp $ */ /* * Copyright (c) 2003 Jean-Francois Brousseau <jfb@openbsd.org> * All rights reserved. @@ -138,7 +138,7 @@ cvs_buf_free(BUF *b) * of the buffer. Instead, they are returned and should be freed later using * free(). */ -void * +u_char * cvs_buf_release(BUF *b) { u_char *tmp; @@ -398,7 +398,7 @@ cvs_buf_copy(BUF *b, size_t off, void *dst, size_t len) * * Peek at the contents of the buffer <b> at offset <off>. */ -const void * +const u_char * cvs_buf_peek(BUF *b, size_t off) { if (off >= b->cb_len) diff --git a/usr.bin/cvs/buf.h b/usr.bin/cvs/buf.h index 3e07ffd1a2a..91b976cf7bd 100644 --- a/usr.bin/cvs/buf.h +++ b/usr.bin/cvs/buf.h @@ -1,4 +1,4 @@ -/* $OpenBSD: buf.h,v 1.19 2007/02/02 04:24:09 ray Exp $ */ +/* $OpenBSD: buf.h,v 1.20 2007/02/19 11:40:00 otto Exp $ */ /* * Copyright (c) 2003 Jean-Francois Brousseau <jfb@openbsd.org> * All rights reserved. @@ -36,7 +36,7 @@ BUF *cvs_buf_alloc(size_t, u_int); BUF *cvs_buf_load(const char *, u_int); BUF *cvs_buf_load_fd(int, u_int); void cvs_buf_free(BUF *); -void *cvs_buf_release(BUF *); +u_char *cvs_buf_release(BUF *); u_char cvs_buf_getc(BUF *, size_t); void cvs_buf_empty(BUF *); ssize_t cvs_buf_append(BUF *, const void *, size_t); @@ -50,7 +50,7 @@ int cvs_buf_differ(BUF *, BUF *); void cvs_buf_write_stmp(BUF *, char *, struct timeval *); ssize_t cvs_buf_copy(BUF *, size_t, void *, size_t); -const void *cvs_buf_peek(BUF *, size_t); +const u_char *cvs_buf_peek(BUF *, size_t); #define cvs_buf_get(b) cvs_buf_peek(b, 0) diff --git a/usr.bin/cvs/cmd.c b/usr.bin/cvs/cmd.c index 44791037724..89c23c86c69 100644 --- a/usr.bin/cvs/cmd.c +++ b/usr.bin/cvs/cmd.c @@ -1,4 +1,4 @@ -/* $OpenBSD: cmd.c,v 1.55 2006/11/27 14:19:53 xsa Exp $ */ +/* $OpenBSD: cmd.c,v 1.56 2007/02/19 11:40:00 otto Exp $ */ /* * Copyright (c) 2005 Joris Vink <joris@openbsd.org> * All rights reserved. @@ -95,7 +95,7 @@ cvs_findcmd(const char *cmd) } struct cvs_cmd * -cvs_findcmdbyreq(int reqid) +cvs_findcmdbyreq(u_int reqid) { int i; struct cvs_cmd *cmdp; diff --git a/usr.bin/cvs/cvs.h b/usr.bin/cvs/cvs.h index 6eddbd2782f..02e0b0bb41e 100644 --- a/usr.bin/cvs/cvs.h +++ b/usr.bin/cvs/cvs.h @@ -1,4 +1,4 @@ -/* $OpenBSD: cvs.h,v 1.132 2007/01/19 08:21:44 xsa Exp $ */ +/* $OpenBSD: cvs.h,v 1.133 2007/02/19 11:40:00 otto Exp $ */ /* * Copyright (c) 2004 Jean-Francois Brousseau <jfb@openbsd.org> * All rights reserved. @@ -324,7 +324,7 @@ extern struct cvs_cmd cvs_cmd_watchers; /* cmd.c */ struct cvs_cmd *cvs_findcmd(const char *); -struct cvs_cmd *cvs_findcmdbyreq(int); +struct cvs_cmd *cvs_findcmdbyreq(u_int); /* cvs.c */ int cvs_var_set(const char *, const char *); @@ -345,7 +345,7 @@ void cvs_ent_close(CVSENTRIES *, int); void cvs_ent_free(struct cvs_ent *); int cvs_ent_exists(CVSENTRIES *, const char *); void cvs_parse_tagfile(char *, char **, char **, int *); -void cvs_write_tagfile(char *, char *, char *, int); +void cvs_write_tagfile(const char *, char *, char *, int); /* root.c */ struct cvsroot *cvsroot_parse(const char *); diff --git a/usr.bin/cvs/entries.c b/usr.bin/cvs/entries.c index d4c93399f72..ba8246020b6 100644 --- a/usr.bin/cvs/entries.c +++ b/usr.bin/cvs/entries.c @@ -1,4 +1,4 @@ -/* $OpenBSD: entries.c,v 1.73 2007/02/17 18:23:43 xsa Exp $ */ +/* $OpenBSD: entries.c,v 1.74 2007/02/19 11:40:00 otto Exp $ */ /* * Copyright (c) 2006 Joris Vink <joris@openbsd.org> * @@ -417,7 +417,7 @@ cvs_parse_tagfile(char *dir, char **tagp, char **datep, int *nbp) } void -cvs_write_tagfile(char *dir, char *tag, char *date, int nb) +cvs_write_tagfile(const char *dir, char *tag, char *date, int nb) { FILE *fp; char tagpath[MAXPATHLEN]; diff --git a/usr.bin/cvs/file.c b/usr.bin/cvs/file.c index f00c781bfdd..e04974736c6 100644 --- a/usr.bin/cvs/file.c +++ b/usr.bin/cvs/file.c @@ -1,4 +1,4 @@ -/* $OpenBSD: file.c,v 1.186 2007/02/09 16:46:26 joris Exp $ */ +/* $OpenBSD: file.c,v 1.187 2007/02/19 11:40:00 otto Exp $ */ /* * Copyright (c) 2006 Joris Vink <joris@openbsd.org> * Copyright (c) 2004 Jean-Francois Brousseau <jfb@openbsd.org> @@ -861,7 +861,7 @@ cvs_file_cmp(const char *file1, const char *file2) if (S_ISREG(stb1.st_mode)) { void *p1, *p2; - if (stb1.st_size > SIZE_MAX) { + if (stb1.st_size > (off_t)SIZE_MAX) { ret = 1; goto out; } @@ -920,7 +920,7 @@ cvs_file_copy(const char *from, const char *to) char *p, *buf; int saved_errno; - if (st.st_size > SIZE_MAX) { + if (st.st_size > (off_t)SIZE_MAX) { ret = -1; goto out; } diff --git a/usr.bin/cvs/rcs.c b/usr.bin/cvs/rcs.c index 1713ce9506a..444ddea941d 100644 --- a/usr.bin/cvs/rcs.c +++ b/usr.bin/cvs/rcs.c @@ -1,4 +1,4 @@ -/* $OpenBSD: rcs.c,v 1.208 2007/02/04 15:05:05 otto Exp $ */ +/* $OpenBSD: rcs.c,v 1.209 2007/02/19 11:40:00 otto Exp $ */ /* * Copyright (c) 2004 Jean-Francois Brousseau <jfb@openbsd.org> * All rights reserved. @@ -1007,7 +1007,8 @@ rcs_tag_resolve(RCSFILE *file, const char *tag) int rcs_patch_lines(struct cvs_lines *dlines, struct cvs_lines *plines) { - char op, *ep; + u_char op; + char *ep; struct cvs_line *lp, *dlp, *ndlp; int i, lineno, nbln; u_char tmp; @@ -1024,7 +1025,7 @@ rcs_patch_lines(struct cvs_lines *dlines, struct cvs_lines *plines) /* NUL-terminate line buffer for strtol() safety. */ tmp = lp->l_line[lp->l_len - 1]; lp->l_line[lp->l_len - 1] = '\0'; - lineno = (int)strtol((lp->l_line + 1), &ep, 10); + lineno = (int)strtol((char*)(lp->l_line + 1), &ep, 10); if (lineno - 1 > dlines->l_nblines || lineno < 0) { fatal("invalid line specification in RCS patch"); } @@ -1174,7 +1175,6 @@ rcs_rev_add(RCSFILE *rf, RCSNUM *rev, const char *msg, time_t date, brp->rb_num = rcsnum_alloc(); rcsnum_cpy(rdp->rd_num, brp->rb_num, 0); TAILQ_INSERT_TAIL(&(rdp->rd_branches), brp, rb_list); - ordp = TAILQ_PREV(rdp, rcs_dlist, rd_list); rcsnum_cpy(rdp->rd_num, ordp->rd_next, 0); } else { @@ -1199,7 +1199,7 @@ rcs_rev_remove(RCSFILE *rf, RCSNUM *rev) { char *path_tmp1, *path_tmp2; struct rcs_delta *rdp, *prevrdp, *nextrdp; - BUF *nextbuf, *prevbuf, *newdiff, *newdeltatext; + BUF *prevbuf, *newdiff, *newdeltatext; if (rev == RCS_HEAD_REV) rev = rf->rf_head; @@ -1221,7 +1221,7 @@ rcs_rev_remove(RCSFILE *rf, RCSNUM *rev) nextrdp = (struct rcs_delta *)TAILQ_PREV(rdp, cvs_tqh, rd_list); newdeltatext = NULL; - prevbuf = nextbuf = NULL; + prevbuf = NULL; if (prevrdp != NULL && nextrdp != NULL) { newdiff = cvs_buf_alloc(64, BUF_AUTOEXT); @@ -1291,7 +1291,6 @@ struct rcs_delta * rcs_findrev(RCSFILE *rfp, RCSNUM *rev) { int isbrev; - u_int cmplen; struct rcs_delta *rdp; isbrev = RCSNUM_ISBRANCHREV(rev); @@ -1308,8 +1307,6 @@ rcs_findrev(RCSFILE *rfp, RCSNUM *rev) rcs_parse_deltas(rfp, rev); } - cmplen = rev->rn_len; - TAILQ_FOREACH(rdp, &(rfp->rf_delta), rd_list) { if (rcsnum_differ(rdp->rd_num, rev)) continue; @@ -2626,8 +2623,8 @@ rcs_translate_tag(const char *revstr, RCSFILE *rfp) struct cvs_lines * rcs_rev_getlines(RCSFILE *rfp, RCSNUM *frev) { - size_t i, plen; - int done, nextroot, found; + size_t plen; + int i, done, nextroot, found; RCSNUM *tnum, *bnum; struct rcs_branch *brp; struct rcs_delta *hrdp, *trdp, *rdp; @@ -2698,6 +2695,7 @@ next: nextroot += 2; rcsnum_cpy(frev, bnum, nextroot); + /* XXX strange loop and "found" set but not used */ TAILQ_FOREACH(brp, &(rdp->rd_branches), rb_list) { found = 1; for (i = 0; i < nextroot - 1; i++) { @@ -2848,7 +2846,8 @@ rcs_kwexp_line(char *rcsfile, struct rcs_delta *rdp, struct cvs_line *line, { int kwtype; u_int j, found; - u_char *c, *kwstr, *start, *end, *fin; + const u_char *c, *start, *fin, *end; + char *kwstr; char expbuf[256], buf[256]; char *fmt; size_t len, kwlen; @@ -3022,14 +3021,14 @@ rcs_kwexp_line(char *rcsfile, struct rcs_delta *rdp, struct cvs_line *line, tmpbuf = cvs_buf_alloc(len + strlen(expbuf), BUF_AUTOEXT); /* Append everything before keyword. */ cvs_buf_append(tmpbuf, line->l_line, - start - (unsigned char *)line->l_line); + start - line->l_line); /* Append keyword. */ cvs_buf_append(tmpbuf, expbuf, strlen(expbuf)); /* Point c to end of keyword. */ tlen = cvs_buf_len(tmpbuf) - 1; /* Append everything after keyword. */ cvs_buf_append(tmpbuf, end, - ((unsigned char *)line->l_line + line->l_len) - end); + line->l_line + line->l_len - end); c = cvs_buf_get(tmpbuf) + tlen; /* Point fin to end of data. */ fin = cvs_buf_get(tmpbuf) + cvs_buf_len(tmpbuf) - 1; diff --git a/usr.bin/cvs/rcs.h b/usr.bin/cvs/rcs.h index 51ef1e500ff..10d740e0037 100644 --- a/usr.bin/cvs/rcs.h +++ b/usr.bin/cvs/rcs.h @@ -1,4 +1,4 @@ -/* $OpenBSD: rcs.h,v 1.74 2007/02/12 14:35:28 xsa Exp $ */ +/* $OpenBSD: rcs.h,v 1.75 2007/02/19 11:40:00 otto Exp $ */ /* * Copyright (c) 2004 Jean-Francois Brousseau <jfb@openbsd.org> * All rights reserved. @@ -177,7 +177,7 @@ TAILQ_HEAD(rcs_dlist, rcs_delta); struct rcs_delta { RCSNUM *rd_num; RCSNUM *rd_next; - u_int rd_flags; + int rd_flags; struct tm rd_date; char *rd_author; char *rd_state; @@ -197,7 +197,7 @@ typedef struct rcs_file { int rf_inattic; char *rf_path; mode_t rf_mode; - u_int rf_flags; + int rf_flags; RCSNUM *rf_head; RCSNUM *rf_branch; diff --git a/usr.bin/cvs/util.c b/usr.bin/cvs/util.c index d61a79f83df..e0a09c9f14d 100644 --- a/usr.bin/cvs/util.c +++ b/usr.bin/cvs/util.c @@ -1,4 +1,4 @@ -/* $OpenBSD: util.c,v 1.105 2007/02/17 18:23:43 xsa Exp $ */ +/* $OpenBSD: util.c,v 1.106 2007/02/19 11:40:00 otto Exp $ */ /* * Copyright (c) 2004 Jean-Francois Brousseau <jfb@openbsd.org> * Copyright (c) 2005, 2006 Joris Vink <joris@openbsd.org> @@ -704,7 +704,7 @@ cvs_mkpath(const char *path) * Split the contents of a file into a list of lines. */ struct cvs_lines * -cvs_splitlines(const u_char *data, size_t len) +cvs_splitlines(u_char *data, size_t len) { u_char *p, *c; size_t i, tlen; @@ -753,7 +753,7 @@ cvs_freelines(struct cvs_lines *lines) } BUF * -cvs_patchfile(const u_char *data, size_t dlen, const u_char *patch, size_t plen, +cvs_patchfile(u_char *data, size_t dlen, u_char *patch, size_t plen, int (*p)(struct cvs_lines *, struct cvs_lines *)) { struct cvs_lines *dlines, *plines; diff --git a/usr.bin/cvs/util.h b/usr.bin/cvs/util.h index 93dcf79be41..13db61da576 100644 --- a/usr.bin/cvs/util.h +++ b/usr.bin/cvs/util.h @@ -1,4 +1,4 @@ -/* $OpenBSD: util.h,v 1.16 2007/02/17 18:23:43 xsa Exp $ */ +/* $OpenBSD: util.h,v 1.17 2007/02/19 11:40:00 otto Exp $ */ /* * Copyright (c) 2006 Niall O'Higgins <niallo@openbsd.org> * All rights reserved. @@ -47,7 +47,7 @@ void cvs_freeargv(char **, int); u_int cvs_revision_select(RCSFILE *, char *); struct cvs_line { - char *l_line; + u_char *l_line; size_t l_len; int l_lineno; int l_needsfree; @@ -66,10 +66,10 @@ struct cvs_argvector { char **argv; }; -BUF *cvs_patchfile(const u_char *, size_t, const u_char *, +BUF *cvs_patchfile(u_char *, size_t, u_char *, size_t, int (*p)(struct cvs_lines *, struct cvs_lines *)); -struct cvs_lines *cvs_splitlines(const u_char *, size_t); +struct cvs_lines *cvs_splitlines(u_char *, size_t); void cvs_freelines(struct cvs_lines *); struct cvs_argvector *cvs_strsplit(char *, const char *); void cvs_argv_destroy(struct cvs_argvector *); |