Date: Wed, 4 Sep 2002 13:40:04 -0700 (PDT) From: Dan Lukes <dan@obluda.cz> To: freebsd-bugs@FreeBSD.org Subject: Re: bin/42385: clean libatm code from warnings Message-ID: <200209042040.g84Ke4nQ030636@freefall.freebsd.org>
next in thread | raw e-mail | index | archive | help
The following reply was made to PR bin/42385; it has been noted by GNATS. From: Dan Lukes <dan@obluda.cz> To: Bruce Evans <bde@zeta.org.au> 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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200209042040.g84Ke4nQ030636>