From: Joerg Sonnenberger Date: Mon, 16 Aug 2004 14:19:31 +0000 (+0000) Subject: Make this WARNS?=6 clean by explicitly using __DECONST for the write X-Git-Tag: v2.0.1~10503 X-Git-Url: https://gitweb.dragonflybsd.org/dragonfly.git/commitdiff_plain/5b85beb7e4d579422886efe91f91527c917a094d Make this WARNS?=6 clean by explicitly using __DECONST for the write buffers in iov. --- diff --git a/lib/libfetch/Makefile b/lib/libfetch/Makefile index 9b33bef8c7..d78198855e 100644 --- a/lib/libfetch/Makefile +++ b/lib/libfetch/Makefile @@ -1,8 +1,8 @@ # $FreeBSD: src/lib/libfetch/Makefile,v 1.14.2.5 2003/01/09 11:50:32 des Exp $ -# $DragonFly: src/lib/libfetch/Makefile,v 1.4 2004/01/31 06:56:39 dillon Exp $ +# $DragonFly: src/lib/libfetch/Makefile,v 1.5 2004/08/16 14:19:31 joerg Exp $ LIB= fetch -WARNS?= 2 +WARNS?= 6 CFLAGS+= -I. CFLAGS+= -DINET6 SRCS= fetch.c common.c ftp.c http.c file.c \ diff --git a/lib/libfetch/common.c b/lib/libfetch/common.c index ca7c614f67..019d7fd9ea 100644 --- a/lib/libfetch/common.c +++ b/lib/libfetch/common.c @@ -26,7 +26,7 @@ * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. * * $FreeBSD: src/lib/libfetch/common.c,v 1.7.2.13 2003/06/06 06:45:25 des Exp $ - * $DragonFly: src/lib/libfetch/common.c,v 1.2 2003/06/17 04:26:49 dillon Exp $ + * $DragonFly: src/lib/libfetch/common.c,v 1.3 2004/08/16 14:19:31 joerg Exp $ */ #include @@ -487,7 +487,8 @@ _fetch_write(conn_t *conn, const char *buf, size_t len) { struct iovec iov; - iov.iov_base = (char *)buf; + /* This is correct, because writev doesn't change the buffer */ + iov.iov_base = __DECONST(char *, buf); iov.iov_len = len; return _fetch_writev(conn, &iov, 1); } @@ -578,9 +579,10 @@ _fetch_putln(conn_t *conn, const char *str, size_t len) int ret; DEBUG(fprintf(stderr, ">>> %s\n", str)); - iov[0].iov_base = (char *)str; + /* This is correct, because writev doesn't change the buffer */ + iov[0].iov_base = __DECONST(char *, str); iov[0].iov_len = len; - iov[1].iov_base = (char *)ENDL; + iov[1].iov_base = __DECONST(char *, ENDL); iov[1].iov_len = sizeof(ENDL); if (len == 0) ret = _fetch_writev(conn, &iov[1], 1);