From 95dc81ae9b9a9ff5088c08b567127f2211d0d58a Mon Sep 17 00:00:00 2001 From: Xavier Santolaria Date: Thu, 22 Feb 2007 08:30:46 +0000 Subject: Fix const inconsistencies, void pointer artithmetic; Based on diff from otto@ in OpenCVS. OK otto@. --- usr.bin/rcs/buf.c | 4 ++-- usr.bin/rcs/buf.h | 4 ++-- usr.bin/rcs/diff.c | 5 +++-- usr.bin/rcs/diff3.c | 8 ++++---- usr.bin/rcs/rcsutil.c | 6 +++--- usr.bin/rcs/rcsutil.h | 7 +++---- 6 files changed, 17 insertions(+), 17 deletions(-) diff --git a/usr.bin/rcs/buf.c b/usr.bin/rcs/buf.c index 11428bf9a07..ea435057c88 100644 --- a/usr.bin/rcs/buf.c +++ b/usr.bin/rcs/buf.c @@ -1,4 +1,4 @@ -/* $OpenBSD: buf.c,v 1.10 2007/02/02 04:34:49 ray Exp $ */ +/* $OpenBSD: buf.c,v 1.11 2007/02/22 08:30:45 xsa Exp $ */ /* * Copyright (c) 2003 Jean-Francois Brousseau * All rights reserved. @@ -165,7 +165,7 @@ rcs_buf_release(BUF *b) /* * rcs_buf_get() */ -void * +u_char * rcs_buf_get(BUF *b) { return (b->cb_buf); diff --git a/usr.bin/rcs/buf.h b/usr.bin/rcs/buf.h index d63a7cfcaf1..4d966c1ced6 100644 --- a/usr.bin/rcs/buf.h +++ b/usr.bin/rcs/buf.h @@ -1,4 +1,4 @@ -/* $OpenBSD: buf.h,v 1.7 2007/02/16 03:00:52 ray Exp $ */ +/* $OpenBSD: buf.h,v 1.8 2007/02/22 08:30:45 xsa Exp $ */ /* * Copyright (c) 2003 Jean-Francois Brousseau * All rights reserved. @@ -57,5 +57,5 @@ size_t rcs_buf_len(BUF *); int rcs_buf_write_fd(BUF *, int); int rcs_buf_write(BUF *, const char *, mode_t); void rcs_buf_write_stmp(BUF *, char *); -void *rcs_buf_get(BUF *b); +u_char *rcs_buf_get(BUF *b); #endif /* BUF_H */ diff --git a/usr.bin/rcs/diff.c b/usr.bin/rcs/diff.c index b5aa4f15729..929f198164a 100644 --- a/usr.bin/rcs/diff.c +++ b/usr.bin/rcs/diff.c @@ -1,4 +1,4 @@ -/* $OpenBSD: diff.c,v 1.10 2006/09/27 06:25:46 ray Exp $ */ +/* $OpenBSD: diff.c,v 1.11 2007/02/22 08:30:45 xsa Exp $ */ /* * Copyright (C) Caldera International Inc. 2001-2002. * All rights reserved. @@ -536,7 +536,8 @@ stone(int *a, int n, int *b, int *c, int flags) u_int numtries; /* XXX move the isqrt() out of the macro to avoid multiple calls */ - const u_int bound = (flags & D_MINIMAL) ? UINT_MAX : MAX(256, isqrt(n)); + const u_int bound = (flags & D_MINIMAL) ? UINT_MAX : + MAX(256, (u_int)isqrt(n)); k = 0; if ((ret = newcand(0, 0, 0)) < 0) diff --git a/usr.bin/rcs/diff3.c b/usr.bin/rcs/diff3.c index bf8ce3b7dea..b7a225441ce 100644 --- a/usr.bin/rcs/diff3.c +++ b/usr.bin/rcs/diff3.c @@ -1,4 +1,4 @@ -/* $OpenBSD: diff3.c,v 1.18 2007/01/11 18:13:33 niallo Exp $ */ +/* $OpenBSD: diff3.c,v 1.19 2007/02/22 08:30:45 xsa Exp $ */ /* * Copyright (C) Caldera International Inc. 2001-2002. @@ -72,7 +72,7 @@ static const char copyright[] = #ifndef lint static const char rcsid[] = - "$OpenBSD: diff3.c,v 1.18 2007/01/11 18:13:33 niallo Exp $"; + "$OpenBSD: diff3.c,v 1.19 2007/02/22 08:30:45 xsa Exp $"; #endif /* not lint */ #include "includes.h" @@ -411,11 +411,11 @@ diff3_internal(int argc, char **argv, const char *fmark, const char *rmark) if (oflag) { i = snprintf(f1mark, sizeof(f1mark), "<<<<<<< %s", fmark); - if (i < 0 || i >= sizeof(f1mark)) + if (i < 0 || i >= (int)sizeof(f1mark)) errx(1, "diff3_internal: string truncated"); i = snprintf(f3mark, sizeof(f3mark), ">>>>>>> %s", rmark); - if (i < 0 || i >= sizeof(f3mark)) + if (i < 0 || i >= (int)sizeof(f3mark)) errx(1, "diff3_internal: string truncated"); } diff --git a/usr.bin/rcs/rcsutil.c b/usr.bin/rcs/rcsutil.c index 9210f4ed872..633862235f6 100644 --- a/usr.bin/rcs/rcsutil.c +++ b/usr.bin/rcs/rcsutil.c @@ -1,4 +1,4 @@ -/* $OpenBSD: rcsutil.c,v 1.26 2007/01/11 18:13:33 niallo Exp $ */ +/* $OpenBSD: rcsutil.c,v 1.27 2007/02/22 08:30:45 xsa Exp $ */ /* * Copyright (c) 2005, 2006 Joris Vink * Copyright (c) 2006 Xavier Santolaria @@ -473,7 +473,7 @@ rcs_set_description(RCSFILE *file, const char *in) * Split the contents of a file into a list of lines. */ struct rcs_lines * -rcs_splitlines(const u_char *data, size_t len) +rcs_splitlines(u_char *data, size_t len) { u_char *c, *p; struct rcs_lines *lines; @@ -520,7 +520,7 @@ rcs_freelines(struct rcs_lines *lines) } BUF * -rcs_patchfile(const u_char *data, size_t dlen, const u_char *patch, size_t plen, +rcs_patchfile(u_char *data, size_t dlen, u_char *patch, size_t plen, int (*p)(struct rcs_lines *, struct rcs_lines *)) { struct rcs_lines *dlines, *plines; diff --git a/usr.bin/rcs/rcsutil.h b/usr.bin/rcs/rcsutil.h index f4c59b9e9d2..0be527b4253 100644 --- a/usr.bin/rcs/rcsutil.h +++ b/usr.bin/rcs/rcsutil.h @@ -1,4 +1,4 @@ -/* $OpenBSD: rcsutil.h,v 1.10 2007/01/02 16:43:45 niallo Exp $ */ +/* $OpenBSD: rcsutil.h,v 1.11 2007/02/22 08:30:45 xsa Exp $ */ /* * Copyright (c) 2006 Xavier Santolaria * All rights reserved. @@ -60,10 +60,9 @@ int rcs_set_description(RCSFILE *, const char *); void rcs_set_rev(const char *, RCSNUM **); void rcs_setrevstr(char **, char *); void rcs_setrevstr2(char **, char **, char *); -BUF *rcs_patchfile(const u_char *, size_t, const u_char *, - size_t, +BUF *rcs_patchfile(u_char *, size_t, u_char *, size_t, int (*p)(struct rcs_lines *,struct rcs_lines *)); -struct rcs_lines *rcs_splitlines(const u_char *, size_t); +struct rcs_lines *rcs_splitlines(u_char *, size_t); void rcs_freelines(struct rcs_lines *); int rcs_yesno(int); struct rcs_argvector *rcs_strsplit(const char *, const char *); -- cgit v1.2.3