From owner-freebsd-bugs@FreeBSD.ORG Tue Sep 9 13:30:24 2003 Return-Path: Delivered-To: freebsd-bugs@hub.freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id CABF016A4BF for ; Tue, 9 Sep 2003 13:30:24 -0700 (PDT) Received: from freefall.freebsd.org (freefall.freebsd.org [216.136.204.21]) by mx1.FreeBSD.org (Postfix) with ESMTP id 5B04F43FE9 for ; Tue, 9 Sep 2003 13:30:23 -0700 (PDT) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) by freefall.freebsd.org (8.12.9/8.12.9) with ESMTP id h89KUNUp087991 for ; Tue, 9 Sep 2003 13:30:23 -0700 (PDT) (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.12.9/8.12.9/Submit) id h89KUNg2087990; Tue, 9 Sep 2003 13:30:23 -0700 (PDT) Resent-Date: Tue, 9 Sep 2003 13:30:23 -0700 (PDT) Resent-Message-Id: <200309092030.h89KUNg2087990@freefall.freebsd.org> Resent-From: FreeBSD-gnats-submit@FreeBSD.org (GNATS Filer) Resent-To: freebsd-bugs@FreeBSD.org Resent-Reply-To: FreeBSD-gnats-submit@FreeBSD.org, Stefan Farfeleder Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 8DBEB16A4BF for ; Tue, 9 Sep 2003 13:25:53 -0700 (PDT) Received: from fafoe.narf.at (chello212186121237.14.vie.surfer.at [212.186.121.237]) by mx1.FreeBSD.org (Postfix) with ESMTP id 41BB443FE9 for ; Tue, 9 Sep 2003 13:25:52 -0700 (PDT) (envelope-from stefan@fafoe.dyndns.org) Received: from frog.fafoe.narf.at (frog.fafoe.narf.at [192.168.2.101]) by fafoe.narf.at (Postfix) with ESMTP id BD02F40B6; Tue, 9 Sep 2003 22:25:44 +0200 (CEST) Received: by frog.fafoe.narf.at (Postfix, from userid 1001) id 08ACB406; Tue, 9 Sep 2003 22:25:44 +0200 (CEST) Message-Id: <20030909202544.08ACB406@frog.fafoe.narf.at> Date: Tue, 9 Sep 2003 22:25:44 +0200 (CEST) From: Stefan Farfeleder To: FreeBSD-gnats-submit@FreeBSD.org X-Send-Pr-Version: 3.113 cc: stefan@fafoe.narf.at Subject: bin/56653: [patch] Removal of non-standard void * arithmetics X-BeenThere: freebsd-bugs@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list Reply-To: Stefan Farfeleder List-Id: Bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 09 Sep 2003 20:30:24 -0000 >Number: 56653 >Category: bin >Synopsis: [patch] Removal of non-standard void * arithmetics >Confidential: no >Severity: non-critical >Priority: low >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Tue Sep 09 13:30:20 PDT 2003 >Closed-Date: >Last-Modified: >Originator: Stefan Farfeleder >Release: FreeBSD 5.1-CURRENT i386 >Organization: >Environment: System: FreeBSD frog.fafoe.narf.at 5.1-CURRENT FreeBSD 5.1-CURRENT #7: Sun Sep 7 18:53:15 CEST 2003 freebsd@frog.fafoe.narf.at:/freebsd/frog/obj/freebsd/frog/src/sys/FROG i386 >Description: ISO C (both versions) allows the addition of an integer to a pointer that has object type only, that is, not void *; the same restriction applies to pointer subtractions. We're currently depending on a non-standard GNU extension, this patch is supposed to fix that. >How-To-Repeat: >Fix: --- voidptr.diff begins here --- Index: src/lib/libalias/alias_db.c =================================================================== RCS file: /usr/home/ncvs/src/lib/libalias/alias_db.c,v retrieving revision 1.53 diff -u -r1.53 alias_db.c --- src/lib/libalias/alias_db.c 1 Jun 2003 23:15:00 -0000 1.53 +++ src/lib/libalias/alias_db.c 9 Sep 2003 13:00:32 -0000 @@ -2732,7 +2732,7 @@ rule->cmd_len = (u_int32_t *)cmd - (u_int32_t *)rule->cmd; - return ((void *)cmd - buf); + return ((char *)cmd - (char *)buf); } #endif /* IPFW2 */ Index: src/lib/libc/gen/opendir.c =================================================================== RCS file: /usr/home/ncvs/src/lib/libc/gen/opendir.c,v retrieving revision 1.20 diff -u -r1.20 opendir.c --- src/lib/libc/gen/opendir.c 16 May 2003 02:15:07 -0000 1.20 +++ src/lib/libc/gen/opendir.c 9 Sep 2003 19:26:10 -0000 @@ -97,7 +97,7 @@ (dirp = malloc(sizeof(DIR) + sizeof(struct _telldir))) == NULL) goto fail; - dirp->dd_td = (void *)dirp + sizeof(DIR); + dirp->dd_td = (void *)((char *)dirp + sizeof(DIR)); LIST_INIT(&dirp->dd_td->td_locq); dirp->dd_td->td_loccnt = 0; Index: src/lib/libc/rpc/clnt_vc.c =================================================================== RCS file: /usr/home/ncvs/src/lib/libc/rpc/clnt_vc.c,v retrieving revision 1.15 diff -u -r1.15 clnt_vc.c --- src/lib/libc/rpc/clnt_vc.c 14 Jul 2002 23:35:04 -0000 1.15 +++ src/lib/libc/rpc/clnt_vc.c 8 Sep 2003 01:03:30 -0000 @@ -738,7 +738,7 @@ } } } else { - for (cnt = len; cnt > 0; cnt -= i, buf += i) { + for (cnt = len; cnt > 0; cnt -= i, buf = (char *)buf + i) { if ((i = _write(ct->ct_fd, buf, (size_t)cnt)) == -1) { ct->ct_error.re_errno = errno; ct->ct_error.re_status = RPC_CANTSEND; Index: src/lib/libc/rpc/svc_vc.c =================================================================== RCS file: /usr/home/ncvs/src/lib/libc/rpc/svc_vc.c,v retrieving revision 1.22 diff -u -r1.22 svc_vc.c --- src/lib/libc/rpc/svc_vc.c 15 Jun 2003 10:55:39 -0000 1.22 +++ src/lib/libc/rpc/svc_vc.c 8 Sep 2003 01:04:05 -0000 @@ -541,7 +541,7 @@ if (cd->nonblock) gettimeofday(&tv0, NULL); - for (cnt = len; cnt > 0; cnt -= i, buf += i) { + for (cnt = len; cnt > 0; cnt -= i, buf = (char *)buf + i) { i = _write(xprt->xp_fd, buf, (size_t)cnt); if (i < 0) { if (errno != EAGAIN || !cd->nonblock) { Index: src/lib/libc_r/uthread/uthread_write.c =================================================================== RCS file: /usr/home/ncvs/src/lib/libc_r/uthread/uthread_write.c,v retrieving revision 1.21 diff -u -r1.21 uthread_write.c --- src/lib/libc_r/uthread/uthread_write.c 5 Nov 2002 00:59:18 -0000 1.21 +++ src/lib/libc_r/uthread/uthread_write.c 9 Sep 2003 13:15:52 -0000 @@ -78,7 +78,8 @@ */ while (ret == 0) { /* Perform a non-blocking write syscall: */ - n = __sys_write(fd, buf + num, nbytes - num); + n = __sys_write(fd, (const char *)buf + num, + nbytes - num); /* Check if one or more bytes were written: */ if (n > 0) Index: src/lib/libc_r/uthread/uthread_writev.c =================================================================== RCS file: /usr/home/ncvs/src/lib/libc_r/uthread/uthread_writev.c,v retrieving revision 1.21 diff -u -r1.21 uthread_writev.c --- src/lib/libc_r/uthread/uthread_writev.c 12 Nov 2002 19:01:49 -0000 1.21 +++ src/lib/libc_r/uthread/uthread_writev.c 9 Sep 2003 13:17:06 -0000 @@ -134,7 +134,9 @@ * for the next write: */ p_iov[idx].iov_len -= cnt; - p_iov[idx].iov_base += cnt; + p_iov[idx].iov_base = + (char *)p_iov[idx].iov_base + + cnt; cnt = 0; } } Index: src/sbin/ldconfig/ldconfig.c =================================================================== RCS file: /usr/home/ncvs/src/sbin/ldconfig/ldconfig.c,v retrieving revision 1.38 diff -u -r1.38 ldconfig.c --- src/sbin/ldconfig/ldconfig.c 17 Sep 2002 01:48:53 -0000 1.38 +++ src/sbin/ldconfig/ldconfig.c 8 Sep 2003 14:42:13 -0000 @@ -564,8 +564,8 @@ } close(fd); - blist = (struct hints_bucket *)(addr + hdr->hh_hashtab); - strtab = (char *)(addr + hdr->hh_strtab); + blist = (struct hints_bucket *)((char *)addr + hdr->hh_hashtab); + strtab = (char *)addr + hdr->hh_strtab; if (hdr->hh_version >= LD_HINTS_VERSION_2) add_search_path(strtab + hdr->hh_dirlist); Index: src/sbin/ping/ping.c =================================================================== RCS file: /usr/home/ncvs/src/sbin/ping/ping.c,v retrieving revision 1.101 diff -u -r1.101 ping.c --- src/sbin/ping/ping.c 14 Jul 2003 12:43:48 -0000 1.101 +++ src/sbin/ping/ping.c 9 Sep 2003 19:33:50 -0000 @@ -954,7 +954,7 @@ #else tp = icp->icmp_data; #endif - tp += phdr_len; + tp = (const char *)tp + phdr_len; if (cc - ICMP_MINLEN - phdr_len >= sizeof(tv1)) { /* Copy to avoid alignment problems: */ --- voidptr.diff ends here --- >Release-Note: >Audit-Trail: >Unformatted: