From owner-freebsd-bugs Wed Sep 4 13:40:12 2002 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 207AB37B400 for ; Wed, 4 Sep 2002 13:40:05 -0700 (PDT) Received: from freefall.freebsd.org (freefall.FreeBSD.org [216.136.204.21]) by mx1.FreeBSD.org (Postfix) with ESMTP id D2FBA43E4A for ; Wed, 4 Sep 2002 13:40:04 -0700 (PDT) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (gnats@localhost [127.0.0.1]) by freefall.freebsd.org (8.12.4/8.12.4) with ESMTP id g84Ke4JU030638 for ; Wed, 4 Sep 2002 13:40:04 -0700 (PDT) (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.12.4/8.12.4/Submit) id g84Ke4nQ030636; Wed, 4 Sep 2002 13:40:04 -0700 (PDT) Date: Wed, 4 Sep 2002 13:40:04 -0700 (PDT) Message-Id: <200209042040.g84Ke4nQ030636@freefall.freebsd.org> To: freebsd-bugs@FreeBSD.org Cc: From: Dan Lukes Subject: Re: bin/42385: clean libatm code from warnings Reply-To: Dan Lukes Sender: owner-freebsd-bugs@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.org The following reply was made to PR bin/42385; it has been noted by GNATS. From: Dan Lukes To: Bruce Evans Cc: freebsd-gnats-submit@FreeBSD.org, dan@obluda.cz Subject: Re: bin/42385: clean libatm code from warnings Date: Wed, 04 Sep 2002 22:37:57 +0200 Bruce Evans wrote: >>lib/libatm/atm_addr.c: >> 308: warning: long unsigned int format, __uint32_t arg (arg 3) >> long unsigned int format, __uint32_t arg (arg 4) >> #>> ntohl (despite of 'l' in it's name) >> #>> return uint32_t ( = __uint32_t = unsigned int ) >> #>> so 'l' modifier should not be used > > > The format is correct. ntohl() returns a typedefed type which may be > u_long. ntohl() still returns long or ulong on some systems like its > name suggests. The values should be cast to u_long since the type is > unknown. The type can be almost anything, but the values are known > to be representable as u_longs. You are true, we shouldn't remove the 'l' modifier, we should cast. So: --- lib/libatm/atm_addr.c.ORIG Tue Jun 25 00:29:01 2002 +++ lib/libatm/atm_addr.c Tue Sep 3 23:11:38 2002 @@ -28,7 +28,7 @@ __FBSDID("$FreeBSD: src/lib/libatm/atm_addr.c,v 1.8 2002/06/24 22:29:01 arr Exp $"); #ifndef lint #if 0 /* original (broken) import id */ -static char *RCSid = "@(#) $Id: atm_addr.c,v 1.1 1998/07/09 21:45:18 johnc Exp $"; +static const char *RCSid = "@(#) $Id: atm_addr.c,v 1.1 1998/07/09 21:45:18 johnc Exp $"; #endif #endif @@ -305,7 +305,7 @@ u2.c[3] = atm_spans->aas_addr[7]; if (!(u1.w == 0 && u2.w == 0)) - sprintf(str, "0x%08lx.%08lx", ntohl(u1.w), ntohl(u2.w)); + sprintf(str, "0x%08lx.%08lx", (u_long) ntohl(u1.w), (u_long) ntohl(u2.w)); break; case T_ATM_PVC_ADDR: Dan To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-bugs" in the body of the message